Skip to content
Delphi Reader for MaxMind MMDB files
Pascal
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Sample
Source
LICENSE
README.md

README.md

MMDB Reader

Description

This distribution provides a Delphi reader for the MaxMind DB file format.

Requirements

Delphi 10.2 Tokyo or newer.

Usage

uses uMMDBReader;

var
  LMMDBReader: TMMDBReader;
  LIPAddress: TMMDBIPAddress;
  LIPInfo: TMMDBIPInfo
  prefixLength: Integer;
begin
 LIPInfo := TMMDBIPInfo.Create;
 LMMDBReader := TMMDBReader.Create('C:\GeoIP2\GeoLite2-Country.mmdb'); 
 try
   LIPAddress := TMMDBIPAddress.Parse('8.8.8.8');
   if LMMDBReader.Find<TMMDBIPInfo>(LIPAddress, prefixLength, LIPInfo) then
     ShowMessage(Format('country_iso_code: "%s", country_geoname_id: %s', [LIPInfo.Country.ISOCode, IntToStr(LIPInfo.country.GeonameId)]))
   else
     ShowMessage('Not found');
 finally
   LMMDBReader.Free;
   LIPInfo.Free;
 end;
end;

License

BSD 2-Clause License.

Dependencies

BigNumbers by Rudy Velthuis (https://github.com/rvelthuis/DelphiBigNumbers).

Contributions

MMDB Reader uses modified IPTypesX module from Albert de Weerd (included in source).

You can’t perform that action at this time.