1use serde::{Deserialize, Serialize};
2
3use super::null_default;
4
5#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
7#[serde(default, rename_all = "camelCase")]
8pub struct VpnResponse {
9 pub ip: String,
10 pub is_vpn: bool,
11 pub is_tor: bool,
12 pub network_class: String,
13 pub anonymized: bool,
14 pub provider: Option<String>,
16 pub vpn_provider: Option<String>,
18 pub risk_score: i64,
19 pub evidence: Vec<String>,
20 pub locked: Vec<String>,
22 pub plan_required: Option<String>,
24}
25
26#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
28#[serde(default, rename_all = "camelCase")]
29pub struct ProxyResponse {
30 pub ip: String,
31 pub is_proxy: bool,
32 pub is_tor: bool,
33 pub network_class: String,
34 pub anonymized: bool,
35 pub provider: Option<String>,
37 pub vpn_provider: Option<String>,
39 pub risk_score: i64,
40 pub evidence: Vec<String>,
41 pub locked: Vec<String>,
43 pub plan_required: Option<String>,
45}
46
47#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
49#[serde(default, rename_all = "camelCase")]
50pub struct GeolocationResponse {
51 pub ip: String,
52 pub country: String,
53 pub country_code: String,
54 pub city: String,
55 pub region: String,
56 pub postal_code: Option<String>,
57 pub latitude: Option<f64>,
58 pub longitude: Option<f64>,
59 pub timezone: String,
60 pub accuracy_radius: Option<i64>,
61 pub locked: Vec<String>,
62 pub plan_required: Option<String>,
63}
64
65#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
67#[serde(default, rename_all = "camelCase")]
68pub struct AsnResponse {
69 pub ip: String,
70 pub asn: String,
71 pub name: String,
72 #[serde(rename = "type")]
73 pub kind: String,
74 pub country: String,
75}
76
77#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
79#[serde(default, rename_all = "camelCase")]
80pub struct WhoisResponse {
81 pub domain: String,
82 pub registrar: String,
83 pub registered_on: String,
84 pub expires_on: String,
85 pub last_updated: String,
86 #[serde(deserialize_with = "null_default")]
87 pub nameservers: Vec<String>,
88 #[serde(deserialize_with = "null_default")]
89 pub status: Vec<String>,
90 pub privacy_protection: bool,
91 pub whois_status: Option<String>,
93}
94
95#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
97#[serde(default, rename_all = "camelCase")]
98pub struct LookupResult {
99 pub target: Target,
100 pub reserved: ReservedRange,
101 pub verdict: Verdict,
102 pub purity: Option<Purity>,
104 pub network_class: String,
105 pub is_vpn: bool,
106 pub is_proxy: bool,
107 pub is_tor: bool,
108 pub provider: Option<String>,
109 pub vpn_provider: Option<String>,
110 pub risk_score: i64,
111 pub network_type: Option<String>,
112 pub geo: Option<GeolocationResponse>,
113 pub asn: Option<AsnResponse>,
114 pub whois: Option<WhoisResponse>,
116 pub whois_status: Option<String>,
118 pub degraded: Vec<String>,
119 pub at: String,
120 pub locked: Vec<String>,
121 pub plan_required: Option<String>,
122}
123
124#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
126#[serde(default, rename_all = "camelCase")]
127pub struct Target {
128 pub raw: String,
129 pub kind: String,
130 pub ip: String,
131 pub hostname: Option<String>,
132 pub network: Option<String>,
133 pub addresses: Option<i64>,
134}
135
136#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
138#[serde(default, rename_all = "camelCase")]
139pub struct ReservedRange {
140 pub reserved: bool,
141 pub label: Option<String>,
142 pub detail: Option<String>,
143}
144
145#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
147#[serde(default, rename_all = "camelCase")]
148pub struct Verdict {
149 pub classification: String,
150 pub anonymized: bool,
151 pub confidence: f64,
152 pub method: String,
153 pub evidence: Vec<String>,
154}
155
156#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
158#[serde(default, rename_all = "camelCase")]
159pub struct Purity {
160 pub score: i64,
161 pub grade: String,
162 pub verdict: String,
163 #[serde(deserialize_with = "null_default")]
164 pub deductions: Vec<Deduction>,
165}
166
167#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
169#[serde(default, rename_all = "camelCase")]
170pub struct Deduction {
171 pub factor: String,
172 pub points: i64,
173 pub detail: String,
174}
175
176#[derive(Debug, Clone, Default)]
178pub struct HistoryParams {
179 pub limit: Option<u32>,
180 pub before: Option<i64>,
181 pub verdict: Option<String>,
182}
183
184#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
186#[serde(default, rename_all = "camelCase")]
187pub struct History {
188 pub events: Vec<HistoryEvent>,
189 pub next_before: i64,
191 pub as_of: String,
192}
193
194#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
196#[serde(default, rename_all = "camelCase")]
197pub struct HistoryEvent {
198 pub id: i64,
199 pub at: String,
200 pub target: String,
201 pub ip: String,
202 pub verdict: String,
203 pub confidence: f64,
204 pub asn: String,
205 pub asn_name: String,
206 pub country: String,
207 pub anonymized: bool,
208 pub source: String,
209}
210
211#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
213#[serde(default, rename_all = "camelCase")]
214pub struct MyIp {
215 pub ipv4: Option<String>,
216 pub ipv6: Option<String>,
217 pub country: String,
218 pub country_code: String,
219 pub city: String,
220 pub region: String,
221 pub postal_code: String,
222 pub latitude: f64,
223 pub longitude: f64,
224 pub timezone: String,
225 pub accuracy_radius: i64,
226 pub asn: String,
227 pub asn_name: String,
228 pub asn_type: String,
229 pub asn_country: String,
230}