-
Notifications
You must be signed in to change notification settings - Fork 55
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
Add support for custom UDP connection identifiers #252
Conversation
0205010
to
c4bbfce
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #252 +/- ##
==========================================
+ Coverage 82.22% 82.50% +0.27%
==========================================
Files 34 34
Lines 3010 3023 +13
==========================================
+ Hits 2475 2494 +19
+ Misses 423 419 -4
+ Partials 112 110 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
c4bbfce
to
8012046
Compare
Adds support for custom UDP connection identifiers. If a ConnIDFn is provided, the result will be used as the identifier of a connection rather then the remote address. If a connection already exists for the remote address, its identifier will be updated to the connection ID. If the remote address for packets associated with a connection identifier changes, the remote address of the connection will also be updated. Signed-off-by: Daniel Mangum <[email protected]>
d7c00f7
to
9ed8a05
Compare
Adds unit testing to ensure that a custom UDP connection identifier results in expected behavior. Testing adheres to the following steps: 1. Initiate 5 connections using remote address as identifier. 2. Send message on each connection that results in migration from remote address identifier to custom identifier. 3. Spawn 20 clients, each assigned to send one message on one of the connections (total of 4 messages on each connection). 4. Spawn 5 servers and ensure that each receives the first initiation and set messages, then 4 messages, each originating from a different remote address. Signed-off-by: Daniel Mangum <[email protected]>
Adds Dan Mangum to AUTHORS.txt. Signed-off-by: Daniel Mangum <[email protected]>
c8dec4a
to
61d42f9
Compare
// If we have a connection associated with this connection ID, | ||
// make sure that the remote address matches. | ||
if conn, ok := l.conns[connID]; ok && conn.RemoteAddr() != raddr { | ||
conn.rAddr = raddr | ||
} |
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.
I am removing this as we should defer updating the remote address of the connection to the conn itself to allow for necessary checks, such as those required for peer address update in the DTLS Connection ID RFC: https://datatracker.ietf.org/doc/html/rfc9146#peer-address-update
However, this is tricky to do today because listener.Accept()
just gives us back a net.Conn
, which doesn't allow for modifying the internal state of the udp.Conn
.
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.
Converting this to draft for now after chat with @Sean-Der -- most of this functionality will be implemented in pion/dtls
.
I agree with @Sean-Der here. Thats a functionality which is better implememented in pion/dtls in my opinion. |
@hasheddan Can we close this PR? |
@stv0g sure 👍🏻 |
Description
Adds support for custom UDP connection identifiers. If a ConnIDFn is
provided, the result will be used as the identifier of a connection
rather then the remote address. If a connection already exists for the
remote address, its identifier will be updated to the connection ID. If
the remote address for packets associated with a connection identifier
changes, the remote address of the connection will also be updated.
Signed-off-by: Daniel Mangum [email protected]
Adds unit testing to ensure that a custom UDP connection identifier
results in expected behavior. Testing adheres to the following steps:
address identifier to custom identifier.
connections (total of 4 messages on each connection).
and set messages, then 4 messages, each originating from a different
remote address.
Signed-off-by: Daniel Mangum [email protected]
Reference issue
Part of pion/dtls#256