Expand description
The official Rust client library for the InternetData API: what every InternetData database says about an IP address, an AS or a domain, and the licensed databases themselves, their metadata and their checksums.
Start with Client::new and Client::lookup. No API key is needed:
without one a lookup is on Unlimited, the free plan, limited per address per
minute. A batch needs a paid plan, and the databases a key carrying the
db.download scope, reached through Client::database. The OAuth
sign-in, by device flow or by authorization code, is Client::oauth.
let client = internetdata::Client::new()?;
let result = client.lookup("146.70.116.130").await?;
println!("{}", result.location.country);§Absent is not false
Every member a plan can leave out is an Option, because your key decides
which of them the API sends. None means “not in your plan”, which is a
different answer from Some(false). Read the option itself wherever that
matters, or unwrap_or(false) when all you want to know is whether an
address is flagged.
§Async only
Everything here is async on tokio, and there is no blocking facade.
reqwest::blocking builds its own runtime and PANICS when constructed inside
one, so a facade would fail for exactly the callers most likely to reach for
it. A caller with no runtime writes the three lines that make the cost
visible:
let runtime = tokio::runtime::Runtime::new()?;
let client = internetdata::Client::new()?;
let result = runtime.block_on(client.lookup("146.70.116.130"))?;Modules§
- middleware
- The framework-agnostic half of a web middleware: resolve a client address, classify it, and decide whether the condition matched.
Structs§
- Abuse
Contact - AbuseContact : Where to report abuse, from IP Abuse Contact.
- Asn
- Asn : The network announcing the address, from IP ASN.
- AsnHosted
Domains - AsnHostedDomains : From ASN Hosted Domains: how many registered domains the AS hosts, and the 10 most popular. Its database lists up to 1,000 an AS. Paid plans and the trial.
- AsnLookup
Response - AsnLookupResponse : What every database says about one AS.
- AsnPrefix
- Authorization
UrlOptions - What
OauthApi::authorization_url_withasks for. A value left unset, or set empty, is left out of the URL rather than sent empty. - Batch
Options - One batch’s overrides for
Client::lookup_batch. - BitTorrent
Detail - Carrier
Detail - Checksums
- Checksums
Response - Class
Detail - Client
- A client for the InternetData API.
- Client
Builder - Builds a
Client. With nothing set it queries production with no API key, which a lookup answers as Unlimited and every database published today answers401. - Client
Registration - A registered client, from
OauthApi::register: public and with no secret, it proves each sign-in with PKCE. - Company
- Company : Who uses the address, from IP Company.
- Database
- Database : One database family, with your organization’s license beside it. A license covers the family, while a download names a specific version, so the IDs passed to
downloadandchecksumcome fromversions. - Database
Api - The database catalog and its downloads, for keys carrying the
db.downloadscope. - Database
Metadata - DatabaseMetadata : The build document written by the exporter, served through unchanged.
- Database
Metadata Column - Database
Version - Device
Authorization - A device sign-in that has started and is waiting for the person.
- Device
Authorization Options - What
OauthApi::device_authorization_withasks for. A value left unset, or set empty, is left out of the request rather than sent empty. - Disposable
Detail - DnsAddress
Record - DnsCname
Record - DnsMx
Record - DnsNs
Record - DnsResolver
Detail - Domain
Dns - DomainDns : Its records in Domain DNS, up to 100 a type. Paid plans and the trial.
- Domain
IpRange - Domain
IpRanges - DomainIpRanges : The organization’s IP ranges, from Domain IP Ranges. Paid plans and the trial.
- Domain
Lookup Response - DomainLookupResponse : What every database says about one domain.
- Download
- Download : One download attempt, refusals included.
- Download
Options - Which file a download fetches:
DatabaseApi::download_url_with,DatabaseApi::download_withandDatabaseApi::download_bytes_with. - Entitlement
- What an API key is entitled to, and what it has spent.
- Entitlement
Apikey - The credential itself.
- Entitlement
Plan - The plan behind the key, and the field tier it buys.
- Entitlement
Usage - Consumption against the plan’s allowance, in the current window.
- Hosted
Domains - HostedDomains : From IP Hosted Domains: how many registered domains resolve to the address, and the 10 most popular. Its database lists up to 1,000 an address. Paid plans and the trial.
- Location
- Location : Where the address is.
- Lookup
- What a lookup answers.
- Lookup
Options - One call’s overrides for
Client::lookup_with,Client::lookup_asn_with,Client::lookup_domain_with,Client::my_ip_withandClient::my_entitlement_with. - Lookup
Response - LookupResponse : What every database says about one address.
- Oauth
Api - The OAuth authorization server behind the API: the device flow, the authorization code flow with PKCE, token refresh and revocation.
- Oauth
Error Response - What the authorization server said when it refused.
- Oauth
Metadata - The authorization server’s discovery document (RFC 8414).
- Oauth
Options - One call’s overrides for an
OauthApimethod. - Pkce
- One sign-in’s PKCE pair, from
OauthApi::create_pkce:challengegoes into the authorization URL,verifieronly to the exchange.Debugleaves the verifier out. - Proxy
Detail - Pubproxy
Detail - Register
Options - What
OauthApi::register_withasks for beyond the redirect URIs. A name left unset, or set empty, is left out of the request. - Rwhois
- Rwhois : IP RWHOIS’s most specific network covering the address. Paid plans and the trial.
- Satellite
Detail - Smtp
Detail - SshDetail
- Token
Response - What a successful token exchange hands over.
- WebDetail
- Whois
- Whois : IP Whois’s most specific record covering the address. Paid plans and the trial.
Enums§
- Database
Format - DatabaseFormat : A file format a database version is published in. A file format a database version is published in.
- Error
- What every failure from this crate is.
- Error
Kind - Why a request failed.
- License
Type - What your license permits you to do with the data. Null when there is no license, which is every family with standing
unlicensed. - Oauth
Error - What every
OauthApicall fails with. - Outcome
- Standing
- Standing : Where your license for a database family stands today.
licensedis a live grant,expiredone whose term has ended, andunlicenseda database published but never bought. Where your license for a database family stands today.licensedis a live grant,expiredone whose term has ended, andunlicenseda database published but never bought.
Constants§
- DEFAULT_
BASE_ URL - The production API. Override it with
ClientBuilder::base_url.
Functions§
- is_
bogon - Whether an address is private, loopback, link-local, documentation, multicast or otherwise not routable on the public internet, including the IPv6 equivalents and the 6to4 and Teredo ranges that wrap them.