fix(setup): 绑定码可重试并说明连接方式

This commit is contained in:
Lemon-miaow committed 2026-10-02 17:07:53 +08:00
1 parent d2a6b6ec73
commit 47a2dec4bc
12 files changed
+563 -51

No files matched your search

+27
View File
@@ -57,6 +57,33 @@ func rootDomainEmbeddedIP(rootDomain string) string {
return ""
}
// setupGameAddress is where the operator joins in Minecraft to bind the Owner: the
// IP a nip.io or sslip.io root domain spells out (nothing to resolve), otherwise the
// root domain, with the port when it is not Minecraft's default. The proxy lands
// every fresh connection on the login server whatever name it was dialled by.
func setupGameAddress(rootDomain string, gamePort int) string {
host := rootDomainEmbeddedIP(rootDomain)
if host == "" {
host = strings.TrimSpace(strings.TrimSuffix(rootDomain, "."))
}
if host == "" {
return ""
}
if gamePort == 0 || gamePort == 25565 {
return host
}
return net.JoinHostPort(host, strconv.Itoa(gamePort))
}
// gameAddrIsIP reports whether addr, a host or host:port, names its host by IP.
func gameAddrIsIP(addr string) bool {
host := addr
if h, _, err := net.SplitHostPort(addr); err == nil {
host = h
}
return net.ParseIP(host) != nil
}
func localPanelOrigin() string {
return fmt.Sprintf("https://127.0.0.1:%d", setupPanelNodePort())
}