Skip to content

Commit

Permalink
docs: update README.md file
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreytse committed Dec 13, 2022
1 parent 5bd0a16 commit 95273c3
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,29 +149,55 @@ Options:
--help display help for command
```

### Request External API Services

Start a tunnel client:

```sh
cactus-tunnel client -b ws://localhost:7800 api.ipify.com:80
cactus-tunnel client -b ws://<your-tunnel-server>:7800 api.ipify.com:80
```

This command will start a server at address `localhost:7700` in bridge mode,
and open the tunnel bridge on the web browser.

```sh
curl http://localhost:7700/?format=json
curl http://localhost:7700/\?format\=json
```

When you connect to the port `7700`, it will auto connect to the specified
tunnel server `localhost:7800` and connect to target host `api.ipify:80`, you
will get your server ip address through [the IP API lookup service](https://www.ipify.com),
tunnel server `<your-tunnel-server>:7800` and connect to target host
`api.ipify:80`, you will get your server ip address through [the IP API lookup service](https://www.ipify.com),
the response content is similar as below:

```sh
$ curl http://localhost:7700/?format=json
$ curl http://localhost:7700/\?format\=json
{"ip":"201.xxx.xxx.138"}%
```

### SSH SOCKS5 Proxy

Start a tunnel client:

```sh
cactus-tunnel client -b ws://<your-tunnel-server>:7800 <your-ssh-server>:22
```

This command will start a server at address `localhost:7700` in bridge mode,
and open the tunnel bridge on the web browser.

```sh
ssh -p 7700 -D 3128 -C -N <your-username>@localhost
```

- `-D 3128`: open a SOCKS5 proxy on local port `3128`
- `-C`: compress data in the tunnel, save bandwidth
- `-N`: do not execute remote commands, useful for just forwarding ports

When you connect to the port `7700`, it will auto connect to the specified
tunnel server `localhost:7800` and connect to target host `<your-ssh-server>:22`.
Now you have an SSH tunnel between your computer and the remote host, in
this example `<your-ssh-server>:22`.

### Import the package

A simple example:
Expand Down

0 comments on commit 95273c3

Please sign in to comment.