maxmind-geoip2 0.0.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +30 -0
  3. data/Gemfile +1 -5
  4. data/README.md +121 -0
  5. data/lib/maxmind/geoip2.rb +1 -13
  6. data/lib/maxmind/geoip2/client.rb +328 -0
  7. data/lib/maxmind/geoip2/errors.rb +37 -3
  8. data/lib/maxmind/geoip2/model/abstract.rb +31 -0
  9. data/lib/maxmind/geoip2/model/anonymous_ip.rb +75 -0
  10. data/lib/maxmind/geoip2/model/asn.rb +43 -0
  11. data/lib/maxmind/geoip2/model/city.rb +63 -44
  12. data/lib/maxmind/geoip2/model/connection_type.rb +36 -0
  13. data/lib/maxmind/geoip2/model/country.rb +64 -45
  14. data/lib/maxmind/geoip2/model/domain.rb +36 -0
  15. data/lib/maxmind/geoip2/model/enterprise.rb +13 -9
  16. data/lib/maxmind/geoip2/model/insights.rb +18 -0
  17. data/lib/maxmind/geoip2/model/isp.rb +57 -0
  18. data/lib/maxmind/geoip2/reader.rb +250 -131
  19. data/lib/maxmind/geoip2/record/abstract.rb +17 -12
  20. data/lib/maxmind/geoip2/record/city.rb +33 -24
  21. data/lib/maxmind/geoip2/record/continent.rb +32 -23
  22. data/lib/maxmind/geoip2/record/country.rb +47 -34
  23. data/lib/maxmind/geoip2/record/location.rb +64 -50
  24. data/lib/maxmind/geoip2/record/maxmind.rb +21 -0
  25. data/lib/maxmind/geoip2/record/place.rb +22 -16
  26. data/lib/maxmind/geoip2/record/postal.rb +26 -18
  27. data/lib/maxmind/geoip2/record/represented_country.rb +20 -14
  28. data/lib/maxmind/geoip2/record/subdivision.rb +42 -34
  29. data/lib/maxmind/geoip2/record/traits.rb +204 -160
  30. data/maxmind-geoip2.gemspec +12 -2
  31. data/test/data/LICENSE +4 -0
  32. data/test/data/MaxMind-DB-spec.md +570 -0
  33. data/test/data/MaxMind-DB-test-metadata-pointers.mmdb +0 -0
  34. data/test/data/README.md +4 -0
  35. data/test/data/bad-data/README.md +7 -0
  36. data/test/data/bad-data/libmaxminddb/libmaxminddb-offset-integer-overflow.mmdb +0 -0
  37. data/test/data/bad-data/maxminddb-golang/cyclic-data-structure.mmdb +0 -0
  38. data/test/data/bad-data/maxminddb-golang/invalid-bytes-length.mmdb +1 -0
  39. data/test/data/bad-data/maxminddb-golang/invalid-data-record-offset.mmdb +0 -0
  40. data/test/data/bad-data/maxminddb-golang/invalid-map-key-length.mmdb +0 -0
  41. data/test/data/bad-data/maxminddb-golang/invalid-string-length.mmdb +1 -0
  42. data/test/data/bad-data/maxminddb-golang/metadata-is-an-uint128.mmdb +1 -0
  43. data/test/data/bad-data/maxminddb-golang/unexpected-bytes.mmdb +0 -0
  44. data/test/data/bad-data/maxminddb-python/bad-unicode-in-map-key.mmdb +0 -0
  45. data/test/data/perltidyrc +12 -0
  46. data/test/data/source-data/GeoIP2-Anonymous-IP-Test.json +49 -0
  47. data/test/data/source-data/GeoIP2-City-Test.json +12852 -0
  48. data/test/data/source-data/GeoIP2-Connection-Type-Test.json +102 -0
  49. data/test/data/source-data/GeoIP2-Country-Test.json +15916 -0
  50. data/test/data/source-data/GeoIP2-DensityIncome-Test.json +14 -0
  51. data/test/data/source-data/GeoIP2-Domain-Test.json +452 -0
  52. data/test/data/source-data/GeoIP2-Enterprise-Test.json +687 -0
  53. data/test/data/source-data/GeoIP2-ISP-Test.json +12595 -0
  54. data/test/data/source-data/GeoIP2-Precision-Enterprise-Test.json +2148 -0
  55. data/test/data/source-data/GeoIP2-Static-IP-Score-Test.json +2132 -0
  56. data/test/data/source-data/GeoIP2-User-Count-Test.json +2837 -0
  57. data/test/data/source-data/GeoLite2-ASN-Test.json +37 -0
  58. data/test/data/source-data/README +15 -0
  59. data/test/data/test-data/GeoIP2-Anonymous-IP-Test.mmdb +0 -0
  60. data/test/data/test-data/GeoIP2-City-Test-Broken-Double-Format.mmdb +0 -0
  61. data/test/data/test-data/GeoIP2-City-Test-Invalid-Node-Count.mmdb +0 -0
  62. data/test/data/test-data/GeoIP2-City-Test.mmdb +0 -0
  63. data/test/data/test-data/GeoIP2-Connection-Type-Test.mmdb +0 -0
  64. data/test/data/test-data/GeoIP2-Country-Test.mmdb +0 -0
  65. data/test/data/test-data/GeoIP2-DensityIncome-Test.mmdb +0 -0
  66. data/test/data/test-data/GeoIP2-Domain-Test.mmdb +0 -0
  67. data/test/data/test-data/GeoIP2-Enterprise-Test.mmdb +0 -0
  68. data/test/data/test-data/GeoIP2-ISP-Test.mmdb +0 -0
  69. data/test/data/test-data/GeoIP2-Precision-Enterprise-Test.mmdb +0 -0
  70. data/test/data/test-data/GeoIP2-Static-IP-Score-Test.mmdb +0 -0
  71. data/test/data/test-data/GeoIP2-User-Count-Test.mmdb +0 -0
  72. data/test/data/test-data/GeoLite2-ASN-Test.mmdb +0 -0
  73. data/test/data/test-data/MaxMind-DB-no-ipv4-search-tree.mmdb +0 -0
  74. data/test/data/test-data/MaxMind-DB-string-value-entries.mmdb +0 -0
  75. data/test/data/test-data/MaxMind-DB-test-broken-pointers-24.mmdb +0 -0
  76. data/test/data/test-data/MaxMind-DB-test-broken-search-tree-24.mmdb +0 -0
  77. data/test/data/test-data/MaxMind-DB-test-decoder.mmdb +0 -0
  78. data/test/data/test-data/MaxMind-DB-test-ipv4-24.mmdb +0 -0
  79. data/test/data/test-data/MaxMind-DB-test-ipv4-28.mmdb +0 -0
  80. data/test/data/test-data/MaxMind-DB-test-ipv4-32.mmdb +0 -0
  81. data/test/data/test-data/MaxMind-DB-test-ipv6-24.mmdb +0 -0
  82. data/test/data/test-data/MaxMind-DB-test-ipv6-28.mmdb +0 -0
  83. data/test/data/test-data/MaxMind-DB-test-ipv6-32.mmdb +0 -0
  84. data/test/data/test-data/MaxMind-DB-test-metadata-pointers.mmdb +0 -0
  85. data/test/data/test-data/MaxMind-DB-test-mixed-24.mmdb +0 -0
  86. data/test/data/test-data/MaxMind-DB-test-mixed-28.mmdb +0 -0
  87. data/test/data/test-data/MaxMind-DB-test-mixed-32.mmdb +0 -0
  88. data/test/data/test-data/MaxMind-DB-test-nested.mmdb +0 -0
  89. data/test/data/test-data/MaxMind-DB-test-pointer-decoder.mmdb +0 -0
  90. data/test/data/test-data/README.md +26 -0
  91. data/test/data/test-data/maps-with-pointers.raw +0 -0
  92. data/test/data/test-data/write-test-data.pl +691 -0
  93. data/test/data/tidyall.ini +5 -0
  94. data/test/test_client.rb +426 -0
  95. data/test/test_model_country.rb +1 -1
  96. data/test/test_model_names.rb +1 -1
  97. data/test/test_reader.rb +92 -1
  98. metadata +194 -10
  99. data/Gemfile.lock +0 -36
@@ -2,25 +2,33 @@
2
2
 
3
3
  require 'maxmind/geoip2/record/abstract'
4
4
 
5
- module MaxMind::GeoIP2::Record
6
- # Contains data for the postal record associated with an IP address.
7
- #
8
- # This record is returned by all location services and databases besides
9
- # Country.
10
- class Postal < Abstract
11
- # The postal code of the location. Postal codes are not available for all
12
- # countries. In some countries, this will only contain part of the postal
13
- # code. This attribute is returned by all location databases and services
14
- # besides Country. String but may be nil.
15
- def code
16
- get('code')
17
- end
5
+ module MaxMind
6
+ module GeoIP2
7
+ module Record
8
+ # Contains data for the postal record associated with an IP address.
9
+ #
10
+ # This record is returned by all location services and databases besides
11
+ # Country.
12
+ class Postal < Abstract
13
+ # The postal code of the location. Postal codes are not available for all
14
+ # countries. In some countries, this will only contain part of the postal
15
+ # code. This attribute is returned by all location databases and services
16
+ # besides Country.
17
+ #
18
+ # @return [String, nil]
19
+ def code
20
+ get('code')
21
+ end
18
22
 
19
- # A value from 0-100 indicating MaxMind's confidence that the postal code
20
- # is correct. This attribute is only available from the Insights service
21
- # and the GeoIP2 Enterprise database. Integer but may be nil.
22
- def confidence
23
- get('confidence')
23
+ # A value from 0-100 indicating MaxMind's confidence that the postal code
24
+ # is correct. This attribute is only available from the Insights service
25
+ # and the GeoIP2 Enterprise database.
26
+ #
27
+ # @return [Integer, nil]
28
+ def confidence
29
+ get('confidence')
30
+ end
31
+ end
24
32
  end
25
33
  end
26
34
  end
@@ -2,20 +2,26 @@
2
2
 
3
3
  require 'maxmind/geoip2/record/country'
4
4
 
5
- module MaxMind::GeoIP2::Record
6
- # Contains data for the represented country associated with an IP address.
7
- #
8
- # This class contains the country-level data associated with an IP address
9
- # for the IP's represented country. The represented country is the country
10
- # represented by something like a military base.
11
- #
12
- # See Country for inherited methods.
13
- class RepresentedCountry < Country
14
- # A string indicating the type of entity that is representing the country.
15
- # Currently we only return +military+ but this could expand to include
16
- # other types in the future. String but may be nil.
17
- def type
18
- get('type')
5
+ module MaxMind
6
+ module GeoIP2
7
+ module Record
8
+ # Contains data for the represented country associated with an IP address.
9
+ #
10
+ # This class contains the country-level data associated with an IP address
11
+ # for the IP's represented country. The represented country is the country
12
+ # represented by something like a military base.
13
+ #
14
+ # See {MaxMind::GeoIP2::Record::Country} for inherited methods.
15
+ class RepresentedCountry < Country
16
+ # A string indicating the type of entity that is representing the country.
17
+ # Currently we only return +military+ but this could expand to include
18
+ # other types in the future.
19
+ #
20
+ # @return [String, nil]
21
+ def type
22
+ get('type')
23
+ end
24
+ end
19
25
  end
20
26
  end
21
27
  end
@@ -2,43 +2,51 @@
2
2
 
3
3
  require 'maxmind/geoip2/record/place'
4
4
 
5
- module MaxMind::GeoIP2::Record
6
- # Contains data for the subdivisions associated with an IP address.
7
- #
8
- # This record is returned by all location databases and services besides
9
- # Country.
10
- #
11
- # See Place for inherited methods.
12
- class Subdivision < Place
13
- # This is a value from 0-100 indicating MaxMind's confidence that the
14
- # subdivision is correct. This attribute is only available from the
15
- # Insights service and the GeoIP2 Enterprise database. Integer but may be
16
- # nil.
17
- def confidence
18
- get('confidence')
19
- end
5
+ module MaxMind
6
+ module GeoIP2
7
+ module Record
8
+ # Contains data for the subdivisions associated with an IP address.
9
+ #
10
+ # This record is returned by all location databases and services besides
11
+ # Country.
12
+ #
13
+ # See {MaxMind::GeoIP2::Record::Place} for inherited methods.
14
+ class Subdivision < Place
15
+ # This is a value from 0-100 indicating MaxMind's confidence that the
16
+ # subdivision is correct. This attribute is only available from the
17
+ # Insights service and the GeoIP2 Enterprise database.
18
+ #
19
+ # @return [Integer, nil]
20
+ def confidence
21
+ get('confidence')
22
+ end
20
23
 
21
- # This is a GeoName ID for the subdivision. This attribute is returned by
22
- # all location databases and services besides Country. Integer but may be
23
- # nil.
24
- def geoname_id
25
- get('geoname_id')
26
- end
24
+ # This is a GeoName ID for the subdivision. This attribute is returned by
25
+ # all location databases and services besides Country.
26
+ #
27
+ # @return [Integer, nil]
28
+ def geoname_id
29
+ get('geoname_id')
30
+ end
27
31
 
28
- # This is a string up to three characters long contain the subdivision
29
- # portion of the ISO 3166-2 code. See
30
- # https://en.wikipedia.org/wiki/ISO_3166-2. This attribute is returned by
31
- # all location databases and services except Country. String but may be
32
- # nil.
33
- def iso_code
34
- get('iso_code')
35
- end
32
+ # This is a string up to three characters long contain the subdivision
33
+ # portion of the ISO 3166-2 code. See
34
+ # https://en.wikipedia.org/wiki/ISO_3166-2. This attribute is returned by
35
+ # all location databases and services except Country.
36
+ #
37
+ # @return [String, nil]
38
+ def iso_code
39
+ get('iso_code')
40
+ end
36
41
 
37
- # A Hash where the keys are locale codes (Strings) and the values are names
38
- # (Strings). This attribute is returned by all location services and
39
- # databases besides country. Hash but may be nil.
40
- def names
41
- get('names')
42
+ # A Hash where the keys are locale codes and the values are names. This attribute is returned by all location services and
43
+ # databases besides country.
44
+ #
45
+ # @return [Hash<String, String>, nil]
46
+ def names
47
+ get('names')
48
+ end
49
+ end
42
50
  end
43
51
  end
44
52
  end
@@ -3,167 +3,211 @@
3
3
  require 'ipaddr'
4
4
  require 'maxmind/geoip2/record/abstract'
5
5
 
6
- module MaxMind::GeoIP2::Record
7
- # Contains data for the traits record associated with an IP address.
8
- #
9
- # This record is returned by all location services and databases.
10
- class Traits < Abstract
11
- def initialize(record) # :nodoc:
12
- super(record)
13
- if !record.key?('network') && record.key?('ip_address') &&
14
- record.key?('prefix_length')
15
- ip = IPAddr.new(
16
- format('%s/%d', record['ip_address'], record['prefix_length']),
17
- )
18
- # We could use ip.prefix instead of record['prefix_length'], but that
19
- # method only becomes available in Ruby 2.5+.
20
- record['network'] = format('%s/%d', ip.to_s, record['prefix_length'])
6
+ module MaxMind
7
+ module GeoIP2
8
+ module Record
9
+ # Contains data for the traits record associated with an IP address.
10
+ #
11
+ # This record is returned by all location services and databases.
12
+ class Traits < Abstract
13
+ # @!visibility private
14
+ def initialize(record)
15
+ super(record)
16
+ if !record.key?('network') && record.key?('ip_address') &&
17
+ record.key?('prefix_length')
18
+ ip = IPAddr.new(record['ip_address']).mask(record['prefix_length'])
19
+ # We could use ip.prefix instead of record['prefix_length'], but that
20
+ # method only becomes available in Ruby 2.5+.
21
+ record['network'] = format('%s/%d', ip.to_s, record['prefix_length'])
22
+ end
23
+ end
24
+
25
+ # The autonomous system number associated with the IP address. See
26
+ # Wikipedia[https://en.wikipedia.org/wiki/Autonomous_system_(Internet)].
27
+ # This attribute is only available from the City and Insights web service
28
+ # and the GeoIP2 Enterprise database.
29
+ #
30
+ # @return [Integer, nil]
31
+ def autonomous_system_number
32
+ get('autonomous_system_number')
33
+ end
34
+
35
+ # The organization associated with the registered autonomous system number
36
+ # for the IP address. See
37
+ # Wikipedia[https://en.wikipedia.org/wiki/Autonomous_system_(Internet)].
38
+ # This attribute is only available from the City and Insights web service
39
+ # and the GeoIP2 Enterprise database.
40
+ #
41
+ # @return [String, nil]
42
+ def autonomous_system_organization
43
+ get('autonomous_system_organization')
44
+ end
45
+
46
+ # The connection type may take the following values: "Dialup",
47
+ # "Cable/DSL", "Corporate", "Cellular". Additional values may be added in
48
+ # the future. This attribute is only available in the GeoIP2 Enterprise
49
+ # database.
50
+ #
51
+ # @return [String, nil]
52
+ def connection_type
53
+ get('connection_type')
54
+ end
55
+
56
+ # The second level domain associated with the IP address. This will be
57
+ # something like "example.com" or "example.co.uk", not "foo.example.com".
58
+ # This attribute is only available from the City and Insights web service
59
+ # and the GeoIP2 Enterprise database.
60
+ #
61
+ # @return [String, nil]
62
+ def domain
63
+ get('domain')
64
+ end
65
+
66
+ # The IP address that the data in the model is for. If you performed a "me"
67
+ # lookup against the web service, this will be the externally routable IP
68
+ # address for the system the code is running on. If the system is behind a
69
+ # NAT, this may differ from the IP address locally assigned to it. This
70
+ # attribute is returned by all end points.
71
+ #
72
+ # @return [String]
73
+ def ip_address
74
+ get('ip_address')
75
+ end
76
+
77
+ # This is true if the IP address belongs to any sort of anonymous network.
78
+ # This property is only available from GeoIP2 Precision Insights.
79
+ #
80
+ # @return [Boolean]
81
+ def anonymous?
82
+ get('is_anonymous')
83
+ end
84
+
85
+ # This is true if the IP address is registered to an anonymous VPN
86
+ # provider. If a VPN provider does not register subnets under names
87
+ # associated with them, we will likely only flag their IP ranges using the
88
+ # hosting_provider? property. This property is only available from GeoIP2
89
+ # Precision Insights.
90
+ #
91
+ # @return [Boolean]
92
+ def anonymous_vpn?
93
+ get('is_anonymous_vpn')
94
+ end
95
+
96
+ # This is true if the IP address belongs to a hosting or VPN provider (see
97
+ # description of the anonymous_vpn? property). This property is only
98
+ # available from GeoIP2 Precision Insights.
99
+ #
100
+ # @return [Boolean]
101
+ def hosting_provider?
102
+ get('is_hosting_provider')
103
+ end
104
+
105
+ # This attribute is true if MaxMind believes this IP address to be a
106
+ # legitimate proxy, such as an internal VPN used by a corporation. This
107
+ # attribute is only available in the GeoIP2 Enterprise database.
108
+ #
109
+ # @return [Boolean]
110
+ def legitimate_proxy?
111
+ get('is_legitimate_proxy')
112
+ end
113
+
114
+ # This is true if the IP address belongs to a public proxy. This property
115
+ # is only available from GeoIP2 Precision Insights.
116
+ #
117
+ # @return [Boolean]
118
+ def public_proxy?
119
+ get('is_public_proxy')
120
+ end
121
+
122
+ # This is true if the IP address is on a suspected anonymizing network
123
+ # and belongs to a residential ISP. This property is only available
124
+ # from GeoIP2 Precision Insights.
125
+ #
126
+ # @return [Boolean]
127
+ def residential_proxy?
128
+ get('is_residential_proxy')
129
+ end
130
+
131
+ # This is true if the IP address is a Tor exit node. This property is only
132
+ # available from GeoIP2 Precision Insights.
133
+ #
134
+ # @return [Boolean]
135
+ def tor_exit_node?
136
+ get('is_tor_exit_node')
137
+ end
138
+
139
+ # The name of the ISP associated with the IP address. This attribute is
140
+ # only available from the City and Insights web services and the GeoIP2
141
+ # Enterprise database.
142
+ #
143
+ # @return [String, nil]
144
+ def isp
145
+ get('isp')
146
+ end
147
+
148
+ # The network in CIDR notation associated with the record. In particular,
149
+ # this is the largest network where all of the fields besides ip_address
150
+ # have the same value.
151
+ #
152
+ # @return [String]
153
+ def network
154
+ get('network')
155
+ end
156
+
157
+ # The name of the organization associated with the IP address. This
158
+ # attribute is only available from the City and Insights web services and
159
+ # the GeoIP2 Enterprise database.
160
+ #
161
+ # @return [String, nil]
162
+ def organization
163
+ get('organization')
164
+ end
165
+
166
+ # An indicator of how static or dynamic an IP address is. This property is
167
+ # only available from GeoIP2 Precision Insights.
168
+ #
169
+ # @return [Float, nil]
170
+ def static_ip_score
171
+ get('static_ip_score')
172
+ end
173
+
174
+ # The estimated number of users sharing the IP/network during the past 24
175
+ # hours. For IPv4, the count is for the individual IP. For IPv6, the count
176
+ # is for the /64 network. This property is only available from GeoIP2
177
+ # Precision Insights.
178
+ #
179
+ # @return [Integer, nil]
180
+ def user_count
181
+ get('user_count')
182
+ end
183
+
184
+ # The user type associated with the IP address. This can be one of the
185
+ # following values:
186
+ #
187
+ # * business
188
+ # * cafe
189
+ # * cellular
190
+ # * college
191
+ # * content_delivery_network
192
+ # * dialup
193
+ # * government
194
+ # * hosting
195
+ # * library
196
+ # * military
197
+ # * residential
198
+ # * router
199
+ # * school
200
+ # * search_engine_spider
201
+ # * traveler
202
+ #
203
+ # This attribute is only available from the Insights web service and the
204
+ # GeoIP2 Enterprise database.
205
+ #
206
+ # @return [String, nil]
207
+ def user_type
208
+ get('user_type')
209
+ end
21
210
  end
22
211
  end
23
-
24
- # The autonomous system number associated with the IP address. See
25
- # Wikipedia[https://en.wikipedia.org/wiki/Autonomous_system_(Internet)].
26
- # This attribute is only available from the City and Insights web service
27
- # and the GeoIP2 Enterprise database. Integer but may be nil.
28
- def autonomous_system_number
29
- get('autonomous_system_number')
30
- end
31
-
32
- # The organization associated with the registered autonomous system number
33
- # for the IP address. See
34
- # Wikipedia[https://en.wikipedia.org/wiki/Autonomous_system_(Internet)].
35
- # This attribute is only available from the City and Insights web service
36
- # and the GeoIP2 Enterprise database. String but may be nil.
37
- def autonomous_system_organization
38
- get('autonomous_system_organization')
39
- end
40
-
41
- # The connection type may take the following values: "Dialup",
42
- # "Cable/DSL", "Corporate", "Cellular". Additional values may be added in
43
- # the future. This attribute is only available in the GeoIP2 Enterprise
44
- # database. String but may be nil.
45
- def connection_type
46
- get('connection_type')
47
- end
48
-
49
- # The second level domain associated with the IP address. This will be
50
- # something like "example.com" or "example.co.uk", not "foo.example.com".
51
- # This attribute is only available from the City and Insights web service
52
- # and the GeoIP2 Enterprise database. String but may be nil.
53
- def domain
54
- get('domain')
55
- end
56
-
57
- # The IP address that the data in the model is for. If you performed a "me"
58
- # lookup against the web service, this will be the externally routable IP
59
- # address for the system the code is running on. If the system is behind a
60
- # NAT, this may differ from the IP address locally assigned to it. This
61
- # attribute is returned by all end points. String.
62
- def ip_address
63
- get('ip_address')
64
- end
65
-
66
- # This is true if the IP address belongs to any sort of anonymous network.
67
- # This property is only available from GeoIP2 Precision Insights. Boolean.
68
- def anonymous?
69
- get('is_anonymous')
70
- end
71
-
72
- # This is true if the IP address is registered to an anonymous VPN
73
- # provider. If a VPN provider does not register subnets under names
74
- # associated with them, we will likely only flag their IP ranges using the
75
- # hosting_provider? property. This property is only available from GeoIP2
76
- # Precision Insights. Boolean.
77
- def anonymous_vpn?
78
- get('is_anonymous_vpn')
79
- end
80
-
81
- # This is true if the IP address belongs to a hosting or VPN provider (see
82
- # description of the anonymous_vpn? property). This property is only
83
- # available from GeoIP2 Precision Insights. Boolean.
84
- def hosting_provider?
85
- get('is_hosting_provider')
86
- end
87
-
88
- # This attribute is true if MaxMind believes this IP address to be a
89
- # legitimate proxy, such as an internal VPN used by a corporation. This
90
- # attribute is only available in the GeoIP2 Enterprise database. Boolean.
91
- def legitimate_proxy?
92
- get('is_legitimate_proxy')
93
- end
94
-
95
- # This is true if the IP address belongs to a public proxy. This property
96
- # is only available from GeoIP2 Precision Insights. Boolean.
97
- def public_proxy?
98
- get('is_public_proxy')
99
- end
100
-
101
- # This is true if the IP address is a Tor exit node. This property is only
102
- # available from GeoIP2 Precision Insights. Boolean.
103
- def tor_exit_node?
104
- get('is_tor_exit_node')
105
- end
106
-
107
- # The name of the ISP associated with the IP address. This attribute is
108
- # only available from the City and Insights web services and the GeoIP2
109
- # Enterprise database. String but may be nil.
110
- def isp
111
- get('isp')
112
- end
113
-
114
- # The network in CIDR notation associated with the record. In particular,
115
- # this is the largest network where all of the fields besides ip_address
116
- # have the same value. String.
117
- def network
118
- get('network')
119
- end
120
-
121
- # The name of the organization associated with the IP address. This
122
- # attribute is only available from the City and Insights web services and
123
- # the GeoIP2 Enterprise database. String but may be nil.
124
- def organization
125
- get('organization')
126
- end
127
-
128
- # An indicator of how static or dynamic an IP address is. This property is
129
- # only available from GeoIP2 Precision Insights. Float but may be nil.
130
- def static_ip_score
131
- get('static_ip_score')
132
- end
133
-
134
- # The estimated number of users sharing the IP/network during the past 24
135
- # hours. For IPv4, the count is for the individual IP. For IPv6, the count
136
- # is for the /64 network. This property is only available from GeoIP2
137
- # Precision Insights. Integer but may be nil.
138
- def user_count
139
- get('user_count')
140
- end
141
-
142
- # The user type associated with the IP address. This can be one of the
143
- # following values:
144
- #
145
- # * business
146
- # * cafe
147
- # * cellular
148
- # * college
149
- # * content_delivery_network
150
- # * dialup
151
- # * government
152
- # * hosting
153
- # * library
154
- # * military
155
- # * residential
156
- # * router
157
- # * school
158
- # * search_engine_spider
159
- # * traveler
160
- #
161
- # This attribute is only available from the Insights web service and the
162
- # GeoIP2 Enterprise database.
163
- #
164
- # May be nil.
165
- def user_type
166
- get('user_type')
167
- end
168
212
  end
169
213
  end