Compare commits
2 Commits
Location
...
canadians-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86fd24f756 | ||
|
|
5ed802e37c |
@@ -44,12 +44,14 @@ public class GeoIPService : IHostedService
|
||||
if (_dbReader!.TryCity(ip, out var response))
|
||||
{
|
||||
string? continent = response?.Continent.Code;
|
||||
string? countryIso = response?.Country.IsoCode;
|
||||
|
||||
if (!string.IsNullOrEmpty(continent) &&
|
||||
string.Equals(continent, "NA", StringComparison.Ordinal)
|
||||
&& response?.Location.Longitude != null)
|
||||
{
|
||||
if (response.Location.Longitude < -102)
|
||||
if (response.Location.Longitude < -102 &&
|
||||
!string.Equals(countryIso, "CA", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
continent = "NA-W";
|
||||
}
|
||||
@@ -57,6 +59,8 @@ public class GeoIPService : IHostedService
|
||||
{
|
||||
continent = "NA-E";
|
||||
}
|
||||
|
||||
_logger.LogDebug("Connecting {countryIso} to {continent}", countryIso, continent);
|
||||
}
|
||||
|
||||
return continent ?? "*";
|
||||
|
||||
Reference in New Issue
Block a user