()
| 64 | } |
| 65 | |
| 66 | func (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 | |
| 87 | func (ps ProxyList) NameAddIndex() ProxyList { |
| 88 | num := len(ps) |
no test coverage detected