From b0ddcf7044b22ec5a715da902e60169bb25ee25b Mon Sep 17 00:00:00 2001 From: Moses Narrow <36607567+0pcom@users.noreply.github.com> Date: Thu, 19 Jan 2023 15:27:20 -0600 Subject: [PATCH 1/6] config gen -b disable public autoconnect if dmsg is used --- CHANGELOG.md | 1 + cmd/skywire-cli/commands/config/gen.go | 8 +++++--- cmd/skywire-cli/commands/visor/ping.go | 1 - cmd/skywire-systray/skywire-systray.go | 3 +-- pkg/visor/gui.go | 3 +-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f7cc8de62..6d8cade9cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## 1.3.0 +- disable public autoconnect logic for `config gen -b` [#1439](https://github.com/skycoin/skywire/pull/1440) - Add changelog generation script [#1439](https://github.com/skycoin/skywire/pull/1439) - Fix GetRewardAddress API [#1438](https://github.com/skycoin/skywire/pull/1438) - fix release issues [#1432](https://github.com/skycoin/skywire/pull/1432) [#1434](https://github.com/skycoin/skywire/pull/1434) [#1433](https://github.com/skycoin/skywire/pull/1433) diff --git a/cmd/skywire-cli/commands/config/gen.go b/cmd/skywire-cli/commands/config/gen.go index fb5432318c..ad2c999240 100644 --- a/cmd/skywire-cli/commands/config/gen.go +++ b/cmd/skywire-cli/commands/config/gen.go @@ -31,7 +31,7 @@ func init() { gHiddenFlags = append(gHiddenFlags, "url") genConfigCmd.Flags().StringVar(&logLevel, "log-level", "info", "level of logging in config") gHiddenFlags = append(gHiddenFlags, "log-level") - genConfigCmd.Flags().BoolVarP(&isBestProtocol, "bestproto", "b", false, "best protocol (dmsg | direct) based on location") + genConfigCmd.Flags().BoolVarP(&isBestProtocol, "bestproto", "b", false, "best protocol (dmsg | direct) based on location") //this will also disable public autoconnect based on location genConfigCmd.Flags().BoolVarP(&isDisableAuth, "noauth", "c", false, "disable authentication for hypervisor UI") gHiddenFlags = append(gHiddenFlags, "noauth") genConfigCmd.Flags().BoolVarP(&isDmsgHTTP, "dmsghttp", "d", false, "use dmsg connection to skywire services") @@ -80,7 +80,7 @@ func init() { gHiddenFlags = append(gHiddenFlags, "hide") genConfigCmd.Flags().BoolVarP(&isRetainHypervisors, "retainhv", "x", false, "retain existing hypervisors with regen") gHiddenFlags = append(gHiddenFlags, "retainhv") - genConfigCmd.Flags().BoolVarP(&isPublicAutoConn, "autoconn", "y", false, "disable autoconnect to public visors") + genConfigCmd.Flags().BoolVarP(&isDisablePublicAutoConn, "autoconn", "y", false, "disable autoconnect to public visors") gHiddenFlags = append(gHiddenFlags, "hide") genConfigCmd.Flags().BoolVarP(&isPublic, "public", "z", false, "publicize visor in service discovery") gHiddenFlags = append(gHiddenFlags, "public") @@ -247,7 +247,9 @@ var genConfigCmd = &cobra.Command{ //determine best protocol if isBestProtocol && netutil.LocalProtocol() { + isDisablePublicAutoConn = true isDmsgHTTP = true + } //create the conf @@ -372,7 +374,7 @@ var genConfigCmd = &cobra.Command{ if ver != "" { conf.Common.Version = ver } - if isPublicAutoConn { + if isDisablePublicAutoConn { conf.Transport.PublicAutoconnect = false } if isPublic { diff --git a/cmd/skywire-cli/commands/visor/ping.go b/cmd/skywire-cli/commands/visor/ping.go index d7d577289e..16ad82fbaf 100644 --- a/cmd/skywire-cli/commands/visor/ping.go +++ b/cmd/skywire-cli/commands/visor/ping.go @@ -8,7 +8,6 @@ import ( "github.com/spf13/cobra" clirpc "github.com/skycoin/skywire/cmd/skywire-cli/commands/rpc" - "github.com/skycoin/skywire/cmd/skywire-cli/internal" "github.com/skycoin/skywire/pkg/visor" ) diff --git a/cmd/skywire-systray/skywire-systray.go b/cmd/skywire-systray/skywire-systray.go index 3701dd9ea6..41fc9a4508 100644 --- a/cmd/skywire-systray/skywire-systray.go +++ b/cmd/skywire-systray/skywire-systray.go @@ -12,11 +12,10 @@ import ( "sync" "time" - "github.com/skycoin/systray" - "github.com/bitfield/script" cc "github.com/ivanpirog/coloredcobra" "github.com/skycoin/skycoin/src/util/logging" + "github.com/skycoin/systray" "github.com/spf13/cobra" "github.com/skycoin/skywire/pkg/visor/visorconfig" diff --git a/pkg/visor/gui.go b/pkg/visor/gui.go index 7ea0bc7404..bc857100ed 100644 --- a/pkg/visor/gui.go +++ b/pkg/visor/gui.go @@ -15,8 +15,6 @@ import ( "sync/atomic" "time" - "github.com/skycoin/systray" - "github.com/gen2brain/dlgs" "github.com/sirupsen/logrus" "github.com/skycoin/dmsg/pkg/direct" @@ -24,6 +22,7 @@ import ( "github.com/skycoin/dmsg/pkg/dmsg" "github.com/skycoin/dmsg/pkg/dmsgget" "github.com/skycoin/dmsg/pkg/dmsghttp" + "github.com/skycoin/systray" "github.com/toqueteos/webbrowser" "github.com/skycoin/skywire-utilities/pkg/cipher" From af3cc77a779a6481dcaacae9c8b11169f98ffe18 Mon Sep 17 00:00:00 2001 From: Moses Narrow <36607567+0pcom@users.noreply.github.com> Date: Thu, 19 Jan 2023 15:31:52 -0600 Subject: [PATCH 2/6] fix link in changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d8cade9cc..7dfc7df119 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## 1.3.0 -- disable public autoconnect logic for `config gen -b` [#1439](https://github.com/skycoin/skywire/pull/1440) +- disable public autoconnect logic for `config gen -b` [#1440](https://github.com/skycoin/skywire/pull/1440) - Add changelog generation script [#1439](https://github.com/skycoin/skywire/pull/1439) - Fix GetRewardAddress API [#1438](https://github.com/skycoin/skywire/pull/1438) - fix release issues [#1432](https://github.com/skycoin/skywire/pull/1432) [#1434](https://github.com/skycoin/skywire/pull/1434) [#1433](https://github.com/skycoin/skywire/pull/1433) From e68165d527bfcf1bee643c8d7cbc6b6b24085f2e Mon Sep 17 00:00:00 2001 From: Moses Narrow <36607567+0pcom@users.noreply.github.com> Date: Thu, 19 Jan 2023 16:47:35 -0600 Subject: [PATCH 3/6] reflect changed variable name isDisablePublicAutoConn in declaration --- cmd/skywire-cli/commands/config/root.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/skywire-cli/commands/config/root.go b/cmd/skywire-cli/commands/config/root.go index 19ac397f3f..dc67437815 100644 --- a/cmd/skywire-cli/commands/config/root.go +++ b/cmd/skywire-cli/commands/config/root.go @@ -73,7 +73,7 @@ var ( conf *visorconfig.V1 isUsr bool isPublic bool - isPublicAutoConn bool + isDisablePublicAutoConn bool isDisplayNodeIP bool addExampleApps bool ) From 5863614b869b1889674cfd3c2c33414aadd462b0 Mon Sep 17 00:00:00 2001 From: Moses Narrow <36607567+0pcom@users.noreply.github.com> Date: Fri, 20 Jan 2023 09:35:23 -0600 Subject: [PATCH 4/6] make format --- cmd/skywire-cli/commands/config/root.go | 122 ++++++++++++------------ 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/cmd/skywire-cli/commands/config/root.go b/cmd/skywire-cli/commands/config/root.go index dc67437815..daf639bfdf 100644 --- a/cmd/skywire-cli/commands/config/root.go +++ b/cmd/skywire-cli/commands/config/root.go @@ -15,67 +15,67 @@ import ( var logger = logging.MustGetLogger("skywire-cli") var ( - sk cipher.SecKey - output string - confPath string - configName string //nolint Note: configName used, but golangci-lint marked it unused in wrong - isStdout bool - isRegen bool - isRetainHypervisors bool - isTestEnv bool - pText string - isPkgEnv bool - isUsrEnv bool - isHypervisor bool - hypervisorPKs string - isDmsgHTTP bool - isPublicRPC bool - isVpnServerEnable bool - isDisableAuth bool - isEnableAuth bool - selectedOS string - disableApps string - isBestProtocol bool - serviceConfURL string - services *visorconfig.Services - isForce bool - isHide bool - isAll bool - isOutUnset bool - ver string - isRoot = visorconfig.IsRoot() - svcConf = strings.ReplaceAll(utilenv.ServiceConfAddr, "http://", "") //visorconfig.DefaultServiceConfAddr - testConf = strings.ReplaceAll(utilenv.TestServiceConfAddr, "http://", "") //visorconfig.DefaultServiceConfAddr - gHiddenFlags []string - uHiddenFlags []string - binPath string - logLevel string - isPkg bool - input string - isUpdateEndpoints bool - addHypervisorPKs string - isResetHypervisor bool - setVPNClientKillswitch string - addVPNClientSrv string - addVPNClientPasscode string - isResetVPNclient bool - addVPNServerPasscode string - setVPNServerSecure string - setVPNServerAutostart string - setVPNServerNetIfc string - isResetVPNServer bool - addSkysocksClientSrv string - isResetSkysocksClient bool - skysocksPasscode string - isResetSkysocks bool - setPublicAutoconnect string - minHops int - conf *visorconfig.V1 - isUsr bool - isPublic bool - isDisablePublicAutoConn bool - isDisplayNodeIP bool - addExampleApps bool + sk cipher.SecKey + output string + confPath string + configName string //nolint Note: configName used, but golangci-lint marked it unused in wrong + isStdout bool + isRegen bool + isRetainHypervisors bool + isTestEnv bool + pText string + isPkgEnv bool + isUsrEnv bool + isHypervisor bool + hypervisorPKs string + isDmsgHTTP bool + isPublicRPC bool + isVpnServerEnable bool + isDisableAuth bool + isEnableAuth bool + selectedOS string + disableApps string + isBestProtocol bool + serviceConfURL string + services *visorconfig.Services + isForce bool + isHide bool + isAll bool + isOutUnset bool + ver string + isRoot = visorconfig.IsRoot() + svcConf = strings.ReplaceAll(utilenv.ServiceConfAddr, "http://", "") //visorconfig.DefaultServiceConfAddr + testConf = strings.ReplaceAll(utilenv.TestServiceConfAddr, "http://", "") //visorconfig.DefaultServiceConfAddr + gHiddenFlags []string + uHiddenFlags []string + binPath string + logLevel string + isPkg bool + input string + isUpdateEndpoints bool + addHypervisorPKs string + isResetHypervisor bool + setVPNClientKillswitch string + addVPNClientSrv string + addVPNClientPasscode string + isResetVPNclient bool + addVPNServerPasscode string + setVPNServerSecure string + setVPNServerAutostart string + setVPNServerNetIfc string + isResetVPNServer bool + addSkysocksClientSrv string + isResetSkysocksClient bool + skysocksPasscode string + isResetSkysocks bool + setPublicAutoconnect string + minHops int + conf *visorconfig.V1 + isUsr bool + isPublic bool + isDisablePublicAutoConn bool + isDisplayNodeIP bool + addExampleApps bool ) // RootCmd contains commands that interact with the config of local skywire-visor From 30b7e2633b5e36828a85d40eef4afbf4a37d5267 Mon Sep 17 00:00:00 2001 From: Moses Narrow <36607567+0pcom@users.noreply.github.com> Date: Fri, 20 Jan 2023 09:59:04 -0600 Subject: [PATCH 5/6] fix goimports errors in appveyor --- cmd/skywire-cli/commands/config/root.go | 122 ++++++++++++------------ 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/cmd/skywire-cli/commands/config/root.go b/cmd/skywire-cli/commands/config/root.go index daf639bfdf..19ac397f3f 100644 --- a/cmd/skywire-cli/commands/config/root.go +++ b/cmd/skywire-cli/commands/config/root.go @@ -15,67 +15,67 @@ import ( var logger = logging.MustGetLogger("skywire-cli") var ( - sk cipher.SecKey - output string - confPath string - configName string //nolint Note: configName used, but golangci-lint marked it unused in wrong - isStdout bool - isRegen bool - isRetainHypervisors bool - isTestEnv bool - pText string - isPkgEnv bool - isUsrEnv bool - isHypervisor bool - hypervisorPKs string - isDmsgHTTP bool - isPublicRPC bool - isVpnServerEnable bool - isDisableAuth bool - isEnableAuth bool - selectedOS string - disableApps string - isBestProtocol bool - serviceConfURL string - services *visorconfig.Services - isForce bool - isHide bool - isAll bool - isOutUnset bool - ver string - isRoot = visorconfig.IsRoot() - svcConf = strings.ReplaceAll(utilenv.ServiceConfAddr, "http://", "") //visorconfig.DefaultServiceConfAddr - testConf = strings.ReplaceAll(utilenv.TestServiceConfAddr, "http://", "") //visorconfig.DefaultServiceConfAddr - gHiddenFlags []string - uHiddenFlags []string - binPath string - logLevel string - isPkg bool - input string - isUpdateEndpoints bool - addHypervisorPKs string - isResetHypervisor bool - setVPNClientKillswitch string - addVPNClientSrv string - addVPNClientPasscode string - isResetVPNclient bool - addVPNServerPasscode string - setVPNServerSecure string - setVPNServerAutostart string - setVPNServerNetIfc string - isResetVPNServer bool - addSkysocksClientSrv string - isResetSkysocksClient bool - skysocksPasscode string - isResetSkysocks bool - setPublicAutoconnect string - minHops int - conf *visorconfig.V1 - isUsr bool - isPublic bool - isDisablePublicAutoConn bool - isDisplayNodeIP bool - addExampleApps bool + sk cipher.SecKey + output string + confPath string + configName string //nolint Note: configName used, but golangci-lint marked it unused in wrong + isStdout bool + isRegen bool + isRetainHypervisors bool + isTestEnv bool + pText string + isPkgEnv bool + isUsrEnv bool + isHypervisor bool + hypervisorPKs string + isDmsgHTTP bool + isPublicRPC bool + isVpnServerEnable bool + isDisableAuth bool + isEnableAuth bool + selectedOS string + disableApps string + isBestProtocol bool + serviceConfURL string + services *visorconfig.Services + isForce bool + isHide bool + isAll bool + isOutUnset bool + ver string + isRoot = visorconfig.IsRoot() + svcConf = strings.ReplaceAll(utilenv.ServiceConfAddr, "http://", "") //visorconfig.DefaultServiceConfAddr + testConf = strings.ReplaceAll(utilenv.TestServiceConfAddr, "http://", "") //visorconfig.DefaultServiceConfAddr + gHiddenFlags []string + uHiddenFlags []string + binPath string + logLevel string + isPkg bool + input string + isUpdateEndpoints bool + addHypervisorPKs string + isResetHypervisor bool + setVPNClientKillswitch string + addVPNClientSrv string + addVPNClientPasscode string + isResetVPNclient bool + addVPNServerPasscode string + setVPNServerSecure string + setVPNServerAutostart string + setVPNServerNetIfc string + isResetVPNServer bool + addSkysocksClientSrv string + isResetSkysocksClient bool + skysocksPasscode string + isResetSkysocks bool + setPublicAutoconnect string + minHops int + conf *visorconfig.V1 + isUsr bool + isPublic bool + isPublicAutoConn bool + isDisplayNodeIP bool + addExampleApps bool ) // RootCmd contains commands that interact with the config of local skywire-visor From 4fdb05dfc1d53b1faecb71b372e3171df1081e28 Mon Sep 17 00:00:00 2001 From: Moses Narrow <36607567+0pcom@users.noreply.github.com> Date: Fri, 20 Jan 2023 10:34:34 -0600 Subject: [PATCH 6/6] add accidentally omitted variable declaration --- cmd/skywire-cli/commands/config/gen.go | 6 +++--- cmd/skywire-cli/commands/config/root.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/skywire-cli/commands/config/gen.go b/cmd/skywire-cli/commands/config/gen.go index ad2c999240..ad832d8665 100644 --- a/cmd/skywire-cli/commands/config/gen.go +++ b/cmd/skywire-cli/commands/config/gen.go @@ -80,7 +80,7 @@ func init() { gHiddenFlags = append(gHiddenFlags, "hide") genConfigCmd.Flags().BoolVarP(&isRetainHypervisors, "retainhv", "x", false, "retain existing hypervisors with regen") gHiddenFlags = append(gHiddenFlags, "retainhv") - genConfigCmd.Flags().BoolVarP(&isDisablePublicAutoConn, "autoconn", "y", false, "disable autoconnect to public visors") + genConfigCmd.Flags().BoolVarP(&disablePublicAutoConn, "autoconn", "y", false, "disable autoconnect to public visors") gHiddenFlags = append(gHiddenFlags, "hide") genConfigCmd.Flags().BoolVarP(&isPublic, "public", "z", false, "publicize visor in service discovery") gHiddenFlags = append(gHiddenFlags, "public") @@ -247,7 +247,7 @@ var genConfigCmd = &cobra.Command{ //determine best protocol if isBestProtocol && netutil.LocalProtocol() { - isDisablePublicAutoConn = true + disablePublicAutoConn = true isDmsgHTTP = true } @@ -374,7 +374,7 @@ var genConfigCmd = &cobra.Command{ if ver != "" { conf.Common.Version = ver } - if isDisablePublicAutoConn { + if disablePublicAutoConn { conf.Transport.PublicAutoconnect = false } if isPublic { diff --git a/cmd/skywire-cli/commands/config/root.go b/cmd/skywire-cli/commands/config/root.go index 19ac397f3f..49590e3bcf 100644 --- a/cmd/skywire-cli/commands/config/root.go +++ b/cmd/skywire-cli/commands/config/root.go @@ -73,7 +73,7 @@ var ( conf *visorconfig.V1 isUsr bool isPublic bool - isPublicAutoConn bool + disablePublicAutoConn bool isDisplayNodeIP bool addExampleApps bool )