Skip to content

Commit

Permalink
opti country find
Browse files Browse the repository at this point in the history
  • Loading branch information
zu1k committed Sep 7, 2020
1 parent 240ac61 commit d84f279
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions pkg/proxy/proxies.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,21 @@ func (ps ProxyList) NameAddCounrty() ProxyList {
ii := i
go func() {
defer wg.Done()
ip, country, err := geoIp.Find(ps[ii].BaseInfo().Server)
if err != nil {
country = "🏁 ZZ"
}
ps[ii].SetName(fmt.Sprintf("%s", country))
ps[ii].SetCountry(country)

// trojan依赖域名?
if ps[ii].TypeName() != "trojan" {
ps[ii].SetIP(ip)
country := ps[ii].BaseInfo().Country
if country == "" {
ip, c, err := geoIp.Find(ps[ii].BaseInfo().Server)
if err != nil {
country = "🏁 ZZ"
} else {
country = c
}
ps[ii].SetCountry(country)
// trojan依赖域名?
if ps[ii].TypeName() != "trojan" {
ps[ii].SetIP(ip)
}
}
ps[ii].SetName(country)
}()
}
wg.Wait()
Expand Down

0 comments on commit d84f279

Please sign in to comment.