Skip to content

Releases: oschwald/maxminddb-golang

v2.0.0-beta.7

07 Jul 17:10
018782a
Compare
Choose a tag to compare
v2.0.0-beta.7 Pre-release
Pre-release

2.0.0-beta.7

  • Update capitalization of "uint" in ReadUInt* to match KindUint* as well
    as the Go standard library.

2.0.0-beta.6

07 Jul 17:04
8ea2bb6
Compare
Choose a tag to compare
2.0.0-beta.6 Pre-release
Pre-release

2.0.0-beta.6

  • Update capitalization of "uint" in ReadUInt* to match KindUint* as well
    as the Go standard library.

2.0.0-beta.5

06 Jul 20:20
ec9ebd2
Compare
Choose a tag to compare
2.0.0-beta.5 Pre-release
Pre-release

2.0.0-beta.5

  • Added Offset() method to Decoder to get the current database offset. This
    enables custom unmarshalers to implement caching for improved performance when
    loading databases with duplicate data structures.
  • Fixed infinite recursion in pointer-to-pointer data structures, which are
    invalid per the MaxMind DB specification.

2.0.0-beta-4

05 Jul 20:55
0719621
Compare
Choose a tag to compare
2.0.0-beta-4 Pre-release
Pre-release
  • BREAKING CHANGE: Removed experimental deserializer interface and
    supporting code. Applications using this interface should migrate to the
    Unmarshaler interface by implementing UnmarshalMaxMindDB(d *Decoder) error
    instead.
  • Open and FromBytes now accept options.
  • BREAKING CHANGE: IncludeNetworksWithoutData and IncludeAliasedNetworks
    now return a NetworksOption rather than being one themselves. These must now
    be called as functions: Networks(IncludeAliasedNetworks()) instead of
    Networks(IncludeAliasedNetworks). This was done to improve the documentation
    organization.
  • Added Unmarshaler interface to allow custom decoding implementations for
    performance-critical applications. Types implementing
    UnmarshalMaxMindDB(d *Decoder) error will automatically use custom decoding
    logic instead of reflection, following the same pattern as
    json.Unmarshaler.
  • Added public Decoder type and Kind constants in mmdbdata package for
    manual decoding. Decoder provides methods like ReadMap(), ReadSlice(),
    ReadString(), ReadUInt32(), PeekKind(), etc. Kind type includes
    helper methods String(), IsContainer(), and IsScalar() for type
    introspection. The main maxminddb package re-exports these types for
    backward compatibility. NewDecoder() supports an options pattern for
    future extensibility.
  • Enhanced UnmarshalMaxMindDB to work with nested struct fields, slice
    elements, and map values. The custom unmarshaler is now called recursively
    for any type that implements the Unmarshaler interface, similar to
    encoding/json.
  • Improved error messages to include byte offset information and, for the
    reflection-based API, path information for nested structures using JSON
    Pointer format. For example, errors may now show "at offset 1234, path
    /city/names/en" or "at offset 1234, path /list/0/name" instead of just the
    underlying error message.
  • PERFORMANCE: Added string interning optimization that reduces allocations
    while maintaining thread safety. Reduces allocation count from 33 to 10 per
    operation in downstream libraries. Uses a fixed 512-entry cache with per-entry
    mutexes for bounded memory usage (~8KB) while minimizing lock contention.

2.0.0-beta.3

16 Feb 02:22
8a6faa4
Compare
Choose a tag to compare
2.0.0-beta.3 Pre-release
Pre-release
  • Open will now fall back to loading the database in memory if the file-system does not support mmap. Pull request by database64128. GitHub #163.
  • Made significant improvements to the Windows memory-map handling. . GitHub #162.
  • Fix an integer overflow on large databases when using a 32-bit architecture. See ipinfo/mmdbctl#33.

2.0.0-beta.2

14 Nov 17:46
d591ef0
Compare
Choose a tag to compare
2.0.0-beta.2 Pre-release
Pre-release
  • Allow negative indexes for arrays when using DecodePath. #152
  • Add IncludeNetworksWithoutData option for Networks and NetworksWithin. #155 and #156

2.0.0-beta.1

18 Aug 23:47
b8ac5c0
Compare
Choose a tag to compare
2.0.0-beta.1 Pre-release
Pre-release

This is the first beta of the v2 releases. Go 1.23 is required. I don't expect to do a final release until Go 1.24 is available. See #141 for the v2 roadmap.

Notable changes:

  • (*Reader).Lookup now takes only the IP address and returns a Result. Lookup(ip, &rec) would now become Lookup(ip).Decode(&rec).
  • (*Reader).LookupNetwork has been removed. To get the network for a result, use (Result).Prefix().
  • (*Reader).LookupOffset now takes an offset and returns a Result. Result has an Offset() method that returns the offset value. (*Reader).Decode has been removed.
  • Use of net.IP and *net.IPNet have been replaced with netip.Addr and netip.Prefix.
  • You may now decode a particular path within a database record using (Result).DecodePath. For instance, to decode just the country code in GeoLite2 Country to a string called code, you might do something like Lookup(ip).DecodePath(&code, "country", "iso_code"). Strings should be used for map keys and ints for array indexes.
  • (*Reader).Networks and (*Reader).NetworksWithin now return a Go 1.23 iterator of Result values. Aliased networks are now skipped by default. If you wish to include them, use the IncludeAliasedNetworks option.

1.13.1

28 Jun 17:50
616cde2
Compare
Choose a tag to compare
  • Return the *net.IPNet in canonical form when using NetworksWithin to look up a network more specific than the one in the database. Previously, the IP field on the *net.IPNet would be set to the IP from the lookup network rather than the first IP of the network.
  • NetworksWithin will now correctly handle an *net.IPNet parameter that is not in canonical form. This issue would only occur if the *net.IPNet was manually constructed, as net.ParseCIDR returns the value in canonical form even if the input string is not.

1.13.0

03 Jun 02:09
af999f7
Compare
Choose a tag to compare
  • Go 1.21 or greater is now required.
  • The error messages when decoding have been improved. #119

1.12.0

01 Aug 02:50
1f4a262
Compare
Choose a tag to compare
  • The wasi target is now built without memory-mapping support. Pull request
    by Alex Kashintsev. GitHub #114.
  • When decoding to a map of non-scalar, non-interface types such as a
    map[string]map[string]any, the decoder failed to zero out the value for
    the map elements, which could result in incorrect decoding. Reported by
    JT Olio. GitHub #115.