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

Hole Punching #806

Merged
merged 127 commits into from
Apr 18, 2023
Merged

Hole Punching #806

merged 127 commits into from
Apr 18, 2023

Conversation

diegomrsantos
Copy link
Contributor

@diegomrsantos diegomrsantos commented Nov 21, 2022

This PR implements end-to-end TCP hole punching, integrating the previously implemented services (Autorelay and Autonat) and protocol (DCUtr) into the Hole Punching Service.

One of the Hole Punching service's responsibilities is to detect new relayed connections and try a unilateral connection upgrade if the remote peer has public dialable addresses. Otherwise, it tries to hole punch using the DCUtr protocol.

It also required changing how local ports are chosen when dialing peers. Previously, it was always chosen by the OS according to availability. This is still done when peer reachability is unknown or public, but the listening port is used instead when the peer is unreachable.

@diegomrsantos diegomrsantos changed the title Basic version which asks peers recently connected about our nat status Hole Punching Nov 21, 2022
@codecov
Copy link

codecov bot commented Nov 22, 2022

Codecov Report

Merging #806 (f05b2c3) into unstable (b7726bf) will increase coverage by 0.04%.
The diff coverage is 85.71%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##           unstable     #806      +/-   ##
============================================
+ Coverage     84.20%   84.25%   +0.04%     
============================================
  Files            90       91       +1     
  Lines         15239    15311      +72     
============================================
+ Hits          12832    12900      +68     
- Misses         2407     2411       +4     
Impacted Files Coverage Δ
libp2p/protocols/connectivity/autonat/client.nim 99.67% <ø> (+<0.01%) ⬆️
libp2p/protocols/connectivity/autonat/service.nim 95.07% <ø> (ø)
libp2p/protocols/connectivity/dcutr/client.nim 76.08% <ø> (+4.34%) ⬆️
libp2p/protocols/connectivity/dcutr/server.nim 72.72% <ø> (ø)
libp2p/wire.nim 61.84% <0.00%> (-0.98%) ⬇️
libp2p/services/hpservice.nim 88.40% <86.88%> (ø)
libp2p/protocols/connectivity/relay/relay.nim 87.14% <100.00%> (ø)

... and 2 files with indirect coverage changes

@diegomrsantos diegomrsantos force-pushed the hole-punching branch 4 times, most recently from 869d8d2 to e7bb48d Compare November 30, 2022 11:05
Menduist
Menduist previously approved these changes Apr 14, 2023
Copy link
Contributor

@Menduist Menduist left a comment

Choose a reason for hiding this comment

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

LGTM except #881

Base automatically changed from dcutr to unstable April 14, 2023 14:23
@diegomrsantos diegomrsantos changed the base branch from unstable to addraises April 14, 2023 14:28
@diegomrsantos diegomrsantos changed the base branch from addraises to unstable April 14, 2023 14:28
@diegomrsantos diegomrsantos dismissed Menduist’s stale review April 14, 2023 14:28

The base branch was changed.

# Conflicts:
#	libp2p/multiaddress.nim
#	libp2p/protocols/connectivity/dcutr/client.nim
#	libp2p/protocols/connectivity/dcutr/core.nim
#	libp2p/protocols/connectivity/dcutr/server.nim
#	tests/testdcutr.nim
#	tests/testnative.nim
@diegomrsantos
Copy link
Contributor Author

@Menduist the tests have been fixed.

Copy link
Contributor

@Menduist Menduist left a comment

Choose a reason for hiding this comment

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

🎉

@diegomrsantos diegomrsantos merged commit a566678 into unstable Apr 18, 2023
@diegomrsantos diegomrsantos deleted the hole-punching branch April 18, 2023 10:50
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.

3 participants