diff --git a/cmd/stdiscosrv/apisrv.go b/cmd/stdiscosrv/apisrv.go index 3190a04b9..a5428fa20 100644 --- a/cmd/stdiscosrv/apisrv.go +++ b/cmd/stdiscosrv/apisrv.go @@ -18,6 +18,7 @@ import ( "net/http" "net/url" "strconv" + "strings" "sync" "time" @@ -334,13 +335,14 @@ func fixupAddresses(remote net.IP, addresses []string) []string { ip := net.ParseIP(host) if host == "" || ip.IsUnspecified() { - // Do not use IPv6 remote address if requested scheme is tcp4 - if uri.Scheme == "tcp4" && remote.To4() == nil { + // Do not use IPv6 remote address if requested scheme is ...4 + // (i.e., tcp4, kcp4, etc.) + if strings.HasSuffix(uri.Scheme, "4") && remote.To4() == nil { continue } - // Do not use IPv4 remote address if requested scheme is tcp6 - if uri.Scheme == "tcp6" && remote.To4() != nil { + // Do not use IPv4 remote address if requested scheme is ...6 + if strings.HasSuffix(uri.Scheme, "6") && remote.To4() != nil { continue }