mirror of
https://github.com/pion/webrtc.git
synced 2025-09-27 11:32:19 +08:00
Add SetDTLSConnectContextMaker to SettingEngine
Allows a user to set the context used during the DTLS Handshake. This can be used to extend or reduce the timeout on the DTLS Handshake. Resolves #2477
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
package webrtc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net"
|
||||
"time"
|
||||
@@ -63,6 +64,7 @@ type SettingEngine struct {
|
||||
insecureSkipHelloVerify bool
|
||||
retransmissionInterval time.Duration
|
||||
ellipticCurves []dtlsElliptic.Curve
|
||||
connectContextMaker func() (context.Context, func())
|
||||
}
|
||||
sctp struct {
|
||||
maxReceiveBufferSize uint32
|
||||
@@ -368,6 +370,17 @@ func (e *SettingEngine) SetDTLSEllipticCurves(ellipticCurves ...dtlsElliptic.Cur
|
||||
e.dtls.ellipticCurves = ellipticCurves
|
||||
}
|
||||
|
||||
// SetDTLSConnectContextMaker sets the context used during the DTLS Handshake.
|
||||
// It can be used to extend or reduce the timeout on the DTLS Handshake.
|
||||
// If nil, the default dtls.ConnectContextMaker is used. It can be implemented as following.
|
||||
//
|
||||
// func ConnectContextMaker() (context.Context, func()) {
|
||||
// return context.WithTimeout(context.Background(), 30*time.Second)
|
||||
// }
|
||||
func (e *SettingEngine) SetDTLSConnectContextMaker(connectContextMaker func() (context.Context, func())) {
|
||||
e.dtls.connectContextMaker = connectContextMaker
|
||||
}
|
||||
|
||||
// SetSCTPMaxReceiveBufferSize sets the maximum receive buffer size.
|
||||
// Leave this 0 for the default maxReceiveBufferSize.
|
||||
func (e *SettingEngine) SetSCTPMaxReceiveBufferSize(maxReceiveBufferSize uint32) {
|
||||
|
Reference in New Issue
Block a user