|
|
|
@ -9,7 +9,7 @@ use std::net::{IpAddr, SocketAddr, ToSocketAddrs}; |
|
|
|
use std::str::FromStr; |
|
|
|
|
|
|
|
#[derive(Debug, Clone, clap::Parser)] |
|
|
|
#[command(author, version, about = "Tunnel interface to proxy.", long_about = None)] |
|
|
|
#[command(author, version = version_info(), about = "Tunnel interface to proxy.", long_about = None)] |
|
|
|
pub struct Args { |
|
|
|
/// Proxy URL in the form proto://[username[:password]@]host:port,
|
|
|
|
/// where proto is one of socks4, socks5, http.
|
|
|
|
@ -127,6 +127,10 @@ pub struct Args { |
|
|
|
pub udpgw_keepalive: Option<u64>, |
|
|
|
} |
|
|
|
|
|
|
|
fn version_info() -> &'static str { |
|
|
|
concat!(env!("CARGO_PKG_VERSION"), " (", env!("GIT_HASH"), " ", env!("BUILD_TIME"), ")") |
|
|
|
} |
|
|
|
|
|
|
|
fn validate_tun(p: &str) -> Result<String> { |
|
|
|
#[cfg(target_os = "macos")] |
|
|
|
if p.len() <= 4 || &p[..4] != "utun" { |
|
|
|
|