提升IP名单性能

This commit is contained in:
GoEdgeLab
2024-03-30 14:42:56 +08:00
parent 60a4016101
commit 93e7c6bb48
10 changed files with 496 additions and 245 deletions

View File

@@ -1,12 +1,13 @@
package utils
import (
"github.com/TeaOSLab/EdgeCommon/pkg/configutils"
"strings"
)
// 计算版本代号
// VersionToLong 计算版本代号
func VersionToLong(version string) uint32 {
countDots := strings.Count(version, ".")
var countDots = strings.Count(version, ".")
if countDots == 2 {
version += ".0"
} else if countDots == 1 {
@@ -14,5 +15,5 @@ func VersionToLong(version string) uint32 {
} else if countDots == 0 {
version += ".0.0.0"
}
return uint32(IP2Long(version))
return uint32(configutils.IPString2Long(version))
}