This commit is contained in:
2025-09-23 01:07:24 +07:00
parent 9f484366bb
commit 0657f36206
12 changed files with 322 additions and 150 deletions
+9 -5
View File
@@ -13,15 +13,19 @@ type Team struct {
}
func (t *Team) GetTeamUrl() (string, error) {
ips, err := getLocalIPs()
if err != nil {
return "", err
}
ip := ips[0]
ip := selectIP()
u := fmt.Sprintf("http://%s:8100?name=%s&password=%s", ip, url.PathEscape(t.Name), t.Password)
return u, nil
}
func selectIP() string {
ips, err := getLocalIPs()
if err != nil || len(ips) == 0 {
return "127.0.0.1"
}
return ips[0]
}
func getLocalIPs() ([]string, error) {
var ips []string
addrs, err := net.InterfaceAddrs()