-
v2.0.0-beta.407196218 · ·
2.0.0-beta.4 - **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.
-
v1.6.06a033e62 · ·
1.6.0 * This module now uses Go modules. Requested by Matthew Rothenberg. GitHub #49. * Plan 9 is now supported. Pull request by Jacob Moody. GitHub #61. * Documentation fixes. Pull request by Olaf Alders. GitHub #62. * Thread-safety is now mentioned in the documentation. Requested by Ken Sedgwick. GitHub #39. * Fix off-by-one error in file offset safety check. Reported by Will Storey. GitHub #63.
-
v1.4.0f51e9f49 · ·
1.4.0 * Add the method `LookupNetwork`. This returns the network that the record belongs to as well as a boolean indicating whether there was a record for the IP address in the database. GitHub #59. * Improve performance.
-
v1.3.12905694a · ·
1.3.1 * Fix issue with the finalizer running too early on Go 1.12 when using the Verify method. Reported by Robert-André Mauchin. GitHub #55. * Remove unnecessary call to reflect.ValueOf. PR by SenseyeDeveloper. GitHub #53.
-
v1.3.0c5bec84d · ·
1.3.0 * The methods on the `maxminddb.Reader` struct now return an error if called on a closed database reader. Previously, this could cause a segmentation violation when using a memory-mapped file. * The `Close` method on the `maxminddb.Reader` struct now sets the underlying buffer to nil, even when using `FromBytes` or `Open` on Google App Engine. * No longer uses constants from `syscall`
-
v1.2.0d19f6d45 · ·
1.2.0 * The database decoder now does bound checking when decoding data from the database. This is to help ensure that the reader does not panic when given a corrupt database to decode. * The reader will now return an error on a data structure with a depth greater than 512. This is done to prevent the possibility of a stack overflow on a cyclic data structure in a corrupt database. This matches the maximum depth allowed by libmaxminddb. All MaxMind databases currently have a depth of less than five.
-
v1.1.04cf6490e · ·
1.1.0 * Added appengine build tag for Windows. When enabled, memory-mapping will be disabled in the Windows build as it is for the non-Windows build. Pull request #35 by Ingo Oeser. * SetFinalizer is now used to unmap files if the user fails to close the reader. Using `r.Close()` is still recommended for most use cases. * Previously, an unsafe conversion between `[]byte` and string was used to avoid unnecessary allocations when decoding struct keys. The decoder now relies on a compiler optimization on `string([]byte)` map lookups to achieve this rather than using `unsafe`.
-
-