Expand description
The official Rust client library for the VPNDetection API: anonymity detection covering VPNs, residential proxies, Tor nodes, hosting servers, CDNs and relays.
Start with Client::new and Client::lookup. No API key is needed:
without one a lookup is on Unlimited, the free plan, answering ip,
is_vpn, the Tor and relay members, location and asn with no daily or
monthly cap. A batch needs a paid plan.
let client = vpndetection::Client::new()?;
let result = client.lookup("45.83.91.1").await?;
println!("{}", result.is_vpn);§Absent is not false
Every field beyond ip and is_vpn 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 = vpndetection::Client::new()?;
let result = runtime.block_on(client.lookup("45.83.91.1"))?;Modules§
- middleware
- The framework-agnostic half of a web middleware: resolve a client address, classify it, and decide whether the condition matched.
Structs§
- 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. - Class
Detail - ClassDetail : The shared detail shape for the hosting, relay, tor and cdn datasets. Every key is present when the object is populated; the object is
{}when its flag is false. - Client
- A client for the VPNDetection API.
- Client
Builder - Builds a
Client. With nothing set it queries production with no API key. - Client
Registration - A registered client, from
OauthApi::register: public and with no secret, it proves each sign-in with PKCE. - 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 you pass to the download and checksum endpoints come from
versions. - Database
Api - The licensed dataset downloads. Access is granted by contract rather than
self-serve, and needs a key carrying the
db.downloadscope. - Database
Format Size - Database
Metadata - Database
Metadata Column - Database
Version - DbChecksums
- DbChecksums : The published digests for one database file.
- 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. - Download
- Download : One download ATTEMPT, refusals included - a denial is what answers "it stopped working", so they are listed rather than dropped.
- Download
Options - Which file one download fetches, for
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.
- Lookup
- What a lookup answers.
- Lookup
Options - One call’s overrides for
Client::lookup_with,Client::my_ip_withandClient::my_entitlement_with. - Lookup
Response - LookupResponse : The union of every tier’s answer. Every answer carries
ip,is_bogon,is_vpn, the Tor and relay members,locationandasn, with or without a key; each remaining field is present when your tier includes it, and absent otherwise. A client that must work across plans should treat an absent flag as unknown rather than asfalse. - 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 - ProxyDetail : The shared detail shape for the residential, datacenter and mobile proxy families, measured over a rolling 90 day window. An address that leaves the window keeps its flag and the values of its last day in it, so
last_seenis what says how recent they are. Every key is present when the object is populated; the object is{}when its flag is false. - Pubproxy
Detail - PubproxyDetail : The address in Public Proxy IP, open proxies anyone can connect through, measured over a rolling 90 day window. An address that leaves the window keeps its flag and the values of its last day in it, so
last_seenis what says how recent they are. An address is either end of a proxy, or both: where it listens, and where its traffic leaves from. Every key is present when the object is populated; the object is{}whenis_pubproxyis false. - Register
Options - What
OauthApi::register_withasks for beyond the redirect URIs. A name left unset, or set empty, is left out of the request. - Token
Response - What a successful token exchange hands over.
- VpnDetail
- VpnDetail : What is known about the VPN attribution. Every key is present when the object is populated, empty values included; the object is
{}whenis_vpnis false.
Enums§
- Database
Format - DatabaseFormat : A file format a database version is published in. A file format a database version is published in.
- Download
Outcome - Error
- What every failure from this crate is.
- Error
Kind - Why a request failed.
- License
Type - What a license permits you to do with the data. Null for a family you hold no license for, which is every one with standing
unlicensed. - Oauth
Error - What every
OauthApicall fails with. - 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.