feat: add the --reconnect-timeout option

This commit is contained in:
Kevin Yue
2024-05-19 09:59:25 +08:00
parent 90a8c11acb
commit af51bc257b
7 changed files with 31 additions and 4 deletions

View File

@@ -23,6 +23,7 @@ pub struct Vpn {
csd_uid: u32,
csd_wrapper: Option<CString>,
reconnect_timeout: u32,
mtu: u32,
disable_ipv6: bool,
@@ -68,6 +69,7 @@ impl Vpn {
csd_uid: self.csd_uid,
csd_wrapper: Self::option_to_ptr(&self.csd_wrapper),
reconnect_timeout: self.reconnect_timeout,
mtu: self.mtu,
disable_ipv6: self.disable_ipv6 as u32,
}
@@ -111,6 +113,7 @@ pub struct VpnBuilder {
csd_uid: u32,
csd_wrapper: Option<String>,
reconnect_timeout: u32,
mtu: u32,
disable_ipv6: bool,
}
@@ -128,6 +131,7 @@ impl VpnBuilder {
csd_uid: 0,
csd_wrapper: None,
reconnect_timeout: 300,
mtu: 0,
disable_ipv6: false,
}
@@ -158,6 +162,11 @@ impl VpnBuilder {
self
}
pub fn reconnect_timeout(mut self, reconnect_timeout: u32) -> Self {
self.reconnect_timeout = reconnect_timeout;
self
}
pub fn mtu(mut self, mtu: u32) -> Self {
self.mtu = mtu;
self
@@ -196,6 +205,7 @@ impl VpnBuilder {
csd_uid: self.csd_uid,
csd_wrapper: self.csd_wrapper.as_deref().map(Self::to_cstring),
reconnect_timeout: self.reconnect_timeout,
mtu: self.mtu,
disable_ipv6: self.disable_ipv6,