3535 zeroEnterprisePostal EnterprisePostal
3636 zeroEnterpriseSubdivision EnterpriseSubdivision
3737 zeroEnterpriseCountryRecord EnterpriseCountryRecord
38+ zeroEnterpriseTraits EnterpriseTraits
39+ zeroCityTraits CityTraits
40+ zeroCountryTraits CountryTraits
3841)
3942
4043// HasData returns true if the Names struct has any localized names.
@@ -227,27 +230,29 @@ type EnterpriseTraits struct {
227230 // UserType indicates the user type associated with the IP address
228231 // (business, cafe, cellular, college, etc.)
229232 UserType string `json:"user_type,omitzero" maxminddb:"user_type"`
230- // StaticIPScore is an indicator of how static or dynamic an IP address
231- // is, ranging from 0 to 99.99
233+ // StaticIPScore was added in error and has never been populated.
234+ //
235+ // Deprecated: This field will be removed in the next major release.
232236 StaticIPScore float64 `json:"static_ip_score,omitzero" maxminddb:"static_ip_score"`
233237 // AutonomousSystemNumber for the IP address
234238 AutonomousSystemNumber uint `json:"autonomous_system_number,omitzero" maxminddb:"autonomous_system_number"`
235239 // IsAnycast is true if the IP address belongs to an anycast network.
236240 // See https://en.wikipedia.org/wiki/Anycast
237241 IsAnycast bool `json:"is_anycast,omitzero" maxminddb:"is_anycast"`
238242 // IsLegitimateProxy is true if MaxMind believes this IP address to be a
239- // legitimate proxy, such as an internal VPN used by a corporation
243+ // legitimate proxy, such as an internal VPN used by a corporation.
244+ //
245+ // Deprecated: MaxMind has deprecated this field. It will be removed in
246+ // the next major release.
240247 IsLegitimateProxy bool `json:"is_legitimate_proxy,omitzero" maxminddb:"is_legitimate_proxy"`
241248}
242249
243250// HasData returns true if the EnterpriseTraits has any data (excluding Network and IPAddress).
244251func (t EnterpriseTraits ) HasData () bool {
245- return t .AutonomousSystemOrganization != "" || t .ConnectionType != "" ||
246- t .Domain != "" || t .ISP != "" || t .MobileCountryCode != "" ||
247- t .MobileNetworkCode != "" || t .Organization != "" ||
248- t .UserType != "" || t .StaticIPScore != 0 ||
249- t .AutonomousSystemNumber != 0 || t .IsAnycast ||
250- t .IsLegitimateProxy
252+ cmp := t
253+ cmp .Network = zeroEnterpriseTraits .Network
254+ cmp .IPAddress = zeroEnterpriseTraits .IPAddress
255+ return cmp != zeroEnterpriseTraits
251256}
252257
253258// City/Country-specific types
@@ -323,7 +328,10 @@ type CityTraits struct {
323328
324329// HasData returns true if the CityTraits has any data (excluding Network and IPAddress).
325330func (t CityTraits ) HasData () bool {
326- return t .IsAnycast
331+ cmp := t
332+ cmp .Network = zeroCityTraits .Network
333+ cmp .IPAddress = zeroCityTraits .IPAddress
334+ return cmp != zeroCityTraits
327335}
328336
329337// CountryTraits contains traits data for Country database records.
@@ -340,7 +348,10 @@ type CountryTraits struct {
340348
341349// HasData returns true if the CountryTraits has any data (excluding Network and IPAddress).
342350func (t CountryTraits ) HasData () bool {
343- return t .IsAnycast
351+ cmp := t
352+ cmp .Network = zeroCountryTraits .Network
353+ cmp .IPAddress = zeroCountryTraits .IPAddress
354+ return cmp != zeroCountryTraits
344355}
345356
346357// The Enterprise struct corresponds to the data in the GeoIP2 Enterprise
0 commit comments