diff --git a/README.md b/README.md index beb7d1a8b7..9fa36b71fe 100644 --- a/README.md +++ b/README.md @@ -80,10 +80,10 @@ The configuration file provides the configuration for `skywire-visor`. It is a t You can generate a default configuration file by running: ```bash -$ skywire-cli node gen-config +$ skywire-cli visor gen-config ``` -Additional options are displayed when `skywire-cli node gen-config -h` is run. +Additional options are displayed when `skywire-cli visor gen-config -h` is run. We will cover certain fields of the configuration file below. @@ -138,7 +138,7 @@ For `dmsgpty` usage, refer to [#run-dmsgpty](#run-dmsgpty). ### Run `skywire-visor` -`skywire-visor` hosts apps, proxies app's requests to remote nodes and exposes communication API that apps can use to implement communication protocols. App binaries are spawned by the node, communication between node and app is performed via unix pipes provided on app startup. +`skywire-visor` hosts apps, proxies app's requests to remote visors and exposes communication API that apps can use to implement communication protocols. App binaries are spawned by the visor, communication between visor and app is performed via unix pipes provided on app startup. Note that `skywire-visor` requires a valid configuration file in order to execute. @@ -195,17 +195,17 @@ Transports can be established via the `skywire-cli`. ```bash # Establish transport to `0276ad1c5e77d7945ad6343a3c36a8014f463653b3375b6e02ebeaa3a21d89e881`. -$ skywire-cli node add-tp 0276ad1c5e77d7945ad6343a3c36a8014f463653b3375b6e02ebeaa3a21d89e881 +$ skywire-cli visor add-tp 0276ad1c5e77d7945ad6343a3c36a8014f463653b3375b6e02ebeaa3a21d89e881 # List established transports. -$ skywire-cli node ls-tp +$ skywire-cli visor ls-tp ``` ## App programming API -App is a generic binary that can be executed by the node. On app -startup node will open pair of unix pipes that will be used for -communication between app and node. `app` packages exposes +App is a generic binary that can be executed by the visor. On app +startup visor will open pair of unix pipes that will be used for +communication between app and visor. `app` packages exposes communication API over the pipe. ```golang @@ -214,13 +214,13 @@ communication API over the pipe. // Setup setups app using default pair of pipes func Setup(config *Config) (*App, error) {} -// Accept awaits for incoming loop confirmation request from a Node and +// Accept awaits for incoming loop confirmation request from a Visor and // returns net.Conn for a received loop. func (app *App) Accept() (net.Conn, error) {} // Addr implements net.Addr for App connections. &Addr{PubKey: pk, Port: 12} -// Dial sends create loop request to a Node and returns net.Conn for created loop. +// Dial sends create loop request to a Visor and returns net.Conn for created loop. func (app *App) Dial(raddr *Addr) (net.Conn, error) {} // Close implements io.Closer for App. @@ -277,7 +277,7 @@ E.g. $ make run_syslog ## run syslog-ng in docker container with logs mounted to /tmp/syslog $ export SYSLOG_OPTS='--syslog localhost:514' $ make integration-run-messaging ## or other integration-run-* goal -$ sudo cat /tmp/syslog/messages ## collected logs from NodeA, NodeB, NodeC instances +$ sudo cat /tmp/syslog/messages ## collected logs from VisorA, VisorB, VisorC instances ``` ## Running skywire in docker containers @@ -448,10 +448,10 @@ Instead of skywire-runner you can use: #### 5. Env-vars for development-/testing- purposes ```bash -export SW_NODE_A=127.0.0.1 -export SW_NODE_A_PK=$(cat ./skywire-config.json|grep static_public_key |cut -d ':' -f2 |tr -d '"'','' ') -export SW_NODE_B=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' SKY01) -export SW_NODE_B_PK=$(cat ./node/skywire-config.json|grep static_public_key |cut -d ':' -f2 |tr -d '"'','' ') +export SW_VISOR_A=127.0.0.1 +export SW_VISOR_A_PK=$(cat ./skywire-config.json|grep static_public_key |cut -d ':' -f2 |tr -d '"'','' ') +export SW_VISOR_B=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' SKY01) +export SW_VISOR_B_PK=$(cat ./visor/skywire-config.json|grep static_public_key |cut -d ':' -f2 |tr -d '"'','' ') ``` #### 6. "Hello-Mike-Hello-Joe" test @@ -463,13 +463,13 @@ Idea of test from Erlang classics: $ make run $ make docker-run # Open in browser skychat application -$ firefox http://$SW_NODE_B:8000 & +$ firefox http://$SW_VISOR_B:8000 & # add transport -$ ./skywire-cli add-transport $SW_NODE_B_PK +$ ./skywire-cli add-transport $SW_VISOR_B_PK # "Hello Mike!" - "Hello Joe!" - "System is working!" -$ curl --data {'"recipient":"'$SW_NODE_A_PK'", "message":"Hello Mike!"}' -X POST http://$SW_NODE_B:8000/message -$ curl --data {'"recipient":"'$SW_NODE_B_PK'", "message":"Hello Joe!"}' -X POST http://$SW_NODE_A:8000/message -$ curl --data {'"recipient":"'$SW_NODE_A_PK'", "message":"System is working!"}' -X POST http://$SW_NODE_B:8000/message +$ curl --data {'"recipient":"'$SW_VISOR_A_PK'", "message":"Hello Mike!"}' -X POST http://$SW_VISOR_B:8000/message +$ curl --data {'"recipient":"'$SW_VISOR_B_PK'", "message":"Hello Joe!"}' -X POST http://$SW_VISOR_A:8000/message +$ curl --data {'"recipient":"'$SW_VISOR_A_PK'", "message":"System is working!"}' -X POST http://$SW_VISOR_B:8000/message # Teardown $ make stop && make docker-stop ``` diff --git a/cmd/skywire-cli/commands/root.go b/cmd/skywire-cli/commands/root.go index ffa1cf72c0..567f5fb1ad 100644 --- a/cmd/skywire-cli/commands/root.go +++ b/cmd/skywire-cli/commands/root.go @@ -6,8 +6,8 @@ import ( "github.com/spf13/cobra" "github.com/SkycoinProject/skywire-mainnet/cmd/skywire-cli/commands/mdisc" - "github.com/SkycoinProject/skywire-mainnet/cmd/skywire-cli/commands/visor" "github.com/SkycoinProject/skywire-mainnet/cmd/skywire-cli/commands/rtfind" + "github.com/SkycoinProject/skywire-mainnet/cmd/skywire-cli/commands/visor" ) var rootCmd = &cobra.Command{ diff --git a/cmd/skywire-cli/commands/visor/gen-config.go b/cmd/skywire-cli/commands/visor/gen-config.go index b27c2b6bc7..62e4a8f818 100644 --- a/cmd/skywire-cli/commands/visor/gen-config.go +++ b/cmd/skywire-cli/commands/visor/gen-config.go @@ -40,7 +40,7 @@ var genConfigCmd = &cobra.Command{ Short: "Generates a config file", PreRun: func(_ *cobra.Command, _ []string) { if output == "" { - output = pathutil.Defaults().Get(configLocType) + output = pathutil.VisorDefaults().Get(configLocType) log.Infof("No 'output' set; using default path: %s", output) } var err error @@ -110,7 +110,7 @@ func defaultConfig() *visor.Config { defaultSkysocksConfig(""), defaultSkysocksClientConfig(), } - conf.Trusteds = []cipher.PubKey{} + conf.TrustedNodes = []cipher.PubKey{} if testenv { conf.Transport.Discovery = skyenv.TestTpDiscAddr diff --git a/integration/InteractiveEnvironments.md b/integration/InteractiveEnvironments.md index 19aacd46d9..496650845f 100644 --- a/integration/InteractiveEnvironments.md +++ b/integration/InteractiveEnvironments.md @@ -23,26 +23,26 @@ integration ├── generic # Generic environment │   ├── env-vars.sh # -│   ├── nodeA.json # -│   └── nodeC.json # +│   ├── visorA.json # +│   └── visorC.json # ├── messaging # Messaging testing environment │   ├── env-vars.sh # -│   ├── nodeA.json # -│   └── nodeC.json # +│   ├── visorA.json # +│   └── visorC.json # ├── proxy # Proxy testing environment │   ├── env-vars.sh # -│   ├── nodeA.json # -│   └── nodeC.json # +│   ├── visorA.json # +│   └── visorC.json # ├── InteractiveEnvironments.md # You're reading it -├── intermediary-nodeB.json # NodeB configurationS +├── intermediary-visorB.json # VisorB configurationS ├── run-base-env.sh # base environment in detached tmux session ├── run-generic-env.sh # generic environment in tmux ├── run-proxy-env.sh # proxy environment in tmux -├── start-restart-nodeB.sh # script for restart in cycle NodeB -├── startup.sh # add transports between nodes +├── start-restart-visorB.sh # script for restart in cycle VisorB +├── startup.sh # add transports between visors ├── tear-down.sh # tear down everything ├── test-messaging-loop.sh # Test script for messaging in infinite loop -├── test-messaging.sh # Test one message between NodeA-NodeC, NodeC-NodeA +├── test-messaging.sh # Test one message between VisorA-VisorC, VisorC-VisorA └── test-proxy.sh # Test script for proxy ``` @@ -74,8 +74,8 @@ The generic test environment will define the following: - skywire-services running on localhost - 3 `skywire-visor`s: - - NodeA, NodeC running all apps - - NodeB - intermediary node without apps + - VisorA, VisorC running all apps + - VisorB - intermediary visor without apps **Run** @@ -83,7 +83,7 @@ The generic test environment will define the following: # Tear down everything $ make integration-teardown -# Start all services and nodes +# Start all services and visors $ make integration-run-generic # Adds pre-defined transports @@ -108,8 +108,8 @@ $ make integration-teardown Instead of `../skywire/skywire-cli --rpc localhost:port [command]`, one can use: -- `CLI_A node ls-tp` - list transports from nodeA -- `CLI_B node add-tp $PK_A` - add transport on nodeB to nodeA +- `CLI_A visor ls-tp` - list transports from visorA +- `CLI_B visor add-tp $PK_A` - add transport on visorB to visorA Consult with `./integration/env-vars.sh` for details. @@ -122,11 +122,11 @@ These tests assume that the generic environment is running (via the aforemention # To be run in the 'shell' tab of tmux. ./integration/test-messaging.sh ``` -- **TEST 2: Test send/receive with unstable NodeB.** - 1. Stop NodeB by switching to the 7th tmux window (`Ctrl+B` & `6`) and sending SIGTERM (`Ctrl-C`). +- **TEST 2: Test send/receive with unstable VisorB.** + 1. Stop VisorB by switching to the 7th tmux window (`Ctrl+B` & `6`) and sending SIGTERM (`Ctrl-C`). 2. Run the following in the same window: ```bash - $ ./integration/start-restart-nodeB.sh + $ ./integration/start-restart-visorB.sh ``` 3. Switch to the `shell` window and run: ```bash @@ -137,22 +137,22 @@ These tests assume that the generic environment is running (via the aforemention The following steps will be performed: -1. copy sw*.json and start-restart-nodeB.sh into skywire directory +1. copy sw*.json and start-restart-visorB.sh into skywire directory 2. Create 9 tmux windows: 1. MSGD: dmsg-discovery 2. MSG: dmsg-server 3. TRD: transport-discovery 4. RF: route-finder 5. SN: setup-node - 6. NodeA: first skywire-visor with generic/nodeA.json - 7. NodeB: first skywire-visor with intermediary-nodeB.json - 8. NodeC: first skywire-visor with generic/nodeC.json + 6. VisorA: first skywire-visor with generic/visorA.json + 7. VisorB: first skywire-visor with intermediary-visorB.json + 8. VisorC: first skywire-visor with generic/visorC.json 9. shell: new shell for interactive exploration 3. ENV-vars in shell-window: 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 + 2. $PK_A, $PK_B, $PK_C - public keys of visor_A, visor_B, visor_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 + 4. $CHAT_A, $CHAT_B - addresses and ports for `skychat`-apps on visor_A and visor_C 4. Aliases in shell-window: `CLI_A`, `CLI_B`, `CLI_C` ### Proxy test environment @@ -161,26 +161,26 @@ The proxy test environment will define the following: - skywire-services running on localhost - 3 `skywire-visor`s: - - NodeA - running `proxy` app - - NodeB - intermediary node without apps - - NodeC - running `proxy-client` app + - VisorA - running `proxy` app + - VsorB - intermediary visor without apps + - VisorC - running `proxy-client` app #### Preparation It's really tricky to make socks5 proxy work now from clean start. Because `skysocks-client` needs: -- transport to NodeA -- NodeA must be running **before** start of `skysocks-client` +- transport to VisorA +- VisorA must be running **before** start of `skysocks-client` Recipe for clean start: 1. Run `make integration-teardown` 2. Start `./integration/run-proxy-env.sh` 3. Run `make integration-startup` -4. Stop NodeA, NodeB, NodeC -5. Restart all nodes -6. Wait for message in NodeC logs about successful start of +4. Stop VisorA, VisorB, VisorC +5. Restart all visors +6. Wait for message in VisorC logs about successful start of skysocks-client 7. Check `lsof -i :9999` that it's really started 8. Check `curl -v --retry 5 --retry-connrefused 1 --connect-timeout 5 -x socks5://123456:@localhost:9999 https://www.google.com` diff --git a/integration/generic/env-vars.sh b/integration/generic/env-vars.sh index 2629dcc040..0582817b49 100644 --- a/integration/generic/env-vars.sh +++ b/integration/generic/env-vars.sh @@ -1,10 +1,10 @@ # This script needs to be `source`d from bash-compatible shell # E.g. `source ./integration/generic/env-vars.sh` or `. ./integration/generic/env-vars.sh` -export PK_A=$(jq -r ".node.static_public_key" ./integration/generic/visorA.json) +export PK_A=$(jq -r ".visor.static_public_key" ./integration/generic/visorA.json) export RPC_A=$(jq -r ".interfaces.rpc" ./integration/generic/visorA.json) -export PK_B=$(jq -r ".node.static_public_key" ./integration/intermediary-nodeB.json) -export RPC_B=$(jq -r ".interfaces.rpc" ./integration/intermediary-nodeB.json) -export PK_C=$(jq -r ".node.static_public_key" ./integration/generic/visorC.json) +export PK_B=$(jq -r ".visor.static_public_key" ./integration/intermediary-visorB.json) +export RPC_B=$(jq -r ".interfaces.rpc" ./integration/intermediary-visorB.json) +export PK_C=$(jq -r ".visor.static_public_key" ./integration/generic/visorC.json) export RPC_C=$(jq -r ".interfaces.rpc" ./integration/generic/visorC.json) export CHAT_A=http://localhost:8000/message diff --git a/integration/generic/visorA.json b/integration/generic/visorA.json index 1028f09111..ac792afa81 100644 --- a/integration/generic/visorA.json +++ b/integration/generic/visorA.json @@ -1,6 +1,6 @@ { "version": "1.0", - "node": { + "visor": { "static_public_key": "02072dd1e2ccd761e717096e1a264de1d8917e78e3176ca99dbf7ccf7292969845", "static_secret_key": "7073e557aa2308b448525397ea2f45d56c9962c4dcdf82c5fdb5cc02fca0481c" }, @@ -12,7 +12,7 @@ "discovery": "https://transport.discovery.skywire.skycoin.com", "log_store": { "type": "file", - "location": "./local/nodeA/transport_logs" + "location": "./local/visorA/transport_logs" } }, "routing": { @@ -40,7 +40,7 @@ "trusted_nodes": [], "hypervisors": [], "apps_path": "./apps", - "local_path": "./local/nodeA", + "local_path": "./local/visorA", "log_level": "info", "interfaces": { "rpc": "localhost:3436" diff --git a/integration/generic/visorC.json b/integration/generic/visorC.json index 320a375644..790d1eed8d 100644 --- a/integration/generic/visorC.json +++ b/integration/generic/visorC.json @@ -1,6 +1,6 @@ { "version": "1.0", - "node": { + "visor": { "static_public_key": "02c9ddf5c2ae6a5a2166028dafbc814eff3ec2352f429fb0aa37d96e1aa668f332", "static_secret_key": "5ab3744ab56e4d0b82f9a915e07b8f05d51ec0f16ff8496bd92f4e378ca6c1fc" }, @@ -12,7 +12,7 @@ "discovery": "https://transport.discovery.skywire.skycoin.com", "log_store": { "type": "file", - "location": "./local/nodeC/transport_logs" + "location": "./local/visorC/transport_logs" } }, "routing": { @@ -46,7 +46,7 @@ "trusted_nodes": [], "hypervisors": [], "apps_path": "./apps", - "local_path": "./local/nodeC", + "local_path": "./local/visorC", "log_level": "info", "interfaces": { "rpc": "localhost:3438" diff --git a/integration/intermediary-nodeB.json b/integration/intermediary-visorB.json similarity index 93% rename from integration/intermediary-nodeB.json rename to integration/intermediary-visorB.json index e34b2b0743..84698be69f 100644 --- a/integration/intermediary-nodeB.json +++ b/integration/intermediary-visorB.json @@ -1,6 +1,6 @@ { "version": "1.0", - "node": { + "visor": { "static_public_key": "0372ee0a2b99b55906ac33b49704073ab90ab4f395d814d48d597b5b42c39e5c79", "static_secret_key": "5092f14fe18bd7dcd34479c5d26bb3bf68b708ec74a12c4557091e82dd6e6c36" }, @@ -12,7 +12,7 @@ "discovery": "https://transport.discovery.skywire.skycoin.com", "log_store": { "type": "file", - "location": "./local/nodeB/transport_logs" + "location": "./local/visorB/transport_logs" } }, "routing": { diff --git a/integration/messaging/env-vars.sh b/integration/messaging/env-vars.sh index fe80326fc5..67580ddcf5 100644 --- a/integration/messaging/env-vars.sh +++ b/integration/messaging/env-vars.sh @@ -1,10 +1,10 @@ # This script needs to be `source`d from bash-compatible shell # E.g. `source ./integration/generic/env-vars.sh` or `. ./integration/messaging/env-vars.sh` -export PK_A=$(jq -r ".node.static_public_key" ./integration/messaging/visorA.json) +export PK_A=$(jq -r ".visor.static_public_key" ./integration/messaging/visorA.json) export RPC_A=$(jq -r ".interfaces.rpc" ./integration/messaging/visorA.json) -export PK_B=$(jq -r ".node.static_public_key" ./integration/intermediary-nodeB.json) -export RPC_B=$(jq -r ".interfaces.rpc" ./integration/intermediary-nodeB.json) -export PK_C=$(jq -r ".node.static_public_key" ./integration/messaging/visorC.json) +export PK_B=$(jq -r ".visor.static_public_key" ./integration/intermediary-visorB.json) +export RPC_B=$(jq -r ".interfaces.rpc" ./integration/intermediary-visorB.json) +export PK_C=$(jq -r ".visor.static_public_key" ./integration/messaging/visorC.json) export RPC_C=$(jq -r ".interfaces.rpc" ./integration/messaging/visorC.json) export CHAT_A=http://localhost:8000/message @@ -18,9 +18,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' -alias RUN_A='./skywire-visor ./integration/messaging/visorA.json --tag NodeA' -alias RUN_B='./skywire-visor ./integration/messaging/intermediary-nodeB.json --tag NodeB' -alias RUN_C='./skywire-visor ./integration/messaging/visorC.json --tag NodeC' +alias RUN_A='./skywire-visor ./integration/messaging/visorA.json --tag VisorA' +alias RUN_B='./skywire-visor ./integration/messaging/intermediary-visorB.json --tag VisorB' +alias RUN_C='./skywire-visor ./integration/messaging/visorC.json --tag VisorC' echo PK_A: $PK_A echo PK_B: $PK_B diff --git a/integration/messaging/nodeA.json b/integration/messaging/visorA.json similarity index 91% rename from integration/messaging/nodeA.json rename to integration/messaging/visorA.json index 3a907c4bde..76be761793 100644 --- a/integration/messaging/nodeA.json +++ b/integration/messaging/visorA.json @@ -1,6 +1,6 @@ { "version": "1.0", - "node": { + "visor": { "static_public_key": "02072dd1e2ccd761e717096e1a264de1d8917e78e3176ca99dbf7ccf7292969845", "static_secret_key": "7073e557aa2308b448525397ea2f45d56c9962c4dcdf82c5fdb5cc02fca0481c" }, @@ -12,7 +12,7 @@ "discovery": "https://transport.discovery.skywire.skycoin.com", "log_store": { "type": "file", - "location": "./local/nodeA/transport_logs" + "location": "./local/visorA/transport_logs" } }, "routing": { @@ -35,7 +35,7 @@ "hypervisors": [], "apps_path": "./apps", "shutdown_timeout": "30s", - "local_path": "./local/nodeA", + "local_path": "./local/visorA", "log_level": "info", "interfaces": { "rpc": "localhost:3436" diff --git a/integration/messaging/nodeC.json b/integration/messaging/visorC.json similarity index 91% rename from integration/messaging/nodeC.json rename to integration/messaging/visorC.json index 7566bfeffc..92a0542525 100644 --- a/integration/messaging/nodeC.json +++ b/integration/messaging/visorC.json @@ -1,6 +1,6 @@ { "version": "1.0", - "node": { + "visor": { "static_public_key": "02c9ddf5c2ae6a5a2166028dafbc814eff3ec2352f429fb0aa37d96e1aa668f332", "static_secret_key": "5ab3744ab56e4d0b82f9a915e07b8f05d51ec0f16ff8496bd92f4e378ca6c1fc" }, @@ -12,7 +12,7 @@ "discovery": "https://transport.discovery.skywire.skycoin.com", "log_store": { "type": "file", - "location": "./local/nodeC/transport_logs" + "location": "./local/visorC/transport_logs" } }, "routing": { @@ -38,7 +38,7 @@ "hypervisors": [], "apps_path": "./apps", "shutdown_timeout": "30s", - "local_path": "./local/nodeC", + "local_path": "./local/visorC", "log_level": "info", "interfaces": { "rpc": "localhost:3438" diff --git a/integration/proxy/env-vars.sh b/integration/proxy/env-vars.sh index 0e5c77ae40..05fb0f29ec 100644 --- a/integration/proxy/env-vars.sh +++ b/integration/proxy/env-vars.sh @@ -1,10 +1,10 @@ # This script needs to be `source`d from bash-compatible shell # E.g. `source ./integration/proxy/env-vars.sh` or `. ./integration/proxy/env-vars.sh` -export PK_A=$(jq -r ".node.static_public_key" ./integration/proxy/visorA.json) +export PK_A=$(jq -r ".visor.static_public_key" ./integration/proxy/visorA.json) export RPC_A=$(jq -r ".interfaces.rpc" ./integration/proxy/visorA.json) -export PK_B=$(jq -r ".node.static_public_key" ./integration/intermediary-nodeB.json) -export RPC_B=$(jq -r ".interfaces.rpc" ./integration/intermediary-nodeB.json) -export PK_C=$(jq -r ".node.static_public_key" ./integration/proxy/visorC.json) +export PK_B=$(jq -r ".visor.static_public_key" ./integration/intermediary-visorB.json) +export RPC_B=$(jq -r ".interfaces.rpc" ./integration/intermediary-visorB.json) +export PK_C=$(jq -r ".visor.static_public_key" ./integration/proxy/visorC.json) export RPC_C=$(jq -r ".interfaces.rpc" ./integration/proxy/visorC.json) alias CLI_A='./skywire-cli --rpc $RPC_A' @@ -15,9 +15,9 @@ 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/visorA.json --tag NodeA' -alias RUN_B='go run ./cmd/skywire-visor ./integration/intermediary-nodeB.json --tag NodeB' -alias RUN_C='go run ./cmd/skywire-visor ./integration/messaging/visorC.json --tag NodeC' +alias RUN_A='go run ./cmd/skywire-visor ./integration/messaging/visorA.json --tag VisorA' +alias RUN_B='go run ./cmd/skywire-visor ./integration/intermediary-visorB.json --tag VisorB' +alias RUN_C='go run ./cmd/skywire-visor ./integration/messaging/visorC.json --tag VisorC' echo PK_A: $PK_A echo PK_B: $PK_B diff --git a/integration/proxy/nodeA.json b/integration/proxy/visorA.json similarity index 90% rename from integration/proxy/nodeA.json rename to integration/proxy/visorA.json index 2129a74d55..0e703c360a 100644 --- a/integration/proxy/nodeA.json +++ b/integration/proxy/visorA.json @@ -1,6 +1,6 @@ { "version": "1.0", - "node": { + "visor": { "static_public_key": "02072dd1e2ccd761e717096e1a264de1d8917e78e3176ca99dbf7ccf7292969845", "static_secret_key": "7073e557aa2308b448525397ea2f45d56c9962c4dcdf82c5fdb5cc02fca0481c" }, @@ -12,7 +12,7 @@ "discovery": "https://transport.discovery.skywire.skycoin.com", "log_store": { "type": "file", - "location": "./local/nodeA/transport_logs" + "location": "./local/visorA/transport_logs" } }, "routing": { @@ -33,7 +33,7 @@ "trusted_nodes": [], "hypervisors": [], "apps_path": "./apps", - "local_path": "./local/nodeA", + "local_path": "./local/visorA", "log_level": "info", "interfaces": { "rpc": "localhost:3436" diff --git a/integration/proxy/nodeC.json b/integration/proxy/visorC.json similarity index 91% rename from integration/proxy/nodeC.json rename to integration/proxy/visorC.json index 5dd19d68d0..08287ff6d1 100644 --- a/integration/proxy/nodeC.json +++ b/integration/proxy/visorC.json @@ -1,6 +1,6 @@ { "version": "1.0", - "node": { + "visor": { "static_public_key": "02c9ddf5c2ae6a5a2166028dafbc814eff3ec2352f429fb0aa37d96e1aa668f332", "static_secret_key": "5ab3744ab56e4d0b82f9a915e07b8f05d51ec0f16ff8496bd92f4e378ca6c1fc" }, @@ -12,7 +12,7 @@ "discovery": "https://transport.discovery.skywire.skycoin.com", "log_store": { "type": "file", - "location": "./local/nodeC/transport_logs" + "location": "./local/visorC/transport_logs" } }, "routing": { @@ -36,7 +36,7 @@ "trusted_nodes": [], "hypervisors": [], "apps_path": "./apps", - "local_path": "./local/nodeC", + "local_path": "./local/visorC", "log_level": "info", "interfaces": { "rpc": "localhost:3438" diff --git a/integration/run-generic-env.sh b/integration/run-generic-env.sh index 8e993b9460..e308c2784d 100644 --- a/integration/run-generic-env.sh +++ b/integration/run-generic-env.sh @@ -9,14 +9,14 @@ source ./integration/generic/env-vars.sh echo "Checking transport-discovery is up" curl --retry 5 --retry-connrefused 1 --connect-timeout 5 https://transport.discovery.skywire.skycoin.net/security/nonces/$PK_A -tmux rename-window -t skywire NodeA -tmux send-keys -t NodeA -l "./skywire-visor ./integration/generic/nodeA.json --tag NodeA $SYSLOG_OPTS" +tmux rename-window -t skywire VisorA +tmux send-keys -t VisorA -l "./skywire-visor ./integration/generic/visorA.json --tag VisorA $SYSLOG_OPTS" tmux send-keys C-m -tmux new-window -t skywire -n NodeB -tmux send-keys -t NodeB -l "./skywire-visor ./integration/intermediary-nodeB.json --tag NodeB $SYSLOG_OPTS" +tmux new-window -t skywire -n VisorB +tmux send-keys -t VisorB -l "./skywire-visor ./integration/intermediary-visorB.json --tag VisorB $SYSLOG_OPTS" tmux send-keys C-m -tmux new-window -t skywire -n NodeC -tmux send-keys -t NodeC -l "./skywire-visor ./integration/generic/nodeC.json --tag NodeC $SYSLOG_OPTS" +tmux new-window -t skywire -n VisorC +tmux send-keys -t VisorC -l "./skywire-visor ./integration/generic/visorC.json --tag VisorC $SYSLOG_OPTS" tmux send-keys C-m tmux new-window -t skywire -n shell diff --git a/integration/run-messaging-env.sh b/integration/run-messaging-env.sh index 2afdb95601..85f7773109 100644 --- a/integration/run-messaging-env.sh +++ b/integration/run-messaging-env.sh @@ -9,14 +9,14 @@ source ./integration/messaging/env-vars.sh echo "Checking transport-discovery is up" curl --retry 5 --retry-connrefused 1 --connect-timeout 5 https://transport.discovery.skywire.skycoin.net/security/nonces/$PK_A -tmux rename-window -t skywire NodeA -tmux send-keys -t NodeA -l "./skywire-visor ./integration/messaging/nodeA.json --tag NodeA $SYSLOG_OPTS" +tmux rename-window -t skywire VisorA +tmux send-keys -t VisorA -l "./skywire-visor ./integration/messaging/visorA.json --tag VisorA $SYSLOG_OPTS" tmux send-keys C-m -tmux new-window -t skywire -n NodeB -tmux send-keys -t NodeB -l "./skywire-visor ./integration/intermediary-nodeB.json --tag NodeB $SYSLOG_OPTS" +tmux new-window -t skywire -n VisorB +tmux send-keys -t VisorB -l "./skywire-visor ./integration/intermediary-visorB.json --tag VisorB $SYSLOG_OPTS" tmux send-keys C-m -tmux new-window -t skywire -n NodeC -tmux send-keys -t NodeC -l "./skywire-visor ./integration/messaging/nodeC.json --tag NodeC $SYSLOG_OPTS" +tmux new-window -t skywire -n VisorC +tmux send-keys -t VisorC -l "./skywire-visor ./integration/messaging/visorC.json --tag VisorC $SYSLOG_OPTS" tmux send-keys C-m tmux new-window -t skywire -n shell diff --git a/integration/run-proxy-env.sh b/integration/run-proxy-env.sh index 3aa2247671..481740f359 100644 --- a/integration/run-proxy-env.sh +++ b/integration/run-proxy-env.sh @@ -9,14 +9,14 @@ source ./integration/proxy/env-vars.sh echo "Checking transport-discovery is up" curl --retry 5 --retry-connrefused 1 --connect-timeout 5 https://transport.discovery.skywire.skycoin.net/security/nonces/$PK_A -tmux rename-window -t skywire NodeA -tmux send-keys -t NodeA -l "./skywire-visor ./integration/proxy/nodeA.json --tag NodeA $SYSLOG_OPTS" +tmux rename-window -t skywire VisorA +tmux send-keys -t VisorA -l "./skywire-visor ./integration/proxy/visorA.json --tag VisorA $SYSLOG_OPTS" tmux send-keys C-m -tmux new-window -t skywire -n NodeB -tmux send-keys -t NodeB -l "./skywire-visor ./integration/intermediary-nodeB.json --tag NodeB $SYSLOG_OPTS" +tmux new-window -t skywire -n VisorB +tmux send-keys -t VisorB -l "./skywire-visor ./integration/intermediary-visorB.json --tag VisorB $SYSLOG_OPTS" tmux send-keys C-m -tmux new-window -t skywire -n NodeC -tmux send-keys -t NodeC -l "./skywire-visor ./integration/proxy/nodeC.json --tag NodeC $SYSLOG_OPTS" +tmux new-window -t skywire -n VisorC +tmux send-keys -t VisorC -l "./skywire-visor ./integration/proxy/visorC.json --tag VisorC $SYSLOG_OPTS" tmux send-keys C-m tmux new-window -t skywire -n shell diff --git a/integration/start-restart-nodeB.sh b/integration/start-restart-nodeB.sh index b87ec1a762..588ceba4cc 100644 --- a/integration/start-restart-nodeB.sh +++ b/integration/start-restart-nodeB.sh @@ -4,11 +4,11 @@ mkdir -p ./logs echo Press Ctrl-C to exit for ((;;)) do - ./bin/skywire-visor ./integration/intermediary-nodeB.json --tag NodeB 2>> ./logs/nodeB.log >> ./logs/nodeB.log & - echo visor starting NodeB + ./bin/skywire-visor ./integration/intermediary-visorB.json --tag VisorB 2>> ./logs/visorB.log >> ./logs/visorB.log & + echo visor starting VisorB sleep 25 - echo Killing NodeB on $(ps aux |grep "[N]odeB" |awk '{print $2}') + echo Killing VisorB on $(ps aux |grep "[N]odeB" |awk '{print $2}') kill $(ps aux |grep "[N]odeB" |awk '{print $2}') sleep 3 - echo Restarting NodeB + echo Restarting VisorB done diff --git a/integration/startup.sh b/integration/startup.sh index caf69b1e77..86e9ad2aeb 100644 --- a/integration/startup.sh +++ b/integration/startup.sh @@ -8,8 +8,8 @@ ./skywire-cli --rpc $RPC_C visor add-tp $PK_B sleep 1 -echo "NodeA Transports:" +echo "VisorA Transports:" ./skywire-cli --rpc $RPC_A visor ls-tp -echo "NodeB Transports:" +echo "VisorB Transports:" ./skywire-cli --rpc $RPC_B visor ls-tp diff --git a/internal/utclient/client_test.go b/internal/utclient/client_test.go index d999037234..29c8ebb8d6 100644 --- a/internal/utclient/client_test.go +++ b/internal/utclient/client_test.go @@ -57,7 +57,7 @@ func TestClientAuth(t *testing.T) { wg.Wait() } -func TestUpdateNodeUptime(t *testing.T) { +func TestUpdateVisorUptime(t *testing.T) { urlCh := make(chan string, 1) srv := httptest.NewServer(authHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { urlCh <- r.URL.String() diff --git a/pkg/hypervisor/hypervisor.go b/pkg/hypervisor/hypervisor.go index a9368df8a5..6d7ca53b64 100644 --- a/pkg/hypervisor/hypervisor.go +++ b/pkg/hypervisor/hypervisor.go @@ -46,7 +46,7 @@ type appVisorConn struct { Client visor.RPCClient } -// Visor manages AppVides. +// Visor manages AppVisors. type Visor struct { c Config visors map[cipher.PubKey]appVisorConn // connected remote visors. diff --git a/pkg/setup/node.go b/pkg/setup/node.go index f114456a9f..0526552dfa 100644 --- a/pkg/setup/node.go +++ b/pkg/setup/node.go @@ -17,7 +17,7 @@ import ( "github.com/SkycoinProject/skywire-mainnet/pkg/routing" ) -// Visor performs routes setup operations over messaging channel. +// Node performs routes setup operations over messaging channel. type Node struct { logger *logging.Logger dmsgC *dmsg.Client diff --git a/pkg/setup/node_test.go b/pkg/setup/node_test.go index 50f140b974..5c7481faee 100644 --- a/pkg/setup/node_test.go +++ b/pkg/setup/node_test.go @@ -66,7 +66,7 @@ func TestNode(t *testing.T) { reservedIDs := []routing.RouteID{1, 2} - // TEST: Emulates the communication between 4 visor nodes and a setup visor, + // TEST: Emulates the communication between 4 visor nodes and a setup node, // where the first client visor initiates a route to the last. t.Run("DialRouteGroup", func(t *testing.T) { testDialRouteGroup(t, keys, nEnv, reservedIDs) diff --git a/pkg/visor/config.go b/pkg/visor/config.go index 1dee6166ca..c70df20a52 100644 --- a/pkg/visor/config.go +++ b/pkg/visor/config.go @@ -61,8 +61,8 @@ type Config struct { Apps []AppConfig `json:"apps"` - TrustedVisors []cipher.PubKey `json:"trusted_nodes"` - Hypervisors []HypervisorConfig `json:"hypervisors"` + TrustedNodes []cipher.PubKey `json:"trusted_nodes"` + Hypervisors []HypervisorConfig `json:"hypervisors"` AppsPath string `json:"apps_path"` LocalPath string `json:"local_path"` diff --git a/pkg/visor/rpc.go b/pkg/visor/rpc.go index 21ceb683fc..5bf80edcbe 100644 --- a/pkg/visor/rpc.go +++ b/pkg/visor/rpc.go @@ -161,8 +161,13 @@ func (r *RPC) Summary(_ *struct{}, out *Summary) error { return true }) *out = Summary{ +<<<<<<< HEAD PubKey: r.node.conf.Node.StaticPubKey, BuildInfo: buildinfo.Get(), +======= + PubKey: r.visor.conf.Visor.StaticPubKey, + VisorVersion: Version, +>>>>>>> rename node to visor in README.md AppProtoVersion: supportedProtocolVersion, Apps: r.visor.Apps(), Transports: summaries, diff --git a/pkg/visor/rpc_client.go b/pkg/visor/rpc_client.go index f5c17d4fba..d45163515f 100644 --- a/pkg/visor/rpc_client.go +++ b/pkg/visor/rpc_client.go @@ -425,7 +425,11 @@ func NewMockRPCClient(r *rand.Rand, maxTps int, maxRules int) (cipher.PubKey, RP client := &mockRPCClient{ s: &Summary{ PubKey: localPK, +<<<<<<< HEAD BuildInfo: buildinfo.Get(), +======= + VisorVersion: Version, +>>>>>>> rename node to visor in README.md AppProtoVersion: supportedProtocolVersion, Apps: []*AppState{ {Name: "foo.v1.0", AutoStart: false, Port: 10}, diff --git a/pkg/visor/rpc_test.go b/pkg/visor/rpc_test.go index 9de042da44..3a4c8785e2 100644 --- a/pkg/visor/rpc_test.go +++ b/pkg/visor/rpc_test.go @@ -145,29 +145,29 @@ func TestStartStopApp(t *testing.T) { unknownApp := "bar" app := apps["foo"].App - nodeCfg := Config{} - nodeCfg.Visor.StaticPubKey = pk + visorCfg := Config{} + visorCfg.Visor.StaticPubKey = pk - node := &Visor{ + visor := &Visor{ router: r, appsConf: apps, logger: logging.MustGetLogger("test"), - conf: &nodeCfg, + conf: &visorCfg, } - pathutil.EnsureDir(node.dir()) + pathutil.EnsureDir(visor.dir()) defer func() { - require.NoError(t, os.RemoveAll(node.dir())) + require.NoError(t, os.RemoveAll(visor.dir())) }() pm := &appserver.MockProcManager{} appCfg1 := appcommon.Config{ Name: app, Version: apps["foo"].Version, - SockFilePath: nodeCfg.AppServerSockFile, - VisorPK: nodeCfg.Visor.StaticPubKey.Hex(), + SockFilePath: visorCfg.AppServerSockFile, + VisorPK: visorCfg.Visor.StaticPubKey.Hex(), WorkDir: filepath.Join("", app, fmt.Sprintf("v%s", apps["foo"].Version)), } - appArgs1 := append([]string{filepath.Join(node.dir(), app)}, apps["foo"].Args...) + appArgs1 := append([]string{filepath.Join(visor.dir(), app)}, apps["foo"].Args...) appPID1 := appcommon.ProcID(10) pm.On("Start", mock.Anything, appCfg1, appArgs1, mock.Anything, mock.Anything). Return(appPID1, testhelpers.NoErr) @@ -176,9 +176,9 @@ func TestStartStopApp(t *testing.T) { pm.On("Exists", app).Return(true) pm.On("Exists", unknownApp).Return(false) - node.procManager = pm + visor.procManager = pm - rpc := &RPC{visor: node} + rpc := &RPC{visor: visor} err := rpc.StartApp(&unknownApp, nil) require.Error(t, err) diff --git a/pkg/visor/visor.go b/pkg/visor/visor.go index ba155c1970..83efafd33d 100644 --- a/pkg/visor/visor.go +++ b/pkg/visor/visor.go @@ -157,7 +157,7 @@ func NewVisor(cfg *Config, logger *logging.MasterLogger, restartCtx *restart.Con tmConfig := &transport.ManagerConfig{ PubKey: pk, SecKey: sk, - DefaultVisors: cfg.TrustedVisors, + DefaultVisors: cfg.TrustedNodes, DiscoveryClient: trDiscovery, LogStore: logStore, } diff --git a/pkg/visor/visor_test.go b/pkg/visor/visor_test.go index b7395489f5..952db839d4 100644 --- a/pkg/visor/visor_test.go +++ b/pkg/visor/visor_test.go @@ -107,8 +107,8 @@ func TestVisorStartClose(t *testing.T) { var ( visorCfg = Config{} - logger = logging.MustGetLogger("test") - server = appserver.New(logger, visorCfg.AppServerSockFile) + logger = logging.MustGetLogger("test") + server = appserver.New(logger, visorCfg.AppServerSockFile) ) visor := &Visor{ diff --git a/skywire-peering-daemon b/skywire-peering-daemon new file mode 100755 index 0000000000..280bbc982a Binary files /dev/null and b/skywire-peering-daemon differ