Skip to content

Commit

Permalink
rename therealproxy to skysocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Kifen committed Jan 6, 2020
1 parent 4ede499 commit 709d678
Show file tree
Hide file tree
Showing 25 changed files with 2,138 additions and 31 deletions.
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ 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/socksproxy.v1.0 ./cmd/apps/skysocks
${OPTS} go build ${BUILD_OPTS} -o ./apps/socksproxy-client.v1.0 ./cmd/apps/skysocks-client

# Bin
bin: ## Build `skywire-visor`, `skywire-cli`, `hypervisor`
Expand All @@ -105,8 +105,8 @@ release: ## Build `skywire-visor`, `skywire-cli`, `hypervisor` and apps without
${OPTS} go build -o ./hypervisor ./cmd/hypervisor
${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/socksproxy.v1.0 ./cmd/apps/skysocks
${OPTS} go build -o ./apps/socksproxy-client.v1.0 ./cmd/apps/skysocks-client

# Dockerized skywire-visor
docker-image: ## Build docker image `skywire-runner`
Expand All @@ -122,8 +122,8 @@ 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/socksproxy.v1.0 ./cmd/apps/skysocks
-${DOCKER_OPTS} go build -race -o ./node/apps/socksproxy-client.v1.0 ./cmd/apps/skysocks-client

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
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,12 @@ After `skywire-visor` is up and running with default environment, default apps a

- [Chat](/cmd/apps/skychat)
- [Hello World](/cmd/apps/helloworld)
<<<<<<< HEAD
- [The Real Proxy](/cmd/apps/therealproxy) ([Client](/cmd/apps/therealproxy-client))
=======
- [The Real Proxy](/cmd/apps/skysocks) ([Client](/cmd/apps/skysocks-client))
- [The Real SSH](/cmd/apps/therealssh) ([Client](/cmd/apps/therealssh-client))
>>>>>>> rename therealproxy to skysocks
### Transports

Expand Down Expand Up @@ -408,7 +413,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/socksproxy.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 Down
2 changes: 1 addition & 1 deletion ci_scripts/run-internal-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +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/skysocks -run TestProxy >> ./logs/internal/TestProxy.log
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ 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"
Expand All @@ -30,7 +30,7 @@ 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 serverPK = flag.String("srv", "", "PubKey of the server to connect to")
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
Original file line number Diff line number Diff line change
Expand Up @@ -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/socksproxy.v1.0 ./cmd/apps/skysocks
$ go build -o apps/socksproxy-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,7 +9,7 @@ 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"
Expand All @@ -23,7 +23,7 @@ const (

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
6 changes: 3 additions & 3 deletions docker/images/node/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ RUN go build -mod=vendor -tags netgo -ldflags="-w -s" \
go build -mod=vendor -ldflags="-w -s" -o skywire-cli ./cmd/skywire-cli &&\
go build -mod=vendor -ldflags="-w -s" -o ./apps/skychat.v1.0 ./cmd/apps/skychat &&\
go build -mod=vendor -ldflags="-w -s" -o ./apps/helloworld.v1.0 ./cmd/apps/helloworld &&\
go build -mod=vendor -ldflags="-w -s" -o ./apps/socksproxy.v1.0 ./cmd/apps/therealproxy &&\
go build -mod=vendor -ldflags="-w -s" -o ./apps/socksproxy-client.v1.0 ./cmd/apps/therealproxy-client

go build -mod=vendor -ldflags="-w -s" -o ./apps/socksproxy.v1.0 ./cmd/apps/skysocks &&\
go build -mod=vendor -ldflags="-w -s" -o ./apps/socksproxy-client.v1.0 ./cmd/apps/skysocks-client &&\

## Resulting image
FROM ${base} as node-runner
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ require (
github.com/google/uuid v1.1.1
github.com/gorilla/handlers v1.4.2
github.com/gorilla/securecookie v1.1.1
github.com/hashicorp/yamux v0.0.0-20190923154419-df201c70410d
github.com/mitchellh/go-homedir v1.1.0
github.com/pkg/profile v1.3.0
github.com/prometheus/client_golang v1.2.1
github.com/prometheus/common v0.7.0
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/
github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ=
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/yamux v0.0.0-20190923154419-df201c70410d h1:W+SIwDdl3+jXWeidYySAgzytE3piq6GumXeBjFBG67c=
github.com/hashicorp/yamux v0.0.0-20190923154419-df201c70410d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
Expand Down
12 changes: 6 additions & 6 deletions internal/therealproxy/client.go → internal/skysocks/client.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package therealproxy
package skysocks

import (
"fmt"
Expand All @@ -9,8 +9,8 @@ import (
"github.com/SkycoinProject/yamux"
)

// Log is therealproxy package level logger, it can be replaced with a different one from outside the package
var Log = logging.MustGetLogger("therealproxy")
// Log is skysocks package level logger, it can be replaced with a different one from outside the package
var Log = logging.MustGetLogger("skysocks")

// Client implement multiplexing proxy client using yamux.
type Client struct {
Expand Down Expand Up @@ -38,7 +38,7 @@ func (c *Client) ListenAndServe(addr string) error {
return fmt.Errorf("listen: %s", err)
}

Log.Printf("Listening therealproxy client on %s", addr)
Log.Printf("Listening skysocks client on %s", addr)

c.listener = l
for {
Expand All @@ -48,13 +48,13 @@ func (c *Client) ListenAndServe(addr string) error {
return fmt.Errorf("accept: %s", err)
}

Log.Println("Accepted therealproxy client")
Log.Println("Accepted skysocks client")
stream, err := c.session.Open()
if err != nil {
return fmt.Errorf("error on `ListenAndServe`: yamux: %s", err)
}

Log.Println("Opened session therealproxy client")
Log.Println("Opened session skysocks client")

go func() {
errCh := make(chan error, 2)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package therealproxy
package skysocks

import (
"fmt"
"net"

"github.com/SkycoinProject/yamux"

"github.com/SkycoinProject/skycoin/src/util/logging"
"github.com/armon/go-socks5"
"github.com/hashicorp/yamux"
)

// Server implements multiplexing proxy server using yamux.
Expand Down Expand Up @@ -44,7 +43,7 @@ func (s *Server) Serve(l net.Listener) error {

session, err := yamux.Server(conn, nil)
if err != nil {
return fmt.Errorf("error in `Serve`: yamux: %s", err)
return fmt.Errorf("yamux server failure: %s", err)
}

go func() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package therealproxy
package skysocks

import (
"fmt"
Expand All @@ -11,6 +11,7 @@ import (
"time"

"github.com/SkycoinProject/skycoin/src/util/logging"
"github.com/hashicorp/yamux"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/net/nettest"
Expand Down Expand Up @@ -49,9 +50,13 @@ func TestProxy(t *testing.T) {
conn, err := net.Dial("tcp", l.Addr().String())
require.NoError(t, err)

client, err := NewClient(conn)
session, err := yamux.Client(conn, nil)
require.NoError(t, err)

client := &Client{
session: session,
}

errChan2 := make(chan error)
go func() {
errChan2 <- client.ListenAndServe(":10080")
Expand Down
23 changes: 23 additions & 0 deletions vendor/github.com/hashicorp/yamux/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 709d678

Please sign in to comment.