Skip to content

Commit

Permalink
Remove duct from talpid-tunnel
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusPettersson98 committed Jan 2, 2025
1 parent 3a134c9 commit ed32ea5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 24 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion talpid-tunnel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ futures = { workspace = true }
tokio = { workspace = true, features = ["process", "rt-multi-thread", "fs"] }

[target.'cfg(all(unix, not(target_os = "android")))'.dependencies]
duct = "0.13"
nix = "0.23"

[target.'cfg(target_os = "android")'.dependencies]
Expand Down
37 changes: 15 additions & 22 deletions talpid-tunnel/src/tun_provider/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,31 +163,24 @@ impl TunnelDevice {
IpAddr::V6(ipv6) => {
#[cfg(target_os = "linux")]
{
duct::cmd!(
"ip",
"-6",
"addr",
"add",
ipv6.to_string(),
"dev",
self.dev.name()
)
.run()
.map(|_| ())
.map_err(Error::SetIpv6)
use std::process::Command;
// ip -6 addr add <ipv6 address> dev <device>
let address = ipv6.to_string();
let device = self.dev.name();
let mut ip = Command::new("ip");
ip.args(["-6", "addr", "add", &address, "dev", device]);
ip.output().map_err(Error::SetIpv6)?;
Ok(())
}
#[cfg(target_os = "macos")]
{
duct::cmd!(
"ifconfig",
self.dev.name(),
"inet6",
ipv6.to_string(),
"alias"
)
.run()
.map(|_| ())
.map_err(Error::SetIpv6)
// ifconfig <device> inet6 <ipv6 address> alias
let address = ipv6.to_string();
let device = self.dev.name();
let mut ifconfig = Command::new("ifconfig");
ifconfig.args([device, "inet6", &address, "alias"]);
ifconfig.output().map_err(Error::SetIpv6)?;
Ok(())
}
}
}
Expand Down

0 comments on commit ed32ea5

Please sign in to comment.