Skip to content

Commit cd60dab

Browse files
authored
Merge pull request #5 from arloor/feature/support-rust-http-proxy
chore: Add support for using an HTTP proxy over TLS as the server
2 parents a194ff7 + 7fd192e commit cd60dab

File tree

5 files changed

+32
-56
lines changed

5 files changed

+32
-56
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PREFIX ?= /usr/local/bin
22
TARGET ?= debug
33

4-
.PHONY: all build install uninstall clean
4+
.PHONY: all build install uninstall clean gh
55
all: build
66

77
build:
@@ -28,3 +28,6 @@ uninstall:
2828

2929
clean:
3030
cargo clean
31+
32+
gh:
33+
cargo install --path . --bin sslocal --features https-tunnel

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ Related Projects:
3131
- [honwen/openwrt-shadowsocks-rust](https://github.com/honwen/openwrt-shadowsocks-rust) OpenWRT solution for `sslocal`, [discussion](https://github.com/honwen/openwrt-shadowsocks-rust)
3232
- [cg31/shadowsocks-windows-gui-rust](https://github.com/cg31/shadowsocks-windows-gui-rust) Windows GUI client, [discussion](https://github.com/shadowsocks/shadowsocks-rust/issues/375)
3333

34+
## About this fork
35+
36+
Add support for using an HTTP proxy over TLS as the server. Specifically, it aims to support the use of [rust_http_proxy](https://github.com/arloor/rust_http_proxy) as the backend server. Refer to [https-tunnel-readme.md](https-tunnel-readme.md) for more infomation.
37+
3438
## Build & Install
3539

3640
### Optional Features

crates/shadowsocks-service/src/local/net/tcp/auto_proxy_stream.rs

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -53,48 +53,7 @@ pub struct HttpTunnelStream {
5353
addr: Address,
5454
auth: String,
5555
}
56-
// #[cfg(feature = "https-tunnel")]
57-
// static CONNECTOR: LazyLock<tokio_rustls::TlsConnector> = std::sync::LazyLock::new(|| {
58-
// use log::warn;
59-
// use once_cell::sync::Lazy;
60-
// use std::sync::Arc;
61-
// use tokio_rustls::{
62-
// rustls::{ClientConfig, RootCertStore},
63-
// TlsConnector,
64-
// };
6556

66-
// static TLS_CONFIG: Lazy<Arc<ClientConfig>> = Lazy::new(|| {
67-
// let mut config = ClientConfig::builder()
68-
// .with_root_certificates(match rustls_native_certs::load_native_certs() {
69-
// Ok(certs) => {
70-
// let mut store = RootCertStore::empty();
71-
72-
// for cert in certs {
73-
// if let Err(err) = store.add(cert) {
74-
// warn!("failed to add cert (native), error: {}", err);
75-
// }
76-
// }
77-
78-
// store
79-
// }
80-
// Err(err) => {
81-
// warn!("failed to load native certs, {}, going to load from webpki-roots", err);
82-
83-
// let mut store = RootCertStore::empty();
84-
// store.extend(webpki_roots::TLS_SERVER_ROOTS.iter().cloned());
85-
86-
// store
87-
// }
88-
// })
89-
// .with_no_client_auth();
90-
91-
// // Try to negotiate HTTP/2
92-
// config.alpn_protocols = vec![b"h2".to_vec(), b"http/1.1".to_vec()];
93-
// Arc::new(config)
94-
// });
95-
96-
// TlsConnector::from(TLS_CONFIG.clone())
97-
// });
9857
#[cfg(feature = "https-tunnel")]
9958
impl HttpTunnelStream {
10059
pub async fn handshake(&mut self) -> io::Result<()> {

https-tunnel-readme.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## vscode debug
2+
3+
```bash
4+
cp .vscode/launch_example.json .vscode/launch.json
5+
```
6+
7+
then modify the arguements in launch.json, especially the `-k` and `-s`.
8+
9+
## install
10+
11+
```bash
12+
make gh
13+
# eg cargo install --path . --bin sslocal --features https-tunnel
14+
```
15+
16+
## run.vbs
17+
18+
useful for windows users
19+
20+
```bash
21+
Set WshShell = CreateObject("WScript.Shell")
22+
WshShell.Run "taskkill /F /IM sslocal.exe", 0, True
23+
WshShell.Run "sslocal --local-addr 0.0.0.0:2080 -k username:password -v -m aes-256-gcm -s host:444", 0
24+
```

test.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)