IPGet 1.1.0

dotnet add package IPGet --version 1.1.0
                    
NuGet\Install-Package IPGet -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="IPGet" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IPGet" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="IPGet" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add IPGet --version 1.1.0
                    
#r "nuget: IPGet, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package IPGet@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=IPGet&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=IPGet&version=1.1.0
                    
Install as a Cake Tool

IPGet .NET SDK

Official .NET SDK for IPGet - High-performance IP geolocation and intelligence API.

Features

  • ✅ Full support for all IPGet API endpoints
  • ✅ Strongly-typed response models
  • ✅ Async/await support
  • ✅ Dependency injection integration
  • ✅ Comprehensive error handling
  • ✅ Automatic retry support
  • ✅ .NET 8+ compatible

Installation

dotnet add package IPGet

Quick Start

Basic Usage

using IPGet;
using IPGet.Configuration;

// Create client with API token
var options = new IPGetOptions { ApiToken = "your-api-token" };
var httpClient = new HttpClient();
var client = new IPGetClient(httpClient, Microsoft.Extensions.Options.Options.Create(options));

// Lookup IP address
var result = await client.LookupAsync("8.8.8.8");
Console.WriteLine($"Country: {result.Location?.CountryName}");
Console.WriteLine($"City: {result.Location?.City}");

Dependency Injection

using IPGet.Extensions;

// In Program.cs or Startup.cs
builder.Services.AddIPGetClient(options =>
{
    options.ApiToken = builder.Configuration["IPGet:ApiToken"];
    options.TimeoutSeconds = 30;
});

// Inject and use
public class MyService
{
    private readonly IIPGetClient _ipGetClient;

    public MyService(IIPGetClient ipGetClient)
    {
        _ipGetClient = ipGetClient;
    }

    public async Task<string> GetCountryAsync(string ipAddress)
    {
        var result = await _ipGetClient.GetLocationAsync(ipAddress);
        return result.CountryName ?? "Unknown";
    }
}

Usage Examples

Get Your Own IP Information

// Get requester's IP information (does not count against API credits)
var me = await client.GetMeAsync();
Console.WriteLine($"Your IP: {me.Network?.Ip}");
Console.WriteLine($"Your Location: {me.Location?.City}, {me.Location?.Country}");
Console.WriteLine($"Your ISP: {me.Network?.OrgName}");

Get Specific Data Groups

// Get only location data
var location = await client.GetLocationAsync("8.8.8.8");
Console.WriteLine($"{location.City}, {location.Country}");

// Get only security data
var security = await client.GetSecurityAsync("8.8.8.8");
if (security.ShouldBlock)
{
    Console.WriteLine("⚠️ This IP should be blocked!");
}

// Get weather data
var weather = await client.GetWeatherAsync("8.8.8.8");
Console.WriteLine($"Temperature: {weather.Current?.Temp}°F");

Get Core Intelligence

// Get location + network + security in one call
var core = await client.GetCoreAsync("8.8.8.8");

Console.WriteLine($"Location: {core.Location?.City}");
Console.WriteLine($"ISP: {core.Network?.OrgName}");
Console.WriteLine($"Threat Level: {core.Security?.ThreatLevel}");

Request Specific Groups

using IPGet.Models.Requests;

var request = new LookupRequest
{
    IpAddress = "8.8.8.8",
    Groups = new List<string> 
    { 
        DataGroups.Location,
        DataGroups.Security,
        DataGroups.Demographics
    }
};

var result = await client.LookupAsync(request);

Get Compliance Data

var compliance = await client.GetComplianceAsync("8.8.8.8");

if (compliance.GdprApplies == true)
{
    Console.WriteLine("GDPR compliance required");
}

if (compliance.TaxRates != null)
{
    Console.WriteLine($"Sales tax: {compliance.TaxRates.CombinedRate:P2}");
}

Error Handling

using IPGet.Exceptions;

try
{
    var result = await client.LookupAsync("8.8.8.8");
}
catch (IPGetAuthenticationException ex)
{
    Console.WriteLine($"Authentication failed: {ex.Message}");
}
catch (IPGetInsufficientCreditsException ex)
{
    Console.WriteLine($"Out of credits: {ex.Message}");
}
catch (IPGetValidationException ex)
{
    Console.WriteLine($"Invalid request: {ex.Message}");
}
catch (IPGetException ex)
{
    Console.WriteLine($"API error: {ex.Message} (Code: {ex.ErrorCode})");
}

Configuration Options

var options = new IPGetOptions
{
    ApiToken = "your-api-token",           // Required
    BaseUrl = "https://api.ipget.io",      // Default
    TimeoutSeconds = 30,                    // Default: 30
    EnableRetry = true,                     // Default: true
    MaxRetryAttempts = 3                    // Default: 3
};

Available Endpoints

Method Description Endpoint
GetMeAsync() Get your own IP info (free) /me
LookupAsync() Get all available data /lookup/{ip}
GetLocationAsync() Geographic location /lookup/{ip}/location
GetNetworkAsync() Network and ASN info /lookup/{ip}/network
GetSecurityAsync() Threat intelligence /lookup/{ip}/security
GetWeatherAsync() Weather data /lookup/{ip}/weather
GetAirportsAsync() Nearby airports /lookup/{ip}/airports
GetLocalizationAsync() Currency and language /lookup/{ip}/localization
GetTemporalAsync() Timezone and holidays /lookup/{ip}/temporal
GetComplianceAsync() Legal compliance /lookup/{ip}/compliance
GetDemographicsAsync() Population stats /lookup/{ip}/demographics
GetCoreAsync() Location + Network + Security /lookup/{ip}/core

Support

License

MIT License - see LICENSE file for details

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 281 11/30/2025