mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-04-19 13:29:09 +00:00
rename bypass_ip to bypass (#66)
This commit is contained in:
parent
d75488f1d8
commit
c1ea5f1af2
5 changed files with 12 additions and 12 deletions
|
@ -99,7 +99,7 @@ Options:
|
|||
--dns-addr <IP> DNS resolver address [default: 8.8.8.8]
|
||||
-6, --ipv6-enabled IPv6 enabled
|
||||
-s, --setup <method> Routing and system setup [possible values: auto]
|
||||
--bypass-ip <IP> Public proxy IP used in routing setup which should bypassing the tunnel
|
||||
-b, --bypass <IP> Public proxy IP used in routing setup which should bypassing the tunnel
|
||||
-v, --verbosity <level> Verbosity level [default: info] [possible values: off, error, warn, info, debug, trace]
|
||||
-h, --help Print help
|
||||
-V, --version Print version
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
run() {
|
||||
if [ -n "$BYPASS_IP" ]; then
|
||||
BYPASS_IP="--bypass-ip $BYPASS_IP"
|
||||
BYPASS_IP="--bypass $BYPASS_IP"
|
||||
fi
|
||||
|
||||
if [ -n "$DNS" ]; then
|
||||
|
|
|
@ -102,7 +102,7 @@ pub struct Options {
|
|||
dns_over_tcp: bool,
|
||||
dns_addr: Option<std::net::IpAddr>,
|
||||
ipv6_enabled: bool,
|
||||
bypass_ip: Option<std::net::IpAddr>,
|
||||
bypass: Option<std::net::IpAddr>,
|
||||
}
|
||||
|
||||
impl Options {
|
||||
|
@ -137,8 +137,8 @@ impl Options {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn with_bypass_ip(mut self, ip: Option<std::net::IpAddr>) -> Self {
|
||||
self.bypass_ip = ip;
|
||||
pub fn with_bypass(mut self, ip: Option<std::net::IpAddr>) -> Self {
|
||||
self.bypass = ip;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
12
src/main.rs
12
src/main.rs
|
@ -42,8 +42,8 @@ struct Args {
|
|||
setup: Option<ArgSetup>,
|
||||
|
||||
/// Public proxy IP used in routing setup which should bypassing the tunnel
|
||||
#[arg(long, value_name = "IP")]
|
||||
bypass_ip: Option<IpAddr>,
|
||||
#[arg(short, long, value_name = "IP")]
|
||||
bypass: Option<IpAddr>,
|
||||
|
||||
/// Verbosity level
|
||||
#[arg(short, long, value_name = "level", value_enum, default_value = "info")]
|
||||
|
@ -116,22 +116,22 @@ fn main() -> ExitCode {
|
|||
}
|
||||
};
|
||||
|
||||
let bypass_tun_ip = match args.bypass_ip {
|
||||
let bypass_tun_ip = match args.bypass {
|
||||
Some(addr) => addr,
|
||||
None => args.proxy.addr.ip(),
|
||||
};
|
||||
options = options.with_bypass_ip(Some(bypass_tun_ip));
|
||||
options = options.with_bypass(Some(bypass_tun_ip));
|
||||
|
||||
let block = || -> Result<(), Error> {
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
let mut setup: Setup;
|
||||
if args.setup == Some(ArgSetup::Auto) {
|
||||
let bypass_tun_ip = match args.bypass_ip {
|
||||
let bypass_tun_ip = match args.bypass {
|
||||
Some(addr) => addr,
|
||||
None => args.proxy.addr.ip(),
|
||||
};
|
||||
setup = Setup::new(&args.tun, &bypass_tun_ip, get_default_cidrs(), args.bypass_ip.is_some());
|
||||
setup = Setup::new(&args.tun, &bypass_tun_ip, get_default_cidrs(), args.bypass.is_some());
|
||||
|
||||
setup.configure()?;
|
||||
|
||||
|
|
|
@ -1154,7 +1154,7 @@ impl<'a> TunToProxy<'a> {
|
|||
count += 1;
|
||||
}
|
||||
Err(err) => {
|
||||
println!("Failed to send exit signal: \"{}\"", err);
|
||||
log::error!("Failed to send exit signal: \"{}\"", err);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue