mirror of
https://github.com/pion/webrtc.git
synced 2025-10-04 06:46:35 +08:00
Add replay protection setting to SettingEngine
Set windows size of each protocol by: - SetDTLSReplayProtectionWindow - SetSRTPReplayProtectionWindow - SetSRTCPReplayProtectionWindow
This commit is contained in:

committed by
Sean DuBois

parent
58338965b2
commit
438ac1eb2f
@@ -89,3 +89,30 @@ func TestSetAnsweringDTLSRole(t *testing.T) {
|
||||
assert.Error(t, s.SetAnsweringDTLSRole(DTLSRoleAuto), "SetAnsweringDTLSRole can only be called with DTLSRoleClient or DTLSRoleServer")
|
||||
assert.Error(t, s.SetAnsweringDTLSRole(DTLSRole(0)), "SetAnsweringDTLSRole can only be called with DTLSRoleClient or DTLSRoleServer")
|
||||
}
|
||||
|
||||
func TestSetReplayProtection(t *testing.T) {
|
||||
s := SettingEngine{}
|
||||
|
||||
if s.replayProtection.DTLS != nil ||
|
||||
s.replayProtection.SRTP != nil ||
|
||||
s.replayProtection.SRTCP != nil {
|
||||
t.Fatalf("SettingEngine defaults aren't as expected.")
|
||||
}
|
||||
|
||||
s.SetDTLSReplayProtectionWindow(128)
|
||||
s.SetSRTPReplayProtectionWindow(64)
|
||||
s.SetSRTCPReplayProtectionWindow(32)
|
||||
|
||||
if s.replayProtection.DTLS == nil ||
|
||||
*s.replayProtection.DTLS != 128 {
|
||||
t.Errorf("Failed to set DTLS replay protection window")
|
||||
}
|
||||
if s.replayProtection.SRTP == nil ||
|
||||
*s.replayProtection.SRTP != 64 {
|
||||
t.Errorf("Failed to set SRTP replay protection window")
|
||||
}
|
||||
if s.replayProtection.SRTCP == nil ||
|
||||
*s.replayProtection.SRTCP != 32 {
|
||||
t.Errorf("Failed to set SRTCP replay protection window")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user