refactor: simplify CheckIPAccess by reusing IPInAllowList
This commit is contained in:
parent
66f608f25b
commit
6e481c36c5
@ -76,13 +76,7 @@ func CheckIPAccess(ctx *fasthttp.RequestCtx, allowed []net.IPNet) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, network := range allowed {
|
return IPInAllowList(clientIP, allowed)
|
||||||
if network.Contains(clientIP) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckTokenAuth checks token-based authentication.
|
// CheckTokenAuth checks token-based authentication.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user