From b1ae21d263f120e051831e67d062ef1fa89a7e66 Mon Sep 17 00:00:00 2001 From: Dawei Feng Date: Thu, 1 Feb 2024 23:37:04 -0800 Subject: [PATCH] Add MaxBindingRequests to SettingEngine --- icegatherer.go | 1 + settingengine.go | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/icegatherer.go b/icegatherer.go index d80298fa9f8..76e16ce3ba8 100644 --- a/icegatherer.go +++ b/icegatherer.go @@ -122,6 +122,7 @@ func (g *ICEGatherer) createAgent() error { UDPMux: g.api.settingEngine.iceUDPMux, ProxyDialer: g.api.settingEngine.iceProxyDialer, DisableActiveTCP: g.api.settingEngine.iceDisableActiveTCP, + MaxBindingRequests: g.api.settingEngine.iceMaxBindingRequests, } requestedNetworkTypes := g.api.settingEngine.candidates.ICENetworkTypes diff --git a/settingengine.go b/settingengine.go index 1487b8fe6c0..ddf679a3535 100644 --- a/settingengine.go +++ b/settingengine.go @@ -91,6 +91,7 @@ type SettingEngine struct { disableMediaEngineCopy bool srtpProtectionProfiles []dtls.SRTPProtectionProfile receiveMTU uint + iceMaxBindingRequests *uint16 } // getReceiveMTU returns the configured MTU. If SettingEngine's MTU is configured to 0 it returns the default @@ -340,6 +341,12 @@ func (e *SettingEngine) SetICEProxyDialer(d proxy.Dialer) { e.iceProxyDialer = d } +// SetICEMaxBindingRequests sets the maximum amount of binding requests +// that can be sent on a candidate before it is considered invalid. +func (e *SettingEngine) SetICEMaxBindingRequests(d uint16) { + e.iceMaxBindingRequests = &d +} + // DisableActiveTCP disables using active TCP for ICE. Active TCP is enabled by default func (e *SettingEngine) DisableActiveTCP(isDisabled bool) { e.iceDisableActiveTCP = isDisabled