vpndetection 5.9.2

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.  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.10.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. Free and paid plans. 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: i32,
    /// 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,
}

impl Asn {
    /// The autonomous system that announces the address. Free and paid plans. 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: i32, name: String, domain: String, r#type: String, prefix: String) -> Asn {
        Asn { asn, name, domain, r#type, prefix }
    }
}