1use std::time::Duration;
4#[derive(Debug, Clone, Copy, PartialEq, Eq)]
6pub enum EConnectionProtocol {
7 Auto,
8 Tcp,
9 WebSocket,
10}
11
12#[derive(Debug, Clone)]
14pub struct SteamOptions {
15 pub protocol: EConnectionProtocol,
17
18 pub auto_relogin: bool,
20
21 pub web_compatibility_mode: bool,
23
24 pub http_proxy: Option<String>,
26
27 pub socks_proxy: Option<String>,
29
30 pub renew_refresh_tokens: bool,
32
33 pub machine_name: Option<String>,
35
36 pub language: String,
38
39 pub local_address: Option<String>,
41
42 pub local_port: Option<u16>,
44
45 pub additional_headers: std::collections::HashMap<String, String>,
47
48 pub enable_pics_cache: bool,
50
51 pub pics_cache_all: bool,
53
54 pub changelist_update_interval: u64,
56
57 pub save_app_tickets: bool,
59
60 pub reconnect: ReconnectConfig,
62
63 pub heartbeat: HeartbeatOptions,
65}
66
67#[derive(Debug, Clone)]
69pub struct ReconnectConfig {
70 pub enabled: bool,
72 pub max_attempts: u32,
74 pub initial_delay: Duration,
76 pub max_delay: Duration,
78 pub backoff_multiplier: f64,
80}
81
82impl Default for ReconnectConfig {
83 fn default() -> Self {
84 Self {
85 enabled: true,
86 max_attempts: 10,
87 initial_delay: Duration::from_secs(2),
88 max_delay: Duration::from_secs(60),
89 backoff_multiplier: 2.0,
90 }
91 }
92}
93
94#[derive(Debug, Clone)]
96pub struct HeartbeatOptions {
97 pub enabled: bool,
99 pub interval: Duration,
101}
102
103impl Default for HeartbeatOptions {
104 fn default() -> Self {
105 Self { enabled: true, interval: Duration::from_secs(30) }
106 }
107}
108
109impl Default for SteamOptions {
110 fn default() -> Self {
111 Self {
112 protocol: EConnectionProtocol::Auto,
113 auto_relogin: true,
114 web_compatibility_mode: false,
115 http_proxy: None,
116 socks_proxy: None,
117 renew_refresh_tokens: false,
118 machine_name: None,
119 language: "english".to_string(),
120 local_address: None,
121 local_port: None,
122 additional_headers: std::collections::HashMap::new(),
123 enable_pics_cache: false,
124 pics_cache_all: false,
125 changelist_update_interval: 60000,
126 save_app_tickets: true,
127 reconnect: ReconnectConfig::default(),
128 heartbeat: HeartbeatOptions::default(),
129 }
130 }
131}