Skip to content

Commit

Permalink
Merge pull request #105 from Kifen/skysocks-rename
Browse files Browse the repository at this point in the history
Skysocks rename
  • Loading branch information
jdknives authored Jan 6, 2020
2 parents 4ede499 + a327b68 commit d9a73f4
Show file tree
Hide file tree
Showing 32 changed files with 2,169 additions and 73 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/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`
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/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 @@ -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/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`. `go build` with ${DOCKER_OPTS}
${DOCKER_OPTS} go build -race -o ./node/skywire-visor ./cmd/skywire-visor
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +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))
- [Sky Socks](/cmd/apps/skysocks) ([Client](/cmd/apps/skysocks-client))

### Transports

Expand Down Expand Up @@ -304,11 +304,11 @@ This will:
├── apps # node `apps` compiled with DOCKER_OPTS
│   ├── skychat.v1.0 #
│   ├── helloworld.v1.0 #
│   ├── socksproxy-client.v1.0 #
│   └── socksproxy.v1.0 #
│   ├── skysocks-client.v1.0 #
│   └── skysocks.v1.0 #
├── local # **Created inside docker**
│   ├── skychat # according to "local_path" in skywire-config.json
│   └── socksproxy #
│   └── skysocks #
├── PK # contains public key of node
├── skywire # db & logs. **Created inside docker**
│   ├── routing.db #
Expand Down Expand Up @@ -408,7 +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/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 @@ -417,7 +417,7 @@ $ tree /tmp/SKYNODE
# ├── apps
# │   ├── skychat.v1.0
# │   ├── helloworld.v1.0
# │   └── socksproxy.v1.0
# │   └── skysocks.v1.0
# ├── skywire-config.json
# └── skywire-visor
# So far so good. We prepared docker volume. Now we can:
Expand All @@ -427,15 +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 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":"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
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
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
22 changes: 11 additions & 11 deletions cmd/skywire-cli/commands/node/gen-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ func defaultConfig() *visor.Config {
ptyConf := defaultDmsgPtyConfig()
conf.DmsgPty = &ptyConf

// TODO(evanlinjin): We have disabled skyproxy passcode by default for now - We should make a cli arg for this.
// TODO(evanlinjin): We have disabled skysocks passcode by default for now - We should make a cli arg for this.
//passcode := base64.StdEncoding.Strict().EncodeToString(cipher.RandByte(8))
conf.Apps = []visor.AppConfig{
defaultSkychatConfig(),
defaultSkyproxyConfig(""),
defaultSkyproxyClientConfig(),
defaultSkysocksConfig(""),
defaultSkysocksClientConfig(),
}
conf.TrustedNodes = []cipher.PubKey{}

Expand Down Expand Up @@ -162,25 +162,25 @@ func defaultSkychatConfig() visor.AppConfig {
}
}

func defaultSkyproxyConfig(passcode string) visor.AppConfig {
func defaultSkysocksConfig(passcode string) visor.AppConfig {
var args []string
if passcode != "" {
args = []string{"-passcode", passcode}
}
return visor.AppConfig{
App: skyenv.SkyproxyName,
Version: skyenv.SkyproxyVersion,
App: skyenv.SkysocksName,
Version: skyenv.SkysocksVersion,
AutoStart: true,
Port: routing.Port(skyenv.SkyproxyPort),
Port: routing.Port(skyenv.SkysocksPort),
Args: args,
}
}

func defaultSkyproxyClientConfig() visor.AppConfig {
func defaultSkysocksClientConfig() visor.AppConfig {
return visor.AppConfig{
App: skyenv.SkyproxyClientName,
Version: skyenv.SkyproxyClientVersion,
App: skyenv.SkysocksClientName,
Version: skyenv.SkysocksClientVersion,
AutoStart: false,
Port: routing.Port(skyenv.SkyproxyClientPort),
Port: routing.Port(skyenv.SkysocksClientPort),
}
}
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/skysocks.v1.0 ./cmd/apps/skysocks &&\
go build -mod=vendor -ldflags="-w -s" -o ./apps/skysocks-client.v1.0 ./cmd/apps/skysocks-client

## Resulting image
FROM ${base} as node-runner
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ 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/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
6 changes: 3 additions & 3 deletions integration/InteractiveEnvironments.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ The proxy test environment will define the following:

It's really tricky to make socks5 proxy work now from clean start.
Because `socksproxy-client` needs:
Because `skysocks-client` needs:
- transport to NodeA
- NodeA must be running **before** start of `socksproxy-client`
- NodeA must be running **before** start of `skysocks-client`
Recipe for clean start:
Expand All @@ -181,7 +181,7 @@ Recipe for clean start:
4. Stop NodeA, NodeB, NodeC
5. Restart all nodes
6. Wait for message in NodeC logs about successful start of
socksproxy-client
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`

Expand Down
2 changes: 1 addition & 1 deletion integration/generic/nodeA.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"args": []
},
{
"app": "socksproxy",
"app": "skysocks",
"version": "1.0",
"auto_start": true,
"port": 3,
Expand Down
2 changes: 1 addition & 1 deletion integration/generic/nodeC.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
]
},
{
"app": "socksproxy-client",
"app": "skysocks-client",
"version": "1.0",
"auto_start": true,
"port": 13,
Expand Down
2 changes: 1 addition & 1 deletion integration/proxy/nodeA.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"apps": [
{
"app": "socksproxy",
"app": "skysocks",
"version": "1.0",
"auto_start": true,
"port": 3,
Expand Down
2 changes: 1 addition & 1 deletion integration/proxy/nodeC.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"apps": [
{
"app": "socksproxy-client",
"app": "skysocks-client",
"version": "1.0",
"auto_start": true,
"port": 13,
Expand Down
18 changes: 9 additions & 9 deletions internal/skyenv/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ const (
SkychatPort = uint16(1)
SkychatAddr = ":8000"

SkyproxyName = "socksproxy"
SkyproxyVersion = "1.0"
SkyproxyPort = uint16(3)

SkyproxyClientName = "socksproxy-client"
SkyproxyClientVersion = "1.0"
SkyproxyClientPort = uint16(13)
SkyproxyClientAddr = ":1080"
// TODO(evanlinjin): skyproxy-client requires
SkysocksName = "skysocks"
SkysocksVersion = "1.0"
SkysocksPort = uint16(3)

SkysocksClientName = "skysocks-client"
SkysocksClientVersion = "1.0"
SkysocksClientPort = uint16(13)
SkysocksClientAddr = ":1080"
// TODO(evanlinjin): skysocks-client requires
)
Loading

0 comments on commit d9a73f4

Please sign in to comment.