|
| 1 | +# 2.0.0-beta.1 - 2025-01-XX |
| 2 | + |
| 3 | +* **BREAKING CHANGE**: Updated to use `maxminddb-golang/v2` which provides |
| 4 | + significant performance improvements and a more modern API. |
| 5 | +* **BREAKING CHANGE**: All lookup methods now accept `netip.Addr` instead of |
| 6 | + `net.IP`. This provides better performance and aligns with modern Go |
| 7 | + networking practices. |
| 8 | +* **BREAKING CHANGE**: Renamed `IsoCode` fields to `ISOCode` in all structs |
| 9 | + to follow proper capitalization for the ISO acronym. Closes GitHub issue #4. |
| 10 | +* **BREAKING CHANGE**: Replaced `map[string]string` Names fields with structured |
| 11 | + `Names` type for significant performance improvements. This eliminates map |
| 12 | + allocation overhead, reducing memory usage by 34% and allocations by 56%. |
| 13 | +* **BREAKING CHANGE**: Added JSON tags to all struct fields. JSON tags match |
| 14 | + the corresponding `maxminddb` tags where they exist. Custom fields (`IPAddress` |
| 15 | + and `Network`) use snake_case (`ip_address` and `network`). |
| 16 | +* **BREAKING CHANGE**: Removed `IsAnonymousProxy` and `IsSatelliteProvider` fields |
| 17 | + from all Traits structs. These fields have been removed from MaxMind databases. |
| 18 | + Use the dedicated Anonymous IP database for anonymity detection instead. |
| 19 | +* **BREAKING CHANGE**: Go 1.24 or greater is now required. This enables the use |
| 20 | + of `omitzero` in JSON tags to match MaxMind database behavior where empty |
| 21 | + values are not included. |
| 22 | +* Added `IsZero()` method to all result structs (City, Country, Enterprise, ASN, |
| 23 | + etc.) to easily check whether any data was found for the queried IP address. |
| 24 | + Requested by Salim Alami. GitHub [#32](https://github.com/oschwald/geoip2-golang/issues/32). |
| 25 | +* Added `Network` and `IPAddress` fields to all result structs. The `Network` field |
| 26 | + exposes the network prefix from the MaxMind database lookup, and the `IPAddress` field |
| 27 | + contains the IP address used during the lookup. These fields are only populated when |
| 28 | + data is found for the IP address. For flat record types (ASN, ConnectionType, Domain, |
| 29 | + ISP, AnonymousIP), the fields are named `Network` and `IPAddress`. For complex types |
| 30 | + (City, Country, Enterprise), the fields are located at `.Traits.Network` and |
| 31 | + `.Traits.IPAddress`. |
| 32 | + Requested by Aaron Bishop. GitHub [#128](https://github.com/oschwald/geoip2-golang/issues/128). |
| 33 | +* Updated module path to `github.com/oschwald/geoip2-golang/v2` to follow |
| 34 | + Go's semantic versioning guidelines for breaking changes. |
| 35 | +* Updated examples and documentation to demonstrate proper error handling |
| 36 | + with `netip.ParseAddr()`. |
| 37 | +* Updated linting rules to support both v1 and v2 import paths during the |
| 38 | + transition period. |
| 39 | + |
| 40 | +## Migration Guide |
| 41 | + |
| 42 | +To migrate from v1 to v2: |
| 43 | + |
| 44 | +1. Update your import path: |
| 45 | + ```go |
| 46 | + // Old |
| 47 | + import "github.com/oschwald/geoip2-golang" |
| 48 | + |
| 49 | + // New |
| 50 | + import "github.com/oschwald/geoip2-golang/v2" |
| 51 | + ``` |
| 52 | + |
| 53 | +2. Replace `net.IP` with `netip.Addr`: |
| 54 | + ```go |
| 55 | + // Old |
| 56 | + ip := net.ParseIP("81.2.69.142") |
| 57 | + record, err := db.City(ip) |
| 58 | + |
| 59 | + // New |
| 60 | + ip, err := netip.ParseAddr("81.2.69.142") |
| 61 | + if err != nil { |
| 62 | + // handle error |
| 63 | + } |
| 64 | + record, err := db.City(ip) |
| 65 | + ``` |
| 66 | + |
| 67 | +3. Update field names from `IsoCode` to `ISOCode`: |
| 68 | + ```go |
| 69 | + // Old |
| 70 | + countryCode := record.Country.IsoCode |
| 71 | + subdivisionCode := record.Subdivisions[0].IsoCode |
| 72 | + |
| 73 | + // New |
| 74 | + countryCode := record.Country.ISOCode |
| 75 | + subdivisionCode := record.Subdivisions[0].ISOCode |
| 76 | + ``` |
| 77 | + |
| 78 | +4. Replace map-based Names access with struct fields: |
| 79 | + ```go |
| 80 | + // Old |
| 81 | + cityName := record.City.Names["en"] |
| 82 | + countryName := record.Country.Names["pt-BR"] |
| 83 | + continentName := record.Continent.Names["zh-CN"] |
| 84 | + |
| 85 | + // New |
| 86 | + cityName := record.City.Names.English |
| 87 | + countryName := record.Country.Names.BrazilianPortuguese |
| 88 | + continentName := record.Continent.Names.SimplifiedChinese |
| 89 | + ``` |
| 90 | + |
| 91 | + Available Names struct fields: |
| 92 | + - `English` (en) |
| 93 | + - `German` (de) |
| 94 | + - `Spanish` (es) |
| 95 | + - `French` (fr) |
| 96 | + - `Japanese` (ja) |
| 97 | + - `BrazilianPortuguese` (pt-BR) |
| 98 | + - `Russian` (ru) |
| 99 | + - `SimplifiedChinese` (zh-CN) |
| 100 | + |
| 101 | +5. Check if data was found using the new `IsZero()` method: |
| 102 | + ```go |
| 103 | + record, err := db.City(ip) |
| 104 | + if err != nil { |
| 105 | + // handle error |
| 106 | + } |
| 107 | + if record.IsZero() { |
| 108 | + fmt.Println("No data found for this IP") |
| 109 | + } else { |
| 110 | + fmt.Printf("City: %s\n", record.City.Names.English) |
| 111 | + } |
| 112 | + ``` |
| 113 | + |
| 114 | +# 1.11.0 - 2024-06-03 |
| 115 | + |
| 116 | +* Go 1.21 or greater is now required. |
| 117 | +* The new `is_anycast` output is now supported on the GeoIP2 Country, City, |
| 118 | + and Enterprise databases. [#119](https://github.com/oschwald/geoip2-golang/issues/119). |
| 119 | + |
| 120 | +Note: 1.10.0 was accidentally skipped. |
| 121 | + |
| 122 | +# 1.9.0 - 2023-06-18 |
| 123 | + |
| 124 | +* Rearrange fields in structs to reduce memory usage. Although this |
| 125 | + does reduce readability, these structs are often created at very |
| 126 | + rates, making the trade-off worth it. |
| 127 | + |
| 128 | +# 1.8.0 - 2022-08-07 |
| 129 | + |
| 130 | +* Set Go version to 1.18 in go.mod. |
| 131 | + |
| 132 | +# 1.7.0 - 2022-03-26 |
| 133 | + |
| 134 | +* Set the minimum Go version in the go.mod file to 1.17. |
| 135 | +* Updated dependencies. |
| 136 | + |
| 137 | +# 1.6.1 - 2022-01-28 |
| 138 | + |
| 139 | +* This is a re-release with the changes that were supposed to be in 1.6.0. |
| 140 | + |
| 141 | +# 1.6.0 - 2022-01-28 |
| 142 | + |
| 143 | +* Add support for new `mobile_country_code` and `mobile_network_code` outputs |
| 144 | + on GeoIP2 ISP and GeoIP2 Enterprise. |
| 145 | + |
| 146 | +# 1.5.0 - 2021-02-20 |
| 147 | + |
| 148 | +* Add `StaticIPScore` field to Enterprise. Pull request by Pierre |
| 149 | + Bonzel. GitHub [#54](https://github.com/oschwald/geoip2-golang/issues/54). |
| 150 | +* Add `IsResidentialProxy` field to `AnonymousIP`. Pull request by |
| 151 | + Brendan Boyle. GitHub [#72](https://github.com/oschwald/geoip2-golang/issues/72). |
| 152 | +* Support DBIP-ASN-Lite database. Requested by Muhammad Hussein |
| 153 | + Fattahizadeh. GitHub [#69](https://github.com/oschwald/geoip2-golang/issues/69). |
| 154 | + |
| 155 | +# 1.4.0 - 2019-12-25 |
| 156 | + |
| 157 | +* This module now uses Go modules. Requested by Axel Etcheverry. |
| 158 | + GitHub [#52](https://github.com/oschwald/geoip2-golang/issues/52). |
| 159 | +* DBIP databases are now supported. Requested by jaw0. GitHub [#45](https://github.com/oschwald/geoip2-golang/issues/45). |
| 160 | +* Allow using the ASN method with the GeoIP2 ISP database. Pull request |
| 161 | + by lspgn. GitHub [#47](https://github.com/oschwald/geoip2-golang/issues/47). |
| 162 | +* The example in the `README.md` now checks the length of the |
| 163 | + subdivision slice before using it. GitHub [#51](https://github.com/oschwald/geoip2-golang/issues/51). |
| 164 | + |
| 165 | +# 1.3.0 - 2019-08-28 |
| 166 | + |
| 167 | +* Added support for the GeoIP2 Enterprise database. |
| 168 | + |
| 169 | +# 1.2.1 - 2018-02-25 |
| 170 | + |
| 171 | +* HTTPS is now used for the test data submodule rather than the Git |
| 172 | + protocol |
| 173 | + |
| 174 | +# 1.2.0 - 2018-02-19 |
| 175 | + |
| 176 | +* The country structs for `geoip2.City` and `geoip2.Country` now have an |
| 177 | + `IsInEuropeanUnion` boolean field. This is true when the associated |
| 178 | + country is a member state of the European Union. This requires a |
| 179 | + database built on or after February 13, 2018. |
| 180 | +* Switch from Go Check to Testify. Closes [#27](https://github.com/oschwald/geoip2-golang/issues/27) |
| 181 | + |
| 182 | +# 1.1.0 - 2017-04-23 |
| 183 | + |
| 184 | +* Add support for the GeoLite2 ASN database. |
| 185 | +* Add support for the GeoIP2 City by Continent databases. GitHub [#26](https://github.com/oschwald/geoip2-golang/issues/26). |
| 186 | + |
| 187 | + |
| 188 | +# 1.0.0 - 2016-11-09 |
| 189 | + |
| 190 | +New release for those using tagged releases. Closes [#21](https://github.com/oschwald/geoip2-golang/issues/21). |
0 commit comments