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 purity: Option<Purity>,
22 pub deduction_count: Option<i64>,
24 pub locked: Vec<String>,
26 pub plan_required: Option<String>,
28}
29
30#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
32#[serde(default, rename_all = "camelCase")]
33pub struct ProxyResponse {
34 pub ip: String,
35 pub is_proxy: bool,
36 pub is_tor: bool,
37 pub network_class: String,
38 pub anonymized: bool,
39 pub provider: Option<String>,
41 pub vpn_provider: Option<String>,
43 pub risk_score: i64,
44 pub evidence: Vec<String>,
45 pub purity: Option<Purity>,
47 pub deduction_count: Option<i64>,
49 pub locked: Vec<String>,
51 pub plan_required: Option<String>,
53}
54
55#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
57#[serde(default, rename_all = "camelCase")]
58pub struct GeolocationResponse {
59 pub ip: String,
60 pub country: String,
61 pub country_code: String,
62 pub city: String,
63 pub region: String,
64 pub postal_code: Option<String>,
65 pub latitude: Option<f64>,
66 pub longitude: Option<f64>,
67 pub timezone: String,
68 pub accuracy_radius: Option<i64>,
69 pub locked: Vec<String>,
70 pub plan_required: Option<String>,
71}
72
73#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
75#[serde(default, rename_all = "camelCase")]
76pub struct AsnResponse {
77 pub ip: String,
78 pub asn: String,
79 pub name: String,
80 #[serde(rename = "type")]
81 pub kind: String,
82 pub country: String,
83}
84
85#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
87#[serde(default, rename_all = "camelCase")]
88pub struct WhoisResponse {
89 pub domain: String,
90 pub registrar: String,
91 pub registered_on: String,
92 pub expires_on: String,
93 pub last_updated: String,
94 #[serde(deserialize_with = "null_default")]
95 pub nameservers: Vec<String>,
96 #[serde(deserialize_with = "null_default")]
97 pub status: Vec<String>,
98 pub privacy_protection: bool,
99 pub whois_status: Option<String>,
101}
102
103#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
105#[serde(default, rename_all = "camelCase")]
106pub struct LookupResult {
107 pub target: Target,
108 pub reserved: ReservedRange,
109 pub verdict: Verdict,
110 pub purity: Option<Purity>,
112 pub network_class: String,
113 pub is_vpn: bool,
114 pub is_proxy: bool,
115 pub is_tor: bool,
116 pub provider: Option<String>,
117 pub vpn_provider: Option<String>,
118 pub risk_score: i64,
119 pub network_type: Option<String>,
120 pub geo: Option<GeolocationResponse>,
121 pub asn: Option<AsnResponse>,
122 pub whois: Option<WhoisResponse>,
124 pub whois_status: Option<String>,
126 pub degraded: Vec<String>,
127 pub at: String,
128 pub deduction_count: Option<i64>,
130 pub locked: Vec<String>,
131 pub plan_required: Option<String>,
132}
133
134#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
136#[serde(default, rename_all = "camelCase")]
137pub struct Target {
138 pub raw: String,
139 pub kind: String,
140 pub ip: String,
141 pub hostname: Option<String>,
142 pub network: Option<String>,
143 pub addresses: Option<i64>,
144}
145
146#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
148#[serde(default, rename_all = "camelCase")]
149pub struct ReservedRange {
150 pub reserved: bool,
151 pub label: Option<String>,
152 pub detail: Option<String>,
153}
154
155#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
157#[serde(default, rename_all = "camelCase")]
158pub struct Verdict {
159 pub classification: String,
160 pub anonymized: bool,
161 pub confidence: f64,
162 pub method: String,
163 pub evidence: Vec<String>,
164}
165
166#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
168#[serde(default, rename_all = "camelCase")]
169pub struct Purity {
170 pub score: i64,
171 pub grade: String,
172 pub verdict: String,
173 #[serde(deserialize_with = "null_default")]
174 pub deductions: Vec<Deduction>,
175}
176
177#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
179#[serde(default, rename_all = "camelCase")]
180pub struct Deduction {
181 pub factor: String,
182 pub points: i64,
183 pub detail: String,
184}
185
186#[derive(Debug, Clone, Default)]
188pub struct HistoryParams {
189 pub limit: Option<u32>,
190 pub before: Option<i64>,
191 pub verdict: Option<String>,
192}
193
194#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
196#[serde(default, rename_all = "camelCase")]
197pub struct History {
198 pub events: Vec<HistoryEvent>,
199 pub next_before: i64,
201 pub as_of: String,
202}
203
204#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
206#[serde(default, rename_all = "camelCase")]
207pub struct HistoryEvent {
208 pub id: i64,
209 pub at: String,
210 pub target: String,
211 pub ip: String,
212 pub verdict: String,
213 pub confidence: f64,
214 pub asn: String,
215 pub asn_name: String,
216 pub country: String,
217 pub anonymized: bool,
218 pub source: String,
219}
220
221#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
223#[serde(default, rename_all = "camelCase")]
224pub struct MyIp {
225 pub ipv4: Option<String>,
226 pub ipv6: Option<String>,
227 pub country: String,
228 pub country_code: String,
229 pub city: String,
230 pub region: String,
231 pub postal_code: String,
232 pub latitude: f64,
233 pub longitude: f64,
234 pub timezone: String,
235 pub accuracy_radius: i64,
236 pub asn: String,
237 pub asn_name: String,
238 pub asn_type: String,
239 pub asn_country: String,
240}