提升IP名单性能

This commit is contained in:
刘祥超
2024-03-30 14:42:56 +08:00
parent 10319ab48f
commit b4995868c9
10 changed files with 496 additions and 245 deletions

View File

@@ -24,7 +24,7 @@ func AllowIP(ip string, serverId int64) (canGoNext bool, inAllowList bool, expir
}
}
var ipLong = utils.IP2Long(ip)
var ipLong = utils.IP2LongHash(ip)
if ipLong == 0 {
return false, false, 0
}
@@ -62,7 +62,7 @@ func AllowIP(ip string, serverId int64) (canGoNext bool, inAllowList bool, expir
// IsInWhiteList 检查IP是否在白名单中
func IsInWhiteList(ip string) bool {
var ipLong = utils.IP2Long(ip)
var ipLong = utils.IP2LongHash(ip)
if ipLong == 0 {
return false
}