1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
5#[serde(default, rename_all = "camelCase")]
6pub struct VpnResponse {
7 pub ip: String,
8 pub is_vpn: bool,
9 pub is_tor: bool,
10 pub network_class: String,
11 pub anonymized: bool,
12 pub provider: String,
13 pub risk_score: i64,
14}
15
16#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
18#[serde(default, rename_all = "camelCase")]
19pub struct ProxyResponse {
20 pub ip: String,
21 pub is_proxy: bool,
22 pub is_tor: bool,
23 pub network_class: String,
24 pub anonymized: bool,
25 pub provider: String,
26 pub risk_score: i64,
27}
28
29#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
31#[serde(default, rename_all = "camelCase")]
32pub struct GeolocationResponse {
33 pub ip: String,
34 pub country: String,
35 pub country_code: String,
36 pub city: String,
37 pub region: String,
38 pub postal_code: String,
39 pub latitude: f64,
40 pub longitude: f64,
41 pub timezone: String,
42 pub accuracy_radius: i64,
43}
44
45#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
47#[serde(default, rename_all = "camelCase")]
48pub struct AsnResponse {
49 pub ip: String,
50 pub asn: String,
51 pub name: String,
52 #[serde(rename = "type")]
53 pub kind: String,
54 pub country: String,
55}
56
57#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
59#[serde(default, rename_all = "camelCase")]
60pub struct WhoisResponse {
61 pub domain: String,
62 pub registrar: String,
63 pub registered_on: String,
64 pub expires_on: String,
65 pub last_updated: String,
66 pub nameservers: Vec<String>,
67 pub status: Vec<String>,
68 pub privacy_protection: bool,
69}
70
71#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
73#[serde(default, rename_all = "camelCase")]
74pub struct LookupResult {
75 pub target: Target,
76 pub reserved: ReservedRange,
77 pub verdict: Verdict,
78 pub purity: Purity,
79 pub network_class: String,
80 pub is_vpn: bool,
81 pub is_proxy: bool,
82 pub is_tor: bool,
83 pub provider: Option<String>,
84 pub risk_score: i64,
85 pub network_type: Option<String>,
86 pub geo: Option<GeolocationResponse>,
87 pub asn: Option<AsnResponse>,
88 pub whois: Option<WhoisResponse>,
89 pub degraded: Vec<String>,
90 pub at: String,
91}
92
93#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
95#[serde(default, rename_all = "camelCase")]
96pub struct Target {
97 pub raw: String,
98 pub kind: String,
99 pub ip: String,
100 pub hostname: Option<String>,
101 pub network: Option<String>,
102 pub addresses: Option<i64>,
103}
104
105#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
107#[serde(default, rename_all = "camelCase")]
108pub struct ReservedRange {
109 pub reserved: bool,
110 pub label: Option<String>,
111 pub detail: Option<String>,
112}
113
114#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
116#[serde(default, rename_all = "camelCase")]
117pub struct Verdict {
118 pub classification: String,
119 pub anonymized: bool,
120 pub confidence: f64,
121 pub method: String,
122}
123
124#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
126#[serde(default, rename_all = "camelCase")]
127pub struct Purity {
128 pub score: i64,
129 pub grade: String,
130 pub verdict: String,
131 pub deductions: Vec<Deduction>,
132}
133
134#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
136#[serde(default, rename_all = "camelCase")]
137pub struct Deduction {
138 pub factor: String,
139 pub points: i64,
140 pub detail: String,
141}
142
143#[derive(Debug, Clone, Default)]
145pub struct HistoryParams {
146 pub limit: Option<u32>,
147 pub before: Option<i64>,
148 pub verdict: Option<String>,
149}
150
151#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
153#[serde(default, rename_all = "camelCase")]
154pub struct History {
155 pub events: Vec<HistoryEvent>,
156 pub next_before: i64,
158 pub as_of: String,
159}
160
161#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
163#[serde(default, rename_all = "camelCase")]
164pub struct HistoryEvent {
165 pub id: i64,
166 pub at: String,
167 pub target: String,
168 pub ip: String,
169 pub verdict: String,
170 pub confidence: f64,
171 pub asn: String,
172 pub asn_name: String,
173 pub country: String,
174 pub anonymized: bool,
175 pub source: String,
176}
177
178#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
180#[serde(default, rename_all = "camelCase")]
181pub struct MyIp {
182 pub ipv4: Option<String>,
183 pub ipv6: Option<String>,
184 pub country: String,
185 pub country_code: String,
186 pub city: String,
187 pub region: String,
188 pub postal_code: String,
189 pub latitude: f64,
190 pub longitude: f64,
191 pub timezone: String,
192 pub accuracy_radius: i64,
193 pub asn: String,
194 pub asn_name: String,
195 pub asn_type: String,
196 pub asn_country: String,
197}