MCPcopy
hub / github.com/zu1k/proxypool / Find

Method Find

pkg/proxy/geoip.go:82–105  ·  view source on GitHub ↗

find ip info

(ipORdomain string)

Source from the content-addressed store, hash-verified

80
81// find ip info
82func (g GeoIP) Find(ipORdomain string) (ip, country string, err error) {
83 ips, err := net.LookupIP(ipORdomain)
84 if err != nil {
85 return "", "", err
86 }
87 ip = ips[0].String()
88
89 var record *geoip2.City
90 record, err = g.db.City(ips[0])
91 if err != nil {
92 return
93 }
94 countryIsoCode := record.Country.IsoCode
95 if countryIsoCode == "" {
96 country = fmt.Sprintf("🏁 ZZ")
97 }
98 emoji, found := g.emojiMap[countryIsoCode]
99 if found {
100 country = fmt.Sprintf("%v %v", emoji, countryIsoCode)
101 } else {
102 country = fmt.Sprintf("🏁 ZZ")
103 }
104 return
105}

Callers 2

NameAddCounrtyMethod · 0.80
GetAllProxiesFunction · 0.80

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected