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

/// 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`.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Database {
    /// The database family, e.g. `vpn_ip`. What the license is held against.
    #[serde(rename = "base")]
    pub base: String,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "summary")]
    pub summary: String,
    /// 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`.
    #[serde(rename = "license_type", deserialize_with = "Option::deserialize")]
    pub license_type: Option<LicenseType>,
    #[serde(rename = "starts", deserialize_with = "crate::dates::option_date_time")]
    pub starts: Option<chrono::DateTime<chrono::FixedOffset>>,
    /// A hard stop. Null when the license has no end date, which is the normal case for a rolling agreement, and when there is no license. A rolling license reports its turnover date in renews_at instead.
    #[serde(rename = "expires", deserialize_with = "crate::dates::option_date_time")]
    pub expires: Option<chrono::DateTime<chrono::FixedOffset>>,
    /// When a rolling license next renews. Null when the license has no defined term, when expires sets a hard stop instead, and when there is no license.
    #[serde(rename = "renews_at", deserialize_with = "crate::dates::option_date_time")]
    pub renews_at: Option<chrono::DateTime<chrono::FixedOffset>>,
    /// The last day notice of non-renewal can be given for the term ending at renews_at. Null whenever renews_at is, and when the agreement records no notice period.
    #[serde(rename = "notice_due_at", deserialize_with = "crate::dates::option_date_time")]
    pub notice_due_at: Option<chrono::DateTime<chrono::FixedOffset>>,
    /// False when the license has lapsed; downloads are refused.
    #[serde(rename = "in_term")]
    pub in_term: bool,
    #[serde(rename = "standing")]
    pub standing: models::Standing,
    /// An Open database: free under CC BY-SA 4.0 (credit VPNDetection, https://vpndetection.io, and share what you build from it under the same license). Every organization holds a `standard` license to it from the start, which `standing` and `license_type` report like any other.
    #[serde(rename = "open")]
    pub open: bool,
    /// Every published version of this family. The `id` here is what the download and checksum endpoints take.
    #[serde(rename = "versions")]
    pub versions: Vec<models::DatabaseVersion>,
}

impl 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`.
    pub fn new(
        base: String,
        name: String,
        summary: String,
        license_type: Option<LicenseType>,
        starts: Option<chrono::DateTime<chrono::FixedOffset>>,
        expires: Option<chrono::DateTime<chrono::FixedOffset>>,
        renews_at: Option<chrono::DateTime<chrono::FixedOffset>>,
        notice_due_at: Option<chrono::DateTime<chrono::FixedOffset>>,
        in_term: bool,
        standing: models::Standing,
        open: bool,
        versions: Vec<models::DatabaseVersion>,
    ) -> Database {
        Database {
            base,
            name,
            summary,
            license_type,
            starts,
            expires,
            renews_at,
            notice_due_at,
            in_term,
            standing,
            open,
            versions,
        }
    }
}
/// 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`.
#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum LicenseType {
    #[serde(rename = "evaluation")]
    Evaluation,
    #[serde(rename = "standard")]
    Standard,
    #[serde(rename = "redistribute")]
    Redistribute,
    /// A value this release was not built with, as the API served it.
    #[serde(untagged)]
    Other(String),
}

impl Default for LicenseType {
    fn default() -> LicenseType {
        Self::Evaluation
    }
}