Support DataChannel messages larger then MaxUint16

SCTP now internally can handle larger messages

Resolves #2712
This commit is contained in:
Sean DuBois
2025-03-04 18:22:14 -08:00
committed by GitHub
parent 98a0025083
commit e4ff415b2b
12 changed files with 264 additions and 89 deletions

View File

@@ -83,6 +83,7 @@ type SettingEngine struct {
maxReceiveBufferSize uint32
enableZeroChecksum bool
rtoMax time.Duration
maxMessageSize uint32
}
sdpMediaLevelFingerprints bool
answeringDTLSRole DTLSRole
@@ -106,6 +107,14 @@ type SettingEngine struct {
dataChannelBlockWrite bool
}
func (e *SettingEngine) getSCTPMaxMessageSize() uint32 {
if e.sctp.maxMessageSize != 0 {
return e.sctp.maxMessageSize
}
return defaultMaxSCTPMessageSize
}
// getReceiveMTU returns the configured MTU. If SettingEngine's MTU is configured to 0 it returns the default.
func (e *SettingEngine) getReceiveMTU() uint {
if e.receiveMTU != 0 {
@@ -467,6 +476,12 @@ func (e *SettingEngine) EnableSCTPZeroChecksum(isEnabled bool) {
e.sctp.enableZeroChecksum = isEnabled
}
// SetSCTPMaxMessageSize sets the largest message we are willing to accept.
// Leave this 0 for the default max message size.
func (e *SettingEngine) SetSCTPMaxMessageSize(maxMessageSize uint32) {
e.sctp.maxMessageSize = maxMessageSize
}
// SetDTLSCustomerCipherSuites allows the user to specify a list of DTLS CipherSuites.
// This allow usage of Ciphers that are reserved for private usage.
func (e *SettingEngine) SetDTLSCustomerCipherSuites(customCipherSuites func() []dtls.CipherSuite) {