vpndetection 6.2.0

The official Rust client library for the VPNDetection API: anonymity detection covering VPNs, residential proxies, Tor nodes, hosting servers, CDNs and relays.
Documentation
/*
 * 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};

/// 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_seen` is 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 `{}` when `is_pubproxy` is false.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PubproxyDetail {
    /// Whether a public proxy listens on this address.
    #[serde(rename = "entry", skip_serializing_if = "Option::is_none")]
    pub entry: Option<bool>,
    /// Whether a public proxy's traffic leaves from this address.
    #[serde(rename = "exit", skip_serializing_if = "Option::is_none")]
    pub exit: Option<bool>,
    /// The protocols of the proxies listening on or leaving from this address: `http`, `https` (an HTTP proxy that also tunnels HTTPS), `socks4` or `socks5`. Empty where only the address is known.
    #[serde(rename = "protocols", skip_serializing_if = "Option::is_none")]
    pub protocols: Option<Vec<String>>,
    /// How many distinct ports a public proxy listens on at this address; 0 when it is only an exit, or its port is not known.
    #[serde(rename = "num_ports", skip_serializing_if = "Option::is_none")]
    pub num_ports: Option<i32>,
    /// How many distinct public proxies' traffic left from this address; 0 when it is only an entry.
    #[serde(rename = "num_proxies", skip_serializing_if = "Option::is_none")]
    pub num_proxies: Option<i32>,
    /// The most recent date a proxy on this address was seen. An address that leaves the window keeps its flag, so this date is what says how recent the sighting is.
    #[serde(
        rename = "last_seen",
        default,
        deserialize_with = "crate::dates::option_date",
        skip_serializing_if = "Option::is_none"
    )]
    pub last_seen: Option<chrono::NaiveDate>,
    /// The most recent date within the window a request through a proxy on this address was answered, as YYYY-MM-DD, or an empty string when none was, as of its last day in the window once it has left.
    #[serde(rename = "last_usable", skip_serializing_if = "Option::is_none")]
    pub last_usable: Option<String>,
}

impl 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_seen` is 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 `{}` when `is_pubproxy` is false.
    pub fn new() -> PubproxyDetail {
        PubproxyDetail {
            entry: None,
            exit: None,
            protocols: None,
            num_ports: None,
            num_proxies: None,
            last_seen: None,
            last_usable: None,
        }
    }
}