Giter Club home page Giter Club logo

mmdbreader's Introduction

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: TMMDBIPCountryInfo;
  prefixLength: Integer;
begin
 LIPInfo := TMMDBIPCountryInfo.Create;
 LMMDBReader := TMMDBReader.Create('C:\GeoIP2\GeoLite2-Country.mmdb');
 try
   LIPAddress := TMMDBIPAddress.Parse('8.8.8.8');
   if LMMDBReader.Find<TMMDBIPCountryInfo>(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).

Supporting the project

mmdbreader's People

Contributors

optinsoft avatar tavel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mmdbreader's Issues

FindAll has error

Hi,FindAll function
When city or subdivisions is emtpy string, names is the last node value.
Uploading 2.png…

How to get country name

I can get ISO code but is it possible to get country name?

It looks like there is a dictionary info.Country.Names. How to use it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.