feat: add disable_ipv6 option (related #364)

This commit is contained in:
Kevin Yue
2024-05-19 09:04:45 +08:00
parent 92b858884c
commit 90a8c11acb
7 changed files with 39 additions and 6 deletions

View File

@@ -36,6 +36,7 @@ pub struct ConnectArgs {
csd_wrapper: Option<String>,
mtu: u32,
os: Option<ClientOs>,
disable_ipv6: bool,
}
impl ConnectArgs {
@@ -48,6 +49,7 @@ impl ConnectArgs {
csd_uid: 0,
csd_wrapper: None,
mtu: 0,
disable_ipv6: false,
}
}
@@ -78,6 +80,10 @@ impl ConnectArgs {
pub fn mtu(&self) -> u32 {
self.mtu
}
pub fn disable_ipv6(&self) -> bool {
self.disable_ipv6
}
}
#[derive(Debug, Deserialize, Serialize, Type)]
@@ -109,11 +115,6 @@ impl ConnectRequest {
self
}
pub fn with_mtu(mut self, mtu: u32) -> Self {
self.args.mtu = mtu;
self
}
pub fn with_user_agent<T: Into<Option<String>>>(mut self, user_agent: T) -> Self {
self.args.user_agent = user_agent.into();
self
@@ -124,6 +125,16 @@ impl ConnectRequest {
self
}
pub fn with_mtu(mut self, mtu: u32) -> Self {
self.args.mtu = mtu;
self
}
pub fn with_disable_ipv6(mut self, disable_ipv6: bool) -> Self {
self.args.disable_ipv6 = disable_ipv6;
self
}
pub fn gateway(&self) -> &Gateway {
self.info.gateway()
}