Browse Source

Significant change in --setup parameter (#207)

pull/209/head
ssrlive 1 year ago
committed by GitHub
parent
commit
8cdb4f535d
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      README.md
  2. 5
      src/args.rs
  3. 10
      src/general_api.rs

4
README.md

@ -149,8 +149,8 @@ Options:
--unshare-pidfile <UNSHARE_PIDFILE> Create a pidfile of `unshare` process when using `--unshare`
-6, --ipv6-enabled IPv6 enabled
-s, --setup Routing and system setup, which decides whether to setup the routing and system
configuration. This option is only available on Linux and requires root-like privileges.
See `capabilities(7)`
configuration. This option requires root-like privileges on every platform.
It is very important on Linux, see `capabilities(7)`
-d, --dns <strategy> DNS handling strategy [default: direct] [possible values: virtual, over-tcp, direct]
--dns-addr <IP> DNS resolver address [default: 8.8.8.8]
--virtual-dns-pool <CIDR> IP address pool to be used by virtual DNS in CIDR notation [default: 198.18.0.0/15]

5
src/args.rs

@ -76,8 +76,9 @@ pub struct Args {
pub ipv6_enabled: bool,
/// Routing and system setup, which decides whether to setup the routing and system configuration.
/// This option is only available on Linux and requires root-like privileges. See `capabilities(7)`.
#[arg(short, long, default_value = if cfg!(target_os = "linux") { "false" } else { "true" })]
/// This option requires root-like privileges on every platform.
/// It is very important on Linux, see `capabilities(7)`.
#[arg(short, long)]
pub setup: bool,
/// DNS handling strategy

10
src/general_api.rs

@ -196,9 +196,6 @@ pub async fn general_run_async(
.bypass_ips(&args.bypass)
.ipv6_default_route(args.ipv6_enabled);
#[allow(unused_mut, unused_assignments, unused_variables)]
let mut setup = true;
let device = tun::create_as_async(&tun_config)?;
#[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
@ -212,13 +209,8 @@ pub async fn general_run_async(
#[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
let mut _restore: Option<tproxy_config::TproxyState> = None;
#[cfg(target_os = "linux")]
{
setup = args.setup;
}
#[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
if setup {
if args.setup {
_restore = Some(tproxy_config::tproxy_setup(&tproxy_args)?);
}

Loading…
Cancel
Save