From bccf7a68422f06fbb1e9b1b6422e62d4c0ca56d8 Mon Sep 17 00:00:00 2001 From: cnderrauber Date: Wed, 18 Jan 2023 16:51:49 +0800 Subject: [PATCH] Add ice mdns config (#1311) * Add use_mdns config * Update config-sample.yaml Co-authored-by: David Zhao Co-authored-by: David Zhao --- config-sample.yaml | 3 +++ pkg/config/config.go | 1 + pkg/rtc/config.go | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/config-sample.yaml b/config-sample.yaml index d56f263cc..b6439bcc1 100644 --- a/config-sample.yaml +++ b/config-sample.yaml @@ -98,6 +98,9 @@ rtc: # - 10.0.0.0/16 # excludes: # - 192.168.1.0/24 + # # Set to true to enable mDNS name candidate. This should be left disabled for most users. + # # when enabled, it will impact performance since each PeerConnection will process the same mDNS message independently + # use_mdns: true # when enabled, LiveKit will expose prometheus metrics on :6789/metrics # prometheus_port: 6789 diff --git a/pkg/config/config.go b/pkg/config/config.go index fbdc0ea6b..84b494ad8 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -81,6 +81,7 @@ type RTCConfig struct { Interfaces InterfacesConfig `yaml:"interfaces"` IPs IPsConfig `yaml:"ips"` EnableLoopbackCandidate bool `yaml:"enable_loopback_candidate"` + UseMDNS bool `yaml:"use_mdns"` // Number of packets to buffer for NACK PacketBufferSize int `yaml:"packet_buffer_size,omitempty"` diff --git a/pkg/rtc/config.go b/pkg/rtc/config.go index 507d4f9db..3f0206a54 100644 --- a/pkg/rtc/config.go +++ b/pkg/rtc/config.go @@ -90,6 +90,10 @@ func NewWebRTCConfig(conf *config.Config, externalIP string) (*WebRTCConfig, err s.SetIPFilter(filter) } + if !rtcConf.UseMDNS { + s.SetICEMulticastDNSMode(ice.MulticastDNSModeDisabled) + } + var nat1to1IPs []string // force it to the node IPs that the user has set if externalIP != "" && (conf.RTC.UseExternalIP || (conf.RTC.NodeIP != "" && !conf.RTC.NodeIPAutoGenerated)) {