[新增] 添加自动 IP 组规则测试功能,支持在保存前验证 Expr 规则命中情况

This commit is contained in:
ryan
2026-06-01 09:50:43 +08:00
parent 73beedfc09
commit b827baf19f
11 changed files with 287 additions and 26 deletions
+13
View File
@@ -199,6 +199,19 @@ func SyncWAFIPGroup(c *gin.Context) {
respondSuccess(c, result)
}
func TestWAFIPGroupAutoConfig(c *gin.Context) {
var input service.WAFIPGroupAutoTestInput
if !bindJSON(c, &input) {
return
}
result, err := service.TestWAFIPGroupAutoConfig(input)
if err != nil {
respondFailure(c, err.Error())
return
}
respondSuccess(c, result)
}
func parseUintPathParam(c *gin.Context, name string) (uint, bool) {
id, err := strconv.ParseUint(c.Param(name), 10, 64)
if err != nil || id == 0 {