port to windows or macos (#61)

This commit is contained in:
ssrlive 2023-08-31 14:31:02 +08:00 committed by GitHub
parent 4b42413ab0
commit bbb8d3b244
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 69 additions and 12 deletions

View file

@ -95,11 +95,15 @@ fn main() -> ExitCode {
options = options.with_ipv6_enabled();
}
#[allow(unused_assignments)]
let interface = match args.tun_fd {
None => NetworkInterface::Named(args.tun.clone()),
Some(fd) => {
Some(_fd) => {
options = options.with_mtu(args.tun_mtu);
NetworkInterface::Fd(fd)
#[cfg(not(target_family = "unix"))]
panic!("Not supported");
#[cfg(target_family = "unix")]
NetworkInterface::Fd(_fd)
}
};