From 73dd331c7cbe62afa9234d0275d27c365694a227 Mon Sep 17 00:00:00 2001 From: Sir Darkrengarius Date: Fri, 5 Jun 2020 16:33:24 +0300 Subject: [PATCH 01/11] Fix updater interval panic Former-commit-id: 1a066c26aabd0be4fd347cc0d169a704ce666dc0 --- pkg/app/appdisc/factory.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/app/appdisc/factory.go b/pkg/app/appdisc/factory.go index 9c5f7598cf..21859523ac 100644 --- a/pkg/app/appdisc/factory.go +++ b/pkg/app/appdisc/factory.go @@ -66,7 +66,8 @@ func (f *Factory) Updater(conf appcommon.ProcConfig) (Updater, bool) { }, true case skyenv.VPNServerName: return &proxyUpdater{ - client: servicedisc.NewClient(log, getServiceDiscConf(conf, servicedisc.ServiceTypeVPN)), + client: servicedisc.NewClient(log, getServiceDiscConf(conf, servicedisc.ServiceTypeVPN)), + interval: f.UpdateInterval, }, true default: return &emptyUpdater{}, false From 4f0b3e6bf74fa65d009065c19053cd2ef3b2b6fa Mon Sep 17 00:00:00 2001 From: Sir Darkrengarius Date: Mon, 8 Jun 2020 09:51:22 +0300 Subject: [PATCH 02/11] Add TODO Former-commit-id: c3ef017f941aa6d6bc0450232396d9c9dffb00db --- pkg/app/appdisc/factory.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/app/appdisc/factory.go b/pkg/app/appdisc/factory.go index 21859523ac..7f10cd2b08 100644 --- a/pkg/app/appdisc/factory.go +++ b/pkg/app/appdisc/factory.go @@ -65,6 +65,7 @@ func (f *Factory) Updater(conf appcommon.ProcConfig) (Updater, bool) { interval: f.UpdateInterval, }, true case skyenv.VPNServerName: + // TODO: rename return &proxyUpdater{ client: servicedisc.NewClient(log, getServiceDiscConf(conf, servicedisc.ServiceTypeVPN)), interval: f.UpdateInterval, From c8d168bec6ee8de7bfa05f247ceab2cf8b2aa425 Mon Sep 17 00:00:00 2001 From: Sir Darkrengarius Date: Mon, 8 Jun 2020 09:53:02 +0300 Subject: [PATCH 03/11] Rename `proxyUpdater` => `serviceUpdater` Former-commit-id: 75ccfa792dc016a5137b16f531784def00c5a9ea --- pkg/app/appdisc/discovery_updater.go | 10 +++++----- pkg/app/appdisc/factory.go | 5 ++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/pkg/app/appdisc/discovery_updater.go b/pkg/app/appdisc/discovery_updater.go index 4e53a0d6ce..fb5bd0c558 100644 --- a/pkg/app/appdisc/discovery_updater.go +++ b/pkg/app/appdisc/discovery_updater.go @@ -29,8 +29,8 @@ func (emptyUpdater) Start() {} func (emptyUpdater) Stop() {} func (emptyUpdater) ChangeValue(name string, v []byte) error { return nil } -// proxyUpdater updates proxy-discovery entry of locally running skysocks App. -type proxyUpdater struct { +// serviceUpdater updates service-discovery entry of locally running App. +type serviceUpdater struct { client *servicedisc.HTTPClient interval time.Duration @@ -39,7 +39,7 @@ type proxyUpdater struct { mu sync.Mutex } -func (u *proxyUpdater) Start() { +func (u *serviceUpdater) Start() { u.mu.Lock() defer u.mu.Unlock() @@ -57,7 +57,7 @@ func (u *proxyUpdater) Start() { }() } -func (u *proxyUpdater) Stop() { +func (u *serviceUpdater) Stop() { u.mu.Lock() defer u.mu.Unlock() @@ -70,7 +70,7 @@ func (u *proxyUpdater) Stop() { u.wg.Wait() } -func (u *proxyUpdater) ChangeValue(name string, v []byte) error { +func (u *serviceUpdater) ChangeValue(name string, v []byte) error { switch name { case ConnCountValue: n, err := strconv.Atoi(string(v)) diff --git a/pkg/app/appdisc/factory.go b/pkg/app/appdisc/factory.go index 7f10cd2b08..38e75245aa 100644 --- a/pkg/app/appdisc/factory.go +++ b/pkg/app/appdisc/factory.go @@ -60,13 +60,12 @@ func (f *Factory) Updater(conf appcommon.ProcConfig) (Updater, bool) { switch conf.AppName { case skyenv.SkysocksName: - return &proxyUpdater{ + return &serviceUpdater{ client: servicedisc.NewClient(log, getServiceDiscConf(conf, servicedisc.ServiceTypeProxy)), interval: f.UpdateInterval, }, true case skyenv.VPNServerName: - // TODO: rename - return &proxyUpdater{ + return &serviceUpdater{ client: servicedisc.NewClient(log, getServiceDiscConf(conf, servicedisc.ServiceTypeVPN)), interval: f.UpdateInterval, }, true From af8f8815adcd44899b26a0e737003d5adc1422a5 Mon Sep 17 00:00:00 2001 From: Sir Darkrengarius Date: Mon, 8 Jun 2020 10:36:00 +0300 Subject: [PATCH 04/11] Make address resolvers non-required to run VPN client Former-commit-id: 53f57deef24ae0462aad2f88c6dacadb1e5763b3 --- internal/vpn/client.go | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/internal/vpn/client.go b/internal/vpn/client.go index 2dcd99847d..7ec9e9afd4 100644 --- a/internal/vpn/client.go +++ b/internal/vpn/client.go @@ -58,21 +58,35 @@ func NewClient(cfg ClientConfig, l logrus.FieldLogger, conn net.Conn) (*Client, return nil, fmt.Errorf("error getting STCP entities: %w", err) } - stcprARip, err := stcprAddressResolverIPFromEnv() - if err != nil { - return nil, fmt.Errorf("error getting stcpr AR IP: %w", err) + var stcprARip net.IP + if _, ok := os.LookupEnv(STCPRAddressResolverAddrEnvKey); ok { + stcprARip, err = stcprAddressResolverIPFromEnv() + if err != nil { + return nil, fmt.Errorf("error getting stcpr AR IP: %w", err) + } } - stcphARip, err := stcphAddressResolverIPFromEnv() - if err != nil { - return nil, fmt.Errorf("error getting stcph AR IP: %w", err) + var stcphARip net.IP + if _, ok := os.LookupEnv(STCPHAddressResolverAddrEnvKey); ok { + stcphARip, err = stcphAddressResolverIPFromEnv() + if err != nil { + return nil, fmt.Errorf("error getting stcph AR IP: %w", err) + } } - directIPs := make([]net.IP, 0, 5+len(dmsgSrvAddrs)+len(stcpEntities)) - directIPs = append(directIPs, dmsgDiscIP, tpDiscIP, rfIP, stcprARip, stcphARip) + directIPs := make([]net.IP, 0, 3+len(dmsgSrvAddrs)+len(stcpEntities)) + directIPs = append(directIPs, dmsgDiscIP, tpDiscIP, rfIP) directIPs = append(directIPs, dmsgSrvAddrs...) directIPs = append(directIPs, stcpEntities...) + if stcprARip != nil { + directIPs = append(directIPs, stcprARip) + } + + if stcphARip != nil { + directIPs = append(directIPs, stcphARip) + } + defaultGateway, err := DefaultNetworkGateway() if err != nil { return nil, fmt.Errorf("error getting default network gateway: %w", err) From ac7d185ffbeb167774da74ee550a7ab8a7cb547a Mon Sep 17 00:00:00 2001 From: Sir Darkrengarius Date: Mon, 8 Jun 2020 16:01:32 +0300 Subject: [PATCH 05/11] Add debug logs Former-commit-id: 264b3922d014853e63832bf982231dda0b8063c1 --- internal/vpn/client.go | 2 ++ pkg/visor/init.go | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/internal/vpn/client.go b/internal/vpn/client.go index 7ec9e9afd4..624a58f17d 100644 --- a/internal/vpn/client.go +++ b/internal/vpn/client.go @@ -33,6 +33,8 @@ type Client struct { // NewClient creates VPN client instance. func NewClient(cfg ClientConfig, l logrus.FieldLogger, conn net.Conn) (*Client, error) { + l.Infof("DMSG DISC ENV: %s", os.Getenv(DmsgDiscAddrEnvKey)) + dmsgDiscIP, err := dmsgDiscIPFromEnv() if err != nil { return nil, fmt.Errorf("error getting Dmsg discovery IP: %w", err) diff --git a/pkg/visor/init.go b/pkg/visor/init.go index 2bcf9b0ce1..247ec4c996 100644 --- a/pkg/visor/init.go +++ b/pkg/visor/init.go @@ -274,6 +274,8 @@ func makeVPNEnvs(conf *visorconfig.V1, n *snet.Network) ([]string, error) { if conf.Dmsg != nil { envCfg.DmsgDiscovery = conf.Dmsg.Discovery + fmt.Printf("VISOR CONF DMSG DISC: %v\n", conf.Dmsg.Discovery) + r := netutil.NewRetrier(logrus.New(), 1*time.Second, 10*time.Second, 0, 1) err := r.Do(context.Background(), func() error { for _, ses := range n.Dmsg().AllSessions() { @@ -290,6 +292,8 @@ func makeVPNEnvs(conf *visorconfig.V1, n *snet.Network) ([]string, error) { if err != nil { return nil, fmt.Errorf("error getting Dmsg servers: %w", err) } + } else { + fmt.Println("DMSG IS NIL IN VISOR CONF") } if conf.Transport != nil { envCfg.TPDiscovery = conf.Transport.Discovery @@ -312,6 +316,8 @@ func makeVPNEnvs(conf *visorconfig.V1, n *snet.Network) ([]string, error) { envMap := vpn.AppEnvArgs(envCfg) + fmt.Printf("DMSG DISC IN ENV MAP: %v\n", envMap[vpn.DmsgDiscAddrEnvKey]) + envs := make([]string, 0, len(envMap)) for k, v := range vpn.AppEnvArgs(envCfg) { envs = append(envs, fmt.Sprintf("%s=%s", k, v)) From 63434c4cb99b3f9d4e70e56cf24404ee72b4bec4 Mon Sep 17 00:00:00 2001 From: Sir Darkrengarius Date: Mon, 8 Jun 2020 16:40:49 +0300 Subject: [PATCH 06/11] Fix debug logs Former-commit-id: 47ed1f7b448886665df8a69888ed89b0c0949eab --- pkg/visor/init.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/visor/init.go b/pkg/visor/init.go index 247ec4c996..852d6b4530 100644 --- a/pkg/visor/init.go +++ b/pkg/visor/init.go @@ -8,6 +8,8 @@ import ( "sync" "time" + "github.com/SkycoinProject/skycoin/src/util/logging" + "github.com/SkycoinProject/dmsg" "github.com/SkycoinProject/dmsg/cipher" "github.com/SkycoinProject/dmsg/netutil" @@ -268,13 +270,13 @@ func initLauncher(v *Visor) bool { return report(nil) } -func makeVPNEnvs(conf *visorconfig.V1, n *snet.Network) ([]string, error) { +func makeVPNEnvs(conf *visorconfig.V1, n *snet.Network, l *logging.Logger) ([]string, error) { var envCfg vpn.DirectRoutesEnvConfig if conf.Dmsg != nil { envCfg.DmsgDiscovery = conf.Dmsg.Discovery - fmt.Printf("VISOR CONF DMSG DISC: %v\n", conf.Dmsg.Discovery) + l.Infof("VISOR CONF DMSG DISC: %v", conf.Dmsg.Discovery) r := netutil.NewRetrier(logrus.New(), 1*time.Second, 10*time.Second, 0, 1) err := r.Do(context.Background(), func() error { @@ -293,7 +295,7 @@ func makeVPNEnvs(conf *visorconfig.V1, n *snet.Network) ([]string, error) { return nil, fmt.Errorf("error getting Dmsg servers: %w", err) } } else { - fmt.Println("DMSG IS NIL IN VISOR CONF") + l.Infoln("DMSG IS NIL IN VISOR CONF") } if conf.Transport != nil { envCfg.TPDiscovery = conf.Transport.Discovery @@ -316,10 +318,10 @@ func makeVPNEnvs(conf *visorconfig.V1, n *snet.Network) ([]string, error) { envMap := vpn.AppEnvArgs(envCfg) - fmt.Printf("DMSG DISC IN ENV MAP: %v\n", envMap[vpn.DmsgDiscAddrEnvKey]) + l.Infof("DMSG DISC IN ENV MAP: %v", envMap[vpn.DmsgDiscAddrEnvKey]) envs := make([]string, 0, len(envMap)) - for k, v := range vpn.AppEnvArgs(envCfg) { + for k, v := range envMap { envs = append(envs, fmt.Sprintf("%s=%s", k, v)) } From 59e8ae298b82ddd83c922cf0e1afb761992558c2 Mon Sep 17 00:00:00 2001 From: Sir Darkrengarius Date: Mon, 8 Jun 2020 16:43:27 +0300 Subject: [PATCH 07/11] Fix Former-commit-id: 395ee0802a22105978c14a5ebbf7e2ae9f6ed077 --- pkg/visor/init.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/visor/init.go b/pkg/visor/init.go index 852d6b4530..9494fbec51 100644 --- a/pkg/visor/init.go +++ b/pkg/visor/init.go @@ -258,8 +258,8 @@ func initLauncher(v *Visor) bool { return report(fmt.Errorf("failed to start launcher: %w", err)) } err = launch.AutoStart(map[string]func() ([]string, error){ - skyenv.VPNClientName: func() ([]string, error) { return makeVPNEnvs(v.conf, v.net) }, - skyenv.VPNServerName: func() ([]string, error) { return makeVPNEnvs(v.conf, v.net) }, + skyenv.VPNClientName: func() ([]string, error) { return makeVPNEnvs(v.conf, v.net, launchLog) }, + skyenv.VPNServerName: func() ([]string, error) { return makeVPNEnvs(v.conf, v.net, launchLog) }, }) if err != nil { return report(fmt.Errorf("failed to autostart apps: %w", err)) From 3b20385328dea03d1c6265a3a7089d16806b4160 Mon Sep 17 00:00:00 2001 From: Sir Darkrengarius Date: Mon, 8 Jun 2020 16:50:01 +0300 Subject: [PATCH 08/11] Add binaries Former-commit-id: 582c8777b12400caea4aaa1108bfa0e0add15838 --- .gitignore | 4 ++-- apps/helloworld.REMOVED.git-id | 1 + apps/helloworld.v1.0.REMOVED.git-id | 1 + apps/skychat.REMOVED.git-id | 1 + apps/skychat.v1.0.REMOVED.git-id | 1 + apps/skysocks-client.REMOVED.git-id | 1 + apps/skysocks-client.v1.0.REMOVED.git-id | 1 + apps/skysocks.REMOVED.git-id | 1 + apps/skysocks.v1.0.REMOVED.git-id | 1 + apps/vpn-client.REMOVED.git-id | 1 + apps/vpn-server.REMOVED.git-id | 1 + skywire-visor.REMOVED.git-id | 1 + 12 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 apps/helloworld.REMOVED.git-id create mode 100644 apps/helloworld.v1.0.REMOVED.git-id create mode 100644 apps/skychat.REMOVED.git-id create mode 100644 apps/skychat.v1.0.REMOVED.git-id create mode 100644 apps/skysocks-client.REMOVED.git-id create mode 100644 apps/skysocks-client.v1.0.REMOVED.git-id create mode 100644 apps/skysocks.REMOVED.git-id create mode 100644 apps/skysocks.v1.0.REMOVED.git-id create mode 100644 apps/vpn-client.REMOVED.git-id create mode 100644 apps/vpn-server.REMOVED.git-id create mode 100644 skywire-visor.REMOVED.git-id diff --git a/.gitignore b/.gitignore index 6f3582fb16..b25718dd70 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ .idea/ /skywire.json -/apps/ +#/apps/ /skywire/ /local* @@ -24,7 +24,7 @@ pkg/visor/foo/ /users.db /hypervisor /*-node -/*-visor +#/*-visor /*-cli /*-server /*.json diff --git a/apps/helloworld.REMOVED.git-id b/apps/helloworld.REMOVED.git-id new file mode 100644 index 0000000000..db3e469618 --- /dev/null +++ b/apps/helloworld.REMOVED.git-id @@ -0,0 +1 @@ +b3f09a7270618ea11f43dc9b58e4044df928604e \ No newline at end of file diff --git a/apps/helloworld.v1.0.REMOVED.git-id b/apps/helloworld.v1.0.REMOVED.git-id new file mode 100644 index 0000000000..df2cccbdca --- /dev/null +++ b/apps/helloworld.v1.0.REMOVED.git-id @@ -0,0 +1 @@ +c6512053e30ab160db83e3d6ad072779f83d9657 \ No newline at end of file diff --git a/apps/skychat.REMOVED.git-id b/apps/skychat.REMOVED.git-id new file mode 100644 index 0000000000..f300993aae --- /dev/null +++ b/apps/skychat.REMOVED.git-id @@ -0,0 +1 @@ +9b0b3bc8e5c893415521224ede580cf3618f72c8 \ No newline at end of file diff --git a/apps/skychat.v1.0.REMOVED.git-id b/apps/skychat.v1.0.REMOVED.git-id new file mode 100644 index 0000000000..213bd71ae0 --- /dev/null +++ b/apps/skychat.v1.0.REMOVED.git-id @@ -0,0 +1 @@ +50006e9c70ecf7307233250819cd37cf0731b129 \ No newline at end of file diff --git a/apps/skysocks-client.REMOVED.git-id b/apps/skysocks-client.REMOVED.git-id new file mode 100644 index 0000000000..93b794c351 --- /dev/null +++ b/apps/skysocks-client.REMOVED.git-id @@ -0,0 +1 @@ +8ceb458a85f615ac6c4c9ae850d7d4416f719a7e \ No newline at end of file diff --git a/apps/skysocks-client.v1.0.REMOVED.git-id b/apps/skysocks-client.v1.0.REMOVED.git-id new file mode 100644 index 0000000000..be005f0302 --- /dev/null +++ b/apps/skysocks-client.v1.0.REMOVED.git-id @@ -0,0 +1 @@ +57b55d038437422a7660f3eebad6035c2cb0a0e2 \ No newline at end of file diff --git a/apps/skysocks.REMOVED.git-id b/apps/skysocks.REMOVED.git-id new file mode 100644 index 0000000000..a2eb9f403b --- /dev/null +++ b/apps/skysocks.REMOVED.git-id @@ -0,0 +1 @@ +6a305d3487be6a431b3ee454db96e605e9470c65 \ No newline at end of file diff --git a/apps/skysocks.v1.0.REMOVED.git-id b/apps/skysocks.v1.0.REMOVED.git-id new file mode 100644 index 0000000000..ee434c93de --- /dev/null +++ b/apps/skysocks.v1.0.REMOVED.git-id @@ -0,0 +1 @@ +4456e74b30d515ee32d35553565fb5b2867ccc27 \ No newline at end of file diff --git a/apps/vpn-client.REMOVED.git-id b/apps/vpn-client.REMOVED.git-id new file mode 100644 index 0000000000..82141dde7e --- /dev/null +++ b/apps/vpn-client.REMOVED.git-id @@ -0,0 +1 @@ +bf60f04103fd4767e78b5fdae0897c0e17004b0f \ No newline at end of file diff --git a/apps/vpn-server.REMOVED.git-id b/apps/vpn-server.REMOVED.git-id new file mode 100644 index 0000000000..b5cb0e7dfc --- /dev/null +++ b/apps/vpn-server.REMOVED.git-id @@ -0,0 +1 @@ +6d2e2bd255d4a223e80c0f39807bf98cf26de43d \ No newline at end of file diff --git a/skywire-visor.REMOVED.git-id b/skywire-visor.REMOVED.git-id new file mode 100644 index 0000000000..b69a0d6c86 --- /dev/null +++ b/skywire-visor.REMOVED.git-id @@ -0,0 +1 @@ +e6d6758e0ccc0cfa203535f786c0de591ea56719 \ No newline at end of file From 3873d6562d1c8c7b349c34001cce62e33ade7f6d Mon Sep 17 00:00:00 2001 From: Sir Darkrengarius Date: Mon, 8 Jun 2020 17:15:55 +0300 Subject: [PATCH 09/11] Fix VPN client launch from hypervisor Former-commit-id: 030199069d8e3f1f99180fb9c942b174d2df8b6a --- internal/vpn/client.go | 2 -- pkg/visor/init.go | 14 +++----------- pkg/visor/rpc.go | 12 +++++++++++- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/internal/vpn/client.go b/internal/vpn/client.go index 624a58f17d..7ec9e9afd4 100644 --- a/internal/vpn/client.go +++ b/internal/vpn/client.go @@ -33,8 +33,6 @@ type Client struct { // NewClient creates VPN client instance. func NewClient(cfg ClientConfig, l logrus.FieldLogger, conn net.Conn) (*Client, error) { - l.Infof("DMSG DISC ENV: %s", os.Getenv(DmsgDiscAddrEnvKey)) - dmsgDiscIP, err := dmsgDiscIPFromEnv() if err != nil { return nil, fmt.Errorf("error getting Dmsg discovery IP: %w", err) diff --git a/pkg/visor/init.go b/pkg/visor/init.go index 9494fbec51..011057f9c3 100644 --- a/pkg/visor/init.go +++ b/pkg/visor/init.go @@ -8,8 +8,6 @@ import ( "sync" "time" - "github.com/SkycoinProject/skycoin/src/util/logging" - "github.com/SkycoinProject/dmsg" "github.com/SkycoinProject/dmsg/cipher" "github.com/SkycoinProject/dmsg/netutil" @@ -258,8 +256,8 @@ func initLauncher(v *Visor) bool { return report(fmt.Errorf("failed to start launcher: %w", err)) } err = launch.AutoStart(map[string]func() ([]string, error){ - skyenv.VPNClientName: func() ([]string, error) { return makeVPNEnvs(v.conf, v.net, launchLog) }, - skyenv.VPNServerName: func() ([]string, error) { return makeVPNEnvs(v.conf, v.net, launchLog) }, + skyenv.VPNClientName: func() ([]string, error) { return makeVPNEnvs(v.conf, v.net) }, + skyenv.VPNServerName: func() ([]string, error) { return makeVPNEnvs(v.conf, v.net) }, }) if err != nil { return report(fmt.Errorf("failed to autostart apps: %w", err)) @@ -270,14 +268,12 @@ func initLauncher(v *Visor) bool { return report(nil) } -func makeVPNEnvs(conf *visorconfig.V1, n *snet.Network, l *logging.Logger) ([]string, error) { +func makeVPNEnvs(conf *visorconfig.V1, n *snet.Network) ([]string, error) { var envCfg vpn.DirectRoutesEnvConfig if conf.Dmsg != nil { envCfg.DmsgDiscovery = conf.Dmsg.Discovery - l.Infof("VISOR CONF DMSG DISC: %v", conf.Dmsg.Discovery) - r := netutil.NewRetrier(logrus.New(), 1*time.Second, 10*time.Second, 0, 1) err := r.Do(context.Background(), func() error { for _, ses := range n.Dmsg().AllSessions() { @@ -294,8 +290,6 @@ func makeVPNEnvs(conf *visorconfig.V1, n *snet.Network, l *logging.Logger) ([]st if err != nil { return nil, fmt.Errorf("error getting Dmsg servers: %w", err) } - } else { - l.Infoln("DMSG IS NIL IN VISOR CONF") } if conf.Transport != nil { envCfg.TPDiscovery = conf.Transport.Discovery @@ -318,8 +312,6 @@ func makeVPNEnvs(conf *visorconfig.V1, n *snet.Network, l *logging.Logger) ([]st envMap := vpn.AppEnvArgs(envCfg) - l.Infof("DMSG DISC IN ENV MAP: %v", envMap[vpn.DmsgDiscAddrEnvKey]) - envs := make([]string, 0, len(envMap)) for k, v := range envMap { envs = append(envs, fmt.Sprintf("%s=%s", k, v)) diff --git a/pkg/visor/rpc.go b/pkg/visor/rpc.go index 2302f6aec4..8d0cc7b0fc 100644 --- a/pkg/visor/rpc.go +++ b/pkg/visor/rpc.go @@ -9,6 +9,8 @@ import ( "os" "time" + "github.com/SkycoinProject/skywire-mainnet/pkg/skyenv" + "github.com/SkycoinProject/dmsg/buildinfo" "github.com/SkycoinProject/dmsg/cipher" "github.com/google/uuid" @@ -213,7 +215,15 @@ func (r *RPC) Apps(_ *struct{}, reply *[]*launcher.AppState) (err error) { func (r *RPC) StartApp(name *string, _ *struct{}) (err error) { defer rpcutil.LogCall(r.log, "StartApp", name)(nil, &err) - return r.visor.appL.StartApp(*name, nil, nil) + var envs []string + if *name == skyenv.VPNClientName { + envs, err = makeVPNEnvs(r.visor.conf, r.visor.net) + if err != nil { + return err + } + } + + return r.visor.appL.StartApp(*name, nil, envs) } // StopApp stops App with provided name. From 8155ab1ee5e80f1e8c6938a6c748492b28ace392 Mon Sep 17 00:00:00 2001 From: Sir Darkrengarius Date: Tue, 9 Jun 2020 14:42:03 +0300 Subject: [PATCH 10/11] Revert .gitignore changes Former-commit-id: 14b691005f6d520a314bfe2ad7572b7e9a184f07 --- .gitignore | 4 ++-- apps/helloworld.REMOVED.git-id | 1 - apps/helloworld.v1.0.REMOVED.git-id | 1 - apps/skychat.REMOVED.git-id | 1 - apps/skychat.v1.0.REMOVED.git-id | 1 - apps/skysocks-client.REMOVED.git-id | 1 - apps/skysocks-client.v1.0.REMOVED.git-id | 1 - apps/skysocks.REMOVED.git-id | 1 - apps/skysocks.v1.0.REMOVED.git-id | 1 - apps/vpn-client.REMOVED.git-id | 1 - apps/vpn-server.REMOVED.git-id | 1 - skywire-visor.REMOVED.git-id | 1 - 12 files changed, 2 insertions(+), 13 deletions(-) delete mode 100644 apps/helloworld.REMOVED.git-id delete mode 100644 apps/helloworld.v1.0.REMOVED.git-id delete mode 100644 apps/skychat.REMOVED.git-id delete mode 100644 apps/skychat.v1.0.REMOVED.git-id delete mode 100644 apps/skysocks-client.REMOVED.git-id delete mode 100644 apps/skysocks-client.v1.0.REMOVED.git-id delete mode 100644 apps/skysocks.REMOVED.git-id delete mode 100644 apps/skysocks.v1.0.REMOVED.git-id delete mode 100644 apps/vpn-client.REMOVED.git-id delete mode 100644 apps/vpn-server.REMOVED.git-id delete mode 100644 skywire-visor.REMOVED.git-id diff --git a/.gitignore b/.gitignore index b25718dd70..6f3582fb16 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ .idea/ /skywire.json -#/apps/ +/apps/ /skywire/ /local* @@ -24,7 +24,7 @@ pkg/visor/foo/ /users.db /hypervisor /*-node -#/*-visor +/*-visor /*-cli /*-server /*.json diff --git a/apps/helloworld.REMOVED.git-id b/apps/helloworld.REMOVED.git-id deleted file mode 100644 index db3e469618..0000000000 --- a/apps/helloworld.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -b3f09a7270618ea11f43dc9b58e4044df928604e \ No newline at end of file diff --git a/apps/helloworld.v1.0.REMOVED.git-id b/apps/helloworld.v1.0.REMOVED.git-id deleted file mode 100644 index df2cccbdca..0000000000 --- a/apps/helloworld.v1.0.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -c6512053e30ab160db83e3d6ad072779f83d9657 \ No newline at end of file diff --git a/apps/skychat.REMOVED.git-id b/apps/skychat.REMOVED.git-id deleted file mode 100644 index f300993aae..0000000000 --- a/apps/skychat.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -9b0b3bc8e5c893415521224ede580cf3618f72c8 \ No newline at end of file diff --git a/apps/skychat.v1.0.REMOVED.git-id b/apps/skychat.v1.0.REMOVED.git-id deleted file mode 100644 index 213bd71ae0..0000000000 --- a/apps/skychat.v1.0.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -50006e9c70ecf7307233250819cd37cf0731b129 \ No newline at end of file diff --git a/apps/skysocks-client.REMOVED.git-id b/apps/skysocks-client.REMOVED.git-id deleted file mode 100644 index 93b794c351..0000000000 --- a/apps/skysocks-client.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -8ceb458a85f615ac6c4c9ae850d7d4416f719a7e \ No newline at end of file diff --git a/apps/skysocks-client.v1.0.REMOVED.git-id b/apps/skysocks-client.v1.0.REMOVED.git-id deleted file mode 100644 index be005f0302..0000000000 --- a/apps/skysocks-client.v1.0.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -57b55d038437422a7660f3eebad6035c2cb0a0e2 \ No newline at end of file diff --git a/apps/skysocks.REMOVED.git-id b/apps/skysocks.REMOVED.git-id deleted file mode 100644 index a2eb9f403b..0000000000 --- a/apps/skysocks.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -6a305d3487be6a431b3ee454db96e605e9470c65 \ No newline at end of file diff --git a/apps/skysocks.v1.0.REMOVED.git-id b/apps/skysocks.v1.0.REMOVED.git-id deleted file mode 100644 index ee434c93de..0000000000 --- a/apps/skysocks.v1.0.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -4456e74b30d515ee32d35553565fb5b2867ccc27 \ No newline at end of file diff --git a/apps/vpn-client.REMOVED.git-id b/apps/vpn-client.REMOVED.git-id deleted file mode 100644 index 82141dde7e..0000000000 --- a/apps/vpn-client.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -bf60f04103fd4767e78b5fdae0897c0e17004b0f \ No newline at end of file diff --git a/apps/vpn-server.REMOVED.git-id b/apps/vpn-server.REMOVED.git-id deleted file mode 100644 index b5cb0e7dfc..0000000000 --- a/apps/vpn-server.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -6d2e2bd255d4a223e80c0f39807bf98cf26de43d \ No newline at end of file diff --git a/skywire-visor.REMOVED.git-id b/skywire-visor.REMOVED.git-id deleted file mode 100644 index b69a0d6c86..0000000000 --- a/skywire-visor.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -e6d6758e0ccc0cfa203535f786c0de591ea56719 \ No newline at end of file From 662d67ab1b01533a942a24cb81dc2647f521d690 Mon Sep 17 00:00:00 2001 From: Sir Darkrengarius Date: Tue, 9 Jun 2020 15:07:08 +0300 Subject: [PATCH 11/11] Sort out some PR queries Former-commit-id: 90c218eaef6782e508808e90687234f13ea3e38b --- internal/vpn/client.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/vpn/client.go b/internal/vpn/client.go index 7ec9e9afd4..11ad7da25d 100644 --- a/internal/vpn/client.go +++ b/internal/vpn/client.go @@ -74,8 +74,9 @@ func NewClient(cfg ClientConfig, l logrus.FieldLogger, conn net.Conn) (*Client, } } - directIPs := make([]net.IP, 0, 3+len(dmsgSrvAddrs)+len(stcpEntities)) - directIPs = append(directIPs, dmsgDiscIP, tpDiscIP, rfIP) + requiredDirectIPs := []net.IP{dmsgDiscIP, tpDiscIP, rfIP} + directIPs := make([]net.IP, 0, len(requiredDirectIPs)+len(dmsgSrvAddrs)+len(stcpEntities)) + directIPs = append(directIPs, requiredDirectIPs...) directIPs = append(directIPs, dmsgSrvAddrs...) directIPs = append(directIPs, stcpEntities...)