orinium_browser/platform/network/
config.rs1use std::time::Duration;
4
5use serde::{Deserialize, Serialize};
6
7#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct NetworkConfig {
10 pub user_agent: String,
12
13 pub connect_timeout: Duration,
15 pub read_timeout: Duration,
16
17 pub enable_cache: bool,
19
20 pub enable_cookies: bool,
22
23 pub verify_tls: bool,
25
26 pub proxies: Vec<ProxyConfig>,
28
29 pub max_connections: usize,
31
32 pub follow_redirects: bool,
34
35 pub enable_websocket: bool,
37}
38
39#[allow(dead_code)]
40#[derive(Debug, Clone)]
41pub enum ProxyType {
42 Http,
43 Https,
44 Socks5,
45}
46
47#[allow(dead_code)]
48#[derive(Debug, Clone, Deserialize, Serialize)]
49pub struct ProxyConfig {
50 pub proxy_type: String,
51 pub host: String,
52 pub port: u16,
53 pub username: Option<String>,
54 pub password: Option<String>,
55}
56
57#[allow(dead_code)]
58#[derive(Debug, Clone, Default)]
59pub struct ProxySettings {
60 pub proxies: Vec<ProxyConfig>, }
62
63impl Default for NetworkConfig {
64 fn default() -> Self {
65 Self {
66 user_agent: String::from(
67 "OrinionBrowser/0.1 (+https://github.com/Orinas-github/Orinium-browser)",
68 ),
69 connect_timeout: Duration::from_secs(10),
70 read_timeout: Duration::from_secs(30),
71 enable_cache: true,
72 enable_cookies: true,
73 verify_tls: true,
74 proxies: vec![],
75 max_connections: 100,
76 follow_redirects: true,
77 enable_websocket: true,
78 }
79 }
80}