-
-
Notifications
You must be signed in to change notification settings - Fork 376
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
Allow overriding ICE ufrag and pwd fields #1201
Closed
achingbrain
wants to merge
2
commits into
paullouisageneau:master
from
achingbrain:feat/allow-overriding-ice-ufrag-and-pwd
Closed
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'm not a fan of exposing something so low-level in the configuration, as some developers tend to fill everything even if they don't understand what it does, and for instance they could easily mistake the fields for ICE server credentials and unknowingly break security or multiplexing.
There is also a smaller issue because ICE ufrag and pwd would change on renegotiation, and you wouldn't be able to override them from here.
I think these overrides should be set in
PeeConnection::gatherLocalCandidates()
instead, which is a method for more advanced use cases that requiresdisableAutoGathering = true
. You could add an overload:The existing method would call this new overload without
iceUfrag
andicePwd
. What do you think?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.
If I understand you correctly, the
PeerConnection
object would need to be created withdisableAutoGathering = true
and the overloadedgatherLocalCandidates
method would need to be called right aftersetLocalDescription
?I think the more moving parts like this are added, the harder it is for the caller to use the API correctly. The simplest thing to do (from the caller's perspective) would be to allow modifying the local description the same way browsers do but given that seems to be out of the question this seems fine?
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.
That's right, I admit it's cumbersome. What about an overload of
setLocalDescription()
? It would be quite straightforward, since from an API standpoint it would be similar to editing the local description betweencreateOffer()
andsetLocalDescription()
:This way it would also allow setting ICE ufrag and pwd on renegotiation.
I understand your concern but adding non-standard low-level settings for very specific use cases like this can also make it hard for most users to use the API correctly, and I'd like to prevent the main config struct from being crowded with them. Allowing the caller to modify the local description is out of the question only because it requires a huge architecture change and involves a lot more complexity only to accommodate non-standard behavior.
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.
How about passing a
LocalDescriptionInit
struct that contains the optionaliceUfrag
/icePwd
as a second optional argument tosetLocalDescription
, similar to the init arg tocreateDataChannel
?It makes implementation a little simpler and it should be non-breaking that way?
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.
It looks good to me!
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've been trying to implement this but it's not straightforward without getting deeply into the internal state of the peer connection.
The general flow is to create a peer connection, open a datachannel, then exchange offers/answers, etc.
I need to be able to set the ufrag/pwd during the initialisation of the ICE transport, which is done as a side-effect of calling
setLocalDescription
when negotiation is needed.negotiationNeeded
flagnegotiaionNeeded
flag seems wronginit
field in.I might be able to skip some of it by setting the
negotiationNeeded
config option tofalse
but then the calling code is responsible for coordinating the two peers which is very complicated and I think will result in something quite fragile.I'm now pretty far from the stated aim of just being able to set a
ufrag
/pwd
instead of randomly generating them.Setting it as a config option as per this PR is much simpler? There's no need to worry about state then, and the concern of developers filling in the field without knowing what it is for can be solved with documentation?
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.
There should be no need for deep modifications, you only need to set
disableAutoNegotiation = true
in the config. This way, the library won't callsetLocalDescription()
internally and you can do so yourself with the init field just after creating the data channel.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.
Aha, I was awaiting the wrong promise during the handshake so everything was grinding to a halt. #1207 implements the local description init arg.