Releases: oschwald/geoip2-golang
Releases · oschwald/geoip2-golang
2.0.0
- BREAKING CHANGE: Lookup methods now require
netip.Addr, return typed
Names, and provideHasData()helpers while always populating
Network/IPAddressfields so network topology remains accessible. - BREAKING CHANGE: Struct field casing now matches MaxMind responses (for
exampleIsoCode→ISOCode), location coordinates use pointers, and JSON
tags rely on Go 1.24omitzerosupport—upgrade your toolchain before
adopting v2. - BREAKING CHANGE: Removed
FromBytesmethod. UseOpenBytesinstead. - Added
MIGRATION.mdwith detailed guidance for upgrading from v1. - Updated dependency on
github.com/oschwald/maxminddb-golang/v2tov2.0.0. - Added configurable
Optionhelpers soOpenandOpenBytescan accept
future options without forcing a v3 release.
2.0.0-beta.4
- Updated maxminddb dependency to v2.0.0-beta.9.
- Added
OpenBytesmethod to match the API changes in maxminddb v2.0.0-beta.9. - Deprecated
FromBytesmethod. UseOpenBytesinstead.FromByteswill be
removed in a future version.
2.0.0-beta.3
- Add support for
GeoIP-City-Redacted-USandGeoIP-Enterprise-Redacted-US.
Requested by Tom Anderson. GitHub #134. - Upgrade
github.com/oschwald/maxminddb-golang/v2tov2.0.0-beta.7.
1.13.0
2.0.0-beta.2
- BREAKING CHANGE: Replaced
IsZero()methods withHasData()methods on all
result structs (including Names). The new methods provide clearer semantics:
HasData()returnstruewhen GeoIP data is found andfalsewhen no data is
available. UnlikeIsZero(),HasData()excludes Network and IPAddress fields
from validation, allowing users to access network topology information even when
no GeoIP data is found. The Network and IPAddress fields are now always
populated for all lookups, regardless of whether GeoIP data is available. - BREAKING CHANGE: Replaced all anonymous nested structs with named types to
improve struct initialization ergonomics. All result structs (Enterprise, City,
Country) now use named types likeEnterpriseCityRecord,CityTraits,
CountryRecord, etc. This makes it much easier to initialize structs in user
code while maintaining the same JSON serialization behavior. - BREAKING CHANGE: Changed
Location.LatitudeandLocation.Longitudefrom
float64to*float64to properly distinguish between missing coordinates and
the valid location (0, 0). Missing coordinates are now represented asnil
and are omitted from JSON output, while valid zero coordinates are preserved.
This fixes the ambiguity where (0, 0) was incorrectly treated as "no data".
AddedLocation.HasCoordinates()method for safe coordinate access. Reported
by Nick Bruun. GitHub #5.
2.0.0-beta.1
- BREAKING CHANGE: Updated to use
maxminddb-golang/v2which provides
significant performance improvements and a more modern API. - BREAKING CHANGE: All lookup methods now accept
netip.Addrinstead of
net.IP. This provides better performance and aligns with modern Go
networking practices. - BREAKING CHANGE: Renamed
IsoCodefields toISOCodein all structs
to follow proper capitalization for the ISO acronym. Closes GitHub issue #4. - BREAKING CHANGE: Replaced
map[string]stringNames fields with structured
Namestype for significant performance improvements. This eliminates map
allocation overhead, reducing memory usage by 34% and allocations by 56%. - BREAKING CHANGE: Added JSON tags to all struct fields. JSON tags match
the correspondingmaxminddbtags where they exist. Custom fields (IPAddress
andNetwork) use snake_case (ip_addressandnetwork). - BREAKING CHANGE: Removed
IsAnonymousProxyandIsSatelliteProviderfields
from all Traits structs. These fields have been removed from MaxMind databases.
Use the dedicated Anonymous IP database for anonymity detection instead. - BREAKING CHANGE: Go 1.24 or greater is now required. This enables the use
ofomitzeroin JSON tags to match MaxMind database behavior where empty
values are not included. - Added
IsZero()method to all result structs (City, Country, Enterprise, ASN,
etc.) to easily check whether any data was found for the queried IP address.
Requested by Salim Alami. GitHub #32. - Added
NetworkandIPAddressfields to all result structs. TheNetworkfield
exposes the network prefix from the MaxMind database lookup, and theIPAddressfield
contains the IP address used during the lookup. These fields are only populated when
data is found for the IP address. For flat record types (ASN, ConnectionType, Domain,
ISP, AnonymousIP), the fields are namedNetworkandIPAddress. For complex types
(City, Country, Enterprise), the fields are located at.Traits.Networkand
.Traits.IPAddress.
Requested by Aaron Bishop. GitHub #128. - Updated module path to
github.com/oschwald/geoip2-golang/v2to follow
Go's semantic versioning guidelines for breaking changes. - Updated examples and documentation to demonstrate proper error handling
withnetip.ParseAddr(). - Updated linting rules to support both v1 and v2 import paths during the
transition period.