[Privacy Detection] Get privacy, proxy and VPN detection information from an IP address using the C# language.
If you are using the C# programming language and want to look up if an IP address is associated with a privacy service such as VPN, proxy or hosting service, you can use our Privacy Detection API service. To get started:
Step 1: Get your access token.
Sign up for the appropriate tier and copy your IPinfo access token from your dashboard.
Step 2: Install the IPinfo C# library
Visit our official open-source IPinfo C# library GitHub repo and follow the instructions to install the library.
Step 3: IPinfo C# library ⇒ IP to Privacy
After importing and initializing the IPinfo package, you will need to call the following methods on the IPResponse
class variable:
Code | Description |
---|---|
ipResponse.Privacy.Hosting | Boolean response for hosting/data center/cloud IP address. Often indicative of a bot or self-hosted VPN. |
ipResponse.Privacy.Proxy | Boolean response for IP address associated with a proxy service. |
ipResponse.Privacy.Vpn | Boolean response for IP address associated with TOR endpoint. |
ipResponse.Privacy.Relay | Boolean response for IP address associated with Apple relay service. |
ipResponse.Privacy.Service | Name of the privacy service provider, if available. |
Starter code template
//namespace using IPinfo; using IPinfo.Models; namespace IPinfoApp { // Class declaration class IPlookup { // Main Method static async Task Main(string[] args) { //////////////////////////////// // initializing IPinfo client // //////////////////////////////// // Get your IPinfo access token from: ipinfo.io/account/token string token = "YOUR_TOKEN"; IPinfoClient client = new IPinfoClient.Builder() .AccessToken(token) .Build(); // making the API call string ip = "173.45.30.55"; IPResponse ipResponse= await client.IPApi.GetDetailsAsync(ip); //////////////////////////////// // Privacy Detection Insights // //////////////////////////////// Console.WriteLine($"Hosting/Data center IP?: {ipResponse.Privacy.Hosting}"); Console.WriteLine($"Proxy IP?: {ipResponse.Privacy.Proxy}"); Console.WriteLine($"Relay IP?: {ipResponse.Privacy.Relay}"); Console.WriteLine($"Tor endpoint IP?: {ipResponse.Privacy.Tor}"); Console.WriteLine($"VPN IP?: {ipResponse.Privacy.Vpn}"); Console.WriteLine($"Service provider: {ipResponse.Privacy.Service}"); } } } <br>
Result
Hosting/Data center IP: False Proxy IP?: False Relay IP?: False Tor endpoint IP?: False VPN IP?: True Service provider:<br>
As you can see, the IP address is flagged as a VPN IP address.
Besides the API service, IPinfo IP to Privacy detection data is also available as a database download.
To learn more about using the C# language and .NET framework with IPinfo, please check out our article: First steps with C#/.NET & IPinfo’s API and Database
If you have any questions, please reach out to us.