GithubHelp home page GithubHelp logo

ng-labo / sqlite-maxminddb Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 8 KB

This is SqLite extension to use lookup functions by libmaxminddb.

License: MIT License

Makefile 1.76% Shell 5.04% C 90.53% Batchfile 2.66%
libmaxminddb sqlite3

sqlite-maxminddb's Introduction

sqlite-maxminddb

This SqLite extension provides asn() org() cc() functions for lookup ASN, CountryCode from IP adresses. `ipmask(), ip6mask()' help to translate to prefixes easily.

Usage

  • prepares libmaxminddb install from package system, or build from source.

  • downloads geolite2 (its one of available contents) put $HOME/.maxminddb/

(on Windows) to %HOMEPATH%.maxminddb\

$ make
$ LD_PRELOAD=libmaxminddb.so sqlite3
sqlite> .load ./maxminddb
sqlite> select asn('8.8.8.8'), org('8.8.8.8'), cc('8.8.8.8');
15169|Google LLC|US
sqlite> select asn('192.168.1.1'), org('192.168.1.1'), cc('192.168.1.1');
||
sqlite> select ipmask('192.168.1.1', 24);
192.168.1.0

NOTE

  • This extension depends on GeoIP2-Lite, or it is other way to create a custom MaxMind DB File.

  • It will process no error in the case of success IP lookup and failure getting value. Unresolveble IP is usual.

  • This extension loads mmdb file from fixed directory. I'd like to consider better way to load any mmdb file to library.

  • It is useful to write '.load /pathto/maxminddb' into $HOME/.sqliterc.

  • Although maxmind/libmaxminddb is available on Windows/OS X, I don't cater for them. Now I only check on x86_64 on ubuntu 16.

  • Update for Windows tentatively. Error message doesn't print correctly.

copy sqlite3.h, sqlite3ext.h from SQLITE3 site on same directory.

clone libmaxminddb on same directory.

run build.bat, then maxminddb.dll will be generated.

sqlite-maxminddb's People

Contributors

ng-labo avatar

Watchers

 avatar

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.