Skip to content

Commit 9677e61

Browse files
committed
Move defaultSrtpProtectionProfiles to constants.go
If a user is curious about the default value when configuring SetSRTPProtectionProfiles this makes it easier to find.
1 parent 80fd6d8 commit 9677e61

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

constants.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package webrtc
22

3+
import "github.com/pion/dtls/v2"
4+
35
const (
46
// Unknown defines default public constant to use for "enum" like struct
57
// comparisons when no value was defined.
@@ -23,3 +25,7 @@ const (
2325

2426
rtpOutboundMTU = 1200
2527
)
28+
29+
func defaultSrtpProtectionProfiles() []dtls.SRTPProtectionProfile {
30+
return []dtls.SRTPProtectionProfile{dtls.SRTP_AEAD_AES_128_GCM, dtls.SRTP_AES128_CM_HMAC_SHA1_80}
31+
}

dtlstransport.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ func (t *DTLSTransport) Start(remoteParameters DTLSParameters) error {
306306
return t.api.settingEngine.srtpProtectionProfiles
307307
}
308308

309-
return []dtls.SRTPProtectionProfile{dtls.SRTP_AEAD_AES_128_GCM, dtls.SRTP_AES128_CM_HMAC_SHA1_80}
309+
return defaultSrtpProtectionProfiles()
310310
}(),
311311
ClientAuth: dtls.RequireAnyClientCert,
312312
LoggerFactory: t.api.settingEngine.LoggerFactory,

settingengine.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ func (e *SettingEngine) DetachDataChannels() {
7272
e.detach.DataChannels = true
7373
}
7474

75-
// SetSRTPProtectionProfiles overrides default srtp protection profiles
75+
// SetSRTPProtectionProfiles allows the user to override the default SRTP Protection Profiles
76+
// The default srtp protection profiles are provided by the function `defaultSrtpProtectionProfiles`
7677
func (e *SettingEngine) SetSRTPProtectionProfiles(profiles ...dtls.SRTPProtectionProfile) {
7778
e.srtpProtectionProfiles = profiles
7879
}

0 commit comments

Comments
 (0)