Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/v0.4.2 #814

Merged
merged 10 commits into from
Jun 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/schollz/progressbar/v2 v2.15.0
github.com/shirou/gopsutil v2.20.5+incompatible
github.com/sirupsen/logrus v1.7.0
github.com/skycoin/dmsg v0.0.0-20201216183836-dae8a7acfc14
github.com/skycoin/dmsg v0.0.0-20210616115957-702a819a9b3d
github.com/skycoin/skycoin v0.27.1
github.com/skycoin/yamux v0.0.0-20200803175205-571ceb89da9f
github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8
Expand Down
7 changes: 5 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoT
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I=
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pires/go-proxyproto v0.3.3/go.mod h1:Odh9VFOZJCf9G8cLW5o435Xf1J95Jw9Gw5rnCjcwzAY=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down Expand Up @@ -194,8 +195,8 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/skycoin/dmsg v0.0.0-20201216183836-dae8a7acfc14 h1:ettvdRq5O1+bx1wIZPS9w+BnjzTxhZeNItDgwYI8KHs=
github.com/skycoin/dmsg v0.0.0-20201216183836-dae8a7acfc14/go.mod h1:aP/e1DEQQ16i5AzHy2e+2EFYT3ZN/sIyWRY0js56yY8=
github.com/skycoin/dmsg v0.0.0-20210616115957-702a819a9b3d h1:39KtADgOPhnUuATKBA59uB2BmzhtOzjeK11aOM+LEyw=
github.com/skycoin/dmsg v0.0.0-20210616115957-702a819a9b3d/go.mod h1:tR/47K4BLJ2MT6eyE2BCxcXHLUhfnWiDhgE1OQmtA70=
github.com/skycoin/noise v0.0.0-20180327030543-2492fe189ae6 h1:1Nc5EBY6pjfw1kwW0duwyG+7WliWz5u9kgk1h5MnLuA=
github.com/skycoin/noise v0.0.0-20180327030543-2492fe189ae6/go.mod h1:UXghlricA7J3aRD/k7p/zBObQfmBawwCxIVPVjz2Q3o=
github.com/skycoin/skycoin v0.26.0/go.mod h1:78nHjQzd8KG0jJJVL/j0xMmrihXi70ti63fh8vXScJw=
Expand Down Expand Up @@ -286,6 +287,7 @@ golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191003171128-d98b1b443823/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191204025024-5ee1b9f4859a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200625001655-4c5254603344 h1:vGXIOMxbNfDTk/aXCmfdLgkrSV+Z2tcbze+pEc3v5W4=
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
Expand Down Expand Up @@ -355,6 +357,7 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogR
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.51.1/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
Expand Down
2 changes: 1 addition & 1 deletion internal/utclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (c *httpClient) Get(ctx context.Context, path string) (*http.Response, erro

// UpdateVisorUptime updates visor uptime.
func (c *httpClient) UpdateVisorUptime(ctx context.Context) error {
resp, err := c.Get(ctx, "/v3/update")
resp, err := c.Get(ctx, "/v4/update")
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/utclient/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func TestUpdateVisorUptime(t *testing.T) {
err = c.UpdateVisorUptime(context.TODO())
require.NoError(t, err)

assert.Equal(t, "/v3/update", <-urlCh)
assert.Equal(t, "/v4/update", <-urlCh)
}

func authHandler(next http.Handler) http.Handler {
Expand Down
5 changes: 0 additions & 5 deletions pkg/app/appdisc/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ func (f *Factory) AppUpdater(conf appcommon.ProcConfig) (Updater, bool) {
}

switch conf.AppName {
case skyenv.SkysocksName:
return &serviceUpdater{
client: servicedisc.NewClient(log, getServiceDiscConf(conf, servicedisc.ServiceTypeProxy)),
interval: f.UpdateInterval,
}, true
case skyenv.VPNServerName:
return &serviceUpdater{
client: servicedisc.NewClient(log, getServiceDiscConf(conf, servicedisc.ServiceTypeVPN)),
Expand Down
27 changes: 19 additions & 8 deletions pkg/skyenv/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,25 @@ const (
PackageSkywirePath = "/opt/skywire"
)

// Constants for default services.
// Constants for old default services.
const (
DefaultTpDiscAddr = "http://transport.discovery.skywire.skycoin.com"
DefaultDmsgDiscAddr = "http://dmsg.discovery.skywire.skycoin.com"
DefaultServiceDiscAddr = "http://service.discovery.skycoin.com"
DefaultRouteFinderAddr = "http://routefinder.skywire.skycoin.com"
DefaultUptimeTrackerAddr = "http://uptime-tracker.skywire.skycoin.com"
DefaultAddressResolverAddr = "http://address.resolver.skywire.skycoin.com"
OldDefaultTpDiscAddr = "http://transport.discovery.skywire.skycoin.com"
OldDefaultDmsgDiscAddr = "http://dmsg.discovery.skywire.skycoin.com"
OldDefaultServiceDiscAddr = "http://service.discovery.skycoin.com"
OldDefaultRouteFinderAddr = "http://routefinder.skywire.skycoin.com"
OldDefaultUptimeTrackerAddr = "http://uptime-tracker.skywire.skycoin.com"
OldDefaultAddressResolverAddr = "http://address.resolver.skywire.skycoin.com"
OldDefaultSetupPK = "0324579f003e6b4048bae2def4365e634d8e0e3054a20fc7af49daf2a179658557"
)

// Constants for new default services.
const (
DefaultTpDiscAddr = "http://tpd.skywire.skycoin.com"
DefaultDmsgDiscAddr = "http://dmsgd.skywire.skycoin.com"
DefaultServiceDiscAddr = "http://sd.skycoin.com"
DefaultRouteFinderAddr = "http://rf.skywire.skycoin.com"
DefaultUptimeTrackerAddr = "http://ut.skywire.skycoin.com"
DefaultAddressResolverAddr = "http://ar.skywire.skycoin.com"
DefaultSetupPK = "0324579f003e6b4048bae2def4365e634d8e0e3054a20fc7af49daf2a179658557"
)

Expand Down Expand Up @@ -91,7 +102,7 @@ const (
// Default skywire app server and discovery constants
const (
DefaultAppSrvAddr = "localhost:5505"
AppDiscUpdateInterval = 30 * time.Second
AppDiscUpdateInterval = time.Minute
DefaultAppLocalPath = DefaultSkywirePath + "/local"
DefaultAppBinPath = DefaultSkywirePath + "/apps"
DefaultLogLevel = "info"
Expand Down
2 changes: 1 addition & 1 deletion pkg/visor/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ func initHypervisors(v *Visor) bool {
}

func initUptimeTracker(v *Visor) bool {
const tickDuration = 1 * time.Minute
const tickDuration = 5 * time.Minute

report := v.makeReporter("uptime_tracker")
conf := v.conf.UptimeTracker
Expand Down
7 changes: 6 additions & 1 deletion pkg/visor/visorconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,17 @@ func MakeBaseConfig(common *Common) *V1 {
RouteFinderTimeout: DefaultTimeout,
}
conf.Launcher = &V1Launcher{
Discovery: nil,
Discovery: &V1AppDisc{
ServiceDisc: skyenv.DefaultServiceDiscAddr,
},
Apps: nil,
ServerAddr: skyenv.DefaultAppSrvAddr,
BinPath: skyenv.DefaultAppBinPath,
LocalPath: skyenv.DefaultAppLocalPath,
}
conf.UptimeTracker = &V1UptimeTracker{
Addr: skyenv.DefaultUptimeTrackerAddr,
}
conf.CLIAddr = skyenv.DefaultRPCAddr
conf.LogLevel = skyenv.DefaultLogLevel
conf.ShutdownTimeout = DefaultTimeout
Expand Down
30 changes: 29 additions & 1 deletion pkg/visor/visorconfig/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ func Parse(log *logging.MasterLogger, path string, raw []byte) (*V1, error) {
}

switch cc.Version {
case V1Name: // Current version.
case V101Name: // Current version.
fallthrough
case V100Name:
return parseV1(cc, raw)
case V0Name, V0NameOldFormat, "":
return parseV0(cc, raw)
Expand All @@ -55,6 +57,10 @@ func parseV1(cc *Common, raw []byte) (*V1, error) {
if err := conf.ensureKeys(); err != nil {
return nil, fmt.Errorf("%v: %w", ErrInvalidSK, err)
}

conf = updateUrls(conf)

conf.Version = V1Name
return conf, conf.flush(conf)
}

Expand Down Expand Up @@ -155,3 +161,25 @@ func parseV0(cc *Common, raw []byte) (*V1, error) {

return conf, conf.flush(conf)
}

func updateUrls(conf *V1) *V1 {
if conf.Dmsg.Discovery == skyenv.OldDefaultDmsgDiscAddr {
conf.Dmsg.Discovery = skyenv.DefaultDmsgDiscAddr
}
if conf.Transport.Discovery == skyenv.OldDefaultTpDiscAddr {
conf.Transport.Discovery = skyenv.DefaultTpDiscAddr
}
if conf.Transport.AddressResolver == skyenv.OldDefaultAddressResolverAddr {
conf.Transport.AddressResolver = skyenv.DefaultAddressResolverAddr
}
if conf.Routing.RouteFinder == skyenv.OldDefaultRouteFinderAddr {
conf.Routing.RouteFinder = skyenv.DefaultRouteFinderAddr
}
if conf.UptimeTracker.Addr == skyenv.OldDefaultUptimeTrackerAddr {
conf.UptimeTracker.Addr = skyenv.DefaultUptimeTrackerAddr
}
if conf.Launcher.Discovery.ServiceDisc == skyenv.OldDefaultServiceDiscAddr {
conf.Launcher.Discovery.ServiceDisc = skyenv.DefaultServiceDiscAddr
}
return conf
}
13 changes: 10 additions & 3 deletions pkg/visor/visorconfig/v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@ import (

//go:generate readmegen -n V1 -o ./README.md ./v1.go

// V1Name is the semantic version string for V1.
const V1Name = "v1.0.0"
// V100Name is the semantic version string for V1.0.0
const V100Name = "v1.0.0"

// V1 is visor config v1.0.0
// V101Name is the semantic version string for V1.0.1
// Default urls are changed to newer ones in this version
const V101Name = "v1.0.1"

// V1Name is the current version of config
const V1Name = V101Name

// V1 is visor config v1.0.1
type V1 struct {
*Common
mu sync.RWMutex
Expand Down
5 changes: 2 additions & 3 deletions vendor/github.com/skycoin/dmsg/const.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions vendor/github.com/skycoin/dmsg/disc/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion vendor/github.com/skycoin/dmsg/go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions vendor/github.com/skycoin/dmsg/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions vendor/github.com/skycoin/dmsg/httputil/httputil.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading