diff --git a/CHANGELOG.md b/CHANGELOG.md index a82107520d..aecde19630 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,28 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## 0.5.0 + +### Changed + +- config updated to `v1.1.0` +- removed public_trusted_visor field from root section +- removed trusted_visors field from transport section +- removed authorization_file field from dmsgpty section +- changed default urls to newer shortned ones +- changed proxy_discovery_addr field to service_discovery +- updated UI +- removed `--public` flag from `skywire-cli visor add-tp` command + +### Added + +- added persistent_transports field to the config and UI +- added stun_servers field to the config +- added is_public field to root section +- added public_autoconnect field to transport section +- added transport_setup_nodes field to transport section +- added MinHops field to V1Routing section of config + ## 0.2.1 - 2020.04.07 ### Changed diff --git a/Char b/Char deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/cmd/skywire-cli/README.md b/cmd/skywire-cli/README.md index e235fe8b8c..c72601c1fc 100644 --- a/cmd/skywire-cli/README.md +++ b/cmd/skywire-cli/README.md @@ -396,7 +396,7 @@ $ skywire-cli visor gen-config "launcher": { "discovery": { "update_interval": "30s", - "proxy_discovery_addr": "http://service.discovery.skycoin.com" + "service_discovery": "http://service.discovery.skycoin.com" }, "apps": [ { @@ -512,7 +512,7 @@ $ skywire-cli visor gen-config -ip "launcher": { "discovery": { "update_interval": "30s", - "proxy_discovery_addr": "http://service.discovery.skycoin.com" + "service_discovery": "http://service.discovery.skycoin.com" }, "apps": [ { @@ -886,7 +886,7 @@ skywire-cli visor update-config "launcher": { "discovery": { "update_interval": "30s", - "proxy_discovery_addr": "http://service.discovery.skycoin.com" + "service_discovery": "http://service.discovery.skycoin.com" }, "apps": [ { diff --git a/pkg/app/appserver/proc.go b/pkg/app/appserver/proc.go index 9c28856a12..0196465fb5 100644 --- a/pkg/app/appserver/proc.go +++ b/pkg/app/appserver/proc.go @@ -16,8 +16,8 @@ import ( "github.com/skycoin/skycoin/src/util/logging" "github.com/skycoin/skywire/pkg/app/appcommon" - "github.com/skycoin/skywire/pkg/app/appdisc" "github.com/skycoin/skywire/pkg/app/appnet" + "github.com/skycoin/skywire/pkg/app/updatedisc" ) var ( @@ -29,7 +29,7 @@ var ( // communication. // TODO(evanlinjin): In the future, we will implement the ability to run multiple instances (procs) of a single app. type Proc struct { - disc appdisc.Updater // app discovery client + disc updatedisc.Updater // app discovery client conf appcommon.ProcConfig log *logging.Logger @@ -57,7 +57,7 @@ type Proc struct { } // NewProc constructs `Proc`. -func NewProc(mLog *logging.MasterLogger, conf appcommon.ProcConfig, disc appdisc.Updater, m ProcManager, +func NewProc(mLog *logging.MasterLogger, conf appcommon.ProcConfig, disc updatedisc.Updater, m ProcManager, appName string) *Proc { if mLog == nil { mLog = logging.NewMasterLogger() @@ -136,8 +136,8 @@ func (p *Proc) awaitConn() bool { connDelta := p.rpcGW.cm.AddDeltaInformer() go func() { for n := range connDelta.Chan() { - if err := p.disc.ChangeValue(appdisc.ConnCountValue, []byte(strconv.Itoa(n))); err != nil { - p.log.WithError(err).WithField("value", appdisc.ConnCountValue). + if err := p.disc.ChangeValue(updatedisc.ConnCountValue, []byte(strconv.Itoa(n))); err != nil { + p.log.WithError(err).WithField("value", updatedisc.ConnCountValue). Error("Failed to change app discovery value.") } } @@ -146,8 +146,8 @@ func (p *Proc) awaitConn() bool { lisDelta := p.rpcGW.lm.AddDeltaInformer() go func() { for n := range lisDelta.Chan() { - if err := p.disc.ChangeValue(appdisc.ListenerCountValue, []byte(strconv.Itoa(n))); err != nil { - p.log.WithError(err).WithField("value", appdisc.ListenerCountValue). + if err := p.disc.ChangeValue(updatedisc.ListenerCountValue, []byte(strconv.Itoa(n))); err != nil { + p.log.WithError(err).WithField("value", updatedisc.ListenerCountValue). Error("Failed to change app discovery value.") } } diff --git a/pkg/app/appserver/proc_manager.go b/pkg/app/appserver/proc_manager.go index 2992fcd60e..3fff6006cd 100644 --- a/pkg/app/appserver/proc_manager.go +++ b/pkg/app/appserver/proc_manager.go @@ -13,8 +13,8 @@ import ( "github.com/skycoin/skycoin/src/util/logging" "github.com/skycoin/skywire/pkg/app/appcommon" - "github.com/skycoin/skywire/pkg/app/appdisc" "github.com/skycoin/skywire/pkg/app/appevent" + "github.com/skycoin/skywire/pkg/app/updatedisc" ) //go:generate mockery -name ProcManager -case underscore -inpkg @@ -57,7 +57,7 @@ type procManager struct { conns map[string]net.Conn connsWG sync.WaitGroup - discF *appdisc.Factory + discF *updatedisc.Factory procs map[string]*Proc procsByKey map[appcommon.ProcKey]*Proc @@ -69,12 +69,12 @@ type procManager struct { } // NewProcManager constructs `ProcManager`. -func NewProcManager(mLog *logging.MasterLogger, discF *appdisc.Factory, eb *appevent.Broadcaster, addr string) (ProcManager, error) { +func NewProcManager(mLog *logging.MasterLogger, discF *updatedisc.Factory, eb *appevent.Broadcaster, addr string) (ProcManager, error) { if mLog == nil { mLog = logging.NewMasterLogger() } if discF == nil { - discF = new(appdisc.Factory) + discF = new(updatedisc.Factory) } if eb == nil { eb = appevent.NewBroadcaster(mLog.PackageLogger("event_broadcaster"), time.Second) diff --git a/pkg/app/appdisc/const.go b/pkg/app/updatedisc/const.go similarity index 69% rename from pkg/app/appdisc/const.go rename to pkg/app/updatedisc/const.go index 35ed12c084..ebc3f4d103 100644 --- a/pkg/app/appdisc/const.go +++ b/pkg/app/updatedisc/const.go @@ -1,6 +1,6 @@ -package appdisc +package updatedisc -// ChangeValue keys. Each key changes a different value for proxyUpdater.ChangeValue +// ChangeValue keys. Each key changes a different value for serviceUpdater.ChangeValue const ( // ConnCountValue represents the number of remote connections to a given proc. ConnCountValue = "conn_count" diff --git a/pkg/app/appdisc/discovery_updater.go b/pkg/app/updatedisc/discovery_updater.go similarity index 98% rename from pkg/app/appdisc/discovery_updater.go rename to pkg/app/updatedisc/discovery_updater.go index e6bcff1892..34ff69f59a 100644 --- a/pkg/app/appdisc/discovery_updater.go +++ b/pkg/app/updatedisc/discovery_updater.go @@ -1,4 +1,4 @@ -package appdisc +package updatedisc import ( "context" diff --git a/pkg/app/appdisc/factory.go b/pkg/app/updatedisc/factory.go similarity index 86% rename from pkg/app/appdisc/factory.go rename to pkg/app/updatedisc/factory.go index f54bba784f..da9052aae2 100644 --- a/pkg/app/appdisc/factory.go +++ b/pkg/app/updatedisc/factory.go @@ -1,4 +1,4 @@ -package appdisc +package updatedisc import ( "time" @@ -18,7 +18,7 @@ type Factory struct { PK cipher.PubKey SK cipher.SecKey UpdateInterval time.Duration - ProxyDisc string // Address of proxy-discovery + ServiceDisc string // Address of service-discovery } func (f *Factory) setDefaults() { @@ -26,10 +26,10 @@ func (f *Factory) setDefaults() { f.Log = logging.MustGetLogger("appdisc") } if f.UpdateInterval == 0 { - f.UpdateInterval = skyenv.AppDiscUpdateInterval + f.UpdateInterval = skyenv.ServiceDiscUpdateInterval } - if f.ProxyDisc == "" { - f.ProxyDisc = skyenv.DefaultServiceDiscAddr + if f.ServiceDisc == "" { + f.ServiceDisc = skyenv.DefaultServiceDiscAddr } } @@ -45,7 +45,7 @@ func (f *Factory) VisorUpdater(port uint16) Updater { PK: f.PK, SK: f.SK, Port: port, - DiscAddr: f.ProxyDisc, + DiscAddr: f.ServiceDisc, } return &serviceUpdater{ @@ -63,7 +63,7 @@ func (f *Factory) AppUpdater(conf appcommon.ProcConfig) (Updater, bool) { log := f.Log.WithField("appName", conf.AppName) - // Do not update in proxy discovery if passcode-protected. + // Do not update in service discovery if passcode-protected. if conf.ContainsFlag("passcode") && conf.ArgVal("passcode") != "" { return &emptyUpdater{}, false } @@ -74,7 +74,7 @@ func (f *Factory) AppUpdater(conf appcommon.ProcConfig) (Updater, bool) { PK: f.PK, SK: f.SK, Port: uint16(conf.RoutingPort), - DiscAddr: f.ProxyDisc, + DiscAddr: f.ServiceDisc, } } diff --git a/pkg/skyenv/values.go b/pkg/skyenv/values.go index 394f673788..8bab0c490f 100644 --- a/pkg/skyenv/values.go +++ b/pkg/skyenv/values.go @@ -103,10 +103,10 @@ const ( // Default skywire app server and discovery constants const ( - DefaultAppSrvAddr = "localhost:5505" - AppDiscUpdateInterval = time.Minute - DefaultAppBinPath = DefaultSkywirePath + "/apps" - DefaultLogLevel = "info" + DefaultAppSrvAddr = "localhost:5505" + ServiceDiscUpdateInterval = time.Minute + DefaultAppBinPath = DefaultSkywirePath + "/apps" + DefaultLogLevel = "info" ) // Package defaults diff --git a/pkg/visor/init.go b/pkg/visor/init.go index 906b2e6036..a4927a6aec 100644 --- a/pkg/visor/init.go +++ b/pkg/visor/init.go @@ -19,10 +19,10 @@ import ( "github.com/skycoin/skywire/internal/utclient" "github.com/skycoin/skywire/internal/vpn" - "github.com/skycoin/skywire/pkg/app/appdisc" "github.com/skycoin/skywire/pkg/app/appevent" "github.com/skycoin/skywire/pkg/app/appserver" "github.com/skycoin/skywire/pkg/app/launcher" + "github.com/skycoin/skywire/pkg/app/updatedisc" "github.com/skycoin/skywire/pkg/dmsgc" "github.com/skycoin/skywire/pkg/routefinder/rfclient" "github.com/skycoin/skywire/pkg/router" @@ -180,7 +180,7 @@ func initAddressResolver(ctx context.Context, v *Visor, log *logging.Logger) err func initDiscovery(ctx context.Context, v *Visor, log *logging.Logger) error { // Prepare app discovery factory. - factory := appdisc.Factory{ + factory := updatedisc.Factory{ Log: v.MasterLogger().PackageLogger("app_discovery"), } @@ -190,7 +190,7 @@ func initDiscovery(ctx context.Context, v *Visor, log *logging.Logger) error { factory.PK = v.conf.PK factory.SK = v.conf.SK factory.UpdateInterval = time.Duration(conf.Discovery.UpdateInterval) - factory.ProxyDisc = conf.Discovery.ServiceDisc + factory.ServiceDisc = conf.Discovery.ServiceDisc } v.initLock.Lock() v.serviceDisc = factory @@ -652,12 +652,12 @@ func initPublicVisors(ctx context.Context, v *Visor, log *logging.Logger) error if !v.conf.Transport.AutoconnectPublic { return nil } - proxyDisc := v.conf.Launcher.Discovery.ServiceDisc - if proxyDisc == "" { - proxyDisc = skyenv.DefaultServiceDiscAddr + serviceDisc := v.conf.Launcher.Discovery.ServiceDisc + if serviceDisc == "" { + serviceDisc = skyenv.DefaultServiceDiscAddr } - // todo: refactor appdisc: split connecting to services in appdisc and + // todo: refactor updatedisc: split connecting to services in updatedisc and // advertising oneself as a service. Currently, config is tailored to // advertising oneself and requires things like port that are not used // in connecting to services @@ -666,7 +666,7 @@ func initPublicVisors(ctx context.Context, v *Visor, log *logging.Logger) error PK: v.conf.PK, SK: v.conf.SK, Port: uint16(0), - DiscAddr: proxyDisc, + DiscAddr: serviceDisc, } connector := servicedisc.MakeConnector(conf, 5, v.tpM, log) go connector.Run(ctx) //nolint:errcheck diff --git a/pkg/visor/visor.go b/pkg/visor/visor.go index 43763ae211..45be7f773d 100644 --- a/pkg/visor/visor.go +++ b/pkg/visor/visor.go @@ -12,10 +12,10 @@ import ( "github.com/skycoin/skycoin/src/util/logging" "github.com/skycoin/skywire/internal/utclient" - "github.com/skycoin/skywire/pkg/app/appdisc" "github.com/skycoin/skywire/pkg/app/appevent" "github.com/skycoin/skywire/pkg/app/appserver" "github.com/skycoin/skywire/pkg/app/launcher" + "github.com/skycoin/skywire/pkg/app/updatedisc" "github.com/skycoin/skywire/pkg/restart" "github.com/skycoin/skywire/pkg/routefinder/rfclient" "github.com/skycoin/skywire/pkg/router" @@ -66,7 +66,7 @@ type Visor struct { procM appserver.ProcManager // proc manager appL *launcher.Launcher // app launcher - serviceDisc appdisc.Factory + serviceDisc updatedisc.Factory initLock *sync.Mutex // when module is failed it pushes its error to this channel // used by init and shutdown to show/check for any residual errors diff --git a/pkg/visor/visorconfig/README.md b/pkg/visor/visorconfig/README.md index 8e4fbeb298..a7aa361702 100644 --- a/pkg/visor/visorconfig/README.md +++ b/pkg/visor/visorconfig/README.md @@ -43,7 +43,7 @@ # V1AppDisc - `update_interval` (Duration) -- `proxy_discovery_addr` (string) +- `service_discovery` (string) # V1LogStore diff --git a/pkg/visor/visorconfig/config.go b/pkg/visor/visorconfig/config.go index aa36b54aa5..5f35b3a6d9 100644 --- a/pkg/visor/visorconfig/config.go +++ b/pkg/visor/visorconfig/config.go @@ -33,7 +33,7 @@ func MakeBaseConfig(common *Common) *V1 { RouteFinderTimeout: DefaultTimeout, } conf.Launcher = &V1Launcher{ - Discovery: &V1AppDisc{ + Discovery: &V1ServiceDisc{ ServiceDisc: skyenv.DefaultServiceDiscAddr, }, Apps: nil, @@ -89,8 +89,8 @@ func defaultConfigFromCommon(cc *Common, hypervisor bool) (*V1, error) { Addr: skyenv.DefaultUptimeTrackerAddr, } - conf.Launcher.Discovery = &V1AppDisc{ - UpdateInterval: Duration(skyenv.AppDiscUpdateInterval), + conf.Launcher.Discovery = &V1ServiceDisc{ + UpdateInterval: Duration(skyenv.ServiceDiscUpdateInterval), ServiceDisc: skyenv.DefaultServiceDiscAddr, } @@ -218,8 +218,8 @@ func SetDefaultProductionValues(conf *V1) { conf.UptimeTracker = &V1UptimeTracker{ Addr: skyenv.DefaultUptimeTrackerAddr, } - conf.Launcher.Discovery = &V1AppDisc{ - UpdateInterval: Duration(skyenv.AppDiscUpdateInterval), + conf.Launcher.Discovery = &V1ServiceDisc{ + UpdateInterval: Duration(skyenv.ServiceDiscUpdateInterval), ServiceDisc: skyenv.DefaultServiceDiscAddr, } } diff --git a/pkg/visor/visorconfig/parse.go b/pkg/visor/visorconfig/parse.go index 2a51c74e5a..786f6e15ff 100644 --- a/pkg/visor/visorconfig/parse.go +++ b/pkg/visor/visorconfig/parse.go @@ -162,7 +162,7 @@ func parseV0(cc *Common, raw []byte) (*V1, error) { func ensureAppDisc(conf *V1) *V1 { if conf.Launcher.Discovery == nil { - conf.Launcher.Discovery = &V1AppDisc{ + conf.Launcher.Discovery = &V1ServiceDisc{ ServiceDisc: skyenv.DefaultServiceDiscAddr, } } diff --git a/pkg/visor/visorconfig/v1.go b/pkg/visor/visorconfig/v1.go index 59517e80ce..3d7429ffc4 100644 --- a/pkg/visor/visorconfig/v1.go +++ b/pkg/visor/visorconfig/v1.go @@ -32,6 +32,9 @@ const V101Name = "v1.0.1" // Removed authorization_file field from dmsgpty section // Default urls are changed to newer shortned ones // Added stun_servers field to the config +// Added persistent_transports field to the config +// Changed proxy_discovery_addr field to service_discovery +// Changed V1AppDisc struct to V1ServiceDisc const V110Name = "v1.1.0" // V1Name is the semantic version string for the most recent version of V1. @@ -100,15 +103,15 @@ type V1UptimeTracker struct { Addr string `json:"addr"` } -// V1AppDisc configures Skywire App Discovery Clients. -type V1AppDisc struct { +// V1ServiceDisc configures Skywire App Discovery Clients. +type V1ServiceDisc struct { UpdateInterval Duration `json:"update_interval,omitempty"` - ServiceDisc string `json:"proxy_discovery_addr"` // TODO: change JSON name + ServiceDisc string `json:"service_discovery"` } // V1Launcher configures the app launcher. type V1Launcher struct { - Discovery *V1AppDisc `json:"discovery"` + Discovery *V1ServiceDisc `json:"discovery"` Apps []launcher.AppConfig `json:"apps"` ServerAddr string `json:"server_addr"` BinPath string `json:"bin_path"`