Skip to content

Latest commit

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

MMDBReader

A MaxMind DB reader in Julia

MaxMind DB binary files store data indexed by IP address subnets.

This package implements version 2 of the format and it can handle both IPv4 or IPv6 databases with record sizes of 24, 28 or 32 bits.

Installation

To install from GitHub:

] add https://github.com/lbilli/MMDBReader.jl

Usage

To look up an IP address in a database:

using MMDBReader: MMDBReader as MM
filename ="/path/to/file.mmdb"
ip ="8.8.8.8" or "2001:4860:4860::8888"# Load a database file
db = MM.loaddb(filename)
# Look up an IP
res, prefix = MM.lookup(db, ip)
# Return the database metadata
meta = MM.metadata(db)

Results are typically kay/value maps, possibly nested, and are presented here as Julia's Dict{String,Any}.

Data mapping

Supported data types are mapped to Julia builtin types according to the following table:

MaxMind DBJulia
UTF-8 stringString
doubleFloat64
bytesUInt8[]
unsigned 16-bit intUInt16
unsigned 32-bit intUInt32
signed 32-bit intInt32
unsigned 64-bit intUInt64
unsigned 128-bit intUInt128
mapDict{String,Any}1
arrayVector{Any}1
booleanBool
floatFloat32

Footnotes

  1. eltype can be stricter than Any if possible. 2

About

A Julia reader for MaxMind DB binary files

Topics

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages