Skip to content

2.0.0-beta.1

Pre-release
Pre-release
Compare
Choose a tag to compare
@oschwald oschwald released this 18 Aug 23:47
· 19 commits to main since this release
b8ac5c0

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.