diff --git a/go.mod b/go.mod index 49e0440290..3165aa6d28 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,7 @@ require ( github.com/sirupsen/logrus v1.9.3 github.com/skycoin/dmsg v1.3.26-0.20240922174815-ced25b343ec5 github.com/skycoin/skycoin v0.27.1 - github.com/skycoin/skycoin-service-discovery v1.3.25 + github.com/skycoin/skycoin-service-discovery v1.3.26-0.20240923193126-2175869a0af5 github.com/skycoin/skywire-services v1.3.25 github.com/skycoin/skywire-utilities v1.3.25 github.com/skycoin/systray v1.10.0 diff --git a/go.sum b/go.sum index ed0fa232c6..7c59a086e4 100644 --- a/go.sum +++ b/go.sum @@ -688,8 +688,8 @@ github.com/skycoin/noise v0.0.0-20180327030543-2492fe189ae6 h1:1Nc5EBY6pjfw1kwW0 github.com/skycoin/noise v0.0.0-20180327030543-2492fe189ae6/go.mod h1:UXghlricA7J3aRD/k7p/zBObQfmBawwCxIVPVjz2Q3o= github.com/skycoin/skycoin v0.27.1 h1:HatxsRwVSPaV4qxH6290xPBmkH/HgiuAoY2qC+e8C9I= github.com/skycoin/skycoin v0.27.1/go.mod h1:78nHjQzd8KG0jJJVL/j0xMmrihXi70ti63fh8vXScJw= -github.com/skycoin/skycoin-service-discovery v1.3.25 h1:vnB4Is0/+rYuE9pH3+pBdnTbKQYQV3h9BvzxHZi7GB8= -github.com/skycoin/skycoin-service-discovery v1.3.25/go.mod h1:D/4UQpOMdv8In2IY3P7+pLJUgJDqrpq7vpjX7dQEPng= +github.com/skycoin/skycoin-service-discovery v1.3.26-0.20240923193126-2175869a0af5 h1:YuUEIh0ZxpprE6cHgTks3nsA9W0h6MAeTiTYzvRvlyY= +github.com/skycoin/skycoin-service-discovery v1.3.26-0.20240923193126-2175869a0af5/go.mod h1:vfFU+qDJkxdf2AgPPem/WbKRxm2dNsWy1d+HJ3mluSM= github.com/skycoin/skywire-services v1.3.25 h1:LzUsNx7CNBTodkhkyl6fmJ1pbHY7WALiS4mNw8PKPe0= github.com/skycoin/skywire-services v1.3.25/go.mod h1:gRucqzsrQmzyPYBfYLJYFgi3+o98j+04oVFY0jRLScs= github.com/skycoin/skywire-utilities v1.3.25 h1:mk8dUonFdhVopFF3d9wbOyXXoiuAO+mN1y+ve6SzgX4= diff --git a/skywire.go b/skywire.go index ac53ec55aa..ee99b8062b 100644 --- a/skywire.go +++ b/skywire.go @@ -63,7 +63,6 @@ var Test Services // TestConf is the service configuration address / URL for the skywire test deployment var TestConf Conf -// initialize the embedded files into variables func init() { var js interface{} err := json.Unmarshal([]byte(ServicesJSON), &js) diff --git a/vendor/github.com/skycoin/skycoin-service-discovery/cmd/service-discovery/commands/root.go b/vendor/github.com/skycoin/skycoin-service-discovery/cmd/service-discovery/commands/root.go index 253c83d902..3ae0836829 100644 --- a/vendor/github.com/skycoin/skycoin-service-discovery/cmd/service-discovery/commands/root.go +++ b/vendor/github.com/skycoin/skycoin-service-discovery/cmd/service-discovery/commands/root.go @@ -1,4 +1,4 @@ -// Package commands cmd/service-discovery/root.go +// Package commands cmd/service-discovery/commands/root.go package commands import ( @@ -18,7 +18,6 @@ import ( "github.com/skycoin/skywire-utilities/pkg/httpauth" "github.com/skycoin/skywire-utilities/pkg/logging" "github.com/skycoin/skywire-utilities/pkg/metricsutil" - "github.com/skycoin/skywire-utilities/pkg/skyenv" "github.com/skycoin/skywire-utilities/pkg/storeconfig" "github.com/skycoin/skywire-utilities/pkg/tcpproxy" "github.com/spf13/cobra" @@ -35,33 +34,33 @@ var log = logging.MustGetLogger("service-discovery") const redisPrefix = "service-discovery" var ( - addr string - metricsAddr string - redisURL string - pgHost string - pgPort string - testMode bool - apiKey string - dmsgDisc string - whitelistKeys string - testEnvironment bool - sk cipher.SecKey - dmsgPort uint16 + addr string + metricsAddr string + redisURL string + pgHost string + pgPort string + testMode bool + apiKey string + dmsgDisc string + whitelistKeys string + sk cipher.SecKey + dmsgPort uint16 + dmsgServerType string ) func init() { - RootCmd.Flags().StringVarP(&addr, "addr", "a", ":9098", "address to bind to") - RootCmd.Flags().StringVarP(&metricsAddr, "metrics", "m", "", "address to bind metrics API to") - RootCmd.Flags().StringVarP(&redisURL, "redis", "r", "redis://localhost:6379", "connections string for a redis store") - RootCmd.Flags().StringVarP(&pgHost, "pg-host", "o", "localhost", "host of postgres") - RootCmd.Flags().StringVarP(&pgPort, "pg-port", "p", "5432", "port of postgres") - RootCmd.Flags().StringVarP(&whitelistKeys, "whitelist-keys", "w", "", "list of whitelisted keys of network monitor used for deregistration") - RootCmd.Flags().BoolVarP(&testMode, "test", "t", false, "run in test mode and disable auth") - RootCmd.Flags().StringVarP(&apiKey, "api-key", "g", "", "geo API key") - RootCmd.Flags().StringVarP(&dmsgDisc, "dmsg-disc", "d", skyenv.DmsgDiscAddr, "url of dmsg-discovery") - RootCmd.Flags().BoolVarP(&testEnvironment, "test-environment", "n", false, "distinguished between prod and test environment") - RootCmd.Flags().VarP(&sk, "sk", "s", "dmsg secret key\n") - RootCmd.Flags().Uint16Var(&dmsgPort, "dmsgPort", dmsg.DefaultDmsgHTTPPort, "dmsg port value") + RootCmd.Flags().StringVarP(&addr, "addr", "a", ":9098", "address to bind to\033[0m") + RootCmd.Flags().StringVarP(&metricsAddr, "metrics", "m", "", "address to bind metrics API to\033[0m") + RootCmd.Flags().StringVarP(&redisURL, "redis", "r", "redis://localhost:6379", "connections string for a redis store\033[0m") + RootCmd.Flags().StringVarP(&pgHost, "pg-host", "o", "localhost", "host of postgres\033[0m") + RootCmd.Flags().StringVarP(&pgPort, "pg-port", "p", "5432", "port of postgres\033[0m") + RootCmd.Flags().StringVarP(&whitelistKeys, "whitelist-keys", "w", "", "list of whitelisted keys of network monitor used for deregistration\033[0m") + RootCmd.Flags().BoolVarP(&testMode, "test", "t", false, "run in test mode and disable auth\033[0m") + RootCmd.Flags().StringVarP(&apiKey, "api-key", "g", "", "geo API key\033[0m") + RootCmd.Flags().StringVarP(&dmsgDisc, "dmsg-disc", "d", dmsg.DiscAddr(false), "url of dmsg-discovery\033[0m") + RootCmd.Flags().StringVar(&dmsgServerType, "dmsg-server-type", "", "type of dmsg server on dmsghttp handler\033[0m") + RootCmd.Flags().VarP(&sk, "sk", "s", "dmsg secret key\033[0m\n\r") + RootCmd.Flags().Uint16Var(&dmsgPort, "dmsgPort", dmsg.DefaultDmsgHTTPPort, "dmsg port value\033[0m") } // RootCmd contains the root service-discovery command @@ -80,7 +79,7 @@ keys-gen | tee sd-config.json PG_USER="postgres" PG_DATABASE="sd" PG_PASSWORD="" service-discovery --sk $(tail -n1 sd-config.json)`, Run: func(_ *cobra.Command, _ []string) { if dmsgDisc == "" { - dmsgDisc = skyenv.DmsgDiscAddr + dmsgDisc = dmsg.DiscAddr(false) } if _, err := buildinfo.Get().WriteTo(os.Stdout); err != nil { log.Printf("Failed to output build info: %v", err) @@ -149,12 +148,6 @@ PG_USER="postgres" PG_DATABASE="sd" PG_PASSWORD="" service-discovery --sk $(tail var whitelistPKs []string if whitelistKeys != "" { whitelistPKs = strings.Split(whitelistKeys, ",") - } else { - if testEnvironment { - whitelistPKs = strings.Split(skyenv.TestNetworkMonitorPKs, ",") - } else { - whitelistPKs = strings.Split(skyenv.NetworkMonitorPKs, ",") - } } for _, v := range whitelistPKs { api.WhitelistPKs.Set(v) @@ -171,10 +164,11 @@ PG_USER="postgres" PG_DATABASE="sd" PG_PASSWORD="" service-discovery --sk $(tail }() if !pk.Null() { - servers := dmsghttp.GetServers(ctx, dmsgDisc, log) + servers := dmsghttp.GetServers(ctx, dmsgDisc, dmsgServerType, log) config := &dmsg.Config{ - MinSessions: 0, // listen on all available servers - UpdateInterval: dmsg.DefaultUpdateInterval, + MinSessions: 0, // listen on all available servers + UpdateInterval: dmsg.DefaultUpdateInterval, + ConnectedServersType: dmsgServerType, } var keys cipher.PubKeys keys = append(keys, pk) @@ -194,7 +188,7 @@ PG_USER="postgres" PG_DATABASE="sd" PG_PASSWORD="" service-discovery --sk $(tail } }() - go dmsghttp.UpdateServers(ctx, dClient, dmsgDisc, dmsgDC, log) + go dmsghttp.UpdateServers(ctx, dClient, dmsgDisc, dmsgDC, dmsgServerType, log) go func() { if err := dmsghttp.ListenAndServe(ctx, sk, sdAPI, dClient, dmsg.DefaultDmsgHTTPPort, dmsgDC, log); err != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index 4e3e984178..f1c2561d2b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -518,7 +518,7 @@ github.com/skycoin/skycoin/src/cipher/ripemd160 github.com/skycoin/skycoin/src/cipher/secp256k1-go github.com/skycoin/skycoin/src/cipher/secp256k1-go/secp256k1-go2 github.com/skycoin/skycoin/src/util/logging -# github.com/skycoin/skycoin-service-discovery v1.3.25 +# github.com/skycoin/skycoin-service-discovery v1.3.26-0.20240923193126-2175869a0af5 ## explicit; go 1.21 github.com/skycoin/skycoin-service-discovery/cmd/service-discovery/commands github.com/skycoin/skycoin-service-discovery/internal/pg