Hole punching
#2556
-
How can we enable |
Beta Was this translation helpful? Give feedback.
Answered by
sukunrt
Sep 5, 2023
Replies: 1 comment 3 replies
-
Use the What do you mean by testing it? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you can do
libp2p.New(EnableHolePunching(), otherOpts...)
Within libp2p, we have a bunch of tests that ensure that hole punching is doing what we want it to. These don't exactly simulate nodes behind NAT/firewall but mock only enough that we have high confidence that we're doing the right thing in most cases.
For really testing NAT traversal in unit tests you'll need to do a lot more work.
There is a draft PR that introduces such tests for hole punching. #2443 but I have no plans right now to polish it and make it reviewable. I do not see myself getting back to it for the next month. However you can see how I use the tailscale natlab package to configure hosts that appear to be behind a N…