Class IpLocationProviderFactory
- Namespace
- VpnHood.Net.IpLocations
- Assembly
- VpnHood.Net.IpLocations.dll
Provides the default IP location provider, and a location's path.
public static class IpLocationProviderFactory
- Inheritance
-
IpLocationProviderFactory
- Inherited Members
Methods
CreateDefault(HttpClient, string)
Creates the default provider, the online IpApiCoLocationProvider.
public static IIpLocationProvider CreateDefault(HttpClient httpClient, string userAgent)
Parameters
httpClientHttpClientThe HTTP client the requests go through; the caller keeps owning it.
userAgentstringThe User-Agent header the requests send.
Returns
- IIpLocationProvider
A new provider.
GetPath(string, string?, string?)
Builds a location's path: the country code, then the region's name, or the city's when the region is unknown.
public static string GetPath(string countryCode, string? regionName, string? cityName)
Parameters
countryCodestringThe country's two-letter code.
regionNamestringThe region's name, or null.
cityNamestringThe city's name, or null.
Returns
- string
The path, such as
US/California, or the country code alone when both names are unknown.