fix: dashboard waf page

This commit is contained in:
naiba 2024-11-30 21:33:18 +08:00
parent 08f0c25dfc
commit 166f25508c
4 changed files with 14 additions and 2 deletions

View File

@ -32,7 +32,7 @@ jobs:
- uses: robinraju/release-downloader@v1
with:
repository: nezhahq/admin-frontend
tag: v1.0.9
tag: v1.0.11
fileName: dist.zip
latest: true
extract: true

View File

@ -14,7 +14,7 @@ import (
// @Description List server
// @Tags auth required
// @Produce json
// @Success 200 {object} model.CommonResponse[[]model.WAF]
// @Success 200 {object} model.CommonResponse[[]model.WAFApiMock]
// @Router /waf [get]
func listBlockedAddress(c *gin.Context) ([]*model.WAF, error) {
var waf []*model.WAF

View File

@ -3,6 +3,7 @@ package rpc
import (
"context"
"fmt"
"log"
"net/http"
"net/netip"
"time"
@ -63,6 +64,10 @@ func getRealIp(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo,
}
}
if singleton.Conf.Debug {
log.Printf("NEZHA>> gRPC Real IP: %s", ip)
}
ctx = context.WithValue(ctx, model.CtxKeyRealIP{}, ip)
return handler(ctx, req)
}

View File

@ -16,6 +16,13 @@ const (
WAFBlockReasonTypeAgentAuthFail
)
type WAFApiMock struct {
IP string `json:"ip,omitempty"`
Count uint64 `json:"count,omitempty"`
LastBlockReason uint8 `json:"last_block_reason,omitempty"`
LastBlockTimestamp uint64 `json:"last_block_timestamp,omitempty"`
}
type WAF struct {
IP []byte `gorm:"type:binary(16);primaryKey" json:"ip,omitempty"`
Count uint64 `json:"count,omitempty"`