fix: fix the bug of page limit (#20)

This commit is contained in:
Li4n0
2021-05-26 00:09:57 +08:00
committed by GitHub
parent cbbf3ba0ba
commit b44e4891a6
17 changed files with 67 additions and 63 deletions
+2 -2
View File
@@ -143,8 +143,8 @@ example.
#### Multi-client #### Multi-client
RevSuit supports multiple clients, and each client in the connected state receives a push of `flag`, so distributed As shown above, RevSuit supports multiple clients, and each client in the connected state receives a push of `flag`, so
scanning can be supported. distributed scanning can be supported.
#### Temporary storage queue #### Temporary storage queue
Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 0 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 133 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 895 KiB

After

Width:  |  Height:  |  Size: 764 KiB

+7 -6
View File
@@ -47,16 +47,17 @@ func ListRecords(c *gin.Context) {
res []Record res []Record
count int64 count int64
order = c.Query("order") order = c.Query("order")
pageSize int pageSize = 10
) )
if c.Query("pageSize") == "" { if c.Query("pageSize") != "" {
pageSize = 10 if n, err := strconv.Atoi(c.Query("pageSize")); err == nil {
} else if n, err := strconv.Atoi(c.Query("pageSize")); err == nil { if n > 0 && n < 100 {
if n <= 0 || n > 100 { pageSize = n
pageSize = 10 }
} }
} }
if err := c.ShouldBind(&dnsRecord); err != nil { if err := c.ShouldBind(&dnsRecord); err != nil {
c.JSON(400, gin.H{ c.JSON(400, gin.H{
"status": "failed", "status": "failed",
+6 -6
View File
@@ -80,14 +80,14 @@ func ListRules(c *gin.Context) {
res []Rule res []Rule
count int64 count int64
order = c.Query("order") order = c.Query("order")
pageSize int pageSize = 10
) )
if c.Query("pageSize") == "" { if c.Query("pageSize") != "" {
pageSize = 10 if n, err := strconv.Atoi(c.Query("pageSize")); err == nil {
} else if n, err := strconv.Atoi(c.Query("pageSize")); err == nil { if n > 0 && n < 100 {
if n <= 0 || n > 100 { pageSize = n
pageSize = 10 }
} }
} }
+6 -6
View File
@@ -59,14 +59,14 @@ func ListRecords(c *gin.Context) {
res []Record res []Record
count int64 count int64
order = c.Query("order") order = c.Query("order")
pageSize int pageSize = 10
) )
if c.Query("pageSize") == "" { if c.Query("pageSize") != "" {
pageSize = 10 if n, err := strconv.Atoi(c.Query("pageSize")); err == nil {
} else if n, err := strconv.Atoi(c.Query("pageSize")); err == nil { if n > 0 && n < 100 {
if n <= 0 || n > 100 { pageSize = n
pageSize = 10 }
} }
} }
+6 -6
View File
@@ -75,14 +75,14 @@ func ListRules(c *gin.Context) {
res []Rule res []Rule
count int64 count int64
order = c.Query("order") order = c.Query("order")
pageSize int pageSize = 10
) )
if c.Query("pageSize") == "" { if c.Query("pageSize") != "" {
pageSize = 10 if n, err := strconv.Atoi(c.Query("pageSize")); err == nil {
} else if n, err := strconv.Atoi(c.Query("pageSize")); err == nil { if n > 0 && n < 100 {
if n <= 0 || n > 100 { pageSize = n
pageSize = 10 }
} }
} }
+6 -6
View File
@@ -57,14 +57,14 @@ func ListRecords(c *gin.Context) {
res []Record res []Record
count int64 count int64
order = c.Query("order") order = c.Query("order")
pageSize int pageSize = 10
) )
if c.Query("pageSize") == "" { if c.Query("pageSize") != "" {
pageSize = 10 if n, err := strconv.Atoi(c.Query("pageSize")); err == nil {
} else if n, err := strconv.Atoi(c.Query("pageSize")); err == nil { if n > 0 && n < 100 {
if n <= 0 || n > 100 { pageSize = n
pageSize = 10 }
} }
} }
+6 -6
View File
@@ -63,14 +63,14 @@ func ListRules(c *gin.Context) {
res []Rule res []Rule
count int64 count int64
order = c.Query("order") order = c.Query("order")
pageSize int pageSize = 10
) )
if c.Query("pageSize") == "" { if c.Query("pageSize") != "" {
pageSize = 10 if n, err := strconv.Atoi(c.Query("pageSize")); err == nil {
} else if n, err := strconv.Atoi(c.Query("pageSize")); err == nil { if n > 0 && n < 100 {
if n <= 0 || n > 100 { pageSize = n
pageSize = 10 }
} }
} }
+6 -7
View File
@@ -50,15 +50,14 @@ func ListRecords(c *gin.Context) {
res []Record res []Record
count int64 count int64
order = c.Query("order") order = c.Query("order")
pageSize int pageSize = 10
) )
if c.Query("pageSize") == "" { if c.Query("pageSize") != "" {
pageSize = 10 if n, err := strconv.Atoi(c.Query("pageSize")); err == nil {
} else if n, err := strconv.Atoi(c.Query("pageSize")); err == nil { if n > 0 && n < 100 {
pageSize = n pageSize = n
if pageSize <= 0 || pageSize > 100 { }
pageSize = 10
} }
} }
+6 -6
View File
@@ -81,14 +81,14 @@ func ListRules(c *gin.Context) {
res []Rule res []Rule
count int64 count int64
order = c.Query("order") order = c.Query("order")
pageSize int pageSize = 10
) )
if c.Query("pageSize") == "" { if c.Query("pageSize") != "" {
pageSize = 10 if n, err := strconv.Atoi(c.Query("pageSize")); err == nil {
} else if n, err := strconv.Atoi(c.Query("pageSize")); err == nil { if n > 0 && n < 100 {
if n <= 0 || n > 100 { pageSize = n
pageSize = 10 }
} }
} }
+6 -6
View File
@@ -46,14 +46,14 @@ func ListRecords(c *gin.Context) {
res []Record res []Record
count int64 count int64
order = c.Query("order") order = c.Query("order")
pageSize int pageSize = 10
) )
if c.Query("pageSize") == "" { if c.Query("pageSize") != "" {
pageSize = 10 if n, err := strconv.Atoi(c.Query("pageSize")); err == nil {
} else if n, err := strconv.Atoi(c.Query("pageSize")); err == nil { if n > 0 && n < 100 {
if n <= 0 || n > 100 { pageSize = n
pageSize = 10 }
} }
} }
+4
View File
@@ -58,6 +58,7 @@ func (s *Server) handleConnection(conn net.Conn) {
if err := conn.SetDeadline(time.Now().Add(time.Second * 30)); err != nil { if err := conn.SetDeadline(time.Now().Add(time.Second * 30)); err != nil {
log.Warn("RMI set connection deadline error:%v", err) log.Warn("RMI set connection deadline error:%v", err)
return
} }
ip, port, _ := net.SplitHostPort(conn.RemoteAddr().String()) ip, port, _ := net.SplitHostPort(conn.RemoteAddr().String())
@@ -66,6 +67,7 @@ func (s *Server) handleConnection(conn net.Conn) {
_, err := conn.Read(buf) _, err := conn.Read(buf)
if err != nil { if err != nil {
log.Warn("RMI read connection error:%v", err) log.Warn("RMI read connection error:%v", err)
return
} }
if !bytes.Contains(buf, []byte{0x4a, 0x52, 0x4d, 0x49}) { if !bytes.Contains(buf, []byte{0x4a, 0x52, 0x4d, 0x49}) {
@@ -86,6 +88,7 @@ func (s *Server) handleConnection(conn net.Conn) {
_, err = conn.Write(send) _, err = conn.Write(send)
if err != nil { if err != nil {
log.Warn("RMI write connection error: %v", err) log.Warn("RMI write connection error: %v", err)
return
} }
data := make([]byte, 512) data := make([]byte, 512)
@@ -94,6 +97,7 @@ func (s *Server) handleConnection(conn net.Conn) {
n, err := conn.Read(data) n, err := conn.Read(data)
if err != nil { if err != nil {
log.Warn("RMI read connection error: %v", err) log.Warn("RMI read connection error: %v", err)
return
} }
length += n length += n
} }
+6 -6
View File
@@ -72,14 +72,14 @@ func ListRules(c *gin.Context) {
res []Rule res []Rule
count int64 count int64
order = c.Query("order") order = c.Query("order")
pageSize int pageSize = 10
) )
if c.Query("pageSize") == "" { if c.Query("pageSize") != "" {
pageSize = 10 if n, err := strconv.Atoi(c.Query("pageSize")); err == nil {
} else if n, err := strconv.Atoi(c.Query("pageSize")); err == nil { if n > 0 && n < 100 {
if n <= 0 || n > 100 { pageSize = n
pageSize = 10 }
} }
} }