-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connection allow get/set context data to control ClientHelloCallback #2437
Comments
related quinn-rs/quinn#2024 |
rustls use Acceptor, so we can decide everything before continue to something. https://docs.rs/tokio-rustls/latest/tokio_rustls/struct.LazyConfigAcceptor.html But openssl use callback style, which require |
Hello @taikulawo, we do have an existing API to set/get the application context on connection through s2n-tls: setting application context: https://docs.rs/s2n-tls/0.3.9/s2n_tls/connection/struct.Connection.html#method.set_application_context You may also find other connection level functions here: https://github.com/aws/s2n-tls/blob/61c2a660cf4363d34ee84b503aafd00d8451fc08/bindings/rust/extended/s2n-tls/src/connection.rs#L100 Hope this helps, and let us know if you have any further questions! |
How I get context back in let tls = s2n_quic::provider::tls::s2n_tls::Server::builder()
.with_client_hello_handler(callback)
.unwrap()
.build()
.unwrap();
let io = IoBuilder::default()
.with_rx_socket(socket)
.unwrap()
.build()
.unwrap();
let mut server = Server::builder()
.with_tls(tls)
.unwrap()
.with_io(io)
.unwrap()
.start()
.unwrap();
while let Some(connection) = server.accept().await {
// quic connection
// NO application_context here
// ?????
connection.application_context();
}
impl ClientHelloCallback for Bar {
fn on_client_hello(
&self,
connection: &mut TlsConnection,
) -> Result<Option<Pin<Box<dyn ConnectionFuture>>>, S2nError> {
struct Foo {};
// tls connection
connection.set_application_context(Foo{});
todo!();
}
} |
That functionality isn't currently supported, unfortunately. The That being said, I think it should be possible to support. We would need to provide a callback on the TLS builder that transfers the TLS context from the TLS connection to the QUIC connection. This is needed because s2n-quic discards the TLS session as soon as the handshake completes and won't exist by the time the application goes to read the application context. Additionally, the connection API will need a way to get at the transferred context. We'd be open to accepting a PR if you have time to get one together. Thanks! |
I see ClientHelloCallback is been unstable feature a long time, Do we have plan to stabilize it? |
We could consider stabilizing it. Is this a blocker for your implementation? |
I could help. but we should address issue one by one.
|
I have open a prototype PR to discuss #2448 |
Problem:
We have Rust-based NGINX, so many domain can listen on same SocketAddr, we want to get some args not only ClientHello to decide which Config to use.
Solution:
Connection add API set_raw_ctx/get_raw_ctx
No
No
Requirements / Acceptance Criteria:
Out of scope:
The text was updated successfully, but these errors were encountered: