modulepackage
1.13.1
Repository: https://github.com/oschwald/maxminddb-golang.git
Documentation: pkg.go.dev
# README
MaxMind DB Reader for Go
This is a Go reader for the MaxMind DB format. Although this can be used to read GeoLite2 and GeoIP2 databases, geoip2 provides a higher-level API for doing so.
This is not an official MaxMind API.
Installation
go get github.com/oschwald/maxminddb-golang
Usage
See GoDoc for documentation and examples.
Examples
See GoDoc or
example_test.go
for examples.
Contributing
Contributions welcome! Please fork the repository and open a pull request with your changes.
License
This is free software, licensed under the ISC License.
# Functions
FromBytes takes a byte slice corresponding to a MaxMind DB file and returns a Reader structure or an error.
Open takes a string path to a MaxMind DB file and returns a Reader structure or an error.
SkipAliasedNetworks is an option for Networks and NetworksWithin that makes them not iterate over aliases of the IPv4 subtree in an IPv6 database, e.g., ::ffff:0:0/96, 2001::/32, and 2002::/16.
# Constants
NotFound is returned by LookupOffset when a matched root record offset cannot be found.
# Structs
InvalidDatabaseError is returned when the database contains invalid data and cannot be parsed.
Metadata holds the metadata decoded from the MaxMind DB file.
Networks represents a set of subnets that we are iterating over.
Reader holds the data corresponding to the MaxMind DB file.
UnmarshalTypeError is returned when the value in the database cannot be assigned to the specified data type.
# Type aliases
NetworksOption are options for Networks and NetworksWithin.