1
0
mirror of https://shylinux.com/x/icebergs synced 2025-05-03 12:07:00 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-05-09 13:25:27 +08:00
parent 960748e223
commit 209d911e25

View File

@ -461,8 +461,11 @@ func HostPort(m *ice.Message, host, port string, arg ...string) string {
return kit.Format("http://%s:%s", host, port) + p
}
}
func PublicIP(m *ice.Message) ice.Any {
return SpideGet(m, "http://ip-api.com/json")
func PublicIP(m *ice.Message, arg ...string) ice.Any {
if len(arg) == 0 {
return SpideGet(m, "http://ip-api.com/json")
}
return kit.Format(kit.Value(SpideGet(m, "http://opendata.baidu.com/api.php?co=&resource_id=6006&oe=utf8", "query", arg[0]), "data.0.location"))
}
func SpideGet(m *ice.Message, arg ...ice.Any) ice.Any {
return kit.UnMarshal(m.Cmdx(http.MethodGet, arg))