This commit is contained in:
adman
2026-01-12 17:33:26 +01:00
parent 08ddf8dc41
commit 11bf0624a4
16 changed files with 132 additions and 58 deletions
+20
View File
@@ -0,0 +1,20 @@
package client
import (
"net"
"strings"
)
func LookupMinecraftSRV(host string, port uint16) (hostRet string, portRet uint16) {
if port != 25565 {
return
}
_, srvs, err := net.LookupSRV("minecraft", "tcp", host)
if err != nil || len(srvs) == 0 {
return
}
target := strings.TrimSuffix(srvs[0].Target, ".")
hostRet = target
portRet = srvs[0].Port
return
}