diff --git a/ci_scripts/run-pkg-tests.sh b/ci_scripts/run-pkg-tests.sh index 3acc0da0b..40555c455 100755 --- a/ci_scripts/run-pkg-tests.sh +++ b/ci_scripts/run-pkg-tests.sh @@ -13,7 +13,7 @@ go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/SkycoinProject/skywire-mainnet/pkg/hypervisor -run TestNewNode >> ./logs/pkg/TestNewNode.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/SkycoinProject/skywire-mainnet/pkg/node -run TestMessagingDiscovery >> ./logs/pkg/TestMessagingDiscovery.log +go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/SkycoinProject/skywire-mainnet/pkg/node -run TestDmsgDiscovery >> ./logs/pkg/TestDmsgDiscovery.log go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/SkycoinProject/skywire-mainnet/pkg/node -run TestTransportDiscovery >> ./logs/pkg/TestTransportDiscovery.log go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/SkycoinProject/skywire-mainnet/pkg/node -run TestTransportLogStore >> ./logs/pkg/TestTransportLogStore.log go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/SkycoinProject/skywire-mainnet/pkg/node -run TestRoutingTable >> ./logs/pkg/TestRoutingTable.log diff --git a/cmd/dmsg-server/commands/root.go b/cmd/dmsg-server/commands/root.go index 37c039d08..93ff627fb 100644 --- a/cmd/dmsg-server/commands/root.go +++ b/cmd/dmsg-server/commands/root.go @@ -27,7 +27,7 @@ var ( cfgFromStdin bool ) -// Config is a messaging-server config +// Config is a DMSG server config type Config struct { PubKey cipher.PubKey `json:"public_key"` SecKey cipher.SecKey `json:"secret_key"` @@ -38,8 +38,8 @@ type Config struct { } var rootCmd = &cobra.Command{ - Use: "messaging-server [config.json]", - Short: "Messaging Server for skywire", + Use: "dmsg-server [config.json]", + Short: "Dmsg Server for skywire", Run: func(_ *cobra.Command, args []string) { // Config configFile := "config.json" @@ -90,7 +90,7 @@ var rootCmd = &cobra.Command{ func init() { rootCmd.Flags().StringVarP(&metricsAddr, "metrics", "m", ":2121", "address to bind metrics API to") rootCmd.Flags().StringVar(&syslogAddr, "syslog", "", "syslog server address. E.g. localhost:514") - rootCmd.Flags().StringVar(&tag, "tag", "messaging-server", "logging tag") + rootCmd.Flags().StringVar(&tag, "tag", "dmsg-server", "logging tag") rootCmd.Flags().BoolVarP(&cfgFromStdin, "stdin", "i", false, "read configuration from STDIN") } diff --git a/cmd/setup-node/config.json b/cmd/setup-node/config.json index 80936cb97..5aac1fde4 100644 --- a/cmd/setup-node/config.json +++ b/cmd/setup-node/config.json @@ -1,7 +1,7 @@ { "public_key": "024ec47420176680816e0406250e7156465e4531f5b26057c9f6297bb0303558c7", "secret_key": "42bca4df2f3189b28872d40e6c61aacd5e85b8e91f8fea65780af27c142419e5", - "messaging": { + "dmsg": { "discovery": "http://skywire.skycoin.net:8001", "server_count": 1 }, diff --git a/cmd/skywire-cli/commands/mdisc/root.go b/cmd/skywire-cli/commands/mdisc/root.go index 7abc3ac46..761cefba6 100644 --- a/cmd/skywire-cli/commands/mdisc/root.go +++ b/cmd/skywire-cli/commands/mdisc/root.go @@ -18,13 +18,13 @@ import ( var mdAddr string func init() { - RootCmd.PersistentFlags().StringVar(&mdAddr, "addr", skyenv.DefaultDmsgDiscAddr, "address of messaging discovery server") + RootCmd.PersistentFlags().StringVar(&mdAddr, "addr", skyenv.DefaultDmsgDiscAddr, "address of DMSG discovery server") } -// RootCmd is the command that contains sub-commands which interacts with messaging services. +// RootCmd is the command that contains sub-commands which interacts with DMSG services. var RootCmd = &cobra.Command{ Use: "mdisc", - Short: "Contains sub-commands that interact with a remote Messaging Discovery", + Short: "Contains sub-commands that interact with a remote DMSG Discovery", } func init() { @@ -36,7 +36,7 @@ func init() { var entryCmd = &cobra.Command{ Use: "entry ", - Short: "fetches an entry from messaging-discovery", + Short: "fetches an entry from DMSG discovery", Args: cobra.MinimumNArgs(1), Run: func(_ *cobra.Command, args []string) { ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) @@ -50,7 +50,7 @@ var entryCmd = &cobra.Command{ var availableServersCmd = &cobra.Command{ Use: "available-servers", - Short: "fetch available servers from messaging-discovery", + Short: "fetch available servers from DMSG discovery", Run: func(_ *cobra.Command, _ []string) { ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) defer cancel() diff --git a/cmd/skywire-cli/commands/node/gen-config.go b/cmd/skywire-cli/commands/node/gen-config.go index e24dbb0d4..346db2f18 100644 --- a/cmd/skywire-cli/commands/node/gen-config.go +++ b/cmd/skywire-cli/commands/node/gen-config.go @@ -94,11 +94,11 @@ func defaultConfig() *visor.Config { conf.STCP.LocalAddr = lIPaddr if testenv { - conf.Messaging.Discovery = skyenv.TestDmsgDiscAddr + conf.Dmsg.Discovery = skyenv.TestDmsgDiscAddr } else { - conf.Messaging.Discovery = skyenv.DefaultDmsgDiscAddr + conf.Dmsg.Discovery = skyenv.DefaultDmsgDiscAddr } - conf.Messaging.ServerCount = 1 + conf.Dmsg.ServerCount = 1 ptyConf := defaultDmsgPtyConfig() conf.DmsgPty = &ptyConf diff --git a/cmd/skywire-visor/config.json b/cmd/skywire-visor/config.json index 3ee1687fa..b293372a7 100644 --- a/cmd/skywire-visor/config.json +++ b/cmd/skywire-visor/config.json @@ -4,15 +4,8 @@ "static_public_key": "024ec47420176680816e0406250e7156465e4531f5b26057c9f6297bb0303558c7", "static_secret_key": "42bca4df2f3189b28872d40e6c61aacd5e85b8e91f8fea65780af27c142419e5" }, - "messaging": { - "server": false, - "public": true, + "dmsg": { "discovery": "http://skywire.skycoin.net:8001", - "delegated_servers": [ - "03a714db33a696a1202de568485234d5035935040bd85a87925568e3ddd100f1e3", - "02709cebf98a35431407068ee0740233224795315e3b218054431da80d9c827f07", - "03cf6b2ab045aa96d39a58cc087177d1d94944f61a131ec4a69327d5007a8e9953" - ], "server_count": 5 }, "apps": [ diff --git a/integration/InteractiveEnvironments.md b/integration/InteractiveEnvironments.md index 599cec113..19aacd46d 100644 --- a/integration/InteractiveEnvironments.md +++ b/integration/InteractiveEnvironments.md @@ -139,8 +139,8 @@ The following steps will be performed: 1. copy sw*.json and start-restart-nodeB.sh into skywire directory 2. Create 9 tmux windows: - 1. MSGD: messaging-discovery - 2. MSG: messaging-server + 1. MSGD: dmsg-discovery + 2. MSG: dmsg-server 3. TRD: transport-discovery 4. RF: route-finder 5. SN: setup-node @@ -149,7 +149,7 @@ The following steps will be performed: 8. NodeC: first skywire-visor with generic/nodeC.json 9. shell: new shell for interactive exploration 3. ENV-vars in shell-window: - 1. $MSG_PK, $SN_PK - public keys of messaging-server and setup-node + 1. $MSG_PK, $SN_PK - public keys of dmsg-server and setup-node 2. $PK_A, $PK_B, $PK_C - public keys of node_A, node_B, node_C 3. $RPC_A, $RPC_B, $RPC_C - `--rpc` param for ../skywire/skywire-cli 4. $CHAT_A, $CHAT_B - addresses and ports for `skychat`-apps on node_A and node_C diff --git a/integration/check-services.sh b/integration/check-services.sh index 17b1a22fb..42525296b 100644 --- a/integration/check-services.sh +++ b/integration/check-services.sh @@ -1,17 +1,17 @@ -echo -e "\n\n" MESSAGING-DISCOVERY +echo -e "\n\n" DMSG-DISCOVERY -echo -e "\n\n" $MSGD/messaging-discovery/available_servers"\n" -curl $MSGD/messaging-discovery/available_servers +echo -e "\n\n" $MSGD/dmsg-discovery/available_servers"\n" +curl $MSGD/dmsg-discovery/available_servers -echo -e "\n\n" $MSGD/messaging-discovery/entry/PK_A"\n" -curl $MSGD/messaging-discovery/entry/$PK_A +echo -e "\n\n" $MSGD/dmsg-discovery/entry/PK_A"\n" +curl $MSGD/dmsg-discovery/entry/$PK_A -echo -e "\n\n" $MSGD/messaging-discovery/entry/PK_B"\n" -curl $MSGD/messaging-discovery/entry/$PK_B +echo -e "\n\n" $MSGD/dmsg-discovery/entry/PK_B"\n" +curl $MSGD/dmsg-discovery/entry/$PK_B -echo -e "\n\n" $MSGD/messaging-discovery/entry/PK_C"\n" -curl $MSGD/messaging-discovery/entry/$PK_C +echo -e "\n\n" $MSGD/dmsg-discovery/entry/PK_C"\n" +curl $MSGD/dmsg-discovery/entry/$PK_C echo -e "\n\n" TRANSPORT-DISCOVERY diff --git a/integration/generic/env-vars.sh b/integration/generic/env-vars.sh index 7a355a47c..a4b77dd7b 100644 --- a/integration/generic/env-vars.sh +++ b/integration/generic/env-vars.sh @@ -14,9 +14,9 @@ alias CLI_A='./skywire-cli --rpc $RPC_A' alias CLI_B='./skywire-cli --rpc $RPC_B' alias CLI_C='./skywire-cli --rpc $RPC_C' -export MSGD=https://messaging.discovery.skywire.skycoin.net -export TRD=https://transport.discovery.skywire.skycoin.net -export RF=https://routefinder.skywire.skycoin.net +export MSGD=https://dmsg.discovery.skywire.skycoin.com +export TRD=https://transport.discovery.skywire.skycoin.com +export RF=https://routefinder.skywire.skycoin.com echo PK_A: $PK_A echo PK_B: $PK_B diff --git a/integration/generic/nodeA.json b/integration/generic/nodeA.json index 4a4de930f..ad68e8ab1 100644 --- a/integration/generic/nodeA.json +++ b/integration/generic/nodeA.json @@ -4,12 +4,12 @@ "static_public_key": "02072dd1e2ccd761e717096e1a264de1d8917e78e3176ca99dbf7ccf7292969845", "static_secret_key": "7073e557aa2308b448525397ea2f45d56c9962c4dcdf82c5fdb5cc02fca0481c" }, - "messaging": { - "discovery": "https://messaging.discovery.skywire.skycoin.net", + "dmsg": { + "discovery": "https://dmsg.discovery.skywire.skycoin.com", "server_count": 1 }, "transport": { - "discovery": "https://transport.discovery.skywire.skycoin.net", + "discovery": "https://transport.discovery.skywire.skycoin.com", "log_store": { "type": "file", "location": "./local/nodeA/transport_logs" @@ -19,7 +19,7 @@ "setup_nodes": [ "0324579f003e6b4048bae2def4365e634d8e0e3054a20fc7af49daf2a179658557" ], - "route_finder": "https://routefinder.skywire.skycoin.net/" + "route_finder": "https://routefinder.skywire.skycoin.com/" }, "apps": [ { diff --git a/integration/generic/nodeC.json b/integration/generic/nodeC.json index 0cde00086..04d29c109 100644 --- a/integration/generic/nodeC.json +++ b/integration/generic/nodeC.json @@ -4,12 +4,12 @@ "static_public_key": "02c9ddf5c2ae6a5a2166028dafbc814eff3ec2352f429fb0aa37d96e1aa668f332", "static_secret_key": "5ab3744ab56e4d0b82f9a915e07b8f05d51ec0f16ff8496bd92f4e378ca6c1fc" }, - "messaging": { - "discovery": "https://messaging.discovery.skywire.skycoin.net", + "dmsg": { + "discovery": "https://dmsg.discovery.skywire.skycoin.com", "server_count": 1 }, "transport": { - "discovery": "https://transport.discovery.skywire.skycoin.net", + "discovery": "https://transport.discovery.skywire.skycoin.com", "log_store": { "type": "file", "location": "./local/nodeC/transport_logs" @@ -19,7 +19,7 @@ "setup_nodes": [ "0324579f003e6b4048bae2def4365e634d8e0e3054a20fc7af49daf2a179658557" ], - "route_finder": "https://routefinder.skywire.skycoin.net/" + "route_finder": "https://routefinder.skywire.skycoin.com/" }, "apps": [ { diff --git a/integration/intermediary-nodeB.json b/integration/intermediary-nodeB.json index 9f2a4d464..b0f1e2956 100644 --- a/integration/intermediary-nodeB.json +++ b/integration/intermediary-nodeB.json @@ -4,12 +4,12 @@ "static_public_key": "0372ee0a2b99b55906ac33b49704073ab90ab4f395d814d48d597b5b42c39e5c79", "static_secret_key": "5092f14fe18bd7dcd34479c5d26bb3bf68b708ec74a12c4557091e82dd6e6c36" }, - "messaging": { - "discovery": "https://messaging.discovery.skywire.skycoin.net", + "dmsg": { + "discovery": "https://dmsg.discovery.skywire.skycoin.com", "server_count": 1 }, "transport": { - "discovery": "https://transport.discovery.skywire.skycoin.net", + "discovery": "https://transport.discovery.skywire.skycoin.com", "log_store": { "type": "file", "location": "./local/nodeB/transport_logs" @@ -19,7 +19,7 @@ "setup_nodes": [ "0324579f003e6b4048bae2def4365e634d8e0e3054a20fc7af49daf2a179658557" ], - "route_finder": "https://routefinder.skywire.skycoin.net/", + "route_finder": "https://routefinder.skywire.skycoin.com/", "route_finder_timeout": "60s" }, "apps": [], diff --git a/integration/messaging/env-vars.sh b/integration/messaging/env-vars.sh index 1110e42eb..bbfc875ce 100644 --- a/integration/messaging/env-vars.sh +++ b/integration/messaging/env-vars.sh @@ -10,9 +10,9 @@ export RPC_C=$(jq -r ".interfaces.rpc" ./integration/messaging/nodeC.json) export CHAT_A=http://localhost:8000/message export CHAT_C=http://localhost$(jq -r '.apps [] |select(.app=="skychat")| .args[1] ' ./integration/messaging/nodeC.json)/message -export MSGD=https://messaging.discovery.skywire.skycoin.net -export TRD=https://transport.discovery.skywire.skycoin.net -export RF=https://routefinder.skywire.skycoin.net +export MSGD=https://dmsg.discovery.skywire.skycoin.com +export TRD=https://transport.discovery.skywire.skycoin.com +export RF=https://routefinder.skywire.skycoin.com alias CLI_A='./skywire-cli --rpc $RPC_A' alias CLI_B='./skywire-cli --rpc $RPC_B' diff --git a/integration/messaging/nodeA.json b/integration/messaging/nodeA.json index a99b22e3a..880b9348a 100644 --- a/integration/messaging/nodeA.json +++ b/integration/messaging/nodeA.json @@ -4,12 +4,12 @@ "static_public_key": "02072dd1e2ccd761e717096e1a264de1d8917e78e3176ca99dbf7ccf7292969845", "static_secret_key": "7073e557aa2308b448525397ea2f45d56c9962c4dcdf82c5fdb5cc02fca0481c" }, - "messaging": { - "discovery": "https://messaging.discovery.skywire.skycoin.net", + "dmsg": { + "discovery": "https://dmsg.discovery.skywire.skycoin.com", "server_count": 1 }, "transport": { - "discovery": "https://transport.discovery.skywire.skycoin.net", + "discovery": "https://transport.discovery.skywire.skycoin.com", "log_store": { "type": "file", "location": "./local/nodeA/transport_logs" @@ -19,7 +19,7 @@ "setup_nodes": [ "0324579f003e6b4048bae2def4365e634d8e0e3054a20fc7af49daf2a179658557" ], - "route_finder": "https://routefinder.skywire.skycoin.net/", + "route_finder": "https://routefinder.skywire.skycoin.com/", "route_finder_timeout": "60s" }, "apps": [ diff --git a/integration/messaging/nodeC.json b/integration/messaging/nodeC.json index 6382f4436..de8b441a5 100644 --- a/integration/messaging/nodeC.json +++ b/integration/messaging/nodeC.json @@ -4,12 +4,12 @@ "static_public_key": "02c9ddf5c2ae6a5a2166028dafbc814eff3ec2352f429fb0aa37d96e1aa668f332", "static_secret_key": "5ab3744ab56e4d0b82f9a915e07b8f05d51ec0f16ff8496bd92f4e378ca6c1fc" }, - "messaging": { - "discovery": "https://messaging.discovery.skywire.skycoin.net", + "dmsg": { + "discovery": "https://dmsg.discovery.skywire.skycoin.com", "server_count": 1 }, "transport": { - "discovery": "https://transport.discovery.skywire.skycoin.net", + "discovery": "https://transport.discovery.skywire.skycoin.com", "log_store": { "type": "file", "location": "./local/nodeC/transport_logs" @@ -19,7 +19,7 @@ "setup_nodes": [ "0324579f003e6b4048bae2def4365e634d8e0e3054a20fc7af49daf2a179658557" ], - "route_finder": "https://routefinder.skywire.skycoin.net/", + "route_finder": "https://routefinder.skywire.skycoin.com/", "route_finder_timeout": "60s" }, "apps": [ diff --git a/integration/proxy/env-vars.sh b/integration/proxy/env-vars.sh index 945a17cd8..c297b62dc 100644 --- a/integration/proxy/env-vars.sh +++ b/integration/proxy/env-vars.sh @@ -11,9 +11,9 @@ alias CLI_A='./skywire-cli --rpc $RPC_A' alias CLI_B='./skywire-cli --rpc $RPC_B' alias CLI_C='./skywire-cli --rpc $RPC_C' -export MSGD=https://messaging.discovery.skywire.skycoin.net -export TRD=https://transport.discovery.skywire.skycoin.net -export RF=https://routefinder.skywire.skycoin.net +export MSGD=https://dmsg.discovery.skywire.skycoin.com +export TRD=https://transport.discovery.skywire.skycoin.com +export RF=https://routefinder.skywire.skycoin.com alias RUN_A='go run ./cmd/skywire-visor ./integration/messaging/nodeA.json --tag NodeA' alias RUN_B='go run ./cmd/skywire-visor ./integration/intermediary-nodeB.json --tag NodeB' diff --git a/integration/proxy/nodeA.json b/integration/proxy/nodeA.json index 05a4816b5..59cf0e2e3 100644 --- a/integration/proxy/nodeA.json +++ b/integration/proxy/nodeA.json @@ -4,12 +4,12 @@ "static_public_key": "02072dd1e2ccd761e717096e1a264de1d8917e78e3176ca99dbf7ccf7292969845", "static_secret_key": "7073e557aa2308b448525397ea2f45d56c9962c4dcdf82c5fdb5cc02fca0481c" }, - "messaging": { - "discovery": "https://messaging.discovery.skywire.skycoin.net", + "dmsg": { + "discovery": "https://dmsg.discovery.skywire.skycoin.com", "server_count": 1 }, "transport": { - "discovery": "https://transport.discovery.skywire.skycoin.net", + "discovery": "https://transport.discovery.skywire.skycoin.com", "log_store": { "type": "file", "location": "./local/nodeA/transport_logs" @@ -19,7 +19,7 @@ "setup_nodes": [ "0324579f003e6b4048bae2def4365e634d8e0e3054a20fc7af49daf2a179658557" ], - "route_finder": "https://routefinder.skywire.skycoin.net/" + "route_finder": "https://routefinder.skywire.skycoin.com/" }, "apps": [ { diff --git a/integration/proxy/nodeC.json b/integration/proxy/nodeC.json index dc4e7b0d5..169dc4125 100644 --- a/integration/proxy/nodeC.json +++ b/integration/proxy/nodeC.json @@ -4,12 +4,12 @@ "static_public_key": "02c9ddf5c2ae6a5a2166028dafbc814eff3ec2352f429fb0aa37d96e1aa668f332", "static_secret_key": "5ab3744ab56e4d0b82f9a915e07b8f05d51ec0f16ff8496bd92f4e378ca6c1fc" }, - "messaging": { - "discovery": "https://messaging.discovery.skywire.skycoin.net", + "dmsg": { + "discovery": "https://dmsg.discovery.skywire.skycoin.com", "server_count": 1 }, "transport": { - "discovery": "https://transport.discovery.skywire.skycoin.net", + "discovery": "https://transport.discovery.skywire.skycoin.com", "log_store": { "type": "file", "location": "./local/nodeC/transport_logs" @@ -19,7 +19,7 @@ "setup_nodes": [ "0324579f003e6b4048bae2def4365e634d8e0e3054a20fc7af49daf2a179658557" ], - "route_finder": "https://routefinder.skywire.skycoin.net/" + "route_finder": "https://routefinder.skywire.skycoin.com/" }, "apps": [ { diff --git a/internal/utclient/client.go b/internal/utclient/client.go index a42efedfe..63d54e467 100644 --- a/internal/utclient/client.go +++ b/internal/utclient/client.go @@ -24,7 +24,7 @@ type Error struct { Error string `json:"error"` } -// APIClient implements messaging discovery API client. +// APIClient implements DMSG discovery API client. type APIClient interface { UpdateNodeUptime(context.Context) error } diff --git a/pkg/metrics/messaging.go b/pkg/metrics/messaging.go deleted file mode 100644 index 9da88e7c4..000000000 --- a/pkg/metrics/messaging.go +++ /dev/null @@ -1,26 +0,0 @@ -package metrics - -import ( - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" -) - -// MessagingMetrics record messaging metrics -type MessagingMetrics struct { - ClientConns prometheus.Gauge - Bandwidth prometheus.Summary -} - -// NewMessagingMetrics construct new MessagingMetrics. -func NewMessagingMetrics(service string) *MessagingMetrics { - return &MessagingMetrics{ - ClientConns: promauto.NewGauge(prometheus.GaugeOpts{ - Name: service + "_clients_total", - Help: "The total number of connected clients", - }), - Bandwidth: promauto.NewSummary(prometheus.SummaryOpts{ - Name: service + "_bandwidth", - Help: "Amount of bytes proxied between clients", - }), - } -} diff --git a/pkg/setup/config.go b/pkg/setup/config.go index 9f1e41d4f..c0f35b803 100644 --- a/pkg/setup/config.go +++ b/pkg/setup/config.go @@ -17,7 +17,7 @@ type Config struct { PubKey cipher.PubKey `json:"public_key"` SecKey cipher.SecKey `json:"secret_key"` - Messaging struct { + Dmsg struct { Discovery string `json:"discovery"` ServerCount int `json:"server_count"` } diff --git a/pkg/setup/node.go b/pkg/setup/node.go index 9e3e99718..05af1200c 100644 --- a/pkg/setup/node.go +++ b/pkg/setup/node.go @@ -42,10 +42,10 @@ func NewNode(conf *Config, metrics metrics.Recorder) (*Node, error) { dmsgC := dmsg.NewClient( conf.PubKey, conf.SecKey, - disc.NewHTTP(conf.Messaging.Discovery), + disc.NewHTTP(conf.Dmsg.Discovery), dmsg.SetLogger(logger.PackageLogger(dmsg.Type)), ) - if err := dmsgC.InitiateServerConnections(ctx, conf.Messaging.ServerCount); err != nil { + if err := dmsgC.InitiateServerConnections(ctx, conf.Dmsg.ServerCount); err != nil { return nil, fmt.Errorf("failed to init dmsg: %s", err) } @@ -62,7 +62,7 @@ func NewNode(conf *Config, metrics metrics.Recorder) (*Node, error) { logger: log, dmsgC: dmsgC, dmsgL: dmsgL, - srvCount: conf.Messaging.ServerCount, + srvCount: conf.Dmsg.ServerCount, metrics: metrics, } diff --git a/pkg/transport-discovery/client/client_test.go b/pkg/transport-discovery/client/client_test.go index cb2f66da3..a790f38e4 100644 --- a/pkg/transport-discovery/client/client_test.go +++ b/pkg/transport-discovery/client/client_test.go @@ -40,8 +40,8 @@ var testPubKey, testSecKey = cipher.GenerateKeyPair() func newTestEntry() *transport.Entry { pk1, _ := cipher.GenerateKeyPair() entry := &transport.Entry{ - ID: transport.MakeTransportID(pk1, testPubKey, "messaging"), - Type: "messaging", + ID: transport.MakeTransportID(pk1, testPubKey, "dmsg"), + Type: "dmsg", Public: true, } entry.SetEdges(pk1, testPubKey) diff --git a/pkg/visor/config.go b/pkg/visor/config.go index 554c6e322..ae99756f7 100644 --- a/pkg/visor/config.go +++ b/pkg/visor/config.go @@ -34,10 +34,10 @@ type Config struct { LocalAddr string `json:"local_address"` } `json:"stcp"` - Messaging struct { + Dmsg struct { Discovery string `json:"discovery"` ServerCount int `json:"server_count"` - } `json:"messaging"` + } `json:"dmsg"` DmsgPty *DmsgPtyConfig `json:"dmsg_pty,omitempty"` @@ -77,18 +77,18 @@ type Config struct { RestartCheckDelay string `json:"restart_check_delay"` } -// MessagingConfig returns config for dmsg client. -func (c *Config) MessagingConfig() (*DmsgConfig, error) { - msgConfig := c.Messaging +// DmsgConfig returns config for dmsg client. +func (c *Config) DmsgConfig() (*DmsgConfig, error) { + dmsgConfig := c.Dmsg - if msgConfig.Discovery == "" { + if dmsgConfig.Discovery == "" { return nil, errors.New("empty discovery") } return &DmsgConfig{ PubKey: c.Node.StaticPubKey, SecKey: c.Node.StaticSecKey, - Discovery: disc.NewHTTP(msgConfig.Discovery), + Discovery: disc.NewHTTP(dmsgConfig.Discovery), Retries: 5, RetryDelay: time.Second, }, nil diff --git a/pkg/visor/config_test.go b/pkg/visor/config_test.go index e0363a8e8..12f08f73e 100644 --- a/pkg/visor/config_test.go +++ b/pkg/visor/config_test.go @@ -18,15 +18,15 @@ import ( "github.com/SkycoinProject/skywire-mainnet/pkg/routing" ) -func TestMessagingDiscovery(t *testing.T) { +func TestDmsgDiscovery(t *testing.T) { pk, sk := cipher.GenerateKeyPair() conf := Config{} conf.Node.StaticPubKey = pk conf.Node.StaticSecKey = sk - conf.Messaging.Discovery = "skywire.skycoin.net:8001" - conf.Messaging.ServerCount = 10 + conf.Dmsg.Discovery = "skywire.skycoin.com:8001" + conf.Dmsg.ServerCount = 10 - c, err := conf.MessagingConfig() + c, err := conf.DmsgConfig() require.NoError(t, err) assert.NotNil(t, c.Discovery) diff --git a/pkg/visor/visor.go b/pkg/visor/visor.go index 9ca6e6a23..a7e39c6f7 100644 --- a/pkg/visor/visor.go +++ b/pkg/visor/visor.go @@ -118,13 +118,13 @@ func NewNode(config *Config, masterLogger *logging.MasterLogger, restartCtx *res pk := config.Node.StaticPubKey sk := config.Node.StaticSecKey - fmt.Println("min servers:", config.Messaging.ServerCount) + fmt.Println("min servers:", config.Dmsg.ServerCount) node.n = snet.New(snet.Config{ PubKey: pk, SecKey: sk, TpNetworks: []string{dmsg.Type, snet.STcpType}, // TODO: Have some way to configure this. - DmsgDiscAddr: config.Messaging.Discovery, - DmsgMinSrvs: config.Messaging.ServerCount, + DmsgDiscAddr: config.Dmsg.Discovery, + DmsgMinSrvs: config.Dmsg.ServerCount, STCPLocalAddr: config.STCP.LocalAddr, STCPTable: config.STCP.PubKeyTable, }) @@ -143,7 +143,7 @@ func NewNode(config *Config, masterLogger *logging.MasterLogger, restartCtx *res trDiscovery, err := config.TransportDiscovery() if err != nil { - return nil, fmt.Errorf("invalid MessagingConfig: %s", err) + return nil, fmt.Errorf("invalid transport discovery config: %s", err) } logStore, err := config.TransportLogStore() if err != nil { diff --git a/pkg/visor/visor_test.go b/pkg/visor/visor_test.go index 8b658d539..dd850c744 100644 --- a/pkg/visor/visor_test.go +++ b/pkg/visor/visor_test.go @@ -60,8 +60,8 @@ func TestMain(m *testing.M) { // conf := Config{Version: "1.0", LocalPath: "local", AppsPath: "apps"} // conf.Node.StaticPubKey = pk // conf.Node.StaticSecKey = sk -// conf.Messaging.Discovery = "http://skywire.skycoin.net:8001" -// conf.Messaging.ServerCount = 10 +// conf.Dmsg.Discovery = "http://skywire.skycoin.com:8001" +// conf.Dmsg.ServerCount = 10 // conf.Transport.Discovery = srv.URL // conf.Apps = []AppConfig{ // {App: "foo", Version: "1.1", Port: 1},