/*
* VPNDetection API
*
* The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
*
* The version of the OpenAPI document: 2026.11.20
* Contact: support@vpndetection.io
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// LookupResponse : The union of every tier's answer. Every answer carries `ip`, `is_bogon`, `is_vpn`, the Tor and relay members, `is_anycast`, `hostname`, `location` and `asn`, 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 as `false`.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct LookupResponse {
/// The address that was looked up, normalized.
#[serde(rename = "ip")]
pub ip: String,
/// Whether the address is reserved space (RFC 1918, loopback, link-local, documentation ranges and their IPv6 equivalents), answered from the address alone. Every answer, with or without a key.
#[serde(rename = "is_bogon", skip_serializing_if = "Option::is_none")]
pub is_bogon: Option<bool>,
/// Whether the address is VPN infrastructure. Keys off presence in the VPN dataset, so an unattributed range with no provider is still `true`.
#[serde(rename = "is_vpn")]
pub is_vpn: bool,
/// Whether the address belongs to a hosting or cloud provider. Paid plans.
#[serde(rename = "is_hosting", skip_serializing_if = "Option::is_none")]
pub is_hosting: Option<bool>,
/// Whether the address is privacy relay or enterprise web gateway egress, such as iCloud Private Relay or Zscaler. Every answer, with or without a key.
#[serde(rename = "is_relay", skip_serializing_if = "Option::is_none")]
pub is_relay: Option<bool>,
/// Whether the address is a Tor node. Every answer, with or without a key.
#[serde(rename = "is_tor", skip_serializing_if = "Option::is_none")]
pub is_tor: Option<bool>,
/// Whether the address belongs to a CDN. Paid plans.
#[serde(rename = "is_cdn", skip_serializing_if = "Option::is_none")]
pub is_cdn: Option<bool>,
/// Whether the address was seen in a residential proxy pool. Paid plans.
#[serde(rename = "is_resproxy", skip_serializing_if = "Option::is_none")]
pub is_resproxy: Option<bool>,
/// Whether the address is one a datacenter proxy service sells or runs on, a proxy company's own ranges included. Paid plans.
#[serde(rename = "is_dcproxy", skip_serializing_if = "Option::is_none")]
pub is_dcproxy: Option<bool>,
/// Whether the address was seen in a mobile proxy pool. Paid plans.
#[serde(rename = "is_mobproxy", skip_serializing_if = "Option::is_none")]
pub is_mobproxy: Option<bool>,
/// Whether a public proxy, one anyone can connect through, listens on the address or sends its traffic out from it. Paid plans.
#[serde(rename = "is_pubproxy", skip_serializing_if = "Option::is_none")]
pub is_pubproxy: Option<bool>,
/// Whether the address is announced from many places at once, as a public DNS resolver's or a CDN's edge is. Every answer, with or without a key.
#[serde(rename = "is_anycast", skip_serializing_if = "Option::is_none")]
pub is_anycast: Option<bool>,
/// Whether the address is a mobile carrier's, where many phones can share one address. Paid plans.
#[serde(rename = "is_carrier", skip_serializing_if = "Option::is_none")]
pub is_carrier: Option<bool>,
/// Whether the address is a satellite operator's. Paid plans.
#[serde(rename = "is_satellite", skip_serializing_if = "Option::is_none")]
pub is_satellite: Option<bool>,
/// Whether an SSH server answered on the address. Paid plans.
#[serde(rename = "is_ssh", skip_serializing_if = "Option::is_none")]
pub is_ssh: Option<bool>,
/// Whether a mail server answered on the address. Paid plans.
#[serde(rename = "is_smtp", skip_serializing_if = "Option::is_none")]
pub is_smtp: Option<bool>,
/// Whether a web server answered on the address, on port 80 or 443. Paid plans.
#[serde(rename = "is_web", skip_serializing_if = "Option::is_none")]
pub is_web: Option<bool>,
/// Whether an open DNS resolver answered on the address. Paid plans.
#[serde(rename = "is_dns_resolver", skip_serializing_if = "Option::is_none")]
pub is_dns_resolver: Option<bool>,
/// Whether a BitTorrent client was seen on the address in the last 90 days. Paid plans.
#[serde(rename = "is_bittorrent", skip_serializing_if = "Option::is_none")]
pub is_bittorrent: Option<bool>,
/// Detail for `is_vpn`. Empty when `is_vpn` is false. Paid plans.
#[serde(rename = "vpn", skip_serializing_if = "Option::is_none")]
pub vpn: Option<Box<models::VpnDetail>>,
/// Detail for `is_hosting`. Empty when false. Paid plans.
#[serde(rename = "hosting", skip_serializing_if = "Option::is_none")]
pub hosting: Option<Box<models::ClassDetail>>,
/// Detail for `is_relay`. Empty when false. Every answer, with or without a key.
#[serde(rename = "relay", skip_serializing_if = "Option::is_none")]
pub relay: Option<Box<models::ClassDetail>>,
/// Detail for `is_tor`. Empty when false. Every answer, with or without a key. The tor dataset carries no provider, so `provider` and `provider_name` are always empty strings.
#[serde(rename = "tor", skip_serializing_if = "Option::is_none")]
pub tor: Option<Box<models::ClassDetail>>,
/// Detail for `is_cdn`. Empty when false. Paid plans.
#[serde(rename = "cdn", skip_serializing_if = "Option::is_none")]
pub cdn: Option<Box<models::ClassDetail>>,
/// Detail for `is_resproxy`. Empty when false. Paid plans.
#[serde(rename = "resproxy", skip_serializing_if = "Option::is_none")]
pub resproxy: Option<Box<models::ProxyDetail>>,
/// Detail for `is_dcproxy`. Empty when false. Paid plans.
#[serde(rename = "dcproxy", skip_serializing_if = "Option::is_none")]
pub dcproxy: Option<Box<models::ProxyDetail>>,
/// Detail for `is_mobproxy`. Empty when false. Paid plans.
#[serde(rename = "mobproxy", skip_serializing_if = "Option::is_none")]
pub mobproxy: Option<Box<models::ProxyDetail>>,
/// Detail for `is_pubproxy`. Empty when false. Paid plans.
#[serde(rename = "pubproxy", skip_serializing_if = "Option::is_none")]
pub pubproxy: Option<Box<models::PubproxyDetail>>,
/// Detail for `is_carrier`. Empty when false. Paid plans.
#[serde(rename = "carrier", skip_serializing_if = "Option::is_none")]
pub carrier: Option<Box<models::CarrierDetail>>,
/// Detail for `is_satellite`. Empty when false. Paid plans.
#[serde(rename = "satellite", skip_serializing_if = "Option::is_none")]
pub satellite: Option<Box<models::SatelliteDetail>>,
/// Detail for `is_ssh`. Empty when false. Paid plans.
#[serde(rename = "ssh", skip_serializing_if = "Option::is_none")]
pub ssh: Option<Box<models::SshDetail>>,
/// Detail for `is_smtp`. Empty when false. Paid plans.
#[serde(rename = "smtp", skip_serializing_if = "Option::is_none")]
pub smtp: Option<Box<models::SmtpDetail>>,
/// Detail for `is_web`: a row per port that answered, lowest first, and `[]` when false. Paid plans.
#[serde(rename = "web", skip_serializing_if = "Option::is_none")]
pub web: Option<Vec<models::WebDetail>>,
/// Detail for `is_dns_resolver`. Empty when false. Paid plans.
#[serde(rename = "dns_resolver", skip_serializing_if = "Option::is_none")]
pub dns_resolver: Option<Box<models::DnsResolverDetail>>,
/// Detail for `is_bittorrent`. Empty when false. Paid plans.
#[serde(rename = "bittorrent", skip_serializing_if = "Option::is_none")]
pub bittorrent: Option<Box<models::BitTorrentDetail>>,
#[serde(rename = "location", skip_serializing_if = "Option::is_none")]
pub location: Option<Box<models::Location>>,
#[serde(rename = "asn", skip_serializing_if = "Option::is_none")]
pub asn: Option<Box<models::Asn>>,
#[serde(rename = "company", skip_serializing_if = "Option::is_none")]
pub company: Option<Box<models::Company>>,
/// The name the address's reverse DNS (PTR) record points to, from our IP RDNS database; an empty string when it has none. Every answer, with or without a key.
#[serde(rename = "hostname", skip_serializing_if = "Option::is_none")]
pub hostname: Option<String>,
#[serde(rename = "abuse", skip_serializing_if = "Option::is_none")]
pub abuse: Option<Box<models::AbuseContact>>,
/// On every answer to a key on the free plan, and on no other: `false` while its organization's trial of every field lasts, `true` once the answer has Unlimited's.
#[serde(rename = "trial_expired", skip_serializing_if = "Option::is_none")]
pub trial_expired: Option<bool>,
/// On every answer to a key on a paid plan, and on no other: `false` while the answer has every field, `true` once its organization's overage cap is reached and the answer has Unlimited's. Lookups answered past the cap are not billed; raising or removing the cap in Billing turns it `false` again.
#[serde(rename = "cap_reached", skip_serializing_if = "Option::is_none")]
pub cap_reached: Option<bool>,
}
impl LookupResponse {
/// The union of every tier's answer. Every answer carries `ip`, `is_bogon`, `is_vpn`, the Tor and relay members, `is_anycast`, `hostname`, `location` and `asn`, 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 as `false`.
pub fn new(ip: String, is_vpn: bool) -> LookupResponse {
LookupResponse {
ip,
is_bogon: None,
is_vpn,
is_hosting: None,
is_relay: None,
is_tor: None,
is_cdn: None,
is_resproxy: None,
is_dcproxy: None,
is_mobproxy: None,
is_pubproxy: None,
is_anycast: None,
is_carrier: None,
is_satellite: None,
is_ssh: None,
is_smtp: None,
is_web: None,
is_dns_resolver: None,
is_bittorrent: None,
vpn: None,
hosting: None,
relay: None,
tor: None,
cdn: None,
resproxy: None,
dcproxy: None,
mobproxy: None,
pubproxy: None,
carrier: None,
satellite: None,
ssh: None,
smtp: None,
web: None,
dns_resolver: None,
bittorrent: None,
location: None,
asn: None,
company: None,
hostname: None,
abuse: None,
trial_expired: None,
cap_reached: None,
}
}
}