Skip to content

Commit c9919b8

Browse files
author
root
committed
feat(proxy): implement connect-udp and optional cronet-rs backend
1 parent 80d3148 commit c9919b8

7 files changed

Lines changed: 533 additions & 14 deletions

File tree

Cargo.lock

Lines changed: 188 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

h3proxy-cli/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name = "h3proxy-cli"
33
version = "0.1.0"
44
edition = "2021"
55

6+
[features]
7+
cronet-backend = ["h3proxy-lib/cronet-backend"]
8+
69
[dependencies]
710
h3proxy-lib = { path = "../h3proxy-lib" }
811
tokio = { version = "1.38", features = ["rt-multi-thread", "macros"] }

h3proxy-cli/src/main.rs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ enum Commands {
3636

3737
#[arg(short, long, default_value = "cert.pem")]
3838
cert: String,
39+
40+
#[arg(short, long, default_value = "quinn")]
41+
backend: String,
3942
},
4043
}
4144

@@ -68,20 +71,29 @@ async fn main() -> Result<()> {
6871
let server = ProxyServer::new(config);
6972
server.serve().await?;
7073
}
71-
Commands::Client { proxy, target, cert } => {
74+
Commands::Client { proxy, target, cert, backend } => {
7275
let cert_data = fs::read(&cert).with_context(|| format!("failed to read cert file: {}", cert))?;
7376
let certs: Vec<_> = rustls_pemfile::certs(&mut &*cert_data)
7477
.collect::<Result<_, _>>()
7578
.context("failed to parse certs")?;
7679

77-
let config = ClientConfig {
78-
proxy_addr: proxy,
79-
target_url: target,
80-
root_certs: certs,
81-
};
82-
83-
let client = ProxyClient::new(config);
84-
client.run().await?;
80+
if backend == "cronet" {
81+
let config = h3proxy_lib::cronet_client::CronetClientConfig {
82+
proxy_addr: proxy,
83+
target_url: target,
84+
root_certs: certs,
85+
};
86+
let client = h3proxy_lib::cronet_client::CronetClient::new(config);
87+
client.run().await?;
88+
} else {
89+
let config = ClientConfig {
90+
proxy_addr: proxy,
91+
target_url: target,
92+
root_certs: certs,
93+
};
94+
let client = ProxyClient::new(config);
95+
client.run().await?;
96+
}
8597
}
8698
}
8799

0 commit comments

Comments
 (0)