Dominik
3 weeks ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
11 additions and
1 deletions
-
src/args.rs
-
src/bin/main.rs
|
|
|
@ -104,6 +104,14 @@ pub struct Args { |
|
|
|
#[arg(short, long, value_name = "IP/CIDR")] |
|
|
|
pub bypass: Vec<IpCidr>, |
|
|
|
|
|
|
|
/// MTU of the TUN device. Userspace TCP stack uses (MTU - 40) as the
|
|
|
|
/// effective MSS for synthesized segments going to the kernel side, so
|
|
|
|
/// lower this when the kernel forwards the traffic onwards through a
|
|
|
|
/// link with a smaller MTU (e.g. a WireGuard tunnel at 1420) to avoid
|
|
|
|
/// having the bigger segments silently dropped.
|
|
|
|
#[arg(long, value_name = "bytes", default_value_t = tun::DEFAULT_MTU)] |
|
|
|
pub mtu: u16, |
|
|
|
|
|
|
|
/// TCP timeout in seconds
|
|
|
|
#[arg(long, value_name = "seconds", default_value = "600")] |
|
|
|
pub tcp_timeout: u64, |
|
|
|
@ -181,6 +189,7 @@ impl Default for Args { |
|
|
|
dns: ArgDns::default(), |
|
|
|
dns_addr: "8.8.8.8".parse().unwrap(), |
|
|
|
bypass: vec![], |
|
|
|
mtu: tun::DEFAULT_MTU, |
|
|
|
tcp_timeout: 600, |
|
|
|
udp_timeout: 10, |
|
|
|
verbosity: ArgVerbosity::Info, |
|
|
|
|
|
|
|
@ -77,7 +77,8 @@ async fn main_async(args: Args) -> Result<(), BoxError> { |
|
|
|
} |
|
|
|
unsafe { tun2proxy::tun2proxy_set_traffic_status_callback(1, Some(traffic_cb), std::ptr::null_mut()) }; |
|
|
|
|
|
|
|
let ret = tun2proxy::general_run_async(args, tun::DEFAULT_MTU, cfg!(target_os = "macos"), shutdown_token).await; |
|
|
|
let mtu = args.mtu; |
|
|
|
let ret = tun2proxy::general_run_async(args, mtu, cfg!(target_os = "macos"), shutdown_token).await; |
|
|
|
if let Err(err) = &ret { |
|
|
|
log::error!("main loop error: {err}"); |
|
|
|
} |
|
|
|
|