Code2.Data.GeoIP
0.1.3
See the version list below for details.
dotnet add package Code2.Data.GeoIP --version 0.1.3
NuGet\Install-Package Code2.Data.GeoIP -Version 0.1.3
<PackageReference Include="Code2.Data.GeoIP" Version="0.1.3" />
paket add Code2.Data.GeoIP --version 0.1.3
#r "nuget: Code2.Data.GeoIP, 0.1.3"
// Install Code2.Data.GeoIP as a Cake Addin #addin nuget:?package=Code2.Data.GeoIP&version=0.1.3 // Install Code2.Data.GeoIP as a Cake Tool #tool nuget:?package=Code2.Data.GeoIP&version=0.1.3
Code2.Data.GeoIP
Service for maxmind geoip csv data which defaults to storing the dat in memory. The csv files can be downloaded after registering at https://www.maxmind.com/.
options
- CsvBlocksFileIPv4, path to csv file with ipv4 block data (optional if ipv6 is set)
- CsvBlocksFileIPv6, path to csv file with ipv6 block data (optional if ipv4 is set)
- CsvLocationsFile (optional), path to csv file with location data
- CsvReaderChunkSize (optional), amount of lines to read and process, default=5000
usage
As there are 2 types of csv files you can either use GeoIPServiceCity or GeoIPServiceCountry. If you're only interested in a few object attributes you can define and use your own objects as long as they are derived from LocationBase and BlockBase.
var options = new GeoIPServiceOptions()
{
CsvBlocksFileIPv4 = "./data/GeoLite2-City-Blocks-IPv4.csv",
CsvBlocksFileIPv6 = "./data/GeoLite2-City-Blocks-IPv6.csv",
CsvLocationsFile = "./data/GeoLite2-City-Locations-en.csv"
};
public class MyBlock: BlockBase {public int AccuracyRadius {get;set;} }
public class MyLocation: LocationBase {public string? CityName {get;set;} }
var service = new GeoIPService<MyBlock, MyLocation>(options);
service.Load();
remarks
The InMemoryBlocksRepository stores the data chunked with the chunksize equal to Options.CsvReaderChunkSize
references
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net7.0
- Code2.Tools.Csv (>= 0.1.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.