Browse Source

Significant change in --setup parameter

pull/207/head
ssrlive 1 year ago
parent
commit
595bb1b679
  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` --unshare-pidfile <UNSHARE_PIDFILE> Create a pidfile of `unshare` process when using `--unshare`
-6, --ipv6-enabled IPv6 enabled -6, --ipv6-enabled IPv6 enabled
-s, --setup Routing and system setup, which decides whether to setup the routing and system -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. configuration. This option requires root-like privileges on every platform.
See `capabilities(7)` It is very important on Linux, see `capabilities(7)`
-d, --dns <strategy> DNS handling strategy [default: direct] [possible values: virtual, over-tcp, direct] -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] --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] --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, pub ipv6_enabled: bool,
/// Routing and system setup, which decides whether to setup the routing and system configuration. /// 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)`. /// This option requires root-like privileges on every platform.
#[arg(short, long, default_value = if cfg!(target_os = "linux") { "false" } else { "true" })] /// It is very important on Linux, see `capabilities(7)`.
#[arg(short, long)]
pub setup: bool, pub setup: bool,
/// DNS handling strategy /// DNS handling strategy

10
src/general_api.rs

@ -196,9 +196,6 @@ pub async fn general_run_async(
.bypass_ips(&args.bypass) .bypass_ips(&args.bypass)
.ipv6_default_route(args.ipv6_enabled); .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)?; let device = tun::create_as_async(&tun_config)?;
#[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))] #[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"))] #[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
let mut _restore: Option<tproxy_config::TproxyState> = None; 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"))] #[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
if setup { if args.setup {
_restore = Some(tproxy_config::tproxy_setup(&tproxy_args)?); _restore = Some(tproxy_config::tproxy_setup(&tproxy_args)?);
} }

Loading…
Cancel
Save