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 aResult
.Lookup(ip, &rec)
would now becomeLookup(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 aResult
.Result
has anOffset()
method that returns the offset value.(*Reader).Decode
has been removed.- Use of
net.IP
and*net.IPNet
have been replaced withnetip.Addr
andnetip.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 calledcode
, you might do something likeLookup(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 ofResult
values. Aliased networks are now skipped by default. If you wish to include them, use theIncludeAliasedNetworks
option.