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 all 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)

DisableMulticastDNS 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.DisableMulticastDNS {
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)"`
DisableMulticastDNS bool `flag:"disable-mdns,usage=disable server discovery through multicast DNS"`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be a "positive" option with a default of true like the corresponding -webrtc flag? personally, I would prefer to change the webrtc flag to be negative (e.g. -disable-webrtc) so the default would be false, but am hesitant to change the existing interface.

thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the two should be consistent, and I don't think we should change the existing interface, so I prefer the positive option with a default of true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left the option on the underlying struct negative since we can't change the default value on that - we get test failures otherwise: 6b7c51f

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anyway to fix the tests? I don't think the two should be different

Copy link
Contributor Author

@maximpertsov maximpertsov Aug 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed IRL, we're gonna make the new option negative

}

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