mirror of
https://github.com/nezhahq/nezha.git
synced 2025-01-22 12:48:14 -05:00
✨ Agent 获取 IP 增加 api.myip.la
This commit is contained in:
parent
7bca2988f4
commit
97ef37ac56
@ -15,6 +15,9 @@ type geoIP struct {
|
||||
CountryCode2 string `json:"countryCode,omitempty"`
|
||||
IP string `json:"ip,omitempty"`
|
||||
Query string `json:"query,omitempty"`
|
||||
Location struct {
|
||||
CountryCode string `json:"country_code,omitempty"`
|
||||
} `json:"location,omitempty"`
|
||||
}
|
||||
|
||||
func (ip *geoIP) Unmarshal(body []byte) error {
|
||||
@ -27,11 +30,15 @@ func (ip *geoIP) Unmarshal(body []byte) error {
|
||||
if ip.CountryCode == "" && ip.CountryCode2 != "" {
|
||||
ip.CountryCode = ip.CountryCode2
|
||||
}
|
||||
if ip.CountryCode == "" && ip.Location.CountryCode != "" {
|
||||
ip.CountryCode = ip.Location.CountryCode
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
geoIPApiList = []string{
|
||||
"https://api.myip.la/en?json",
|
||||
"https://api.ip.sb/geoip",
|
||||
"https://ipapi.co/json",
|
||||
"https://freegeoip.app/json/",
|
||||
|
Loading…
Reference in New Issue
Block a user