Skip to content

Commit ace82bd

Browse files
authored
RSDK-4334 add option to disable server discovery via mdns (viamrobotics#2826)
1 parent 39d34bc commit ace82bd

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

robot/web/options/options.go

+2
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ type Options struct {
6767

6868
WebRTCOnPeerAdded func(pc *webrtc.PeerConnection)
6969
WebRTCOnPeerRemoved func(pc *webrtc.PeerConnection)
70+
71+
DisableMulticastDNS bool
7072
}
7173

7274
// New returns a default set of options which will have the

robot/web/web.go

+4
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,10 @@ func (svc *webService) initRPCOptions(listenerTCPAddr *net.TCPAddr, options webo
927927
OnPeerRemoved: options.WebRTCOnPeerRemoved,
928928
}),
929929
}
930+
if options.DisableMulticastDNS {
931+
rpcOpts = append(rpcOpts, rpc.WithDisableMulticastDNS())
932+
}
933+
930934
var unaryInterceptors []googlegrpc.UnaryServerInterceptor
931935

932936
unaryInterceptors = append(unaryInterceptors, ensureTimeoutUnaryInterceptor)

web/server/entrypoint.go

+2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ type Arguments struct {
5454
RevealSensitiveConfigDiffs bool `flag:"reveal-sensitive-config-diffs,usage=show config diffs"`
5555
UntrustedEnv bool `flag:"untrusted-env,usage=disable processes and shell from running in a untrusted environment"`
5656
OutputTelemetry bool `flag:"output-telemetry,usage=print out telemetry data (metrics and spans)"`
57+
DisableMulticastDNS bool `flag:"disable-mdns,usage=disable server discovery through multicast DNS"`
5758
}
5859

5960
type robotServer struct {
@@ -198,6 +199,7 @@ func (s *robotServer) createWebOptions(cfg *config.Config) (weboptions.Options,
198199
options.SharedDir = s.args.SharedDir
199200
options.Debug = s.args.Debug || cfg.Debug
200201
options.WebRTC = s.args.WebRTC
202+
options.DisableMulticastDNS = s.args.DisableMulticastDNS
201203
if cfg.Cloud != nil && s.args.AllowInsecureCreds {
202204
options.SignalingDialOpts = append(options.SignalingDialOpts, rpc.WithAllowInsecureWithCredentialsDowngrade())
203205
}

0 commit comments

Comments
 (0)