Update module github.com/pion/ice/v3 to v3.0.7

Generated by renovateBot
This commit is contained in:
renovate[bot]
2024-05-02 07:36:18 +00:00
committed by Sean DuBois
parent a97c420d0c
commit 480be18a34
5 changed files with 58 additions and 12 deletions

View File

@@ -13,6 +13,8 @@ import (
"time"
"github.com/pion/dtls/v2/pkg/crypto/elliptic"
"github.com/pion/ice/v3"
"github.com/pion/stun/v2"
"github.com/pion/transport/v3/test"
"github.com/stretchr/testify/assert"
)
@@ -278,3 +280,32 @@ func TestSetSCTPRTOMax(t *testing.T) {
s.SetSCTPRTOMax(expSize)
assert.Equal(t, expSize, s.sctp.rtoMax)
}
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)
}