net3000.ipinfo 1.0.0

dotnet add package net3000.ipinfo --version 1.0.0
                    
NuGet\Install-Package net3000.ipinfo -Version 1.0.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="net3000.ipinfo" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="net3000.ipinfo" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="net3000.ipinfo" />
                    
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 net3000.ipinfo --version 1.0.0
                    
#r "nuget: net3000.ipinfo, 1.0.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 net3000.ipinfo@1.0.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=net3000.ipinfo&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=net3000.ipinfo&version=1.0.0
                    
Install as a Cake Tool

Net3000 IP Info Library

Overview

The net3000.ipinfo library provides IP geolocation services for Net3000 solutions. It uses the IP2Location database (via MaxMind GeoIP2 library) to retrieve detailed location information from IP addresses, including country, region, city, postal code, coordinates, and timezone data.

Features

  • IP address geolocation lookup
  • Country, region, and city identification
  • Postal code and coordinate retrieval
  • Timezone information
  • Automatic filtering of local/private IP addresses
  • Support for both IPv4 and IPv6 addresses

Public API

<details> <summary>net3000.IpInfo.Service</summary>

Member Summary Parameters
Service(string databasePath) Initializes a new instance of the IP geolocation service. databasePath (string) - Path to the IP2Location MMDB database file. Defaults to "IP2LOCATION-LITE-DB9.MMDB"
LocationDetails? GetLocationByIp(string ipAddress) Gets complete location details for a given IP address. ipAddress (string) - IP address as string (IPv4 or IPv6)
string? GetCountryByIp(string ipAddress) Gets just the country code for an IP address. ipAddress (string) - IP address as string
CityCountryInfo? GetCityCountryByIp(string ipAddress) Gets city and country information for an IP address. ipAddress (string) - IP address as string
static bool IsLocalIp(IPAddress ipAddress) Checks if an IP address is local/private. ipAddress (IPAddress) - IP address to check
static bool IsLocalIp(string ipAddress) Checks if an IP address string is local/private. ipAddress (string) - IP address string to check
void Dispose() Releases resources used by the service. None

</details>

<details> <summary>net3000.IpInfo.LocationDetails</summary>

Property Type Description
IpAddress string The IP address that was looked up
Country string? ISO country code (e.g., "US", "CA")
CountryName string? Full country name
Region string? ISO region/subdivision code
RegionName string? Full region/subdivision name
City string? City name
PostalCode string? Postal/ZIP code
Latitude double? Latitude coordinate
Longitude double? Longitude coordinate
TimeZone string? Timezone identifier
Continent string? Continent code
ContinentName string? Full continent name

</details>

<details> <summary>net3000.IpInfo.CityCountryInfo</summary>

Property Type Description
City string? City name
Country string? ISO country code
CountryName string? Full country name
Region string? ISO region/subdivision code
RegionName string? Full region/subdivision name

</details>

Usage

Basic Example

using net3000.IpInfo;

// Initialize the service with default database path
using var ipService = new Service();

// Get complete location details
var location = ipService.GetLocationByIp("8.8.8.8");
if (location != null)
{
    Console.WriteLine($"Country: {location.CountryName} ({location.Country})");
    Console.WriteLine($"City: {location.City}");
    Console.WriteLine($"Coordinates: {location.Latitude}, {location.Longitude}");
}

// Get just country code
var country = ipService.GetCountryByIp("8.8.8.8");

// Get city and country info
var cityCountry = ipService.GetCityCountryByIp("8.8.8.8");

Custom Database Path

// Use a custom database file path
using var ipService = new Service("path/to/your/database.mmdb");

Check for Local IPs

// Check if an IP is local/private
bool isLocal = Service.IsLocalIp("192.168.1.1"); // Returns true
bool isPublic = Service.IsLocalIp("8.8.8.8");    // Returns false

Database

This library uses the IP2Location LITE database (MMDB format) which is provided free of charge. The database file (IP2LOCATION-LITE-DB9.MMDB) should be included in your project and copied to the output directory.

Note: The IP2Location LITE edition has accuracy up to Class C (192.168.1.X) only. For higher accuracy, you can acquire commercial editions from IP2Location.com.

Dependencies

  • MaxMind.GeoIP2 (v5.4.1) - MaxMind GeoIP2 library for reading MMDB database files

License

This library is proprietary to Net3000. The IP2Location LITE database is provided under the IP2Location LITE license terms. See LICENSE.md for details.

IP2Location Attribution

This library uses the IP2Location LITE database for IP geolocation. All sites, advertising materials, and documentation mentioning features or the use of this database must display the following acknowledgment:

"[Your site name or product name] uses the IP2Location LITE database for IP geolocation."

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.0.0 111 1/12/2026

Initial release of Net3000 IP Info library with IP geolocation services using IP2Location database.