Table of Contents

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

httpClient HttpClient

The HTTP client the requests go through; the caller keeps owning it.

userAgent string

The 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

countryCode string

The country's two-letter code.

regionName string

The region's name, or null.

cityName string

The city's name, or null.

Returns

string

The path, such as US/California, or the country code alone when both names are unknown.