diff --git a/go.sum b/go.sum index a1a7d4d306..3a4a8e5d43 100644 --- a/go.sum +++ b/go.sum @@ -277,8 +277,6 @@ github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5k github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/skycoin/dmsg v0.0.0-20210603142231-3cba29fefe94 h1:pEXB812hRagn23n/SJQkFE/Pj0CJ1L5bA3qWSbUyC9M= -github.com/skycoin/dmsg v0.0.0-20210603142231-3cba29fefe94/go.mod h1:kd73tig/WUzBvcRmR7UwPi1JprzDDBUcSSBmF7RTJjo= github.com/skycoin/dmsg v0.0.0-20210607131549-0c02e58ac5ee h1:amNDcQH4yce7nqs+P8RptKWhloC5q2upsQOk4YTXOKs= github.com/skycoin/dmsg v0.0.0-20210607131549-0c02e58ac5ee/go.mod h1:kd73tig/WUzBvcRmR7UwPi1JprzDDBUcSSBmF7RTJjo= github.com/skycoin/noise v0.0.0-20180327030543-2492fe189ae6 h1:1Nc5EBY6pjfw1kwW0duwyG+7WliWz5u9kgk1h5MnLuA= diff --git a/pkg/skyenv/values.go b/pkg/skyenv/values.go index d9af79a80f..cd32ad108a 100644 --- a/pkg/skyenv/values.go +++ b/pkg/skyenv/values.go @@ -49,10 +49,8 @@ const ( const ( DmsgPtyPort uint16 = 22 - DefaultDmsgPtyCLINet = "unix" - DefaultDmsgPtyCLIAddr = "/tmp/dmsgpty.sock" - DefaultDmsgPtyWhitelist = DefaultSkywirePath + "/dmsgpty/whitelist.json" - PackageDmsgPtyWhiteList = PackageSkywirePath + "/dmsgpty/whitelist.json" + DefaultDmsgPtyCLINet = "unix" + DefaultDmsgPtyCLIAddr = "/tmp/dmsgpty.sock" ) // Default STCP constants. @@ -93,17 +91,15 @@ const ( const ( DefaultAppSrvAddr = "localhost:5505" AppDiscUpdateInterval = time.Minute - DefaultAppLocalPath = DefaultSkywirePath + "/local" DefaultAppBinPath = DefaultSkywirePath + "/apps" DefaultLogLevel = "info" - PackageAppLocalPath = PackageSkywirePath + "/local" PackageAppBinPath = PackageSkywirePath + "/apps" ) -// Default routing constants +// Default local constants const ( - DefaultTpLogStore = DefaultSkywirePath + "/transport_logs" - PackageTpLogStore = PackageSkywirePath + "/transport_logs" + DefaultLocalPath = DefaultSkywirePath + "/local" + PackageLocalPath = PackageSkywirePath + "/local" ) // Default hypervisor constants diff --git a/pkg/visor/init.go b/pkg/visor/init.go index 4aa4f67625..1ff8120b31 100644 --- a/pkg/visor/init.go +++ b/pkg/visor/init.go @@ -235,7 +235,6 @@ func initDmsgCtrl(ctx context.Context, v *Visor, _ *logging.Logger) error { } func initTransport(ctx context.Context, v *Visor, log *logging.Logger) error { - conf := v.conf.Transport tpdC, err := connectToTpDisc(v) if err != nil { @@ -243,20 +242,7 @@ func initTransport(ctx context.Context, v *Visor, log *logging.Logger) error { return err } - var logS transport.LogStore - switch conf.LogStore.Type { - case visorconfig.FileLogStore: - logS, err = transport.FileTransportLogStore(conf.LogStore.Location) - if err != nil { - err := fmt.Errorf("failed to create %s log store: %w", visorconfig.FileLogStore, err) - return err - } - case visorconfig.MemoryLogStore: - logS = transport.InMemoryTransportLogStore() - default: - err := fmt.Errorf("invalid log store type: %s", conf.LogStore.Type) - return err - } + logS := transport.InMemoryTransportLogStore() tpMConf := transport.ManagerConfig{ PubKey: v.conf.PK, @@ -402,7 +388,7 @@ func initLauncher(ctx context.Context, v *Visor, log *logging.Logger) error { Apps: conf.Apps, ServerAddr: conf.ServerAddr, BinPath: conf.BinPath, - LocalPath: conf.LocalPath, + LocalPath: v.conf.LocalPath, } launchLog := v.MasterLogger().PackageLogger("launcher") diff --git a/pkg/visor/visorconfig/config.go b/pkg/visor/visorconfig/config.go index 180230f5a7..00c4a0c101 100644 --- a/pkg/visor/visorconfig/config.go +++ b/pkg/visor/visorconfig/config.go @@ -25,9 +25,6 @@ func MakeBaseConfig(common *Common) *V1 { conf.Transport = &V1Transport{ Discovery: skyenv.DefaultTpDiscAddr, AddressResolver: skyenv.DefaultAddressResolverAddr, - LogStore: &V1LogStore{ - Type: "memory", - }, } conf.Routing = &V1Routing{ SetupNodes: []cipher.PubKey{skyenv.MustPK(skyenv.DefaultSetupPK)}, @@ -39,10 +36,10 @@ func MakeBaseConfig(common *Common) *V1 { Apps: nil, ServerAddr: skyenv.DefaultAppSrvAddr, BinPath: skyenv.DefaultAppBinPath, - LocalPath: skyenv.DefaultAppLocalPath, } conf.CLIAddr = skyenv.DefaultRPCAddr conf.LogLevel = skyenv.DefaultLogLevel + conf.LocalPath = skyenv.DefaultLocalPath conf.ShutdownTimeout = DefaultTimeout conf.RestartCheckDelay = Duration(restart.DefaultCheckDelay) return conf @@ -81,11 +78,6 @@ func defaultConfigFromCommon(cc *Common, hypervisor bool) (*V1, error) { PKTable: nil, } - conf.Transport.LogStore = &V1LogStore{ - Type: "file", - Location: skyenv.DefaultTpLogStore, - } - conf.UptimeTracker = &V1UptimeTracker{ Addr: skyenv.DefaultUptimeTrackerAddr, } @@ -160,14 +152,8 @@ func MakePackageConfig(log *logging.MasterLogger, confPath string, sk *cipher.Se CLINet: skyenv.DefaultDmsgPtyCLINet, CLIAddr: skyenv.DefaultDmsgPtyCLIAddr, } - - conf.Transport.LogStore = &V1LogStore{ - Type: "file", - Location: skyenv.PackageTpLogStore, - } - + conf.LocalPath = skyenv.PackageLocalPath conf.Launcher.BinPath = skyenv.PackageAppBinPath - conf.Launcher.LocalPath = skyenv.PackageAppLocalPath if conf.Hypervisor != nil { conf.Hypervisor.EnableAuth = skyenv.DefaultEnableAuth diff --git a/pkg/visor/visorconfig/parse.go b/pkg/visor/visorconfig/parse.go index b2ae5b7249..b993732831 100644 --- a/pkg/visor/visorconfig/parse.go +++ b/pkg/visor/visorconfig/parse.go @@ -35,10 +35,6 @@ func Parse(log *logging.MasterLogger, path string, raw []byte) (*V1, error) { switch cc.Version { // parse any v1-compatible version with v1 parse procedure - case V112Name: - fallthrough - case V111Name: - fallthrough case V110Name: fallthrough case V100Name: @@ -52,7 +48,6 @@ func Parse(log *logging.MasterLogger, path string, raw []byte) (*V1, error) { func parseV1(cc *Common, raw []byte) (*V1, error) { conf := MakeBaseConfig(cc) - dec := json.NewDecoder(bytes.NewReader(raw)) if err := dec.Decode(&conf); err != nil { return nil, err @@ -61,6 +56,7 @@ func parseV1(cc *Common, raw []byte) (*V1, error) { if err := conf.ensureKeys(); err != nil { return nil, fmt.Errorf("%v: %w", ErrInvalidSK, err) } + conf.Version = V1Name return conf, conf.flush(conf) } @@ -106,7 +102,6 @@ func parseV0(cc *Common, raw []byte) (*V1, error) { if old.Transport != nil { conf.Transport.Discovery = old.Transport.Discovery - conf.Transport.LogStore = old.Transport.LogStore } if old.Routing != nil { @@ -142,8 +137,8 @@ func parseV0(cc *Common, raw []byte) (*V1, error) { conf.Launcher.Apps = append(conf.Launcher.Apps, vpnApps...) + conf.LocalPath = old.LocalPath conf.Launcher.BinPath = old.AppsPath - conf.Launcher.LocalPath = old.LocalPath conf.Launcher.ServerAddr = old.AppServerAddr for _, hv := range old.Hypervisors { diff --git a/pkg/visor/visorconfig/v1.go b/pkg/visor/visorconfig/v1.go index 10231a214f..f5077ff484 100644 --- a/pkg/visor/visorconfig/v1.go +++ b/pkg/visor/visorconfig/v1.go @@ -19,21 +19,16 @@ const V100Name = "v1.0.0" // V110Name is the semantic version string for v1.1.0. // Added MinHops field to V1Routing section of config -const V110Name = "v1.1.0" - -// V111Name is the semantic version string for v1.1.1. // Removed public_trusted_visor field from root section // Removed trusted_visors field from transport section // Added is_public field to root section // Added public_autoconnect field to transport section -const V111Name = "v1.1.1" - -// V112Name is the semantic version string for v1.1.2. // Added transport_setup_nodes field to transport section -const V112Name = "v1.1.2" +// Removed authorization_file field from dmsgpty section +const V110Name = "v1.1.0" // V1Name is the semantic version string for the most recent version of V1. -const V1Name = V112Name +const V1Name = V110Name // V1 is visor config type V1 struct { @@ -52,6 +47,7 @@ type V1 struct { CLIAddr string `json:"cli_addr"` LogLevel string `json:"log_level"` + LocalPath string `json:"local_path"` ShutdownTimeout Duration `json:"shutdown_timeout,omitempty"` // time value, examples: 10s, 1m, etc RestartCheckDelay Duration `json:"restart_check_delay,omitempty"` // time value, examples: 10s, 1m, etc IsPublic bool `json:"is_public"` @@ -70,7 +66,6 @@ type V1Dmsgpty struct { type V1Transport struct { Discovery string `json:"discovery"` AddressResolver string `json:"address_resolver"` - LogStore *V1LogStore `json:"log_store"` AutoconnectPublic bool `json:"public_autoconnect"` TransportSetup []cipher.PubKey `json:"transport_setup_nodes"` } @@ -107,7 +102,6 @@ type V1Launcher struct { Apps []launcher.AppConfig `json:"apps"` ServerAddr string `json:"server_addr"` BinPath string `json:"bin_path"` - LocalPath string `json:"local_path"` } // Flush flushes the config to file (if specified).