-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat: Add WebTransport protocol based on BiagioFesta/wtransport
#5701
base: master
Are you sure you want to change the base?
Conversation
# Conflicts: # Cargo.lock # transports/tls/src/certificate.rs # transports/tls/src/lib.rs
# Conflicts: # Cargo.lock
BiagioFesta/wtransport
# Conflicts: # Cargo.lock
@jxs @thomaseizinger @dariusc93 Thanks! |
Hi @dgarus, thank you for your PR, it's much appreciated! I'll try to give this a review as soon as possible, but it might take some days until I get to it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank your for this great effort and sorry for the delay. I started reviewing it, but didn't look into the certification logic yet.
This PR differs in some aspects from the previous webtransport PR #5564. In particular it:
- now builds on the
wtransport
crate, instead ofh3-webtransport
- doesn't extend
libp2p_quic
anymore but instead is a separate crate
Could you briefly elaborate what motivated these changes? In particular for latter, because now the webtransport::GenTransport
duplicates a lot of quic::GenTransport
.
Co-authored-by: Elena Frank <elena.frank@proton.me>
Co-authored-by: Elena Frank <elena.frank@proton.me>
Co-authored-by: Elena Frank <elena.frank@proton.me>
Co-authored-by: Elena Frank <elena.frank@proton.me>
Hi! And as the result, it is here 🙂 With Additionally, if a user wants to use pure |
@elenaf9 thank you for review! |
fn poll_outbound( | ||
self: Pin<&mut Self>, | ||
_cx: &mut Context<'_>, | ||
) -> Poll<Result<Self::Substream, Self::Error>> { | ||
// Doesn't support outbound connections! | ||
Poll::Pending | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
outbound stream != outbound connection
I think on an already established connection, both sides should be able to open a new stream, no?
I understand, and I agree that having both in one module with a lot of if/else branches is a bit confusing. Do you think that it would be possible to extract the shared quic code into one transport that is then generic over the two different variants (plain quic and webtransport), like this: trait QuicTransport {
type Endpoint;
type Connection;
type Connecting;
type SendStream;
type RecvStream;
...
fn new_server_endpoint(addr: Multiaddr, config: &Config) -> Result<Self::Endpoint, Error>;
fn new_client_endpoint(addr: Multiaddr, config: &Config) -> Result<Self::Endpoint, Error>;
fn open_stream(connection: &mut Self::Connection) -> BoxFuture<_, Result<(Self::SendStream, Self::RecvStream), Error>>;
fn accept_stream(connection: &mut Self::Connection) -> BoxFuture<_, Result<(Self::SendStream, Self::RecvStream), Error>>;
...
}
struct Transport<QuicTransport = PlainQuic>;
impl QuicTransport for PlainQuic {
...
}
impl QuicTransport for WebTransport {
...
} That way the webtransport and normal quic transport specific logic would be separated, but (hopefully) not much code duplicated. |
If you are bothering about code duplication, I could return to #5564. |
And use |
Use |
Based on your experience, which one of the two do you think we should use? Is one clearly more mature or easier to integrate? |
related to #2993
spec
https://github.com/libp2p/specs/tree/master/webtransport