From e10c98b3d1e8c57ad050841168adb41b77be8e25 Mon Sep 17 00:00:00 2001 From: Maxim Pertsov Date: Wed, 23 Aug 2023 12:41:21 -0400 Subject: [PATCH 1/4] add option to disable server discovery via mdns --- robot/web/options/options.go | 2 ++ robot/web/web.go | 4 ++++ web/server/entrypoint.go | 2 ++ 3 files changed, 8 insertions(+) diff --git a/robot/web/options/options.go b/robot/web/options/options.go index 891871d13d4..881a909ce04 100644 --- a/robot/web/options/options.go +++ b/robot/web/options/options.go @@ -67,6 +67,8 @@ type Options struct { WebRTCOnPeerAdded func(pc *webrtc.PeerConnection) WebRTCOnPeerRemoved func(pc *webrtc.PeerConnection) + + DisableMulticastDNS bool } // New returns a default set of options which will have the diff --git a/robot/web/web.go b/robot/web/web.go index e1b03af9181..4cce690fd2a 100644 --- a/robot/web/web.go +++ b/robot/web/web.go @@ -927,6 +927,10 @@ func (svc *webService) initRPCOptions(listenerTCPAddr *net.TCPAddr, options webo OnPeerRemoved: options.WebRTCOnPeerRemoved, }), } + if options.DisableMulticastDNS { + rpcOpts = append(rpcOpts, rpc.WithDisableMulticastDNS()) + } + var unaryInterceptors []googlegrpc.UnaryServerInterceptor unaryInterceptors = append(unaryInterceptors, ensureTimeoutUnaryInterceptor) diff --git a/web/server/entrypoint.go b/web/server/entrypoint.go index 5603d6a16e9..dd023d83fde 100644 --- a/web/server/entrypoint.go +++ b/web/server/entrypoint.go @@ -54,6 +54,7 @@ type Arguments struct { RevealSensitiveConfigDiffs bool `flag:"reveal-sensitive-config-diffs,usage=show config diffs"` UntrustedEnv bool `flag:"untrusted-env,usage=disable processes and shell from running in a untrusted environment"` OutputTelemetry bool `flag:"output-telemetry,usage=print out telemetry data (metrics and spans)"` + DisableMulticastDNS bool `flag:"disable-mdns,usage=disable server discovery through multicast DNS"` } type robotServer struct { @@ -198,6 +199,7 @@ func (s *robotServer) createWebOptions(cfg *config.Config) (weboptions.Options, options.SharedDir = s.args.SharedDir options.Debug = s.args.Debug || cfg.Debug options.WebRTC = s.args.WebRTC + options.DisableMulticastDNS = s.args.DisableMulticastDNS if cfg.Cloud != nil && s.args.AllowInsecureCreds { options.SignalingDialOpts = append(options.SignalingDialOpts, rpc.WithAllowInsecureWithCredentialsDowngrade()) } From 6b7c51fc044b444ef7c4382a04ced09289139012 Mon Sep 17 00:00:00 2001 From: Maxim Pertsov Date: Wed, 23 Aug 2023 17:53:20 -0400 Subject: [PATCH 2/4] be positive --- robot/web/options/options.go | 2 +- robot/web/web.go | 2 +- web/server/entrypoint.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/robot/web/options/options.go b/robot/web/options/options.go index 881a909ce04..b47c6ae0300 100644 --- a/robot/web/options/options.go +++ b/robot/web/options/options.go @@ -68,7 +68,7 @@ type Options struct { WebRTCOnPeerAdded func(pc *webrtc.PeerConnection) WebRTCOnPeerRemoved func(pc *webrtc.PeerConnection) - DisableMulticastDNS bool + MulticastDNS bool } // New returns a default set of options which will have the diff --git a/robot/web/web.go b/robot/web/web.go index 4cce690fd2a..5843ead75bf 100644 --- a/robot/web/web.go +++ b/robot/web/web.go @@ -927,7 +927,7 @@ func (svc *webService) initRPCOptions(listenerTCPAddr *net.TCPAddr, options webo OnPeerRemoved: options.WebRTCOnPeerRemoved, }), } - if options.DisableMulticastDNS { + if !options.MulticastDNS { rpcOpts = append(rpcOpts, rpc.WithDisableMulticastDNS()) } diff --git a/web/server/entrypoint.go b/web/server/entrypoint.go index dd023d83fde..de794276058 100644 --- a/web/server/entrypoint.go +++ b/web/server/entrypoint.go @@ -54,7 +54,7 @@ type Arguments struct { RevealSensitiveConfigDiffs bool `flag:"reveal-sensitive-config-diffs,usage=show config diffs"` UntrustedEnv bool `flag:"untrusted-env,usage=disable processes and shell from running in a untrusted environment"` OutputTelemetry bool `flag:"output-telemetry,usage=print out telemetry data (metrics and spans)"` - DisableMulticastDNS bool `flag:"disable-mdns,usage=disable server discovery through multicast DNS"` + MulticastDNS bool `flag:"mdns,default=true,usage=enable server discovery through multicast DNS"` } type robotServer struct { @@ -199,7 +199,7 @@ func (s *robotServer) createWebOptions(cfg *config.Config) (weboptions.Options, options.SharedDir = s.args.SharedDir options.Debug = s.args.Debug || cfg.Debug options.WebRTC = s.args.WebRTC - options.DisableMulticastDNS = s.args.DisableMulticastDNS + options.MulticastDNS = s.args.MulticastDNS if cfg.Cloud != nil && s.args.AllowInsecureCreds { options.SignalingDialOpts = append(options.SignalingDialOpts, rpc.WithAllowInsecureWithCredentialsDowngrade()) } From 65993c859eeace9cd69657438bd8f308c70dcb9c Mon Sep 17 00:00:00 2001 From: Maxim Pertsov Date: Thu, 24 Aug 2023 09:15:17 -0400 Subject: [PATCH 3/4] keep mdns toggle negative on struct --- robot/web/options/options.go | 2 +- robot/web/web.go | 2 +- web/server/entrypoint.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/robot/web/options/options.go b/robot/web/options/options.go index b47c6ae0300..881a909ce04 100644 --- a/robot/web/options/options.go +++ b/robot/web/options/options.go @@ -68,7 +68,7 @@ type Options struct { WebRTCOnPeerAdded func(pc *webrtc.PeerConnection) WebRTCOnPeerRemoved func(pc *webrtc.PeerConnection) - MulticastDNS bool + DisableMulticastDNS bool } // New returns a default set of options which will have the diff --git a/robot/web/web.go b/robot/web/web.go index 5843ead75bf..4cce690fd2a 100644 --- a/robot/web/web.go +++ b/robot/web/web.go @@ -927,7 +927,7 @@ func (svc *webService) initRPCOptions(listenerTCPAddr *net.TCPAddr, options webo OnPeerRemoved: options.WebRTCOnPeerRemoved, }), } - if !options.MulticastDNS { + if options.DisableMulticastDNS { rpcOpts = append(rpcOpts, rpc.WithDisableMulticastDNS()) } diff --git a/web/server/entrypoint.go b/web/server/entrypoint.go index de794276058..2c7eb93dca5 100644 --- a/web/server/entrypoint.go +++ b/web/server/entrypoint.go @@ -199,7 +199,7 @@ func (s *robotServer) createWebOptions(cfg *config.Config) (weboptions.Options, options.SharedDir = s.args.SharedDir options.Debug = s.args.Debug || cfg.Debug options.WebRTC = s.args.WebRTC - options.MulticastDNS = s.args.MulticastDNS + options.DisableMulticastDNS = !s.args.MulticastDNS if cfg.Cloud != nil && s.args.AllowInsecureCreds { options.SignalingDialOpts = append(options.SignalingDialOpts, rpc.WithAllowInsecureWithCredentialsDowngrade()) } From 9442787991fc7fc7674941743672796fd9b1f771 Mon Sep 17 00:00:00 2001 From: Maxim Pertsov Date: Thu, 24 Aug 2023 13:02:10 -0400 Subject: [PATCH 4/4] Revert "be positive" This reverts commit 6b7c51fc044b444ef7c4382a04ced09289139012. --- web/server/entrypoint.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/server/entrypoint.go b/web/server/entrypoint.go index 2c7eb93dca5..dd023d83fde 100644 --- a/web/server/entrypoint.go +++ b/web/server/entrypoint.go @@ -54,7 +54,7 @@ type Arguments struct { RevealSensitiveConfigDiffs bool `flag:"reveal-sensitive-config-diffs,usage=show config diffs"` UntrustedEnv bool `flag:"untrusted-env,usage=disable processes and shell from running in a untrusted environment"` OutputTelemetry bool `flag:"output-telemetry,usage=print out telemetry data (metrics and spans)"` - MulticastDNS bool `flag:"mdns,default=true,usage=enable server discovery through multicast DNS"` + DisableMulticastDNS bool `flag:"disable-mdns,usage=disable server discovery through multicast DNS"` } type robotServer struct { @@ -199,7 +199,7 @@ func (s *robotServer) createWebOptions(cfg *config.Config) (weboptions.Options, options.SharedDir = s.args.SharedDir options.Debug = s.args.Debug || cfg.Debug options.WebRTC = s.args.WebRTC - options.DisableMulticastDNS = !s.args.MulticastDNS + options.DisableMulticastDNS = s.args.DisableMulticastDNS if cfg.Cloud != nil && s.args.AllowInsecureCreds { options.SignalingDialOpts = append(options.SignalingDialOpts, rpc.WithAllowInsecureWithCredentialsDowngrade()) }