Skip to content
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

rust-client: Add support for QUIC transport #52

Merged
merged 14 commits into from
Nov 30, 2022
Merged

Conversation

elenaf9
Copy link
Collaborator

@elenaf9 elenaf9 commented Nov 29, 2022

Add support for the QUIC transport to the rust-client.
Resolves #41.
Since the IPFS network does not support the new /quic-v1 codepoint yet we have to use the old /quic one, interpreted as draft-29. This is not supported by rust-libp2p v0.50.0 / libp2p-quic v0.7.0-alpha, thus this PR uses right now libp2p from libp2p/rust-libp2p#3151.

This enables support for dialing quic addresses that use the old `/quic`
codepoint, interpreted as quic version draft-29.
Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for preparing this!

@@ -11,7 +11,7 @@ env_logger = "0.9"
either = "1.6.1"
futures = "0.3"
futures-timer = "3.0.0"
libp2p = { version = "0.50.0", features = ["async-std", "dcutr", "dns", "identify", "noise", "relay", "ping", "tcp", "yamux", "macros"] }
libp2p = { version = "0.50.0", git = "https://github.com/elenaf9/rust-libp2p", branch = "quic/draft-29", features = ["async-std", "dcutr", "dns", "identify", "noise", "relay", "ping", "quic", "tcp", "yamux", "macros"] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed in a call, let's use a commit hash here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 63c45cf

Comment on lines 209 to 214
let transport = OrTransport::new(quic_transport, tcp_relay_transport)
.map(|either_output, _| match either_output {
EitherOutput::First((peer_id, muxer)) => (peer_id, StreamMuxerBox::new(muxer)),
EitherOutput::Second((peer_id, muxer)) => (peer_id, StreamMuxerBox::new(muxer)),
})
.boxed();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would not allow a DNS address for QUIC, right? E.g. /dns6/max-inden.de/udp/1234/quic.

I think the easiest fix would be to wrap the quic_transport with another DnsConfig::system.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 780e104.

@elenaf9 elenaf9 marked this pull request as ready for review November 30, 2022 11:15
@elenaf9
Copy link
Collaborator Author

elenaf9 commented Nov 30, 2022

@MarcoPolo nix builds in the CI fail, I think because we are now using libp2p from git. Any idea how to fix this?

To support hole punching on IPv6, the rust-client should listen on IPv6
for incoming TCP and QUIC connections.
Some IPFS nodes still use RSA keys. Enabling the feature will allow us to
connect to these nodes.
@elenaf9 elenaf9 requested a review from mxinden November 30, 2022 12:25
Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fixes.

mxinden and others added 5 commits November 30, 2022 13:50
Currently the client learns its observed address through the relay of the target
host. Though that is only a single IP version and Transport protocol pair. E.g.
when the client connects via IPv4 and TCP to the relay, it will not learn its
IPv6 nor QUIC address.

With this patch, the client connects to the various IPFS bootstrap nodes, each
with a different IP version and Transport protocol, thus learning more, maybe
even all, of its observed addresses.

Fixes #32.
Co-authored-by: Elena Frank <elena.frank@protonmail.com>
@elenaf9
Copy link
Collaborator Author

elenaf9 commented Nov 30, 2022

@mxinden I would already merge this PR. Once libp2p/rust-libp2p#3151 is merged we can change the git rev to the merge commit or wait for the patch release of libp2p-quic.

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging here sounds good to me.

@elenaf9 elenaf9 merged commit aeb9bbe into main Nov 30, 2022
@elenaf9 elenaf9 deleted the rust-client/feat/quic branch November 30, 2022 14:52
@mxinden
Copy link
Member

mxinden commented Nov 30, 2022

//CC @MarcoPolo we broke the Nix build, given that the Rust client now depends on a git reference. We prioritized QUIC over Nix. Please speak up in case that is a big issue.

@MarcoPolo
Copy link
Collaborator

Not a problem, looks like an easy fix. I'll have something up in a bit

@MarcoPolo MarcoPolo mentioned this pull request Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rust-client: Add QUIC transport
3 participants