-
Notifications
You must be signed in to change notification settings - Fork 160
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
IPv6 relay support #462
base: master
Are you sure you want to change the base?
IPv6 relay support #462
Conversation
@@ -598,7 +617,8 @@ func (a *Agent) gatherCandidatesRelay(ctx context.Context, urls []*URL) { //noli | |||
relayProtocol = "dtls" | |||
locConn = &fakePacketConn{conn} | |||
case url.Proto == ProtoTypeTCP && url.Scheme == SchemeTypeTURNS: | |||
conn, connectErr := tls.Dial(NetworkTypeTCP4.String(), TURNServerAddr, &tls.Config{ | |||
network = tcpNetworkType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, network
was hardcoded to NetworkTypeUDP4
even if the url.Proto == ProtoTypeTCP
.
Not sure if this was correct?
This requires no extra configuration from the user. The example in the description shows that a IPv6 address can be used, but it's not required. If a hostname is provided (e.g., |
I stand corrected. The iteration happens at a higher level than I was expecting. I need time to grok the fullness. |
I strongly support this work. IPv6 support is necessary for Pion, it greatly simplifies connectivity in many cases (e.g. in Docker containers). This version works by gathering two candidates for each double-stack TURN server, one for each address family. Two comments:
|
Yes, that sounds like a better approach. I'm thinking we should limit the max amount of addresses just in case the DNS lookup returns many IPs. For example, max 5 IPv6 and 5 IPv4 addresses per relay.
I really don't know how TCP works here, so looking for guidance. It's not clear to me why we would force IPv6/4 for UDP but not TCP. Also, will this break TLS since we will be passing IP addresses instead of hostnames? With the web/https, the hostname is checked against the cert's common name. Not sure if that's also applicable here. |
a1467ba
to
2c75bb7
Compare
Can we separate the retry logic into a separate PR? I think its unrelated to the IPv6 support.. Also pion/turn#265 might get obsolete if pion/turn#276 gets merged. |
Requires these changes: pion/turn#265
I've only tested on Linux with UDP turn servers.
This adds support for IPv6 relays. When discovering candidates, Pion will attempt to contact the turn servers via both IPv4 and IPv6. You can also specify a IPv6 literal address in the config, such as: