mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-04-20 13:59:10 +00:00
tcp timeout option
This commit is contained in:
parent
3fe47d92ec
commit
c430d76534
2 changed files with 6 additions and 2 deletions
|
@ -41,6 +41,10 @@ pub struct Args {
|
|||
#[arg(short, long, value_name = "IP")]
|
||||
pub bypass: Vec<IpAddr>,
|
||||
|
||||
/// TCP timeout in seconds
|
||||
#[arg(long, value_name = "seconds", default_value = "600")]
|
||||
pub tcp_timeout: u64,
|
||||
|
||||
/// Verbosity level
|
||||
#[arg(short, long, value_name = "level", value_enum, default_value = "info")]
|
||||
pub verbosity: ArgVerbosity,
|
||||
|
@ -57,6 +61,7 @@ impl Default for Args {
|
|||
dns: ArgDns::default(),
|
||||
dns_addr: "8.8.8.8".parse().unwrap(),
|
||||
bypass: vec![],
|
||||
tcp_timeout: 600,
|
||||
verbosity: ArgVerbosity::Info,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ mod virtual_dns;
|
|||
const DNS_PORT: u16 = 53;
|
||||
|
||||
const MAX_SESSIONS: u64 = 200;
|
||||
const TCP_TIMEOUT_SEC: u64 = 600; // 10 minutes
|
||||
const UDP_TIMEOUT_SEC: u64 = 10; // 10 seconds
|
||||
|
||||
static TASK_COUNT: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);
|
||||
|
@ -87,7 +86,7 @@ where
|
|||
|
||||
let mut ipstack_config = ipstack::IpStackConfig::default();
|
||||
ipstack_config.mtu(mtu);
|
||||
ipstack_config.tcp_timeout(std::time::Duration::from_secs(TCP_TIMEOUT_SEC));
|
||||
ipstack_config.tcp_timeout(std::time::Duration::from_secs(args.tcp_timeout));
|
||||
ipstack_config.udp_timeout(std::time::Duration::from_secs(UDP_TIMEOUT_SEC));
|
||||
|
||||
let mut ip_stack = ipstack::IpStack::new(ipstack_config, device);
|
||||
|
|
Loading…
Add table
Reference in a new issue