Skip to main content

fiftyone_ip_intelligence_shared/
ip_intelligence_data.rs

1/* *********************************************************************
2 * This Original Work is copyright of 51 Degrees Mobile Experts Limited.
3 * Copyright 2026 51 Degrees Mobile Experts Limited, Davidson House,
4 * Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
5 *
6 * This Original Work is licensed under the European Union Public Licence
7 * (EUPL) v.1.2 and is subject to its terms as set out below.
8 *
9 * If a copy of the EUPL was not distributed with this file, You can obtain
10 * one at https://opensource.org/licenses/EUPL-1.2.
11 *
12 * The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
13 * amended by the European Commission) shall be deemed incompatible for
14 * the purposes of the Work and the provisions of the compatibility
15 * clause in Article 5 of the EUPL shall not apply.
16 *
17 * If using the Work as, or as part of, a network application, by
18 * including the attribution notice(s) required under Article 5 of the EUPL
19 * in the end user terms of the application under an appropriate heading,
20 * such notice(s) shall fulfill the requirements of that article.
21 * ********************************************************************* */
22
23/* *********************************************************************
24 * This code is auto generated by 51Degrees using the most up to data
25 * at the time of release, and should not be changed directly.
26 * **********************************************************************/
27
28//! Generated strongly-typed read accessors for IP Intelligence.
29//!
30//! This file is produced by the 51Degrees PropertyGenerator tool from the
31//! common metadata. It defines the [`IpIntelligenceData`] trait, one accessor
32//! per documented property, and implements it for the hand-written
33//! [`IpIntelligenceDataBase`] by delegating to its by-name stores. Plain
34//! properties resolve to a single typed value; the weighted properties
35//! (the country-code distributions and `Mcc`) resolve to an ordered list of
36//! weighted candidates.
37#![allow(rustdoc::bare_urls, rustdoc::invalid_html_tags)]
38
39use crate::data::IpIntelligenceDataBase;
40use fiftyone_pipeline_core::{PropertyValueType, WeightedValue};
41use fiftyone_pipeline_engines::{AspectData, AspectPropertyValue};
42
43/// Strongly-typed read accessors for IP Intelligence properties.
44///
45/// Covers the network and location properties of an IP. Each accessor
46/// returns an [`AspectPropertyValue`] wrapping the property's value type, so
47/// an absent value carries the engine's no-value reason.
48pub trait IpIntelligenceData: AspectData {
49    /// Radius in kilometers of the circle centred around the most probable location that encompasses the entire area. Where multiple areas are returned, this will only cover the area the most probable location is in. See Areas property. This will likely be a very large distance. It is recommend to use the AccuracyRadiusMin property.
50    fn accuracy_radius_max(&self) -> AspectPropertyValue<i32>;
51
52    /// Radius in kilometers of the largest circle centred around the most probable location that fits within the area. Where multiple areas are returned, only the area that the most probable location falls within is considered. See Areas property.
53    fn accuracy_radius_min(&self) -> AspectPropertyValue<i32>;
54
55    /// Any shapes associated with the location. Usually this is the area which the IP range covers. This is returned as a WKT String stored as a reduced format of WKB.
56    fn areas(&self) -> AspectPropertyValue<String>;
57
58    /// Autonomous System Number associated with the IP address.
59    fn asn(&self) -> AspectPropertyValue<String>;
60
61    /// The name registered to the Asn associated with the IP address.
62    fn asn_name(&self) -> AspectPropertyValue<String>;
63
64    /// Refers to the diversity of browsers observed from the IP range. An integer between 1-10, a lower value indicates a low number of browsers seen per IP address, while a higher value indicates a high number of browsers seen per IP address. A 0 value indicates that the probability is unknown.
65    fn browser_diversity(&self) -> AspectPropertyValue<i32>;
66
67    /// Indicates the type of connection being used. Returns either Broadband, Cellular, or Hosting and Anonymous.
68    fn connection_type(&self) -> AspectPropertyValue<String>;
69
70    /// The 3-character ISO 3166-1 continent code for the supplied location.
71    fn continent_code2(&self) -> AspectPropertyValue<String>;
72
73    /// The name of the continent the supplied location is in.
74    fn continent_name(&self) -> AspectPropertyValue<String>;
75
76    /// The name of the country that the supplied location is in.
77    fn country(&self) -> AspectPropertyValue<String>;
78
79    /// The 2-character ISO 3166-1 code of the country that the supplied location is in.
80    fn country_code(&self) -> AspectPropertyValue<String>;
81
82    /// The 3-character ISO 3166-1 alpha-3 code of the country that the supplied location is in.
83    fn country_code3(&self) -> AspectPropertyValue<String>;
84
85    /// A list of countries in ISO 3166-1 alpha-2 country code format that overlap with the area likely associated with the provided evidence, weighted and ordered by each country's proportion of the area. Administrative areas that cannot be cleanly resolved to the country level will not contribute to the resulting data.
86    fn country_codes_geographical(&self) -> AspectPropertyValue<Vec<WeightedValue<String>>>;
87
88    /// A list of countries in ISO 3166-1 alpha-2 country code format that overlap with the area likely associated with the provided evidence, weighted and ordered by each country's proportion of the total population within the area. Administrative areas that cannot be cleanly resolved to the country level will not contribute to the resulting data.
89    fn country_codes_population(&self) -> AspectPropertyValue<Vec<WeightedValue<String>>>;
90
91    /// The name of the county that the supplied location is in. In this case, a county is defined as an administrative sub-section of a country or state.
92    fn county(&self) -> AspectPropertyValue<String>;
93
94    /// The Alpha-3 ISO 4217 code of the currency associated with the supplied location.
95    fn currency_code(&self) -> AspectPropertyValue<String>;
96
97    /// ITU international telephone numbering plan code for the country.
98    fn dial_code(&self) -> AspectPropertyValue<String>;
99
100    /// Refers to the diversity of hardware devices observed from the IP range. An integer between 1-10, a lower value indicates a low number of devices seen per IP address, while a higher value indicates a high number of devices seen per IP address. A 0 value indicates that the probability is unknown.
101    fn hardware_diversity(&self) -> AspectPropertyValue<i32>;
102
103    /// The confidence that the IP address is a human user versus associated with hosting. A 0-10 value where; 0-3: Low confidence the user is human, 4-6: Medium confidence, 7-10: High confidence. A -1 value indicates that the probability is unknown.
104    fn human_probability(&self) -> AspectPropertyValue<i32>;
105
106    /// The IPv4 address of the request.
107    fn ip(&self) -> AspectPropertyValue<String>;
108
109    /// End of the IP range to which the evidence IP belongs.
110    fn ip_range_end(&self) -> AspectPropertyValue<String>;
111
112    /// Start of the IP range to which the evidence IP belongs.
113    fn ip_range_start(&self) -> AspectPropertyValue<String>;
114
115    /// The IPv6 address of the request.
116    fn ip_v6(&self) -> AspectPropertyValue<String>;
117
118    /// Indicates whether the IP address is associated with a broadband connection. Includes DSL, Cable, Fibre, and Satellite connections.
119    fn is_broadband(&self) -> AspectPropertyValue<bool>;
120
121    /// Indicates whether the IP address is associated with a cellular network.
122    fn is_cellular(&self) -> AspectPropertyValue<bool>;
123
124    /// Indicates whether the country of the supplied location is within the European Union.
125    fn is_eu(&self) -> AspectPropertyValue<bool>;
126
127    /// Indicates whether the IP address is associated with hosting. Includes both hosting and anonymised connections such as hosting networks, hosting ASNs, VPNs, proxies, TOR networks, and unreachable IP addresses.
128    fn is_hosted(&self) -> AspectPropertyValue<bool>;
129
130    /// The ISO 3166-2 code for the supplied location. This is using the 'ISO3166-2-lvl4' property from OpenStreetMap.
131    fn iso31662_lvl4(&self) -> AspectPropertyValue<String>;
132
133    /// The alphanumeric code representing the subdivision from the ISO 3166-2 code of the supplied location. This is using the 'ISO3166-2-lvl4' property from OpenStreetMap.
134    fn iso31662_lvl4_subdivision_only(&self) -> AspectPropertyValue<String>;
135
136    /// The ISO 3166-2 code for the supplied location. This is using the 'ISO3166-2-lvl8' property from OpenStreetMap.
137    fn iso31662_lvl8(&self) -> AspectPropertyValue<String>;
138
139    /// The alphanumeric code representing the subdivision from the ISO 3166-2 code of the supplied location. This is using the 'ISO3166-2-lvl8' property from OpenStreetMap.
140    fn iso31662_lvl8_subdivision_only(&self) -> AspectPropertyValue<String>;
141
142    /// Indicates whether the IP address is associated with a Proxy server.
143    fn is_proxy(&self) -> AspectPropertyValue<bool>;
144
145    /// Indicates whether the IP address is associated with a public router.
146    fn is_public_router(&self) -> AspectPropertyValue<bool>;
147
148    /// Indicates whether the IP address is associated with a TOR server.
149    fn is_tor(&self) -> AspectPropertyValue<bool>;
150
151    /// Indicates whether the IP address is associated with a VPN server.
152    fn is_vpn(&self) -> AspectPropertyValue<bool>;
153
154    /// The Alpha-2 ISO 639 Language code associated with the supplied location.
155    fn language_code(&self) -> AspectPropertyValue<String>;
156
157    /// Average latitude of the IP. For privacy, this is randomized within around 1 kilometer of the result. Randomized result will change only once per day.
158    fn latitude(&self) -> AspectPropertyValue<f32>;
159
160    /// The confidence in the town and country provided.
161    fn location_confidence(&self) -> AspectPropertyValue<String>;
162
163    /// Average longitude of the IP. For privacy, this is randomized within around 1 kilometer of the result. Randomized result will change only once per day.
164    fn longitude(&self) -> AspectPropertyValue<f32>;
165
166    /// The mobile country code of the network the device is connected to.
167    fn mcc(&self) -> AspectPropertyValue<Vec<WeightedValue<String>>>;
168
169    /// Refers to the diversity of software observed from the IP range. An integer between 1-10, a lower value indicates a low number of software seen per IP address, while a higher value indicates a high number of software seen per IP address. A 0 value indicates that the probability is unknown.
170    fn platform_diversity(&self) -> AspectPropertyValue<i32>;
171
172    /// The name of the geographical region that the supplied location is in.
173    fn region(&self) -> AspectPropertyValue<String>;
174
175    /// Country code of the registered range.
176    fn registered_country(&self) -> AspectPropertyValue<String>;
177
178    /// Name of the IP range. This is usually the owner.
179    fn registered_name(&self) -> AspectPropertyValue<String>;
180
181    /// Registered owner of the range.
182    fn registered_owner(&self) -> AspectPropertyValue<String>;
183
184    /// The name of the state that the supplied location is in.
185    fn state(&self) -> AspectPropertyValue<String>;
186
187    /// The name of the suburb that the supplied location is in.
188    fn suburb(&self) -> AspectPropertyValue<String>;
189
190    /// The time zone at the supplied location in the IANA Time Zone format.
191    fn time_zone_iana(&self) -> AspectPropertyValue<String>;
192
193    /// The offset from UTC in minutes in the supplied location, at the time that the value is produced.
194    fn time_zone_offset(&self) -> AspectPropertyValue<i32>;
195
196    /// The name of the town that the supplied location is in.
197    fn town(&self) -> AspectPropertyValue<String>;
198
199    /// The zip or postal code that the supplied location falls under.
200    fn zip_code(&self) -> AspectPropertyValue<String>;
201}
202
203impl IpIntelligenceData for IpIntelligenceDataBase {
204    fn accuracy_radius_max(&self) -> AspectPropertyValue<i32> {
205        self.integer("AccuracyRadiusMax")
206    }
207
208    fn accuracy_radius_min(&self) -> AspectPropertyValue<i32> {
209        self.integer("AccuracyRadiusMin")
210    }
211
212    fn areas(&self) -> AspectPropertyValue<String> {
213        self.string("Areas")
214    }
215
216    fn asn(&self) -> AspectPropertyValue<String> {
217        self.string("Asn")
218    }
219
220    fn asn_name(&self) -> AspectPropertyValue<String> {
221        self.string("AsnName")
222    }
223
224    fn browser_diversity(&self) -> AspectPropertyValue<i32> {
225        self.integer("BrowserDiversity")
226    }
227
228    fn connection_type(&self) -> AspectPropertyValue<String> {
229        self.string("ConnectionType")
230    }
231
232    fn continent_code2(&self) -> AspectPropertyValue<String> {
233        self.string("ContinentCode2")
234    }
235
236    fn continent_name(&self) -> AspectPropertyValue<String> {
237        self.string("ContinentName")
238    }
239
240    fn country(&self) -> AspectPropertyValue<String> {
241        self.string("Country")
242    }
243
244    fn country_code(&self) -> AspectPropertyValue<String> {
245        self.string("CountryCode")
246    }
247
248    fn country_code3(&self) -> AspectPropertyValue<String> {
249        self.string("CountryCode3")
250    }
251
252    fn country_codes_geographical(&self) -> AspectPropertyValue<Vec<WeightedValue<String>>> {
253        self.weighted_string("CountryCodesGeographical")
254    }
255
256    fn country_codes_population(&self) -> AspectPropertyValue<Vec<WeightedValue<String>>> {
257        self.weighted_string("CountryCodesPopulation")
258    }
259
260    fn county(&self) -> AspectPropertyValue<String> {
261        self.string("County")
262    }
263
264    fn currency_code(&self) -> AspectPropertyValue<String> {
265        self.string("CurrencyCode")
266    }
267
268    fn dial_code(&self) -> AspectPropertyValue<String> {
269        self.string("DialCode")
270    }
271
272    fn hardware_diversity(&self) -> AspectPropertyValue<i32> {
273        self.integer("HardwareDiversity")
274    }
275
276    fn human_probability(&self) -> AspectPropertyValue<i32> {
277        self.integer("HumanProbability")
278    }
279
280    fn ip(&self) -> AspectPropertyValue<String> {
281        self.string("Ip")
282    }
283
284    fn ip_range_end(&self) -> AspectPropertyValue<String> {
285        self.string("IpRangeEnd")
286    }
287
288    fn ip_range_start(&self) -> AspectPropertyValue<String> {
289        self.string("IpRangeStart")
290    }
291
292    fn ip_v6(&self) -> AspectPropertyValue<String> {
293        self.string("IpV6")
294    }
295
296    fn is_broadband(&self) -> AspectPropertyValue<bool> {
297        self.boolean("IsBroadband")
298    }
299
300    fn is_cellular(&self) -> AspectPropertyValue<bool> {
301        self.boolean("IsCellular")
302    }
303
304    fn is_eu(&self) -> AspectPropertyValue<bool> {
305        self.boolean("IsEu")
306    }
307
308    fn is_hosted(&self) -> AspectPropertyValue<bool> {
309        self.boolean("IsHosted")
310    }
311
312    fn iso31662_lvl4(&self) -> AspectPropertyValue<String> {
313        self.string("Iso31662Lvl4")
314    }
315
316    fn iso31662_lvl4_subdivision_only(&self) -> AspectPropertyValue<String> {
317        self.string("Iso31662Lvl4SubdivisionOnly")
318    }
319
320    fn iso31662_lvl8(&self) -> AspectPropertyValue<String> {
321        self.string("Iso31662Lvl8")
322    }
323
324    fn iso31662_lvl8_subdivision_only(&self) -> AspectPropertyValue<String> {
325        self.string("Iso31662Lvl8SubdivisionOnly")
326    }
327
328    fn is_proxy(&self) -> AspectPropertyValue<bool> {
329        self.boolean("IsProxy")
330    }
331
332    fn is_public_router(&self) -> AspectPropertyValue<bool> {
333        self.boolean("IsPublicRouter")
334    }
335
336    fn is_tor(&self) -> AspectPropertyValue<bool> {
337        self.boolean("IsTor")
338    }
339
340    fn is_vpn(&self) -> AspectPropertyValue<bool> {
341        self.boolean("IsVPN")
342    }
343
344    fn language_code(&self) -> AspectPropertyValue<String> {
345        self.string("LanguageCode")
346    }
347
348    fn latitude(&self) -> AspectPropertyValue<f32> {
349        self.float("Latitude")
350    }
351
352    fn location_confidence(&self) -> AspectPropertyValue<String> {
353        self.string("LocationConfidence")
354    }
355
356    fn longitude(&self) -> AspectPropertyValue<f32> {
357        self.float("Longitude")
358    }
359
360    fn mcc(&self) -> AspectPropertyValue<Vec<WeightedValue<String>>> {
361        self.weighted_string("Mcc")
362    }
363
364    fn platform_diversity(&self) -> AspectPropertyValue<i32> {
365        self.integer("PlatformDiversity")
366    }
367
368    fn region(&self) -> AspectPropertyValue<String> {
369        self.string("Region")
370    }
371
372    fn registered_country(&self) -> AspectPropertyValue<String> {
373        self.string("RegisteredCountry")
374    }
375
376    fn registered_name(&self) -> AspectPropertyValue<String> {
377        self.string("RegisteredName")
378    }
379
380    fn registered_owner(&self) -> AspectPropertyValue<String> {
381        self.string("RegisteredOwner")
382    }
383
384    fn state(&self) -> AspectPropertyValue<String> {
385        self.string("State")
386    }
387
388    fn suburb(&self) -> AspectPropertyValue<String> {
389        self.string("Suburb")
390    }
391
392    fn time_zone_iana(&self) -> AspectPropertyValue<String> {
393        self.string("TimeZoneIana")
394    }
395
396    fn time_zone_offset(&self) -> AspectPropertyValue<i32> {
397        self.integer("TimeZoneOffset")
398    }
399
400    fn town(&self) -> AspectPropertyValue<String> {
401        self.string("Town")
402    }
403
404    fn zip_code(&self) -> AspectPropertyValue<String> {
405        self.string("ZipCode")
406    }
407}
408
409/// Every generated property paired with its core value type, in name
410/// order. The data base uses this to publish per-property metadata.
411pub const GENERATED_PROPERTY_TYPES: &[(&str, PropertyValueType)] = &[
412    ("AccuracyRadiusMax", PropertyValueType::Integer),
413    ("AccuracyRadiusMin", PropertyValueType::Integer),
414    ("Areas", PropertyValueType::String),
415    ("Asn", PropertyValueType::String),
416    ("AsnName", PropertyValueType::String),
417    ("BrowserDiversity", PropertyValueType::Integer),
418    ("ConnectionType", PropertyValueType::String),
419    ("ContinentCode2", PropertyValueType::String),
420    ("ContinentName", PropertyValueType::String),
421    ("Country", PropertyValueType::String),
422    ("CountryCode", PropertyValueType::String),
423    ("CountryCode3", PropertyValueType::String),
424    ("CountryCodesGeographical", PropertyValueType::KeyValueList),
425    ("CountryCodesPopulation", PropertyValueType::KeyValueList),
426    ("County", PropertyValueType::String),
427    ("CurrencyCode", PropertyValueType::String),
428    ("DialCode", PropertyValueType::String),
429    ("HardwareDiversity", PropertyValueType::Integer),
430    ("HumanProbability", PropertyValueType::Integer),
431    ("Ip", PropertyValueType::String),
432    ("IpRangeEnd", PropertyValueType::String),
433    ("IpRangeStart", PropertyValueType::String),
434    ("IpV6", PropertyValueType::String),
435    ("IsBroadband", PropertyValueType::Bool),
436    ("IsCellular", PropertyValueType::Bool),
437    ("IsEu", PropertyValueType::Bool),
438    ("IsHosted", PropertyValueType::Bool),
439    ("Iso31662Lvl4", PropertyValueType::String),
440    ("Iso31662Lvl4SubdivisionOnly", PropertyValueType::String),
441    ("Iso31662Lvl8", PropertyValueType::String),
442    ("Iso31662Lvl8SubdivisionOnly", PropertyValueType::String),
443    ("IsProxy", PropertyValueType::Bool),
444    ("IsPublicRouter", PropertyValueType::Bool),
445    ("IsTor", PropertyValueType::Bool),
446    ("IsVPN", PropertyValueType::Bool),
447    ("LanguageCode", PropertyValueType::String),
448    ("Latitude", PropertyValueType::Double),
449    ("LocationConfidence", PropertyValueType::String),
450    ("Longitude", PropertyValueType::Double),
451    ("Mcc", PropertyValueType::KeyValueList),
452    ("PlatformDiversity", PropertyValueType::Integer),
453    ("Region", PropertyValueType::String),
454    ("RegisteredCountry", PropertyValueType::String),
455    ("RegisteredName", PropertyValueType::String),
456    ("RegisteredOwner", PropertyValueType::String),
457    ("State", PropertyValueType::String),
458    ("Suburb", PropertyValueType::String),
459    ("TimeZoneIana", PropertyValueType::String),
460    ("TimeZoneOffset", PropertyValueType::Integer),
461    ("Town", PropertyValueType::String),
462    ("ZipCode", PropertyValueType::String),
463];