BiagioFesta / wtransport

Async-friendly WebTransport implementation in Rust
Apache License 2.0
470 stars 31 forks source link

Access to low-level quinn details in client #150

Open MOZGIII opened 8 months ago

MOZGIII commented 8 months ago

I need to set quinn transport congestion control to BBR, but there's no way to do it currently. It would be great to have a lower level access there, maybe to instantiate wtransport client (and server?) for a pre-made quinn::Endpoint.

I'm intentionally not providing an implementation this time before the discussion.

BiagioFesta commented 8 months ago

It should be possible by configuring the transport, shouldn't it?

https://docs.rs/wtransport/latest/wtransport/struct.ClientConfig.html#method.quic_config_mut

Client example:

use std::sync::Arc;
use wtransport::quinn::congestion::BbrConfig;
use wtransport::quinn::TransportConfig;
use wtransport::ClientConfig;
use wtransport::Endpoint;

#[tokio::main]
async fn main() {
    let mut transport_config = TransportConfig::default();
    transport_config.congestion_controller_factory(Arc::new(BbrConfig::default()));

    let mut client_config = ClientConfig::default();
    client_config
        .quic_config_mut()
        .transport_config(Arc::new(transport_config));

    let connection = Endpoint::client(client_config)
        .unwrap()
        .connect("https://example.com")
        .await
        .unwrap();
}
MOZGIII commented 7 months ago

I want to alter an already setup endpoint though

BiagioFesta commented 7 months ago

Endpoint::reload_config maybe?