mirror of
https://github.com/qdm12/gluetun.git
synced 2026-06-23 20:37:35 +02:00
fix(purevpn/updater): parse country and city from hostname and merges with ip address information (#2991)
This commit is contained in:
@@ -90,10 +90,27 @@ func (u *Updater) FetchServers(ctx context.Context, minServers int) (
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for i := range servers {
|
||||
servers[i].Country = ipsInfo[i].Country
|
||||
servers[i].Region = ipsInfo[i].Region
|
||||
servers[i].City = ipsInfo[i].City
|
||||
parsedCountry, parsedCity, warnings := parseHostname(servers[i].Hostname)
|
||||
for _, warning := range warnings {
|
||||
u.warner.Warn(warning)
|
||||
}
|
||||
servers[i].Country = parsedCountry
|
||||
if servers[i].Country == "" {
|
||||
servers[i].Country = ipsInfo[i].Country
|
||||
}
|
||||
servers[i].City = parsedCity
|
||||
if servers[i].City == "" {
|
||||
servers[i].City = ipsInfo[i].City
|
||||
}
|
||||
|
||||
if (parsedCountry == "" ||
|
||||
comparePlaceNames(parsedCountry, ipsInfo[i].Country)) &&
|
||||
(parsedCity == "" ||
|
||||
comparePlaceNames(parsedCity, ipsInfo[i].City)) {
|
||||
servers[i].Region = ipsInfo[i].Region
|
||||
}
|
||||
}
|
||||
|
||||
sort.Sort(models.SortableServers(servers))
|
||||
|
||||
Reference in New Issue
Block a user