ssrlive
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
6 additions and
13 deletions
-
README.md
-
src/args.rs
-
src/general_api.rs
|
|
|
@ -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] |
|
|
|
|
|
|
|
@ -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
|
|
|
|
|
|
|
|
@ -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)?); |
|
|
|
} |
|
|
|
|
|
|
|
|