Update module github.com/pion/ice/v2 to v2.3.24

Generated by renovateBot
This commit is contained in:
renovate[bot]
2024-05-02 07:36:18 +00:00
committed by Sean DuBois
parent e7cf3ba869
commit 7cad104f43
5 changed files with 46 additions and 3 deletions

View File

@@ -13,6 +13,8 @@ import (
"time"
"github.com/pion/dtls/v2/pkg/crypto/elliptic"
"github.com/pion/ice/v2"
"github.com/pion/stun"
"github.com/pion/transport/v2/test"
"github.com/stretchr/testify/assert"
)
@@ -269,3 +271,32 @@ func TestSetSCTPMaxReceiverBufferSize(t *testing.T) {
s.SetSCTPMaxReceiveBufferSize(expSize)
assert.Equal(t, expSize, s.sctp.maxReceiveBufferSize)
}
func TestSetICEBindingRequestHandler(t *testing.T) {
seenICEControlled, seenICEControlledCancel := context.WithCancel(context.Background())
seenICEControlling, seenICEControllingCancel := context.WithCancel(context.Background())
s := SettingEngine{}
s.SetICEBindingRequestHandler(func(m *stun.Message, _, _ ice.Candidate, _ *ice.CandidatePair) bool {
for _, a := range m.Attributes {
switch a.Type {
case stun.AttrICEControlled:
seenICEControlledCancel()
case stun.AttrICEControlling:
seenICEControllingCancel()
default:
}
}
return false
})
pcOffer, pcAnswer, err := NewAPI(WithSettingEngine(s)).newPair(Configuration{})
assert.NoError(t, err)
assert.NoError(t, signalPair(pcOffer, pcAnswer))
<-seenICEControlled.Done()
<-seenICEControlling.Done()
closePairNow(t, pcOffer, pcAnswer)
}