diff --git a/Cargo.toml b/Cargo.toml index 9ea335a..b302aec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wstunnel" -version = "8.4.0" +version = "8.4.1" edition = "2021" repository = "https://github.com/erebe/wstunnel.git" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -13,7 +13,7 @@ base64 = "0.21.5" bb8 = { version = "0.8", features = [] } bytes = { version = "1.5.0", features = [] } -clap = { version = "4.4.11", features = ["derive"] } +clap = { version = "4.4.11", features = ["derive", "env"] } fast-socks5 = { version = "0.9.2", features = [] } fastwebsockets = { version = "0.6.0", features = ["upgrade", "simd", "unstable-split"] } futures-util = { version = "0.3.29" } diff --git a/src/dns.rs b/src/dns.rs index 8c6554a..bb1742b 100644 --- a/src/dns.rs +++ b/src/dns.rs @@ -10,9 +10,7 @@ pub enum DnsResolver { impl DnsResolver { pub async fn lookup_host(&self, domain: &str, port: u16) -> anyhow::Result> { let addrs: Vec = match self { - DnsResolver::System => tokio::net::lookup_host(format!("{}:{}", domain, port)) - .await? - .collect(), + DnsResolver::System => tokio::net::lookup_host(format!("{}:{}", domain, port)).await?.collect(), DnsResolver::TrustDns(dns_resolver) => dns_resolver .lookup_ip(domain) .await? diff --git a/src/main.rs b/src/main.rs index 38c48b2..9481457 100644 --- a/src/main.rs +++ b/src/main.rs @@ -105,7 +105,12 @@ struct Client { /// Use a specific prefix that will show up in the http path during the upgrade request. /// Useful if you need to route requests server side but don't have vhosts - #[arg(long, default_value = "morille", verbatim_doc_comment)] + #[arg( + long, + default_value = "morille", + verbatim_doc_comment, + env = "WSTUNNEL_HTTP_UPGRADE_PATH_PREFIX" + )] http_upgrade_path_prefix: String, /// Pass authorization header with basic auth credentials during the upgrade request. @@ -174,7 +179,12 @@ struct Server { /// Useful if you specify in the client a custom path prefix and you want the server to only allow this one. /// The path prefix act as a secret to authenticate clients /// Disabled by default. Accept all path prefix. Can be specified multiple time - #[arg(short = 'r', long, verbatim_doc_comment)] + #[arg( + short = 'r', + long, + verbatim_doc_comment, + env = "WSTUNNEL_RESTRICT_HTTP_UPGRADE_PATH_PREFIX" + )] restrict_http_upgrade_path_prefix: Option>, /// [Optional] Use custom certificate (.crt) instead of the default embedded self signed certificate.