From 67cd92da6b69eaa0b721473a9de304974247bb13 Mon Sep 17 00:00:00 2001 From: sergystepanov Date: Mon, 8 Jun 2026 11:07:31 +0300 Subject: [PATCH] Add IncludeLoopbackCandidate option --- pkg/config/config.yaml | 1 + pkg/config/webrtc.go | 13 +++++++------ pkg/network/webrtc/factory.go | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/pkg/config/config.yaml b/pkg/config/config.yaml index c6332696..dfb14a0b 100644 --- a/pkg/config/config.yaml +++ b/pkg/config/config.yaml @@ -436,6 +436,7 @@ webrtc: icePorts: min: max: + includeLoopbackCandidate: false # 2. select a single port to forward all ICE connections there singlePort: # override ICE candidate IP, see: https://github.com/pion/webrtc/issues/835, diff --git a/pkg/config/webrtc.go b/pkg/config/webrtc.go index 0a0fd0a2..007983f1 100644 --- a/pkg/config/webrtc.go +++ b/pkg/config/webrtc.go @@ -8,12 +8,13 @@ type Webrtc struct { Min uint16 Max uint16 } - IceIpMap string - IceLite bool - IpFilter []string - IpFilterRemote []string - SinglePort int - LogLevel int + IceIpMap string + IceLite bool + IpFilter []string + IpFilterRemote []string + IncludeLoopbackCandidate bool + SinglePort int + LogLevel int } type IceServer struct { diff --git a/pkg/network/webrtc/factory.go b/pkg/network/webrtc/factory.go index c6269655..99e02b81 100644 --- a/pkg/network/webrtc/factory.go +++ b/pkg/network/webrtc/factory.go @@ -38,7 +38,7 @@ func NewApiFactory(conf config.Webrtc, log *logger.Logger, mod ModApiFun) (api * } customLogger := NewPionLogger(log, conf.LogLevel) s := webrtc.SettingEngine{LoggerFactory: customLogger} - s.SetIncludeLoopbackCandidate(true) + s.SetIncludeLoopbackCandidate(conf.IncludeLoopbackCandidate) if conf.HasDtlsRole() { log.Info().Msgf("A custom DTLS role [%v]", conf.DtlsRole) err = s.SetAnsweringDTLSRole(webrtc.DTLSRole(conf.DtlsRole))