Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSDK-4334 add option to disable server discovery via mdns #2826

Merged
merged 4 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions robot/web/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ type Options struct {

WebRTCOnPeerAdded func(pc *webrtc.PeerConnection)
WebRTCOnPeerRemoved func(pc *webrtc.PeerConnection)

MulticastDNS bool
}

// New returns a default set of options which will have the
Expand Down
4 changes: 4 additions & 0 deletions robot/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,10 @@ func (svc *webService) initRPCOptions(listenerTCPAddr *net.TCPAddr, options webo
OnPeerRemoved: options.WebRTCOnPeerRemoved,
}),
}
if !options.MulticastDNS {
rpcOpts = append(rpcOpts, rpc.WithDisableMulticastDNS())
}

var unaryInterceptors []googlegrpc.UnaryServerInterceptor

unaryInterceptors = append(unaryInterceptors, ensureTimeoutUnaryInterceptor)
Expand Down
2 changes: 2 additions & 0 deletions web/server/entrypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)"`
MulticastDNS bool `flag:"mdns,default=true,usage=enable server discovery through multicast DNS"`
}

type robotServer struct {
Expand Down Expand Up @@ -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.MulticastDNS = s.args.MulticastDNS
if cfg.Cloud != nil && s.args.AllowInsecureCreds {
options.SignalingDialOpts = append(options.SignalingDialOpts, rpc.WithAllowInsecureWithCredentialsDowngrade())
}
Expand Down