@@ -8,6 +8,7 @@ package webrtc
8
8
9
9
import (
10
10
"context"
11
+ "crypto/x509"
11
12
"io"
12
13
"net"
13
14
"time"
@@ -61,10 +62,15 @@ type SettingEngine struct {
61
62
SRTCP *uint
62
63
}
63
64
dtls struct {
64
- insecureSkipHelloVerify bool
65
- retransmissionInterval time.Duration
66
- ellipticCurves []dtlsElliptic.Curve
67
- connectContextMaker func() (context.Context, func())
65
+ insecureSkipHelloVerify bool
66
+ disableInsecureSkipVerify bool
67
+ retransmissionInterval time.Duration
68
+ ellipticCurves []dtlsElliptic.Curve
69
+ connectContextMaker func() (context.Context, func())
70
+ extendedMasterSecret dtls.ExtendedMasterSecretType
71
+ clientAuth *dtls.ClientAuthType
72
+ clientCAs *x509.CertPool
73
+ rootCAs *x509.CertPool
68
74
}
69
75
sctp struct {
70
76
maxReceiveBufferSize uint32
@@ -368,6 +374,12 @@ func (e *SettingEngine) SetDTLSInsecureSkipHelloVerify(skip bool) {
368
374
e.dtls.insecureSkipHelloVerify = skip
369
375
}
370
376
377
+ // SetDTLSDisableInsecureSkipVerify sets the disable skip insecure verify flag for DTLS.
378
+ // This controls whether a client verifies the server's certificate chain and host name.
379
+ func (e *SettingEngine) SetDTLSDisableInsecureSkipVerify(disable bool) {
380
+ e.dtls.disableInsecureSkipVerify = disable
381
+ }
382
+
371
383
// SetDTLSEllipticCurves sets the elliptic curves for DTLS.
372
384
func (e *SettingEngine) SetDTLSEllipticCurves(ellipticCurves ...dtlsElliptic.Curve) {
373
385
e.dtls.ellipticCurves = ellipticCurves
@@ -384,6 +396,26 @@ func (e *SettingEngine) SetDTLSConnectContextMaker(connectContextMaker func() (c
384
396
e.dtls.connectContextMaker = connectContextMaker
385
397
}
386
398
399
+ // SetDTLSExtendedMasterSecret sets the extended master secret type for DTLS.
400
+ func (e *SettingEngine) SetDTLSExtendedMasterSecret(extendedMasterSecret dtls.ExtendedMasterSecretType) {
401
+ e.dtls.extendedMasterSecret = extendedMasterSecret
402
+ }
403
+
404
+ // SetDTLSClientAuth sets the client auth type for DTLS.
405
+ func (e *SettingEngine) SetDTLSClientAuth(clientAuth dtls.ClientAuthType) {
406
+ e.dtls.clientAuth = &clientAuth
407
+ }
408
+
409
+ // SetDTLSClientCAs sets the client CA certificate pool for DTLS certificate verification.
410
+ func (e *SettingEngine) SetDTLSClientCAs(clientCAs *x509.CertPool) {
411
+ e.dtls.clientCAs = clientCAs
412
+ }
413
+
414
+ // SetDTLSRootCAs sets the root CA certificate pool for DTLS certificate verification.
415
+ func (e *SettingEngine) SetDTLSRootCAs(rootCAs *x509.CertPool) {
416
+ e.dtls.rootCAs = rootCAs
417
+ }
418
+
387
419
// SetSCTPMaxReceiveBufferSize sets the maximum receive buffer size.
388
420
// Leave this 0 for the default maxReceiveBufferSize.
389
421
func (e *SettingEngine) SetSCTPMaxReceiveBufferSize(maxReceiveBufferSize uint32) {
0 commit comments