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};

/// Asn : The autonomous system that announces the address. Every answer, with or without a key. Each field is present whenever the object is: `asn` is 0 and the rest empty where no announcement covers the address.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Asn {
    /// The AS number, 0 when no announcement covers the address.
    #[serde(rename = "asn")]
    pub asn: i64,
    /// Name of the organization that operates the AS.
    #[serde(rename = "name")]
    pub name: String,
    /// The AS operator's own registrable domain.
    #[serde(rename = "domain")]
    pub domain: String,
    /// The kind of network the AS runs: isp, hosting, education, government or business.
    #[serde(rename = "type")]
    pub r#type: String,
    /// The announced BGP prefix that covers the address, the most specific when several do.
    #[serde(rename = "prefix")]
    pub prefix: String,
    /// The country the AS's registry assigned it to.
    #[serde(rename = "country", skip_serializing_if = "Option::is_none")]
    pub country: Option<String>,
    /// The announcement's RPKI status: valid, invalid or not_found.
    #[serde(rename = "rpki_status", skip_serializing_if = "Option::is_none")]
    pub rpki_status: Option<String>,
}

impl Asn {
    /// The autonomous system that announces the address. Every answer, with or without a key. Each field is present whenever the object is: `asn` is 0 and the rest empty where no announcement covers the address.
    pub fn new(asn: i64, name: String, domain: String, r#type: String, prefix: String) -> Asn {
        Asn { asn, name, domain, r#type, prefix, country: None, rpki_status: None }
    }
}