safesocket: remove the now unused WindowsLocalPort

Also drop the port param from safesocket.Listen. #cleanup

Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
Maisem Ali
2023-01-30 09:34:51 -08:00
committed by Maisem Ali
parent fede3cd704
commit 4441609d8f
8 changed files with 18 additions and 33 deletions

View File

@@ -35,7 +35,6 @@ import (
"tailscale.com/ipn/ipnstate"
"tailscale.com/logtail"
"tailscale.com/net/netutil"
"tailscale.com/safesocket"
"tailscale.com/tailcfg"
"tailscale.com/tka"
"tailscale.com/types/key"
@@ -188,17 +187,10 @@ func validHost(h string) bool {
return true
}
// Allow either localhost or loopback IP hosts.
host, portStr, err := net.SplitHostPort(h)
host, _, err := net.SplitHostPort(h)
if err != nil {
return false
}
port, err := strconv.ParseUint(portStr, 10, 16)
if err != nil {
return false
}
if runtime.GOOS == "windows" && port != safesocket.WindowsLocalPort {
return false
}
if host == "localhost" {
return true
}