diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2b2d1a0..e5429f9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/cmd/dashboard/controller/waf.go b/cmd/dashboard/controller/waf.go index 6d4fe50..cd37218 100644 --- a/cmd/dashboard/controller/waf.go +++ b/cmd/dashboard/controller/waf.go @@ -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 diff --git a/cmd/dashboard/rpc/rpc.go b/cmd/dashboard/rpc/rpc.go index 1d0876b..2f7ea47 100644 --- a/cmd/dashboard/rpc/rpc.go +++ b/cmd/dashboard/rpc/rpc.go @@ -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) } diff --git a/model/waf.go b/model/waf.go index 34427ac..af28469 100644 --- a/model/waf.go +++ b/model/waf.go @@ -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"`