improve: use IndexByte to find the colon of ip address (#92)
This commit is contained in:
1 parent
ee37e35eb2
commit
88efe2d1d5
3 files changed
+5
-5
No files matched your search
+2
-2
@@ -91,11 +91,11 @@ func fetchIP(servers []string, isV6 bool) string {
|
||||
}
|
||||
}
|
||||
// 没取到 v6 IP
|
||||
if isV6 && !strings.Contains(newIP, ":") {
|
||||
if isV6 && strings.IndexByte(newIP, ':') == -1 {
|
||||
continue
|
||||
}
|
||||
// 没取到 v4 IP
|
||||
if !isV6 && !strings.Contains(newIP, ".") {
|
||||
if !isV6 && strings.IndexByte(newIP, '.') == -1 {
|
||||
continue
|
||||
}
|
||||
ip = newIP
|
||||
|
||||
Reference in new issue
Block a user