refactor: simplify CheckIPAccess by reusing IPInAllowList

This commit is contained in:
xfy 2026-06-03 17:53:00 +08:00
parent 66f608f25b
commit 6e481c36c5

View File

@ -76,13 +76,7 @@ func CheckIPAccess(ctx *fasthttp.RequestCtx, allowed []net.IPNet) bool {
return false
}
for _, network := range allowed {
if network.Contains(clientIP) {
return true
}
}
return false
return IPInAllowList(clientIP, allowed)
}
// CheckTokenAuth checks token-based authentication.