generated from VLADIMIR/template
update
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user