✨ 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"`
 | 
						CountryCode2 string `json:"countryCode,omitempty"`
 | 
				
			||||||
	IP           string `json:"ip,omitempty"`
 | 
						IP           string `json:"ip,omitempty"`
 | 
				
			||||||
	Query        string `json:"query,omitempty"`
 | 
						Query        string `json:"query,omitempty"`
 | 
				
			||||||
 | 
						Location     struct {
 | 
				
			||||||
 | 
							CountryCode string `json:"country_code,omitempty"`
 | 
				
			||||||
 | 
						} `json:"location,omitempty"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (ip *geoIP) Unmarshal(body []byte) error {
 | 
					func (ip *geoIP) Unmarshal(body []byte) error {
 | 
				
			||||||
@ -27,11 +30,15 @@ func (ip *geoIP) Unmarshal(body []byte) error {
 | 
				
			|||||||
	if ip.CountryCode == "" && ip.CountryCode2 != "" {
 | 
						if ip.CountryCode == "" && ip.CountryCode2 != "" {
 | 
				
			||||||
		ip.CountryCode = ip.CountryCode2
 | 
							ip.CountryCode = ip.CountryCode2
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if ip.CountryCode == "" && ip.Location.CountryCode != "" {
 | 
				
			||||||
 | 
							ip.CountryCode = ip.Location.CountryCode
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var (
 | 
					var (
 | 
				
			||||||
	geoIPApiList = []string{
 | 
						geoIPApiList = []string{
 | 
				
			||||||
 | 
							"https://api.myip.la/en?json",
 | 
				
			||||||
		"https://api.ip.sb/geoip",
 | 
							"https://api.ip.sb/geoip",
 | 
				
			||||||
		"https://ipapi.co/json",
 | 
							"https://ipapi.co/json",
 | 
				
			||||||
		"https://freegeoip.app/json/",
 | 
							"https://freegeoip.app/json/",
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user