NAT traversal: Optimize Circuit Relays(AKA TURN) and rewrite the code to become packet oriented
@aarshkshah1992 is already working on this.
Since Nov 5, 2020.
- Dominant language
- Go
- Stars
- 6.9k
- Forks
- 1.3k
- Avg merge
- 13d 21h
- Merged PRs (30d)
- 1
Description
Circuit Relays are our last resort for NAT traversal for TCP based transports and and even for QUIC transports when hole punching fails. However, the current Relay communication is Stream oriented instead of being simple request/response style message oriented communication. There’s a lot of potential optimisation we can derive from rewriting Circuit Relays to use Message oriented Transports.
---
Based on an offline discussion with @Stebalien :
**There are two main issues with the current system:**
- All connections being one hop means every node on the network will end up connecting to every relay. This could be fixed either by:
- Every peer connects to a home relay and relays connect to each other. This will make all paths "two hop" (a -> a's relay -> b's relay -> b).
- Packet oriented protocols such that peers can establish low-cost sessions with every relay without maintaining a connection. The "everyone connects to everyone" problem is still there, but at least those connections have very low overhead.
Ideally, we'd do both of the above.
- All circuits require two goroutines, two live streams, and two locked up buffers. The fix here is to make the circuit protocol message/packet oriented. That way, relays don't need to keep state and waste resources to keep track of (often) idle connections.
**Note:** Libp2p will have to include support for Message Oriented Transports before we do this.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.