feat(relay-server): add default bootstrap address and improve client config usage
Set a default bootstrap address in command flags and refactor client initialization to use functional options for cleaner configuration of bootstrap servers.
lemon-mint committed
Oct 29, 2025 at 16:02 UTC
d7ece53aded971fba1177c7a458644020a6cbaca
2 files changed
+2
-4
cmd/relay-server/main.go
+1
-1
@@ -30,7 +30,7 @@ var (
30
31
func init() {
32
flags := rootCmd.PersistentFlags()
33
- flags.StringArrayVar(&flagBootstraps, "bootstraps", nil, "bootstrap addresses")
33
+ flags.StringArrayVar(&flagBootstraps, "bootstraps", []string{"ws://localhost:4017/relay"}, "bootstrap addresses")
34
flags.StringVar(&flagALPN, "alpn", "http/1.1", "ALPN identifier for this service")
35
flags.IntVar(&flagPort, "port", 4017, "admin UI and HTTP proxy port")
36
}
cmd/relay-server/view.go
+1
-3
@@ -48,9 +48,7 @@ func serveHTTP(_ context.Context, addr string, serv *relaydns.RelayServer, nodeI
48
// No TLS handling here; extend to wss if needed in future
49
bs = []string{fmt.Sprintf("%s://%s/relay", scheme, r.Host)}
50
}
51
- proxyClient, proxyClientErr = sdk.NewClient(func(c *sdk.RDClientConfig) {
52
- c.BootstrapServers = bs
53
- })
51
+ proxyClient, proxyClientErr = sdk.NewClient(sdk.WithBootstrapServers(bs))
52
})
53
return proxyClient, proxyClientErr
54
}