WithBindingRequestHandler sets a handler to allow applications to perform logic on incoming STUN Binding Requests. This was implemented to allow users to: - Log incoming Binding Requests for debugging - Implement draft-thatcher-ice-renomination - Implement custom CandidatePair switching logic Examp
( handler func(m *stun.Message, local, remote Candidate, pair *CandidatePair) bool, )
| 776 | // } |
| 777 | // agent, err := NewAgentWithOptions(WithBindingRequestHandler(handler)) |
| 778 | func WithBindingRequestHandler( |
| 779 | handler func(m *stun.Message, local, remote Candidate, pair *CandidatePair) bool, |
| 780 | ) AgentOption { |
| 781 | return func(a *Agent) error { |
| 782 | if a.constructed { |
| 783 | return ErrAgentOptionNotUpdatable |
| 784 | } |
| 785 | |
| 786 | a.userBindingRequestHandler = handler |
| 787 | |
| 788 | return nil |
| 789 | } |
| 790 | } |
| 791 | |
| 792 | // WithEnableUseCandidateCheckPriority enables checking for equal or higher priority when |
| 793 | // switching selected candidate pair if the peer requests USE-CANDIDATE and agent is a lite agent. |
no outgoing calls
searching dependent graphs…