diff --git a/assets/data/img/flags/__.png b/assets/data/img/flags/__.png new file mode 100644 index 00000000..38232f4b Binary files /dev/null and b/assets/data/img/flags/__.png differ diff --git a/desktop/angular/docker.sh b/desktop/angular/docker.sh index bbd896e7..c0deab8c 100755 --- a/desktop/angular/docker.sh +++ b/desktop/angular/docker.sh @@ -11,8 +11,8 @@ mnt="$( cd ../.. && pwd )" docker run \ -ti \ --rm \ - -v $mnt:/portmaster-ui \ - -w /portmaster-ui/modules/portmaster \ + -v $mnt:/portmaster \ + -w /portmaster/desktop/angular \ -p 8081:8080 \ node:latest \ npm start -- --host 0.0.0.0 --port 8080 diff --git a/desktop/angular/src/app/pages/spn/map-renderer/map-renderer.ts b/desktop/angular/src/app/pages/spn/map-renderer/map-renderer.ts index bea5ee57..b794a8cc 100644 --- a/desktop/angular/src/app/pages/spn/map-renderer/map-renderer.ts +++ b/desktop/angular/src/app/pages/spn/map-renderer/map-renderer.ts @@ -195,6 +195,8 @@ export class MapRendererComponent implements OnInit, AfterViewInit, OnDestroy { data.forEach((country: any) => { this.countryNames[country.properties.iso_a2] = country.properties.name }) + // Add special country values. + this.countryNames["__"] = "Anycast" this.worldGroup.selectAll() .data<GeoPermissibleObjects>(data) diff --git a/desktop/angular/src/app/shared/netquery/pipes/location.pipe.ts b/desktop/angular/src/app/shared/netquery/pipes/location.pipe.ts index 522ed86a..4b53f8fe 100644 --- a/desktop/angular/src/app/shared/netquery/pipes/location.pipe.ts +++ b/desktop/angular/src/app/shared/netquery/pipes/location.pipe.ts @@ -11,6 +11,9 @@ export class ConnectionLocationPipe implements PipeTransform { return ''; } if (!!conn.country) { + if (conn.country === "__") { + return "Anycast" + } return conn.country; } diff --git a/service/intel/geoip/country_info.go b/service/intel/geoip/country_info.go index 06a87c4e..3651a5bb 100644 --- a/service/intel/geoip/country_info.go +++ b/service/intel/geoip/country_info.go @@ -11,6 +11,14 @@ func (l *Location) AddCountryInfo() { return } + // Check for anycast. + if l.IsAnycast { + // Reset data for anycast. + l.Country.Code = "__" + l.Coordinates.Latitude = 0 + l.Coordinates.Longitude = 0 + } + // Get country info. info, ok := countries[l.Country.Code] if !ok { @@ -83,6 +91,10 @@ func init() { } var countries = map[string]CountryInfo{ + "__": { + Name: "Anycast", + Center: Coordinates{AccuracyRadius: earthCircumferenceInKm}, + }, "MN": { Name: "Mongolia", Continent: ContinentInfo{Region: "AS-E"}, diff --git a/service/intel/geoip/country_info_test.go b/service/intel/geoip/country_info_test.go index 57cb6e8f..a422767b 100644 --- a/service/intel/geoip/country_info_test.go +++ b/service/intel/geoip/country_info_test.go @@ -9,6 +9,11 @@ func TestCountryInfo(t *testing.T) { t.Parallel() for key, country := range countries { + // Skip special anycast country. + if key == "__" { + continue + } + if key != country.Code { t.Errorf("%s has a wrong country code of %q", key, country.Code) }