Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

UDP support #3

Closed
wants to merge 1 commit into from
Closed

UDP support #3

wants to merge 1 commit into from

Conversation

cannium
Copy link

@cannium cannium commented Oct 3, 2018

First step for libp2p/go-libp2p#433,
also change package name to reusetransport;
no interface should be (accidentally) changed.

Btw, the tests are of very high quality and helped me a lot.

also change package name to `reusetransport`;
no interface should be changed
@Stebalien
Copy link
Member

First of all, I apologize for not getting back to you sooner on that issue. This looks like an excellent patch. Unfortunately, I'm not sure UDP reuseport is actually useful (for us, at least)

We need reuseport for TCP connections to:

  1. Open outbound connections on a port we're already listening on.
  2. Open multiple outbound connections from the same port.

However, UDP doesn't have connections. We can reuse the same port (and even the same underlying OS socket) by calling pc := net.ListenPacket("udp", ":NNNN"). From here, we can send packets to any ip/port with pc.WriteTo(buf, dest) and read incoming packets from any ip/port with pc.ReadFrom(buf).

The issue with QUIC is libp2p/go-libp2p-quic-transport#8. Basically, we just need to extract the port picking logic from this package and then reuse it in go-libp2p-quic-transport when trying to pick a connection to dial with.

@cannium
Copy link
Author

cannium commented Oct 17, 2018

I make a pull request to QUIC transport: libp2p/go-libp2p-quic-transport#34, please review @Stebalien.
Sorry for the long response time, I took a vacation recently, so...
Close this pull request for now.

@cannium cannium closed this Oct 17, 2018
@Stebalien
Copy link
Member

No need to apologize for response times, ever.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants