Skip to content

Commit 7cad104

Browse files
renovate[bot]Sean-Der
authored andcommitted
Update module github.com/pion/ice/v2 to v2.3.24
Generated by renovateBot
1 parent e7cf3ba commit 7cad104

File tree

5 files changed

+46
-3
lines changed

5 files changed

+46
-3
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.17
55
require (
66
github.com/pion/datachannel v1.5.5
77
github.com/pion/dtls/v2 v2.2.7
8-
github.com/pion/ice/v2 v2.3.15
8+
github.com/pion/ice/v2 v2.3.24
99
github.com/pion/interceptor v0.1.25
1010
github.com/pion/logging v0.2.2
1111
github.com/pion/randutil v0.1.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ github.com/pion/datachannel v1.5.5 h1:10ef4kwdjije+M9d7Xm9im2Y3O6A6ccQb0zcqZcJew
4242
github.com/pion/datachannel v1.5.5/go.mod h1:iMz+lECmfdCMqFRhXhcA/219B0SQlbpoR2V118yimL0=
4343
github.com/pion/dtls/v2 v2.2.7 h1:cSUBsETxepsCSFSxC3mc/aDo14qQLMSL+O6IjG28yV8=
4444
github.com/pion/dtls/v2 v2.2.7/go.mod h1:8WiMkebSHFD0T+dIU+UeBaoV7kDhOW5oDCzZ7WZ/F9s=
45-
github.com/pion/ice/v2 v2.3.15 h1:oCGVqnd6OWmJr4I6eQwSWn8VJDF45wIXFTjV3tyyris=
46-
github.com/pion/ice/v2 v2.3.15/go.mod h1:KXJJcZK7E8WzrBEYnV4UtqEZsGeWfHxsNqhVcVvgjxw=
45+
github.com/pion/ice/v2 v2.3.24 h1:RYgzhH/u5lH0XO+ABatVKCtRd+4U1GEaCXSMjNr13tI=
46+
github.com/pion/ice/v2 v2.3.24/go.mod h1:KXJJcZK7E8WzrBEYnV4UtqEZsGeWfHxsNqhVcVvgjxw=
4747
github.com/pion/interceptor v0.1.25 h1:pwY9r7P6ToQ3+IF0bajN0xmk/fNw/suTgaTdlwTDmhc=
4848
github.com/pion/interceptor v0.1.25/go.mod h1:wkbPYAak5zKsfpVDYMtEfWEy8D4zL+rpxCxPImLOg3Y=
4949
github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY=

icegatherer.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ func (g *ICEGatherer) createAgent() error {
122122
UDPMux: g.api.settingEngine.iceUDPMux,
123123
ProxyDialer: g.api.settingEngine.iceProxyDialer,
124124
DisableActiveTCP: g.api.settingEngine.iceDisableActiveTCP,
125+
BindingRequestHandler: g.api.settingEngine.iceBindingRequestHandler,
125126
}
126127

127128
requestedNetworkTypes := g.api.settingEngine.candidates.ICENetworkTypes

settingengine.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
dtlsElliptic "github.com/pion/dtls/v2/pkg/crypto/elliptic"
1818
"github.com/pion/ice/v2"
1919
"github.com/pion/logging"
20+
"github.com/pion/stun"
2021
"github.com/pion/transport/v2"
2122
"github.com/pion/transport/v2/packetio"
2223
"github.com/pion/transport/v2/vnet"
@@ -89,6 +90,7 @@ type SettingEngine struct {
8990
iceUDPMux ice.UDPMux
9091
iceProxyDialer proxy.Dialer
9192
iceDisableActiveTCP bool
93+
iceBindingRequestHandler func(m *stun.Message, local, remote ice.Candidate, pair *ice.CandidatePair) bool
9294
disableMediaEngineCopy bool
9395
srtpProtectionProfiles []dtls.SRTPProtectionProfile
9496
receiveMTU uint
@@ -442,3 +444,12 @@ func (e *SettingEngine) SetSCTPMaxReceiveBufferSize(maxReceiveBufferSize uint32)
442444
func (e *SettingEngine) EnableSCTPZeroChecksum(isEnabled bool) {
443445
e.sctp.enableZeroChecksum = isEnabled
444446
}
447+
448+
// SetICEBindingRequestHandler sets a callback that is fired on a STUN BindingRequest
449+
// This allows users to do things like
450+
// - Log incoming Binding Requests for debugging
451+
// - Implement draft-thatcher-ice-renomination
452+
// - Implement custom CandidatePair switching logic
453+
func (e *SettingEngine) SetICEBindingRequestHandler(bindingRequestHandler func(m *stun.Message, local, remote ice.Candidate, pair *ice.CandidatePair) bool) {
454+
e.iceBindingRequestHandler = bindingRequestHandler
455+
}

settingengine_test.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import (
1313
"time"
1414

1515
"github.com/pion/dtls/v2/pkg/crypto/elliptic"
16+
"github.com/pion/ice/v2"
17+
"github.com/pion/stun"
1618
"github.com/pion/transport/v2/test"
1719
"github.com/stretchr/testify/assert"
1820
)
@@ -269,3 +271,32 @@ func TestSetSCTPMaxReceiverBufferSize(t *testing.T) {
269271
s.SetSCTPMaxReceiveBufferSize(expSize)
270272
assert.Equal(t, expSize, s.sctp.maxReceiveBufferSize)
271273
}
274+
275+
func TestSetICEBindingRequestHandler(t *testing.T) {
276+
seenICEControlled, seenICEControlledCancel := context.WithCancel(context.Background())
277+
seenICEControlling, seenICEControllingCancel := context.WithCancel(context.Background())
278+
279+
s := SettingEngine{}
280+
s.SetICEBindingRequestHandler(func(m *stun.Message, _, _ ice.Candidate, _ *ice.CandidatePair) bool {
281+
for _, a := range m.Attributes {
282+
switch a.Type {
283+
case stun.AttrICEControlled:
284+
seenICEControlledCancel()
285+
case stun.AttrICEControlling:
286+
seenICEControllingCancel()
287+
default:
288+
}
289+
}
290+
291+
return false
292+
})
293+
294+
pcOffer, pcAnswer, err := NewAPI(WithSettingEngine(s)).newPair(Configuration{})
295+
assert.NoError(t, err)
296+
297+
assert.NoError(t, signalPair(pcOffer, pcAnswer))
298+
299+
<-seenICEControlled.Done()
300+
<-seenICEControlling.Done()
301+
closePairNow(t, pcOffer, pcAnswer)
302+
}

0 commit comments

Comments
 (0)