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

Method NameAddCounrty

pkg/proxy/proxies.go:66–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

64}
65
66func (ps ProxyList) NameAddCounrty() ProxyList {
67 num := len(ps)
68 wg := &sync.WaitGroup{}
69 wg.Add(num)
70 for i := 0; i < num; i++ {
71 ii := i
72 go func() {
73 defer wg.Done()
74 _, country, err := geoIp.Find(ps[ii].BaseInfo().Server)
75 if err != nil {
76 country = "🏁 ZZ"
77 }
78 ps[ii].SetName(fmt.Sprintf("%s", country))
79 ps[ii].SetCountry(country)
80 //ps[ii].SetIP(ip)
81 }()
82 }
83 wg.Wait()
84 return ps
85}
86
87func (ps ProxyList) NameAddIndex() ProxyList {
88 num := len(ps)

Callers 1

CrawlGoFunction · 0.80

Calls 4

FindMethod · 0.80
BaseInfoMethod · 0.65
SetNameMethod · 0.65
SetCountryMethod · 0.65

Tested by

no test coverage detected