Skip to content

Commit c550cdf

Browse files
AzazKamazzonyitoo
authored andcommitted
Parse tun_interface_destination from ssconfig
1 parent c337e4e commit c550cdf

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

crates/shadowsocks-service/src/config.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,6 +1625,17 @@ impl Config {
16251625
}
16261626
}
16271627

1628+
#[cfg(feature = "local-tun")]
1629+
if let Some(tun_interface_destination) = local.tun_interface_destination {
1630+
match tun_interface_destination.parse::<IpNet>() {
1631+
Ok(addr) => local_config.tun_interface_destination = Some(addr),
1632+
Err(..) => {
1633+
let err = Error::new(ErrorKind::Malformed, "`tun_interface_destination` invalid", None);
1634+
return Err(err);
1635+
}
1636+
}
1637+
}
1638+
16281639
#[cfg(feature = "local-tun")]
16291640
if let Some(tun_interface_name) = local.tun_interface_name {
16301641
local_config.tun_interface_name = Some(tun_interface_name);

0 commit comments

Comments
 (0)