Skip to main content

Crate internetdata

Crate internetdata 

Source
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§

AbuseContact
AbuseContact : Where to report abuse, from IP Abuse Contact.
Asn
Asn : The network announcing the address, from IP ASN.
AsnHostedDomains
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.
AsnLookupResponse
AsnLookupResponse : What every database says about one AS.
AsnPrefix
AuthorizationUrlOptions
What OauthApi::authorization_url_with asks for. A value left unset, or set empty, is left out of the URL rather than sent empty.
BatchOptions
One batch’s overrides for Client::lookup_batch.
BitTorrentDetail
CarrierDetail
Checksums
ChecksumsResponse
ClassDetail
Client
A client for the InternetData API.
ClientBuilder
Builds a Client. With nothing set it queries production with no API key, which a lookup answers as Unlimited and every database published today answers 401.
ClientRegistration
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 download and checksum come from versions.
DatabaseApi
The database catalog and its downloads, for keys carrying the db.download scope.
DatabaseMetadata
DatabaseMetadata : The build document written by the exporter, served through unchanged.
DatabaseMetadataColumn
DatabaseVersion
DeviceAuthorization
A device sign-in that has started and is waiting for the person.
DeviceAuthorizationOptions
What OauthApi::device_authorization_with asks for. A value left unset, or set empty, is left out of the request rather than sent empty.
DisposableDetail
DnsAddressRecord
DnsCnameRecord
DnsMxRecord
DnsNsRecord
DnsResolverDetail
DomainDns
DomainDns : Its records in Domain DNS, up to 100 a type. Paid plans and the trial.
DomainIpRange
DomainIpRanges
DomainIpRanges : The organization’s IP ranges, from Domain IP Ranges. Paid plans and the trial.
DomainLookupResponse
DomainLookupResponse : What every database says about one domain.
Download
Download : One download attempt, refusals included.
DownloadOptions
Which file a download fetches: DatabaseApi::download_url_with, DatabaseApi::download_with and DatabaseApi::download_bytes_with.
Entitlement
What an API key is entitled to, and what it has spent.
EntitlementApikey
The credential itself.
EntitlementPlan
The plan behind the key, and the field tier it buys.
EntitlementUsage
Consumption against the plan’s allowance, in the current window.
HostedDomains
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.
LookupOptions
One call’s overrides for Client::lookup_with, Client::lookup_asn_with, Client::lookup_domain_with, Client::my_ip_with and Client::my_entitlement_with.
LookupResponse
LookupResponse : What every database says about one address.
OauthApi
The OAuth authorization server behind the API: the device flow, the authorization code flow with PKCE, token refresh and revocation.
OauthErrorResponse
What the authorization server said when it refused.
OauthMetadata
The authorization server’s discovery document (RFC 8414).
OauthOptions
One call’s overrides for an OauthApi method.
Pkce
One sign-in’s PKCE pair, from OauthApi::create_pkce: challenge goes into the authorization URL, verifier only to the exchange. Debug leaves the verifier out.
ProxyDetail
PubproxyDetail
RegisterOptions
What OauthApi::register_with asks 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.
SatelliteDetail
SmtpDetail
SshDetail
TokenResponse
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§

DatabaseFormat
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.
ErrorKind
Why a request failed.
LicenseType
What your license permits you to do with the data. Null when there is no license, which is every family with standing unlicensed.
OauthError
What every OauthApi call fails with.
Outcome
Standing
Standing : Where your license for a database family stands today. licensed is a live grant, expired one whose term has ended, and unlicensed a database published but never bought. Where your license for a database family stands today. licensed is a live grant, expired one whose term has ended, and unlicensed a 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.