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

Allow users to pass custom 'CandidateSelectorControlling and CandidateSelectorControlled` #623

Closed
Sean-Der opened this issue Sep 24, 2023 · 3 comments · Fixed by #695
Closed

Comments

@Sean-Der
Copy link
Member

Sean-Der commented Sep 24, 2023

We have had two asks for custom ICE selection logic.

@lisay-yan in pion/webrtc#2539 wants to effectively disable ICE. Just take the best candidate right away

@gbfarah wants to always take whatever the latest traffic coming in is in pion/webrtc#2585

These are both greats ideas. However I am worried about the unintended side effects. I don't want to accidentally add a security/interoperability issue into Pion. I would like to support everyones use case though!

To do this I think we should make CandidatePairSelector a public interface (it is private now)

type CandidatePairSelector interface {
    Start(agent CandidatePairSelectorAgent)
    ContactCandidates(agent CandidatePairSelectorAgent)
    PingCandidate(agent CandidatePairSelectorAgent, local, remote Candidate)
    HandleSuccessResponse(agent CandidatePairSelectorAgent, m *stun.Message, local, remote Candidate, remoteAddr net.Addr)
    HandleBindingRequest(agent CandidatePairSelectorAgent, m *stun.Message, local, remote Candidate)
}

We will also create a new interface. This will allow us to selectively expose private APIs that users will need. We can add things as needed.

type CandidatePairSelectorAgent interface {
 GetSelectedPair()
 GetBestAvailableCandidatePair()
}

Users via AgentConfig can then pass in their CandidatePairSelectorControlling and CandidatePairSelectorControlled

@Sean-Der
Copy link
Member Author

Do you think this is an ok path forward @at-wat and @stv0g ?

@stv0g
Copy link
Member

stv0g commented Sep 25, 2023

I support the idea of making them customizable via interfaces. Its a good compromise of providing flexibility to the users without adding all these special use cases into the package itself.

Also, I think we can expect that users who implement their own versions of these interfaces really know what they are doing. This wouldnt be the case if we support these special features behind a simple boolean option.

@Sean-Der
Copy link
Member Author

Great! I will start a PR soon

Sean-Der added a commit that referenced this issue May 1, 2024
Allow the user to perform custom processing for inbound STUN Binding
requests. This allows users to do some of the following

* Log incoming Binding Requests for debugging
* Implement draft-thatcher-ice-renomination
* Implement custom CandidatePair switching logic

Resolves pion/webrtc#2539
Resolves pion/webrtc#2585
Resolves #623
Sean-Der added a commit that referenced this issue May 1, 2024
Allow the user to perform custom processing for inbound STUN Binding
requests. This allows users to do some of the following

* Log incoming Binding Requests for debugging
* Implement draft-thatcher-ice-renomination
* Implement custom CandidatePair switching logic

Resolves pion/webrtc#2539
Resolves pion/webrtc#2585
Resolves #623
Sean-Der added a commit that referenced this issue May 1, 2024
Allow the user to perform custom processing for inbound STUN Binding
requests. This allows users to do some of the following

* Log incoming Binding Requests for debugging
* Implement draft-thatcher-ice-renomination
* Implement custom CandidatePair switching logic

Resolves pion/webrtc#2539
Resolves pion/webrtc#2585
Resolves #623
Sean-Der added a commit that referenced this issue May 1, 2024
Allow the user to perform custom processing for inbound STUN Binding
requests. This allows users to do some of the following

* Log incoming Binding Requests for debugging
* Implement draft-thatcher-ice-renomination
* Implement custom CandidatePair switching logic

Resolves pion/webrtc#2539
Resolves pion/webrtc#2585
Resolves #623
Sean-Der added a commit that referenced this issue May 1, 2024
Allow the user to perform custom processing for inbound STUN Binding
requests. This allows users to do some of the following

* Log incoming Binding Requests for debugging
* Implement draft-thatcher-ice-renomination
* Implement custom CandidatePair switching logic

Resolves pion/webrtc#2539
Resolves pion/webrtc#2585
Resolves #623
Sean-Der added a commit that referenced this issue May 2, 2024
Allow the user to perform custom processing for inbound STUN Binding
requests. This allows users to do some of the following

* Log incoming Binding Requests for debugging
* Implement draft-thatcher-ice-renomination
* Implement custom CandidatePair switching logic

Resolves pion/webrtc#2539
Resolves pion/webrtc#2585
Resolves #623
Sean-Der added a commit that referenced this issue May 2, 2024
Allow the user to perform custom processing for inbound STUN Binding
requests. This allows users to do some of the following

* Log incoming Binding Requests for debugging
* Implement draft-thatcher-ice-renomination
* Implement custom CandidatePair switching logic

Resolves pion/webrtc#2539
Resolves pion/webrtc#2585
Resolves #623
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.

2 participants