using PrivaPub.Models.Jobs; namespace PrivaPub.Domain.Statistics { public sealed record PublicLocation(string Country, string City, double? Latitude, double? Longitude, string Network, string Cdn); public static class PublicGeo { //a server's place as it is shown publicly: where it was located (country, city, coordinates to 0.1°, network), //except that a CDN-fronted server shows only its CDN, because the address we reached is the CDN's edge public static PublicLocation Project(InstanceGeo geo) { if (geo == default) return default; if (geo.Cdn != default) return new PublicLocation(default, default, default, default, default, geo.Cdn); if (geo.Country == default && geo.Latitude == default) return default; return new PublicLocation(geo.Country, geo.City, geo.Latitude, geo.Longitude, geo.AsnOrg, default); } } }