Skip to content

Commit

Permalink
Merge pull request #252 from ayuryshev/bug/apps-create-multiple-trans…
Browse files Browse the repository at this point in the history
…ports-248

Deterministic properties of Transports. Linked to "Apps create multiple transports-248"
  • Loading branch information
ayuryshev authored Apr 15, 2019
2 parents cf523df + 377033d commit d52f221
Show file tree
Hide file tree
Showing 34 changed files with 1,293 additions and 345 deletions.
81 changes: 62 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.PHONY : check lint install-linters dep test
.PHONY : build clean install format
.PHONY : host-apps bin
.PHONY : run stop
.PHONY : run stop config
.PHONY : docker-image docker-clean docker-network
.PHONY : docker-apps docker-bin docker-volume
.PHONY : docker-run docker-stop
Expand All @@ -17,12 +17,14 @@ check: lint test ## Run linters and tests

build: dep host-apps bin ## Install dependencies, build apps and binaries. `go build` with ${OPTS}

run: stop build ## Run skywire-node on host
./skywire-node
run: stop build config ## Run skywire-node on host
./skywire-node skywire.json

stop: ## Stop running skywire-node on host
-bash -c "kill $$(ps aux |grep '[s]kywire-node' |awk '{print $$2}')"

config: ## Generate skywire.json
-./skywire-cli node gen-config -o ./skywire.json -r

clean: ## Clean project: remove created binaries and apps
-rm -rf ./apps
Expand All @@ -31,6 +33,12 @@ clean: ## Clean project: remove created binaries and apps
install: ## Install `skywire-node`, `skywire-cli`, `manager-node`, `therealssh-cli`
${OPTS} go install ./cmd/skywire-node ./cmd/skywire-cli ./cmd/manager-node ./cmd/therealssh-cli

rerun: stop
${OPTS} go build -race -o ./skywire-node ./cmd/skywire-node
-./skywire-cli node gen-config -o ./skywire.json -r
perl -pi -e 's/localhost//g' ./skywire.json
./skywire-node skywire.json


lint: ## Run linters. Use make install-linters first
${OPTS} golangci-lint run -c .golangci.yml ./...
Expand All @@ -49,8 +57,22 @@ vendorcheck: ## Run vendorcheck
#GO111MODULE=off vendorcheck ./cmd/therealssh-cli/...

test: ## Run tests for net
-go clean -testcache
${OPTS} go test -race -tags no_ci -cover -timeout=5m ./internal/...
${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/...
#${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/...
${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/app/...
${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/cipher/...
${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/manager/...
${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/messaging-discovery/...
${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/node/...
${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/route-finder/...
${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/router/...
${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/routing/...
${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/setup/...
${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/transport/...
${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/transport-discovery/...
${OPTS} go test -tags no_ci -cover -timeout=5m ./pkg/messaging/...


install-linters: ## Install linters
- VERSION=1.13.2 ./ci_scripts/install-golangci-lint.sh
Expand All @@ -71,19 +93,33 @@ dep: ## Sorts dependencies

# Apps
host-apps: ## Build app
${OPTS} go build -o ./apps/chat.v1.0 ./cmd/apps/chat
${OPTS} go build -o ./apps/helloworld.v1.0 ./cmd/apps/helloworld
${OPTS} go build -o ./apps/therealproxy.v1.0 ./cmd/apps/therealproxy
${OPTS} go build -o ./apps/therealproxy-client.v1.0 ./cmd/apps/therealproxy-client
${OPTS} go build -o ./apps/therealssh.v1.0 ./cmd/apps/therealssh
${OPTS} go build -o ./apps/therealssh-client.v1.0 ./cmd/apps/therealssh-client
${OPTS} go build -race -o ./apps/chat.v1.0 ./cmd/apps/chat
${OPTS} go build -race -o ./apps/helloworld.v1.0 ./cmd/apps/helloworld
${OPTS} go build -race -o ./apps/therealproxy.v1.0 ./cmd/apps/therealproxy
${OPTS} go build -race -o ./apps/therealproxy-client.v1.0 ./cmd/apps/therealproxy-client
${OPTS} go build -race -o ./apps/therealssh.v1.0 ./cmd/apps/therealssh
${OPTS} go build -race -o ./apps/therealssh-client.v1.0 ./cmd/apps/therealssh-client

# Bin
bin: ## Build `skywire-node`, `skywire-cli`, `manager-node`, `therealssh-cli`
${OPTS} go build -race -o ./skywire-node ./cmd/skywire-node
${OPTS} go build -race -o ./skywire-cli ./cmd/skywire-cli
${OPTS} go build -race -o ./manager-node ./cmd/manager-node
${OPTS} go build -race -o ./therealssh-cli ./cmd/therealssh-cli

release: ## Build skywire-node`, skywire-cli, manager-node, therealssh-cli and apps without -race flag
${OPTS} go build -o ./skywire-node ./cmd/skywire-node
${OPTS} go build -o ./skywire-cli ./cmd/skywire-cli
${OPTS} go build -o ./manager-node ./cmd/manager-node
${OPTS} go build -o ./therealssh-cli ./cmd/therealssh-cli
${OPTS} go build -o ./apps/chat.v1.0 ./cmd/apps/chat
${OPTS} go build -o ./apps/helloworld.v1.0 ./cmd/apps/helloworld
${OPTS} go build -o ./apps/therealproxy.v1.0 ./cmd/apps/therealproxy
${OPTS} go build -o ./apps/therealproxy-client.v1.0 ./cmd/apps/therealproxy-client
${OPTS} go build -o ./apps/therealssh.v1.0 ./cmd/apps/therealssh
${OPTS} go build -o ./apps/therealssh-client.v1.0 ./cmd/apps/therealssh-client



# Dockerized skywire-node
docker-image: ## Build docker image `skywire-runner`
Expand All @@ -97,26 +133,33 @@ docker-network: ## Create docker network ${DOCKER_NETWORK}
-docker network create ${DOCKER_NETWORK}

docker-apps: ## Build apps binaries for dockerized skywire-node. `go build` with ${DOCKER_OPTS}
-${DOCKER_OPTS} go build -o ./node/apps/chat.v1.0 ./cmd/apps/chat
-${DOCKER_OPTS} go build -o ./node/apps/helloworld.v1.0 ./cmd/apps/helloworld
-${DOCKER_OPTS} go build -o ./node/apps/therealproxy.v1.0 ./cmd/apps/therealproxy
-${DOCKER_OPTS} go build -o ./node/apps/therealproxy-client.v1.0 ./cmd/apps/therealproxy-client
-${DOCKER_OPTS} go build -o ./node/apps/therealssh.v1.0 ./cmd/apps/therealssh
-${DOCKER_OPTS} go build -o ./node/apps/therealssh-client.v1.0 ./cmd/apps/therealssh-client
-${DOCKER_OPTS} go build -race -o ./node/apps/chat.v1.0 ./cmd/apps/chat
-${DOCKER_OPTS} go build -race -o ./node/apps/helloworld.v1.0 ./cmd/apps/helloworld
-${DOCKER_OPTS} go build -race -o ./node/apps/therealproxy.v1.0 ./cmd/apps/therealproxy
-${DOCKER_OPTS} go build -race -o ./node/apps/therealproxy-client.v1.0 ./cmd/apps/therealproxy-client
-${DOCKER_OPTS} go build -race -o ./node/apps/therealssh.v1.0 ./cmd/apps/therealssh
-${DOCKER_OPTS} go build -race -o ./node/apps/therealssh-client.v1.0 ./cmd/apps/therealssh-client

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

docker-volume: docker-apps docker-bin bin ## Prepare docker volume for dockerized skywire-node
./skywire-cli node gen-config -o ./node/skywire.json -r
-./skywire-cli node gen-config -o ./node/skywire.json -r
perl -pi -e 's/localhost//g' ./node/skywire.json # To make node accessible from outside with skywire-cli

docker-run: docker-clean docker-image docker-network docker-volume ## Run dockerized skywire-node ${DOCKER_NODE} in image ${DOCKER_IMAGE} with network ${DOCKER_NETWORK}
docker run -it -v $(shell pwd)/node:/sky --network=${DOCKER_NETWORK} \
--name=${DOCKER_NODE} ${DOCKER_IMAGE} bash -c "cd /sky && ./skywire-node"
--name=${DOCKER_NODE} ${DOCKER_IMAGE} bash -c "cd /sky && ./skywire-node skywire.json"

docker-stop: ## Stop running dockerized skywire-node ${DOCKER_NODE}
-docker container stop ${DOCKER_NODE}

docker-rerun: docker-stop
-./skywire-cli gen-config -o ./node/skywire.json -r
perl -pi -e 's/localhost//g' ./node/skywire.json # To make node accessible from outside with skywire-cli
${DOCKER_OPTS} go build -race -o ./node/skywire-node ./cmd/skywire-node
docker container start -i ${DOCKER_NODE}


help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
Expand Down
2 changes: 1 addition & 1 deletion cmd/skywire-cli/commands/tpdisc/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func printTransportEntries(entries ...*transport.EntryWithStatus) {
internal.Catch(err)
for _, e := range entries {
_, err := fmt.Fprintf(w, "%s\t%s\t%t\t%d\t%t\t%s\t%s\t%t\t%t\n",
e.Entry.ID, e.Entry.Type, e.Entry.Public, e.Registered, e.IsUp, e.Entry.Edges[0], e.Entry.Edges[1], e.Statuses[0], e.Statuses[1])
e.Entry.ID, e.Entry.Type, e.Entry.Public, e.Registered, e.IsUp, e.Entry.Edges()[0], e.Entry.Edges()[1], e.Statuses[0], e.Statuses[1])
internal.Catch(err)
}
internal.Catch(w.Flush())
Expand Down
41 changes: 38 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,63 @@ module github.com/skycoin/skywire
go 1.12

require (
github.com/FiloSottile/vendorcheck v0.0.0-20160511012517-d6d54d1b5894 // indirect
github.com/Masterminds/semver v1.4.2 // indirect
github.com/Masterminds/vcs v1.13.0 // indirect
github.com/acroca/go-symbols v0.1.1 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5
github.com/boltdb/bolt v1.3.1 // indirect
github.com/calebthompson/ftree v0.2.0 // indirect
github.com/dvyukov/go-fuzz v0.0.0-20190402070214-9cfa592d5792 // indirect
github.com/elazarl/go-bindata-assetfs v1.0.0 // indirect
github.com/ernesto-jimenez/gogen v0.0.0-20180125220232-d7d4131e6607 // indirect
github.com/fatih/gomodifytags v0.0.0-20180914191908-141225bf62b6 // indirect
github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6
github.com/go-chi/chi v4.0.2+incompatible
github.com/go-delve/delve v1.2.0 // indirect
github.com/godbus/dbus v4.1.0+incompatible // indirect
github.com/golang/dep v0.5.1 // indirect
github.com/golangci/golangci-lint v1.16.0 // indirect
github.com/google/uuid v1.1.1
github.com/gorilla/securecookie v1.1.1
github.com/gorilla/sessions v1.1.3 // indirect
github.com/hanwen/go-fuse v1.0.0 // indirect
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/jmank88/nuts v0.3.0 // indirect
github.com/karrick/godirwalk v1.8.0 // indirect
github.com/keegancsmith/rpc v1.1.0 // indirect
github.com/kr/fs v0.1.0 // indirect
github.com/kr/pty v1.1.3
github.com/mattn/go-colorable v0.1.1 // indirect
github.com/mattn/go-sqlite3 v1.10.0 // indirect
github.com/mdempsky/gocode v0.0.0-20190203001940-7fb65232883f // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/mibk/dupl v1.0.0 // indirect
github.com/mitchellh/go-homedir v1.1.0
github.com/nightlyone/lockfile v0.0.0-20180618180623-0ad87eef1443 // indirect
github.com/oniony/TMSU v0.7.4 // indirect
github.com/pkg/errors v0.8.1 // indirect
github.com/ramya-rao-a/go-outline v0.0.0-20181122025142-7182a932836a // indirect
github.com/rogpeppe/godef v1.1.1 // indirect
github.com/sdboyer/constext v0.0.0-20170321163424-836a14457353 // indirect
github.com/sirupsen/logrus v1.4.0 // indirect
github.com/skycoin/skycoin v0.25.1
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.3 // indirect
github.com/sqs/goreturns v0.0.0-20181028201513-538ac6014518 // indirect
github.com/stamblerre/gocode v0.0.0-20190327203809-810592086997 // indirect
github.com/stephens2424/writerset v1.0.2 // indirect
github.com/stretchr/testify v1.3.0
github.com/tools/godep v0.0.0-20180126220526-ce0bfadeb516 // indirect
github.com/uudashr/gopkgs v2.0.1+incompatible // indirect
github.com/visualfc/fastmod v0.0.0-20190131104758-c069a47540eb // indirect
github.com/visualfc/gocode v0.0.0-20190319040811-fab173807d9b // indirect
github.com/visualfc/gotools v0.0.0-20190218124934-6d12497f1bd5 // indirect
go.etcd.io/bbolt v1.3.2
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 // indirect
golang.org/x/net v0.0.0-20190324223953-e3b2ff56ed87
golang.org/x/sys v0.0.0-20190322080309-f49334f85ddc // indirect
golang.org/x/tools v0.0.0-20190325223049-1d95b17f1b04 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
)
Loading

0 comments on commit d52f221

Please sign in to comment.