package utils import ( "gitee.ltd/lxh/logger/log" "wireguard-dashboard/client" ) type network struct{} func Network() network { return network{} } // GetHostPublicIP // @description: 获取本机公网地址 // @receiver network // @return string func (network) GetHostPublicIP() string { var response = map[string]string{} _, err := client.HttpClient.R().SetResult(&response).Get("https://httpbin.org/ip") if err != nil { log.Errorf("获取本机公网IP失败: %v", err.Error()) return "" } return response["origin"] }