Skip to content

Commit

Permalink
Merge branch 'mainnet' into feature/improve-close
Browse files Browse the repository at this point in the history
# Conflicts:
#	pkg/messaging/channel.go
#	pkg/messaging/factory.go
#	pkg/messaging/link.go
#	pkg/messaging/pool.go
  • Loading branch information
nkryuchkov committed Jul 3, 2019
2 parents 8468f56 + 91283de commit ace5b6d
Show file tree
Hide file tree
Showing 138 changed files with 1,722 additions and 6,805 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@ pkg/node/foo/
/*-server
/*.json
/*.sh
/*.log
/*.log

# Ignore backup go.mod after running '/ci_scripts/go_mod_replace.sh'.
go.mod-e
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,14 @@ test: ## Run tests
#${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/...
${OPTS} go test ${TEST_OPTS} ./pkg/app/...
${OPTS} go test ${TEST_OPTS} ./pkg/cipher/...
${OPTS} go test ${TEST_OPTS} ./pkg/dmsg/...
${OPTS} go test ${TEST_OPTS} ./pkg/manager/...
${OPTS} go test ${TEST_OPTS} ./pkg/messaging-discovery/...
${OPTS} go test ${TEST_OPTS} ./pkg/node/...
${OPTS} go test ${TEST_OPTS} ./pkg/route-finder/...
${OPTS} go test ${TEST_OPTS} ./pkg/router/...
${OPTS} go test ${TEST_OPTS} ./pkg/routing/...
${OPTS} go test ${TEST_OPTS} ./pkg/setup/...
${OPTS} go test ${TEST_OPTS} ./pkg/transport/...
${OPTS} go test ${TEST_OPTS} ./pkg/transport-discovery/...
${OPTS} go test -tags no_ci -cover -timeout=5m ./pkg/messaging/...


install-linters: ## Install linters
Expand Down Expand Up @@ -198,6 +195,11 @@ integration-run-proxy: ## Runs the proxy interactive testing environment
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

mod-uncomm: ## Uncomments the 'replace' rule in go.mod
./ci_scripts/go_mod_replace.sh uncomment go.mod

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

34 changes: 34 additions & 0 deletions ci_scripts/go_mod_replace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash

if [[ $# -ne 2 ]]; then
exit 0
fi

# Inputs.
action=$1
filename=$2

# Line to comment/uncomment in go.mod
line="replace github.com\/skycoin\/dmsg => ..\/dmsg"

function print_usage() {
echo $"Usage: $0 (comment|uncomment) <filename>"
}

case "$action" in
comment)
echo "commenting ${filename}..."
sed -i -e "/$line/s/^\/*/\/\//" ${filename}
;;
uncomment)
echo "uncommenting ${filename}..."
sed -i -e "/$line/s/^\/\/*//" ${filename}
;;
help)
print_usage
;;
*)
print_usage
exit 1
;;
esac
32 changes: 0 additions & 32 deletions ci_scripts/run-pkg-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,6 @@ 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/skycoin/skywire/pkg/manager -run TestNewNode >> ./logs/pkg/TestNewNode.log

go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging -run TestChannelRead >> ./logs/pkg/TestChannelRead.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging -run TestChannelWrite >> ./logs/pkg/TestChannelWrite.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging -run TestChannelClose >> ./logs/pkg/TestChannelClose.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging -run TestClientConnectInitialServers >> ./logs/pkg/TestClientConnectInitialServers.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging -run TestClientDial >> ./logs/pkg/TestClientDial.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging -run TestHandshakeFrame >> ./logs/pkg/TestHandshakeFrame.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging -run TestHandshake >> ./logs/pkg/TestHandshake.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging -run TestHandshakeInvalidResponder >> ./logs/pkg/TestHandshakeInvalidResponder.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging -run TestHandshakeInvalidInitiator >> ./logs/pkg/TestHandshakeInvalidInitiator.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging -run TestNewConn >> ./logs/pkg/TestNewConn.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging -run TestNewPool >> ./logs/pkg/TestNewPool.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging -run TestPool_Range >> ./logs/pkg/TestPool_Range.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging -run TestPool_All >> ./logs/pkg/TestPool_All.log

go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging-discovery/client -run TestNewMockGetAvailableServers>> ./logs/pkg/TestNewMockGetAvailableServers.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging-discovery/client -run TestNewMockEntriesEndpoint>> ./logs/pkg/TestNewMockEntriesEndpoint.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging-discovery/client -run TestNewMockSetEntriesEndpoint>> ./logs/pkg/TestNewMockSetEntriesEndpoint.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging-discovery/client -run TestNewMockUpdateEntriesEndpoint>> ./logs/pkg/TestNewMockUpdateEntriesEndpoint.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging-discovery/client -run TestNewMockUpdateEntrySequence>> ./logs/pkg/TestNewMockUpdateEntrySequence.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging-discovery/client -run TestNewClientEntryIsValid>> ./logs/pkg/TestNewClientEntryIsValid.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging-discovery/client -run TestVerifySignature>> ./logs/pkg/TestVerifySignature.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging-discovery/client -run TestValidateRightEntry>> ./logs/pkg/TestValidateRightEntry.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging-discovery/client -run TestValidateNonKeysEntry>> ./logs/pkg/TestValidateNonKeysEntry.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging-discovery/client -run TestValidateNonClientNonServerEntry>> ./logs/pkg/TestValidateNonClientNonServerEntry.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging-discovery/client -run TestValidateNonSignedEntry>> ./logs/pkg/TestValidateNonSignedEntry.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging-discovery/client -run TestValidateIteration>> ./logs/pkg/TestValidateIteration.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging-discovery/client -run TestValidateIterationEmptyClient>> ./logs/pkg/TestValidateIterationEmptyClient.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging-discovery/client -run TestValidateIterationWrongSequence>> ./logs/pkg/TestValidateIterationWrongSequence.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging-discovery/client -run TestValidateIterationWrongTime>> ./logs/pkg/TestValidateIterationWrongTime.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/messaging-discovery/client -run TestCopy>> ./logs/pkg/TestCopy.log


go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/node -run TestMessagingDiscovery >> ./logs/pkg/TestMessagingDiscovery.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/node -run TestTransportDiscovery >> ./logs/pkg/TestTransportDiscovery.log
go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/node -run TestTransportLogStore >> ./logs/pkg/TestTransportLogStore.log
Expand Down
3 changes: 2 additions & 1 deletion cmd/apps/helloworld/helloworld.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"log"
"os"

"github.com/skycoin/dmsg/cipher"

"github.com/skycoin/skywire/pkg/app"
"github.com/skycoin/skywire/pkg/cipher"
)

func main() {
Expand Down
3 changes: 2 additions & 1 deletion cmd/apps/skychat/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import (
"sync"
"time"

"github.com/skycoin/dmsg/cipher"

"github.com/skycoin/skywire/internal/netutil"
"github.com/skycoin/skywire/pkg/app"
"github.com/skycoin/skywire/pkg/cipher"
)

var addr = flag.String("addr", ":8000", "address to bind")
Expand Down
4 changes: 2 additions & 2 deletions cmd/apps/therealproxy-client/therealproxy-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
"net"
"time"

"github.com/skycoin/skywire/internal/netutil"
"github.com/skycoin/dmsg/cipher"

"github.com/skycoin/skywire/internal/netutil"
"github.com/skycoin/skywire/internal/therealproxy"
"github.com/skycoin/skywire/pkg/app"
"github.com/skycoin/skywire/pkg/cipher"
)

const socksPort = 3
Expand Down
9 changes: 4 additions & 5 deletions cmd/messaging-server/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ import (

"github.com/prometheus/client_golang/prometheus/promhttp"
logrus_syslog "github.com/sirupsen/logrus/hooks/syslog"
"github.com/skycoin/dmsg"
"github.com/skycoin/dmsg/cipher"
"github.com/skycoin/dmsg/disc"
"github.com/skycoin/skycoin/src/util/logging"
"github.com/spf13/cobra"

"github.com/skycoin/skywire/pkg/cipher"
"github.com/skycoin/skywire/pkg/dmsg"
"github.com/skycoin/skywire/pkg/messaging-discovery/client"
)

var (
Expand Down Expand Up @@ -78,7 +77,7 @@ var rootCmd = &cobra.Command{
}

// Start
srv, err := dmsg.NewServer(conf.PubKey, conf.SecKey, conf.PublicAddress, l, client.NewHTTP(conf.Discovery))
srv, err := dmsg.NewServer(conf.PubKey, conf.SecKey, conf.PublicAddress, l, disc.NewHTTP(conf.Discovery))
if err != nil {
logger.Fatalf("Error creating DMSG server instance: %v", err)
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/skywire-cli/commands/mdisc/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"text/tabwriter"
"time"

"github.com/skycoin/dmsg/disc"
"github.com/spf13/cobra"

"github.com/skycoin/skywire/cmd/skywire-cli/internal"
"github.com/skycoin/skywire/pkg/messaging-discovery/client"
)

var mdAddr string
Expand Down Expand Up @@ -40,7 +40,7 @@ var entryCmd = &cobra.Command{
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
defer cancel()
pk := internal.ParsePK("node-public-key", args[0])
entry, err := client.NewHTTP(mdAddr).Entry(ctx, pk)
entry, err := disc.NewHTTP(mdAddr).Entry(ctx, pk)
internal.Catch(err)
fmt.Println(entry)
},
Expand All @@ -52,13 +52,13 @@ var availableServersCmd = &cobra.Command{
Run: func(_ *cobra.Command, _ []string) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
defer cancel()
entries, err := client.NewHTTP(mdAddr).AvailableServers(ctx)
entries, err := disc.NewHTTP(mdAddr).AvailableServers(ctx)
internal.Catch(err)
printAvailableServers(entries)
},
}

func printAvailableServers(entries []*client.Entry) {
func printAvailableServers(entries []*disc.Entry) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 5, ' ', tabwriter.TabIndent)
_, err := fmt.Fprintln(w, "version\tregistered\tpublic-key\taddress\tport\tconns")
internal.Catch(err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/skywire-cli/commands/node/gen-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"path/filepath"
"time"

"github.com/skycoin/dmsg/cipher"
"github.com/spf13/cobra"

"github.com/skycoin/skywire/pkg/cipher"
"github.com/skycoin/skywire/pkg/node"
"github.com/skycoin/skywire/pkg/util/pathutil"
)
Expand Down
5 changes: 2 additions & 3 deletions cmd/skywire-cli/commands/node/transports.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ import (
"text/tabwriter"
"time"

"github.com/skycoin/skywire/pkg/dmsg"

"github.com/skycoin/dmsg"
"github.com/skycoin/dmsg/cipher"
"github.com/spf13/cobra"

"github.com/skycoin/skywire/cmd/skywire-cli/internal"
"github.com/skycoin/skywire/pkg/cipher"
"github.com/skycoin/skywire/pkg/node"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/skywire-cli/commands/rtfind/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"fmt"
"time"

"github.com/skycoin/dmsg/cipher"
"github.com/spf13/cobra"

"github.com/skycoin/skywire/cmd/skywire-cli/internal"
"github.com/skycoin/skywire/pkg/cipher"
"github.com/skycoin/skywire/pkg/route-finder/client"
)

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 @@ -9,10 +9,10 @@ import (
"time"

"github.com/google/uuid"
"github.com/skycoin/dmsg/cipher"
"github.com/spf13/cobra"

"github.com/skycoin/skywire/cmd/skywire-cli/internal"
"github.com/skycoin/skywire/pkg/cipher"
"github.com/skycoin/skywire/pkg/transport"
"github.com/skycoin/skywire/pkg/transport-discovery/client"
)
Expand Down
3 changes: 1 addition & 2 deletions cmd/skywire-cli/internal/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import (
"fmt"

"github.com/google/uuid"
"github.com/skycoin/dmsg/cipher"
"github.com/skycoin/skycoin/src/util/logging"

"github.com/skycoin/skywire/pkg/cipher"
)

var log = logging.MustGetLogger("skywire-cli")
Expand Down
3 changes: 1 addition & 2 deletions cmd/therealssh-cli/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ import (
"time"

"github.com/kr/pty"
"github.com/skycoin/dmsg/cipher"
"github.com/spf13/cobra"
"golang.org/x/crypto/ssh/terminal"

"github.com/skycoin/skywire/pkg/cipher"

ssh "github.com/skycoin/skywire/internal/therealssh"
)

Expand Down
9 changes: 4 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,22 @@ require (
github.com/google/uuid v1.1.1
github.com/gorilla/handlers v1.4.0
github.com/gorilla/securecookie v1.1.1
github.com/hashicorp/go-retryablehttp v0.5.4 // indirect
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d
github.com/kr/pty v1.1.5
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/mitchellh/go-homedir v1.1.0
github.com/pkg/profile v1.3.0
github.com/prometheus/client_golang v1.0.0
github.com/prometheus/common v0.4.1
github.com/sirupsen/logrus v1.4.2
github.com/skycoin/dmsg v0.0.0-20190628092537-e69f75132be9
github.com/skycoin/skycoin v0.26.0
github.com/spf13/cobra v0.0.5
github.com/stretchr/testify v1.3.0
go.etcd.io/bbolt v1.3.3
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4
golang.org/x/net v0.0.0-20190620200207-3b0461eec859
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb // indirect
golang.org/x/text v0.3.2 // indirect
golang.org/x/tools v0.0.0-20190627033414-4874f863e654 // indirect
)

// Uncomment for tests with alternate branches of 'dmsg'
//replace github.com/skycoin/dmsg => ../dmsg
Loading

0 comments on commit ace5b6d

Please sign in to comment.