ipdata
Rust client for the ipdata.co IP geolocation and threat intelligence API.
Installation
Add to your Cargo.toml:
[]
= "0.1"
Usage
Single IP Lookup
let client = new;
let info = client.lookup.await?;
println!;
Look Up Your Own IP
let info = client.lookup_self.await?;
Field Filtering
Request only specific fields to reduce response size:
let info = client.lookup_fields.await?;
Single Field Lookup
let asn = client.lookup_field.await?;
Bulk Lookup
Look up to 100 IPs in a single request (requires a paid API key):
let results = client.bulk.await?;
for info in &results
Typed Sub-resource Lookups
Get specific data with strongly-typed return values:
let asn = client.asn.await?;
println!;
let threat = client.threat.await?;
println!;
let tz = client.time_zone.await?;
println!;
let currency = client.currency.await?;
println!;
let carrier = client.carrier.await?;
println!;
EU Endpoint
Use the EU-specific endpoint backed by datacenters in Frankfurt, Paris, and Ireland:
let client = eu;
Custom Endpoint
let client = with_base_url;
Error Handling
match client.lookup.await
Response Types
The main response type is IpInfo which includes:
- Geolocation:
city,region,country_name,country_code,continent_name,latitude,longitude,postal - ASN:
asn(struct withasn,name,domain,route,asn_type) - Company:
company(struct withname,domain,network,company_type) - Carrier:
carrier(struct withname,mcc,mnc) - Currency:
currency(struct withname,code,symbol,native,plural) - Time Zone:
time_zone(struct withname,abbreviation,offset,is_dst,current_time) - Organisation:
organisation(ISP / organization name) - Threat:
threat(struct withis_tor,is_vpn,is_proxy,is_anonymous,is_threat,is_bogon,blocklists,scores, and more) - Languages:
languages(vec ofLanguagewithname,native,code)
License
MIT