diff --git a/cmd/skywire-cli/commands/config/gen.go b/cmd/skywire-cli/commands/config/gen.go index aa150c07c..d986a44cb 100644 --- a/cmd/skywire-cli/commands/config/gen.go +++ b/cmd/skywire-cli/commands/config/gen.go @@ -82,6 +82,8 @@ func init() { gHiddenFlags = append(gHiddenFlags, "noauth") genConfigCmd.Flags().BoolVarP(&isDmsgHTTP, "dmsghttp", "d", scriptExecBool("${DMSGHTTP:-false}"), "use dmsg connection to skywire services\033[0m") gHiddenFlags = append(gHiddenFlags, "dmsghttp") + genConfigCmd.Flags().IntVar(&minDmsgSess, "minsess", scriptExecInt("${MINDMSGSESS:-1}"), "number of dmsg servers to connect to (0 = unlimited)\033[0m") + gHiddenFlags = append(gHiddenFlags, "minsess") genConfigCmd.Flags().BoolVarP(&isEnableAuth, "auth", "e", false, "enable auth on hypervisor UI\033[0m") gHiddenFlags = append(gHiddenFlags, "auth") genConfigCmd.Flags().BoolVarP(&isForce, "force", "f", false, "remove pre-existing config\033[0m") @@ -127,6 +129,7 @@ func init() { gHiddenFlags = append(gHiddenFlags, "example-apps") genConfigCmd.Flags().BoolVarP(&isStdout, "stdout", "n", false, "write config to stdout\033[0m") gHiddenFlags = append(gHiddenFlags, "stdout") + genConfigCmd.Flags().BoolVarP(&isEnvs, "envs", "q", false, "show the environmental variable settings") msg = "output config" if scriptExecString("${OUTPUT}") == "" { msg += ": " + visorconfig.ConfigName @@ -155,7 +158,7 @@ func init() { gHiddenFlags = append(gHiddenFlags, "sk") genConfigCmd.Flags().BoolVarP(&isTestEnv, "testenv", "t", scriptExecBool("${TESTENV:-false}"), "use test deployment "+testConf+"\033[0m") gHiddenFlags = append(gHiddenFlags, "testenv") - genConfigCmd.Flags().BoolVarP(&isVpnServerEnable, "servevpn", "v", scriptExecBool("${SERVEVPN:-false}"), "enable vpn server\033[0m") + genConfigCmd.Flags().BoolVarP(&isVpnServerEnable, "servevpn", "v", scriptExecBool("${VPNSERVER:-false}"), "enable vpn server\033[0m") gHiddenFlags = append(gHiddenFlags, "servevpn") genConfigCmd.Flags().BoolVarP(&isHide, "hide", "w", false, "dont print the config to the terminal :: show errors with -n flag\033[0m") gHiddenFlags = append(gHiddenFlags, "hide") @@ -169,30 +172,40 @@ func init() { gHiddenFlags = append(gHiddenFlags, "stcpr") genConfigCmd.Flags().IntVar(&sudphPort, "sudph", scriptExecInt("${SUDPHPORT:-0}"), "set udp transport listening port - 0 for random\033[0m") gHiddenFlags = append(gHiddenFlags, "sudph") - genConfigCmd.Flags().BoolVar(&isAll, "all", false, "show all flags") genConfigCmd.Flags().StringVar(&binPath, "binpath", scriptExecString("${BINPATH}"), "set bin_path\033[0m") gHiddenFlags = append(gHiddenFlags, "binpath") genConfigCmd.Flags().StringVar(&addSkysocksClientSrv, "proxyclientpk", scriptExecString("${PROXYCLIENTPK}"), "set server public key for proxy client") + gHiddenFlags = append(gHiddenFlags, "proxyclientpk") genConfigCmd.Flags().BoolVar(&enableProxyClientAutostart, "startproxyclient", scriptExecBool("${STARTPROXYCLIENT:-false}"), "autostart proxy client") + gHiddenFlags = append(gHiddenFlags, "startproxyclient") genConfigCmd.Flags().BoolVar(&disableProxyServerAutostart, "noproxyserver", scriptExecBool("${NOPROXYSERVER:-false}"), "disable autostart of proxy server") + gHiddenFlags = append(gHiddenFlags, "noproxyserver") genConfigCmd.Flags().StringVar(&proxyServerPass, "proxyserverpass", scriptExecString("${PROXYSEVERPASS}"), "set proxy server password") + gHiddenFlags = append(gHiddenFlags, "proxyserverpass") genConfigCmd.Flags().StringVar(&proxyClientPass, "proxyclientpass", scriptExecString("${PROXYCLIENTPASS}"), "password for the proxy client to access the server (if needed)") + gHiddenFlags = append(gHiddenFlags, "proxyclientpass") // TODO: Password for accessing proxy client genConfigCmd.Flags().StringVar(&setVPNClientKillswitch, "killsw", scriptExecString("${VPNKS}"), "vpn client killswitch") + gHiddenFlags = append(gHiddenFlags, "killsw") genConfigCmd.Flags().StringVar(&addVPNClientSrv, "addvpn", scriptExecString("${ADDVPNPK}"), "set vpn server public key for vpn client") + gHiddenFlags = append(gHiddenFlags, "addvpn") genConfigCmd.Flags().StringVar(&addVPNClientPasscode, "vpnpass", scriptExecString("${VPNCLIENTPASS}"), "password for vpn client to access the vpn server (if needed)") + gHiddenFlags = append(gHiddenFlags, "vpnpass") genConfigCmd.Flags().StringVar(&addVPNServerPasscode, "vpnserverpass", scriptExecString("${VPNSEVERPASS}"), "set password to the vpn server") + gHiddenFlags = append(gHiddenFlags, "vpnserverpass") genConfigCmd.Flags().StringVar(&setVPNServerSecure, "secure", scriptExecString("${VPNSEVERSECURE}"), "change secure mode status of vpn server") + gHiddenFlags = append(gHiddenFlags, "secure") genConfigCmd.Flags().StringVar(&setVPNServerNetIfc, "netifc", scriptExecString("${VPNSEVERNETIFC}"), "VPN Server network interface (detected: "+getInterfaceNames()+")") - genConfigCmd.Flags().BoolVarP(&isEnvs, "envs", "q", false, "show the environmental variable settings") - gHiddenFlags = append(gHiddenFlags, "envs") + gHiddenFlags = append(gHiddenFlags, "netifc") genConfigCmd.Flags().BoolVar(&noFetch, "nofetch", false, "do not fetch the services from the service conf url") gHiddenFlags = append(gHiddenFlags, "nofetch") - genConfigCmd.Flags().StringVar(&configServicePath, "confpath", "", "path of config-service offline file") + genConfigCmd.Flags().StringVar(&configServicePath, "confpath", "", "specify service conf file (instead of fetching from URL)") + gHiddenFlags = append(gHiddenFlags, "confpath") genConfigCmd.Flags().BoolVar(&noDefaults, "nodefaults", false, "do not use hardcoded defaults for production / test services") gHiddenFlags = append(gHiddenFlags, "nodefaults") genConfigCmd.Flags().StringVar(&ver, "version", scriptExecString("${VERSION}"), "custom version testing override\033[0m") gHiddenFlags = append(gHiddenFlags, "version") + genConfigCmd.Flags().BoolVar(&isAll, "all", false, "show all flags") //show all flags on help if os.Getenv("UNHIDEFLAGS") != "1" { @@ -766,7 +779,7 @@ var genConfigCmd = &cobra.Command{ conf.Dmsg = &dmsgc.DmsgConfig{ Discovery: services.DmsgDiscovery, - SessionsCount: 1, + SessionsCount: minDmsgSess, Servers: []*disc.Entry{}, } conf.Transport = &visorconfig.Transport{ @@ -1220,6 +1233,9 @@ const envfileLinux = `# #-- Use dmsghttp to connect to the production deployment #DMSGHTTP=true +#-- Number of dmsg serverts to connect to (0 unlimits) +#MINDMSGSESS=8 + #-- Start the hypervisor interface for this visor #ISHYPERVISOR=true @@ -1319,6 +1335,9 @@ const envfileWindows = `# #-- Use dmsghttp to connect to the production deployment #$DMSGHTTP=true +#-- Number of dmsg serverts to connect to (0 unlimits) +#$MINDMSGSESS=8 + #-- Start the hypervisor interface for this visor #$ISHYPERVISOR=true diff --git a/cmd/skywire-cli/commands/config/root.go b/cmd/skywire-cli/commands/config/root.go index a09808799..33c8d2ac8 100644 --- a/cmd/skywire-cli/commands/config/root.go +++ b/cmd/skywire-cli/commands/config/root.go @@ -43,6 +43,7 @@ var ( routeSetupNodes string transportSetupPKs string isDmsgHTTP bool + minDmsgSess int isVpnServerEnable bool isDisableAuth bool isEnableAuth bool