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

Support net.PacketConn in DTLS Listener #568

Closed
hasheddan opened this issue Aug 10, 2023 · 0 comments · Fixed by #570
Closed

Support net.PacketConn in DTLS Listener #568

hasheddan opened this issue Aug 10, 2023 · 0 comments · Fixed by #570
Assignees

Comments

@hasheddan
Copy link
Contributor

Summary

After the merge of #558, we now support the use of net.PacketConn in the DTLS Client and Server. However, because the Listener is based on pion/transport's UDP Listener, we wrap the returned net.Conn in a net.PacketConn and thus are bound to using the same remote address for the duration of the session.

Motivation

Supporting changing the remote address is important following the implementation of Connection ID support, as an alternative identifier is able to be used, and sessions can update their remote address to continue communicating with the remote endpoint. However, using the wrapped net.Conn does not allow us to update the remote address, and the underlying UDP Listener will not send datagrams to an existing connection unless the IP address / port matches. This needs to be configurable when supporting Connection IDs:

  • If a connection ID is being used, datagrams should be routed based on the connection ID
  • If a connection ID not being used, datagrams should be routed based on the IP address / port

It is important to note that a single DTLS server may be serving some connections that are using connection IDs alongside others that are not. Additionally, handshake datagrams do not use the connection ID, so they must be routed based on IP address / port until the connection ID is negotiated, at which point they must switch to being routed based on connection ID.

Describe alternatives you've considered

My initial attempt was in pion/transport#252, but it became clear that this will need to be more closely integrated with pion/dtls rather than being a generic implementation used across libraries (i.e. the behavior only makes sense in the context of DTLS usage).

Additional context

Note that packetio.Buffer will also need to be ported to this library.

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 a pull request may close this issue.

1 participant