mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 01:08:31 +02:00
fix(acl): deny rules now have higher precedence than allow rules
This commit is contained in:
committed by
github-actions[bot]
parent
90a4922b79
commit
ab1881d02e
@@ -292,16 +292,16 @@ func (c *Config) IPAllowed(ip net.IP) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ipAndStr := &maxmind.IPInfo{IP: ip, Str: ipStr}
|
ipAndStr := &maxmind.IPInfo{IP: ip, Str: ipStr}
|
||||||
if c.Allow.Match(ipAndStr) {
|
|
||||||
c.logAndNotify(ipAndStr, true)
|
|
||||||
c.cacheRecord(ipAndStr, true)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
if c.Deny.Match(ipAndStr) {
|
if c.Deny.Match(ipAndStr) {
|
||||||
c.logAndNotify(ipAndStr, false)
|
c.logAndNotify(ipAndStr, false)
|
||||||
c.cacheRecord(ipAndStr, false)
|
c.cacheRecord(ipAndStr, false)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if c.Allow.Match(ipAndStr) {
|
||||||
|
c.logAndNotify(ipAndStr, true)
|
||||||
|
c.cacheRecord(ipAndStr, true)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
c.logAndNotify(ipAndStr, c.defaultAllow)
|
c.logAndNotify(ipAndStr, c.defaultAllow)
|
||||||
c.cacheRecord(ipAndStr, c.defaultAllow)
|
c.cacheRecord(ipAndStr, c.defaultAllow)
|
||||||
|
|||||||
Reference in New Issue
Block a user