diff --git a/Cargo.toml b/Cargo.toml index 85070e7..c7be987 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "overtls" -version = "0.2.35" +version = "0.2.36" edition = "2021" license = "MIT" description = "A simple proxy tunnel, minimalist tool for bypassing the GFW." diff --git a/readme-cn.md b/readme-cn.md index 0454b6a..a63d45b 100644 --- a/readme-cn.md +++ b/readme-cn.md @@ -42,7 +42,7 @@ overtls 客戶端首先與 overtls 服務端建立 TLS 連接,然後 overtls 如果你已經安裝了 [Rust](https://rustup.rs/),你可以直接安裝 overtls。 ```bash -cargo install overtls +cargo install overtls --root /usr/local/ ``` ### 預編譯二進制文件 diff --git a/readme.md b/readme.md index 21ce26d..371fe3d 100644 --- a/readme.md +++ b/readme.md @@ -55,7 +55,7 @@ In summary, we need to prepare the following things If you have installed the [Rust](https://rustup.rs/), you can install overtls directly. ```bash -cargo install overtls +cargo install overtls --root /usr/local/ ``` ### Pre-compiled binary file diff --git a/src/client.rs b/src/client.rs index ae5bcdd..efab029 100644 --- a/src/client.rs +++ b/src/client.rs @@ -262,8 +262,9 @@ pub(crate) async fn create_ws_stream( let tunnel_path = config.tunnel_path.extract().first().ok_or(err)?.trim_matches('/'); let b64_dst = dst_addr.as_ref().map(|dst_addr| addess_to_b64str(dst_addr, false)); + let host = client.server_domain.as_ref().unwrap_or(&client.server_host); - let uri = format!("ws://{}/{}/", client.server_host, tunnel_path); + let uri = format!("ws://{}/{}/", host, tunnel_path); let uri = WeirdUri::new(&uri, b64_dst, udp_tunnel, client.client_id.clone()); diff --git a/src/weirduri.rs b/src/weirduri.rs index 73c9dc5..4a8de10 100644 --- a/src/weirduri.rs +++ b/src/weirduri.rs @@ -46,6 +46,12 @@ fn combine_addr_and_port(addr: &url::Host<&str>, port: Option) -> String { impl IntoClientRequest for WeirdUri { fn into_client_request(self) -> Result { + self.into_client_request_v1() + } +} + +impl WeirdUri { + fn into_client_request_v1(self) -> Result { let uri = url::Url::parse(&self.uri).map_err(|_| Error::Url(UrlError::NoPathOrQuery))?; let host = uri.host().ok_or(Error::from(UrlError::EmptyHostName))?;