Implement SCTP Negotiation Acceleration Protocol (SNAP)#449
Implement SCTP Negotiation Acceleration Protocol (SNAP)#449fippo merged 9 commits intopion:masterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #449 +/- ##
==========================================
+ Coverage 84.13% 84.17% +0.03%
==========================================
Files 54 54
Lines 4287 4366 +79
==========================================
+ Hits 3607 3675 +68
- Misses 494 500 +6
- Partials 186 191 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
a41c9fd to
cb1762e
Compare
|
I think this is now independent of options/config but still a breaking change 😨 |
|
@fippo this should be merged after or base on #450 as an option |
|
@JoTurk problem is that sctp-init (and maxMessageSize + sctp port) should not be a config option, these are negotiated parameters. https://draft.ortc.org/#sctp-transport* had them as "capabilities" but that distinction is too fine-grained (as shown by the non-object remotePort argument) |
|
@fippo I get the point in the WebRTC context that these inputs are negotiated/signaled values. But pion/sctp as well as most of our libraries are intentionally standalone. it doesn't own SDP/signaling, We try to make our libraries less aware of the webrtc semantics as much as possible, so the only thing it should do is accept those negotiated values as inputs from the caller. In some applications these valuse can be provided by the application for example application with static maxMessageSize. Exposing them via options patterns doesn't mean "the app must pick them" and shouldn't negotiate them, it's just the mechanism for providing externally parameters to library, config or negotiated parameters, or anything else, that's all. we are adopting this pattern across all of pion libraries, and we have many users that aren't webrtc users. |
|
Noting here so I don't forget. I have a local rebase but will wait with pushing. |
|
options got merged, sorry for the conflicts. |
cc13ea6 to
9bac17b
Compare
|
not sure if comparing config's (which will be internal at some point anyway?) is needed |
|
(casting to strings was 😭 but...) |
|
@fippo I try not to be rushed with the reviews if it's still pending / experimental work, but you can ping me if you want quick or actual review, just making sure you're not being ghosted :) |
|
A review would be great but it is probably best to not to merge until some IETF folks have read the draft ;-) |
This commit adds a createAssociationWithOutOfBandTokens method that creates the SCTP association with a local and remote sctp-init token as described in draft-hancke-tsvwg-snap-00. Tokens can be generated using the newly added GenerateOutOfBandToken method and set in the sctp.Config as LocalSctpInit and RemoteSctpInit. This allows the peer connection to generate and negotiate the sctp-init attribute in the SDP which skips two network round trips.
JoTurk
left a comment
There was a problem hiding this comment.
thank you so much, this is really cool, just few comments mostly on the library's api.
association_options.go
Outdated
| c.LocalSctpInit = string(localSctpInit) | ||
| c.RemoteSctpInit = string(remoteSctpInit) |
There was a problem hiding this comment.
Since we silently fallback to regular handshake if only only one of them is set, we should return an error here if only one is set.
There was a problem hiding this comment.
but that would make taking them from the SDP and throwing them into WithSNAP harder?
There was a problem hiding this comment.
That's fair, we can add a warning later then.
There was a problem hiding this comment.
only one of both sides supporting an attribute is common enough though, see cryptex or some of the opus variants. Dumping WithSnap(nil, whatevertheremotehas) is useful
There was a problem hiding this comment.
Yes but this should be handled in pion/webrtc, no?, WithSnap(nil, remote) is a silent non-op now, and while it's convenient, it feels like a bug with our how we usually make our options APIs validate only valid inputs and return errors, i think it's not a clear contract for a public library, it feels that something is wrong. but this is more of a nit. so feel free to ignore it :)
There was a problem hiding this comment.
Yeah but that means it has to become something along the lines of
WithSnap(localAndRemoteSet ? local : nil, localAndRemoteSet ? remote : nil)
The contract is that Snap is used if both are set.
There was a problem hiding this comment.
No, We can not add WithSnap to the options in webrtc if both aren't set. example for dtls options https://github.com/pion/webrtc/blob/87b7c3ec2bd36ffc5f6a7c274c3c3dd11166cee7/dtlstransport.go#L376-L381
There was a problem hiding this comment.
updated pion/webrtc#3327 along those lines
which solves the whole string-array conversion (or does it?)
|
is this patch ready to go? |
|
heh, the timing of the options migration got indeed in the way but it is what it is. Thank you for the review(s) and the patience! (the snap branch in pion/webrtc should have most of what the migration needs, feel free to borrow) |
JoTurk
left a comment
There was a problem hiding this comment.
Thank you so much, and sorry again for all the back and forth.
Implements SCTP Negotiation Acceleration Protocol (draft-hancke-tsvwg-snap-01), allowing associations to skip the SCTP 4-way handshake by exchanging INIT chunks out-of-band via a signaling channel (e.g., SDP a=sctp-init). Based on pion/sctp#449.
implements [draft-hancke-tsvwg-snap.html](https://datatracker.ietf.org/doc/draft-hancke-tsvwg-snap/), i.e. moving the sctp handshake to out-of-band negotiation as `a=sctp-init` in the SDP which saves two network round-trips. (based on #3326, sctp changes in pion/sctp#449)
This commit adds a createAssociationWithOutOfBandTokens method that creates the SCTP association with a local and remote sctp-init token as described in draft-hancke-tsvwg-snap-00.
Tokens can be generated using the newly added GenerateOutOfBandToken method and set in the sctp.Config as LocalSctpInit and RemoteSctpInit.
This allows the peer connection to generate and negotiate the sctp-init in the SDP which skips two network round trips.
pion/WebRTC changes are in pion/webrtc#3327