chg: [isNet] fix silly bug

d4forward 0.1.1
Jean-Louis Huynen 2020-02-12 14:47:21 +01:00
parent aa03cc3065
commit 0ef9aada6f
No known key found for this signature in database
GPG Key ID: 64799157F4BD6B93
1 changed files with 6 additions and 5 deletions

View File

@ -32,7 +32,6 @@ func IsNet(host string) (bool, string) {
}
// trim brackets
if net.ParseIP(strings.Trim(host[:i+1], "[]")) != nil {
log.Fatal(fmt.Sprintf("Server IP: %s, Server Port: %s\n", host[:i+1], host[i+1:]))
return true, host
}
} else {
@ -44,12 +43,14 @@ func IsNet(host string) (bool, string) {
return false, ""
}
if net.ParseIP(ss[0]) != nil {
log.Fatal(fmt.Sprintf("Server IP: %s, Server Port: %s\n", ss[0], ss[1]))
return true, host
} else if validDNS.MatchString(ss[0]) {
log.Fatal(fmt.Sprintf("DNS: %s, Server Port: %s\n", ss[0], ss[1]))
return true, host
}
if validDNS.MatchString(ss[0]) {
return true, host
} else {
log.Fatal(fmt.Sprintf("DNS/IP: %s, Server Port: %s\n", ss[0], ss[1]))
return false, ""
}
}
}
return false, host