Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…e-mainnet into fix/default-route-group-timeout
  • Loading branch information
Darkren committed Jan 9, 2020
2 parents 4571bd6 + b4df6ea commit 1dbf3c0
Show file tree
Hide file tree
Showing 83 changed files with 2,722 additions and 3,097 deletions.
38 changes: 12 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ config: ## Generate skywire.json

clean: ## Clean project: remove created binaries and apps
-rm -rf ./apps
-rm -f ./skywire-visor ./skywire-cli ./setup-node ./hypervisor ./SSH-cli
-rm -f ./skywire-visor ./skywire-cli ./setup-node ./hypervisor

install: ## Install `skywire-visor`, `skywire-cli`, `hypervisor`, `SSH-cli`, `dmsgpty`
${OPTS} go install ./cmd/skywire-visor ./cmd/skywire-cli ./cmd/setup-node ./cmd/hypervisor ./cmd/therealssh-cli ./cmd/dmsgpty
install: ## Install `skywire-visor`, `skywire-cli`, `hypervisor`, `dmsgpty`
${OPTS} go install ./cmd/skywire-visor ./cmd/skywire-cli ./cmd/setup-node ./cmd/hypervisor ./cmd/dmsgpty

rerun: stop
${OPTS} go build -race -o ./skywire-visor ./cmd/skywire-visor
Expand All @@ -56,9 +56,6 @@ vendorcheck: ## Run vendorcheck
GO111MODULE=off vendorcheck ./cmd/setup-node/...
GO111MODULE=off vendorcheck ./cmd/skywire-cli/...
GO111MODULE=off vendorcheck ./cmd/skywire-visor/...
# vendorcheck fails on ./cmd/therealssh-cli
# the problem is indirect dependency to github.com/sirupsen/logrus
#GO111MODULE=off vendorcheck ./cmd/therealssh-cli/...

test: ## Run tests
-go clean -testcache &>/dev/null
Expand Down Expand Up @@ -89,33 +86,27 @@ dep: ## Sorts dependencies
host-apps: ## Build app
${OPTS} go build ${BUILD_OPTS} -o ./apps/skychat.v1.0 ./cmd/apps/skychat
${OPTS} go build ${BUILD_OPTS} -o ./apps/helloworld.v1.0 ./cmd/apps/helloworld
${OPTS} go build ${BUILD_OPTS} -o ./apps/socksproxy.v1.0 ./cmd/apps/therealproxy
${OPTS} go build ${BUILD_OPTS} -o ./apps/socksproxy-client.v1.0 ./cmd/apps/therealproxy-client
${OPTS} go build ${BUILD_OPTS} -o ./apps/SSH.v1.0 ./cmd/apps/therealssh
${OPTS} go build ${BUILD_OPTS} -o ./apps/SSH-client.v1.0 ./cmd/apps/therealssh-client
${OPTS} go build ${BUILD_OPTS} -o ./apps/skysocks.v1.0 ./cmd/apps/skysocks
${OPTS} go build ${BUILD_OPTS} -o ./apps/skysocks-client.v1.0 ./cmd/apps/skysocks-client

# Bin
bin: ## Build `skywire-visor`, `skywire-cli`, `hypervisor`, `SSH-cli`
bin: ## Build `skywire-visor`, `skywire-cli`, `hypervisor`
${OPTS} go build ${BUILD_OPTS} -o ./skywire-visor ./cmd/skywire-visor
${OPTS} go build ${BUILD_OPTS} -o ./skywire-cli ./cmd/skywire-cli
${OPTS} go build ${BUILD_OPTS} -o ./setup-node ./cmd/setup-node
${OPTS} go build ${BUILD_OPTS} -o ./dmsg-server ./cmd/dmsg-server
${OPTS} go build ${BUILD_OPTS} -o ./hypervisor ./cmd/hypervisor
${OPTS} go build ${BUILD_OPTS} -o ./SSH-cli ./cmd/therealssh-cli
${OPTS} go build ${BUILD_OPTS} -o ./dmsgpty ./cmd/dmsgpty

release: ## Build `skywire-visor`, `skywire-cli`, `hypervisor`, `SSH-cli` and apps without -race flag
release: ## Build `skywire-visor`, `skywire-cli`, `hypervisor` and apps without -race flag
${OPTS} go build -o ./skywire-visor ./cmd/skywire-visor
${OPTS} go build -o ./skywire-cli ./cmd/skywire-cli
${OPTS} go build -o ./setup-node ./cmd/setup-node
${OPTS} go build -o ./hypervisor ./cmd/hypervisor
${OPTS} go build -o ./SSH-cli ./cmd/therealssh-cli
${OPTS} go build -o ./apps/skychat.v1.0 ./cmd/apps/skychat
${OPTS} go build -o ./apps/helloworld.v1.0 ./cmd/apps/helloworld
${OPTS} go build -o ./apps/socksproxy.v1.0 ./cmd/apps/therealproxy
${OPTS} go build -o ./apps/socksproxy-client.v1.0 ./cmd/apps/therealproxy-client
${OPTS} go build -o ./apps/SSH.v1.0 ./cmd/apps/therealssh
${OPTS} go build -o ./apps/SSH-client.v1.0 ./cmd/apps/therealssh-client
${OPTS} go build -o ./apps/skysocks.v1.0 ./cmd/apps/skysocks
${OPTS} go build -o ./apps/skysocks-client.v1.0 ./cmd/apps/skysocks-client

# Dockerized skywire-visor
docker-image: ## Build docker image `skywire-runner`
Expand All @@ -131,12 +122,10 @@ docker-network: ## Create docker network ${DOCKER_NETWORK}
docker-apps: ## Build apps binaries for dockerized skywire-visor. `go build` with ${DOCKER_OPTS}
-${DOCKER_OPTS} go build -race -o ./node/apps/skychat.v1.0 ./cmd/apps/skychat
-${DOCKER_OPTS} go build -race -o ./node/apps/helloworld.v1.0 ./cmd/apps/helloworld
-${DOCKER_OPTS} go build -race -o ./node/apps/socksproxy.v1.0 ./cmd/apps/therealproxy
-${DOCKER_OPTS} go build -race -o ./node/apps/socksproxy-client.v1.0 ./cmd/apps/therealproxy-client
-${DOCKER_OPTS} go build -race -o ./node/apps/SSH.v1.0 ./cmd/apps/therealssh
-${DOCKER_OPTS} go build -race -o ./node/apps/SSH-client.v1.0 ./cmd/apps/therealssh-client
-${DOCKER_OPTS} go build -race -o ./node/apps/skysocks.v1.0 ./cmd/apps/skysocks
-${DOCKER_OPTS} go build -race -o ./node/apps/skysocks-client.v1.0 ./cmd/apps/skysocks-client

docker-bin: ## Build `skywire-visor`, `skywire-cli`, `hypervisor`, `therealssh-cli`. `go build` with ${DOCKER_OPTS}
docker-bin: ## Build `skywire-visor`, `skywire-cli`, `hypervisor`. `go build` with ${DOCKER_OPTS}
${DOCKER_OPTS} go build -race -o ./node/skywire-visor ./cmd/skywire-visor

docker-volume: dep docker-apps docker-bin bin ## Prepare docker volume for dockerized skywire-visor
Expand Down Expand Up @@ -186,9 +175,6 @@ integration-run-messaging: ## Runs the messaging interactive testing environment
integration-run-proxy: ## Runs the proxy interactive testing environment
./integration/run-proxy-env.sh

integration-run-ssh: ## Runs the ssh interactive testing environment
./integration/run-ssh-env.sh

mod-comm: ## Comments the 'replace' rule in go.mod
./ci_scripts/go_mod_replace.sh comment go.mod

Expand Down
45 changes: 17 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,25 @@
- [Testing](#testing)
- [Testing with default settings](#testing-with-default-settings)
- [Customization with environment variables](#customization-with-environment-variables)
- [$TEST_OPTS](#testopts)
- [$TEST_LOGGING_LEVEL](#testlogginglevel)
- [$SYSLOG_OPTS](#syslogopts)
- [$TEST_OPTS](#test_opts)
- [$TEST_LOGGING_LEVEL](#test_logging_level)
- [$SYSLOG_OPTS](#syslog_opts)
- [Running skywire in docker containers](#running-skywire-in-docker-containers)
- [Run dockerized `skywire-visor`](#run-dockerized-skywire-visor)
- [Structure of `./node`](#structure-of-node)
- [Refresh and restart `SKY01`](#refresh-and-restart-sky01)
- [Customization of dockers](#customization-of-dockers)
- [1. DOCKER_IMAGE](#1-dockerimage)
- [2. DOCKER_NETWORK](#2-dockernetwork)
- [3. DOCKER_NODE](#3-dockernode)
- [4. DOCKER_OPTS](#4-dockeropts)
- [1. DOCKER_IMAGE](#1-docker_image)
- [2. DOCKER_NETWORK](#2-docker_network)
- [3. DOCKER_NODE](#3-docker_node)
- [4. DOCKER_OPTS](#4-docker_opts)
- [Dockerized `skywire-visor` recipes](#dockerized-skywire-visor-recipes)
- [1. Get Public Key of docker-node](#1-get-public-key-of-docker-node)
- [2. Get an IP of node](#2-get-an-ip-of-node)
- [3. Open in browser containerized `skychat` application](#3-open-in-browser-containerized-skychat-application)
- [4. Create new dockerized `skywire-visor`s](#4-create-new-dockerized-skywire-visors)
- [5. Env-vars for development-/testing- purposes](#5-env-vars-for-development-testing--purposes)
- [6. "Hello-Mike-Hello-Joe" test](#6-%22hello-mike-hello-joe%22-test)
- [6. "Hello-Mike-Hello-Joe" test](#6-hello-mike-hello-joe-test)

**NOTE:** The project is still under heavy development and should only be used for testing purposes right now. Miners should not switch over to this project if they want to receive testnet rewards.

Expand Down Expand Up @@ -185,8 +185,7 @@ After `skywire-visor` is up and running with default environment, default apps a

- [Chat](/cmd/apps/skychat)
- [Hello World](/cmd/apps/helloworld)
- [The Real Proxy](/cmd/apps/therealproxy) ([Client](/cmd/apps/therealproxy-client))
- [The Real SSH](/cmd/apps/therealssh) ([Client](/cmd/apps/therealssh-client))
- [Sky Socks](/cmd/apps/skysocks) ([Client](/cmd/apps/skysocks-client))

### Transports

Expand Down Expand Up @@ -305,14 +304,11 @@ This will:
├── apps # node `apps` compiled with DOCKER_OPTS
│   ├── skychat.v1.0 #
│   ├── helloworld.v1.0 #
│   ├── socksproxy-client.v1.0 #
│   ├── socksproxy.v1.0 #
│   ├── SSH-client.v1.0 #
│   └── SSH.v1.0 #
│   ├── skysocks-client.v1.0 #
│   └── skysocks.v1.0 #
├── local # **Created inside docker**
│   ├── skychat # according to "local_path" in skywire-config.json
│   ├── socksproxy #
│   └── SSH #
│   └── skysocks #
├── PK # contains public key of node
├── skywire # db & logs. **Created inside docker**
│   ├── routing.db #
Expand Down Expand Up @@ -412,9 +408,7 @@ $ GO111MODULE=on GOOS=linux go build -o /tmp/SKYNODE/skywire-visor ./cmd/skywire
# 3. compile apps
$ GO111MODULE=on GOOS=linux go build -o /tmp/SKYNODE/apps/skychat.v1.0 ./cmd/apps/skychat
$ GO111MODULE=on GOOS=linux go build -o /tmp/SKYNODE/apps/helloworld.v1.0 ./cmd/apps/helloworld
$ GO111MODULE=on GOOS=linux go build -o /tmp/SKYNODE/apps/socksproxy.v1.0 ./cmd/apps/therealproxy
$ GO111MODULE=on GOOS=linux go build -o /tmp/SKYNODE/apps/SSH.v1.0 ./cmd/apps/SSH
$ GO111MODULE=on GOOS=linux go build -o /tmp/SKYNODE/apps/SSH-client.v1.0 ./cmd/apps/SSH-client
$ GO111MODULE=on GOOS=linux go build -o /tmp/SKYNODE/apps/skysocks.v1.0 ./cmd/apps/skysocks
# 4. Create skywire-config.json for node
$ skywire-cli node gen-config -o /tmp/SKYNODE/skywire-config.json
# 2019/03/15 16:43:49 Done!
Expand All @@ -423,9 +417,7 @@ $ tree /tmp/SKYNODE
# ├── apps
# │   ├── skychat.v1.0
# │   ├── helloworld.v1.0
# │   ├── socksproxy.v1.0
# │   ├── SSH-client.v1.0
# │   └── SSH.v1.0
# │   └── skysocks.v1.0
# ├── skywire-config.json
# └── skywire-visor
# So far so good. We prepared docker volume. Now we can:
Expand All @@ -435,18 +427,15 @@ $ docker run -it -v /tmp/SKYNODE:/sky --network=SKYNET --name=SKYNODE skywire-ru
# [2019-03-15T13:55:10Z] INFO [skywire]: Connected to messaging servers
# [2019-03-15T13:55:10Z] INFO [skywire]: Starting skychat.v1.0
# [2019-03-15T13:55:10Z] INFO [skywire]: Starting RPC interface on 127.0.0.1:3435
# [2019-03-15T13:55:10Z] INFO [skywire]: Starting socksproxy.v1.0
# [2019-03-15T13:55:10Z] INFO [skywire]: Starting SSH.v1.0
# [2019-03-15T13:55:10Z] INFO [skywire]: Starting skysocks.v1.0
# [2019-03-15T13:55:10Z] INFO [skywire]: Starting packet router
# [2019-03-15T13:55:10Z] INFO [router]: Starting router
# [2019-03-15T13:55:10Z] INFO [trmanager]: Starting transport manager
# [2019-03-15T13:55:10Z] INFO [router]: Got new App request with type Init: {"app-name":"skychat",# "app-version":"1.0","protocol-version":"0.0.1"}
# [2019-03-15T13:55:10Z] INFO [router]: Handshaked new connection with the app skychat.v1.0
# [2019-03-15T13:55:10Z] INFO [skychat.v1.0]: 2019/03/15 13:55:10 Serving HTTP on :8000
# [2019-03-15T13:55:10Z] INFO [router]: Got new App request with type Init: {"app-name":"SSH",# "app-version":"1.0","protocol-version":"0.0.1"}
# [2019-03-15T13:55:10Z] INFO [router]: Handshaked new connection with the app SSH.v1.0
# [2019-03-15T13:55:10Z] INFO [router]: Got new App request with type Init: {"app-name":"socksproxy",# "app-version":"1.0","protocol-version":"0.0.1"}
# [2019-03-15T13:55:10Z] INFO [router]: Handshaked new connection with the app socksproxy.v1.0
# [2019-03-15T13:55:10Z] INFO [router]: Got new App request with type Init: {"app-name":"skysocks",# "app-version":"1.0","protocol-version":"0.0.1"}
# [2019-03-15T13:55:10Z] INFO [router]: Handshaked new connection with the app skysocks.v1.0
```

Note that in this example docker is running in non-detached mode - it could be useful in some scenarios.
Expand Down
16 changes: 1 addition & 15 deletions ci_scripts/run-internal-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,4 @@ 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/internal/noise -run TestReadWriterXKPattern >> ./logs/internal/TestReadWriterXKPattern.log
go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/SkycoinProject/skywire-mainnet/internal/noise -run TestReadWriterConcurrentTCP >> ./logs/internal/TestReadWriterConcurrentTCP.log

go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/SkycoinProject/skywire-mainnet/internal/therealproxy -run TestProxy >> ./logs/internal/TestProxy.log

go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/SkycoinProject/skywire-mainnet/internal/therealssh -run TestListAuthorizer >> ./logs/internal/TestListAuthorizer.log
go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/SkycoinProject/skywire-mainnet/internal/therealssh -run TestFileAuthorizer >> ./logs/internal/TestFileAuthorizer.log
go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/SkycoinProject/skywire-mainnet/internal/therealssh -run TestChannelServe >> ./logs/internal/TestChannelServe.log
go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/SkycoinProject/skywire-mainnet/internal/therealssh -run TestChannelSendWrite >> ./logs/internal/TestChannelSendWrite.log
go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/SkycoinProject/skywire-mainnet/internal/therealssh -run TestChannelRead >> ./logs/internal/TestChannelRead.log
go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/SkycoinProject/skywire-mainnet/internal/therealssh -run TestChannelRequest >> ./logs/internal/TestChannelRequest.log
go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/SkycoinProject/skywire-mainnet/internal/therealssh -run TestChannelServeSocket >> ./logs/internal/TestChannelServeSocket.log
go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/SkycoinProject/skywire-mainnet/internal/therealssh -run TestClientOpenChannel >> ./logs/internal/TestClientOpenChannel.log
go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/SkycoinProject/skywire-mainnet/internal/therealssh -run TestClientHandleResponse >> ./logs/internal/TestClientHandleResponse.log
go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/SkycoinProject/skywire-mainnet/internal/therealssh -run TestClientHandleData >> ./logs/internal/TestClientHandleData.log
go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/SkycoinProject/skywire-mainnet/internal/therealssh -run TestServerOpenChannel >> ./logs/internal/TestServerOpenChannel.log
go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/SkycoinProject/skywire-mainnet/internal/therealssh -run TestServerHandleRequest >> ./logs/internal/TestServerHandleRequest.log
go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/SkycoinProject/skywire-mainnet/internal/therealssh -run TestServerHandleData >> ./logs/internal/TestServerHandleData.log
go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/SkycoinProject/skywire-mainnet/internal/skysocks -run TestProxy >> ./logs/internal/TestProxy.log
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Skywire SOCKS5 proxy client app

`socksproxy-client` app implements client for the SOCKS5 app.
`skysocks-client` app implements client for the SOCKS5 app.

It opens persistent `skywire` connection to the configured remote node
and local TCP port, all incoming TCP traffics is forwarded to the
~skywire~ connection.

Any conventional SOCKS5 client should be able to connect to the proxy client.

Please check docs for `socksproxy` app for further instructions.
Please check docs for `skysocks` app for further instructions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ import (

"github.com/SkycoinProject/skywire-mainnet/internal/netutil"
"github.com/SkycoinProject/skywire-mainnet/internal/skyenv"
"github.com/SkycoinProject/skywire-mainnet/internal/therealproxy"
"github.com/SkycoinProject/skywire-mainnet/internal/skysocks"
"github.com/SkycoinProject/skywire-mainnet/pkg/app"
"github.com/SkycoinProject/skywire-mainnet/pkg/app/appnet"
"github.com/SkycoinProject/skywire-mainnet/pkg/routing"
)

const (
appName = "socksproxy-client"
appName = "skysocks-client"
netType = appnet.TypeSkynet
socksPort = routing.Port(3)
)
Expand All @@ -30,9 +30,9 @@ var r = netutil.NewRetrier(time.Second, 0, 1)

func main() {
log := app.NewLogger(appName)
therealproxy.Log = log.PackageLogger("therealproxy")
skysocks.Log = log.PackageLogger("skysocks")

var addr = flag.String("addr", skyenv.SkyproxyClientAddr, "Client address to listen on")
var addr = flag.String("addr", skyenv.SkysocksClientAddr, "Client address to listen on")
var serverPK = flag.String("srv", "", "PubKey of the server to connect to")
flag.Parse()

Expand Down Expand Up @@ -74,7 +74,7 @@ func main() {

log.Printf("Connected to %v\n", pk)

client, err := therealproxy.NewClient(conn)
client, err := skysocks.NewClient(conn)
if err != nil {
log.Fatal("Failed to create a new client: ", err)
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/apps/therealproxy/README.md → cmd/apps/skysocks/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Skywire SOCKS5 proxy app

`socksproxy` app implements SOCKS5 functionality over skywire
`skysocks` app implements SOCKS5 functionality over skywire
net.
Any conventional SOCKS5 client should be able to connect to the
proxy client.
Expand All @@ -18,7 +18,7 @@ Create 2 node config files:
{
"apps": [
{
"app": "socksproxy",
"app": "skysocks",
"version": "1.0",
"auto_start": true,
"port": 3,
Expand All @@ -34,7 +34,7 @@ Create 2 node config files:
{
"apps": [
{
"app": "socksproxy-client",
"app": "skysocks-client",
"version": "1.0",
"auto_start": true,
"port": 33,
Expand All @@ -47,8 +47,8 @@ Create 2 node config files:
Compile binaries and start 2 nodes:

```sh
$ go build -o apps/socksproxy.v1.0 ./cmd/apps/therealproxy
$ go build -o apps/socksproxy-client.v1.0 ./cmd/apps/therealproxy-client
$ go build -o apps/skysocks.v1.0 ./cmd/apps/skysocks
$ go build -o apps/skysocks-client.v1.0 ./cmd/apps/skysocks-client
$ ./skywire-visor skywire1.json
$ ./skywire-visor skywire2.json
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ import (

"github.com/SkycoinProject/skycoin/src/util/logging"

"github.com/SkycoinProject/skywire-mainnet/internal/therealproxy"
"github.com/SkycoinProject/skywire-mainnet/internal/skysocks"
"github.com/SkycoinProject/skywire-mainnet/pkg/app"
"github.com/SkycoinProject/skywire-mainnet/pkg/app/appnet"
"github.com/SkycoinProject/skywire-mainnet/pkg/routing"
)

const (
appName = "socksproxy"
appName = "skysocks"
netType = appnet.TypeSkynet
port = routing.Port(3)
)

func main() {
log := app.NewLogger(appName)
therealproxy.Log = log.PackageLogger("therealproxy")
skysocks.Log = log.PackageLogger("skysocks")

var passcode = flag.String("passcode", "", "Authorize user against this passcode")
flag.Parse()
Expand All @@ -41,7 +41,7 @@ func main() {
socksApp.Close()
}()

srv, err := therealproxy.NewServer(*passcode, log)
srv, err := skysocks.NewServer(*passcode, log)
if err != nil {
log.Fatal("Failed to create a new server: ", err)
}
Expand Down
8 changes: 0 additions & 8 deletions cmd/apps/therealssh-client/README.md

This file was deleted.

Loading

0 comments on commit 1dbf3c0

Please sign in to comment.