Skip to content

Commit

Permalink
v20211227
Browse files Browse the repository at this point in the history
  • Loading branch information
txthinking committed Dec 27, 2021
1 parent 9900224 commit 7aab01f
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 41 deletions.
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,26 @@ $ zoro client -s 1.2.3.4:9999 -p password --serverPort 8888 -c 127.0.0.1:8080
Then access `1.2.3.4:8888` equals to access `127.0.0.1:8080`

## `httpsserver` and `httpsclient`

On remote server. Assume your domain is `domain.com`, cert of `*.domain.com` is `./domain_com_cert.pem` and `./domain_com_cert_key.pem`, want https listen on `443`. Note that the firewall opens TCP on all relevant ports

```
$ zoro httpsserver -l :9999 -p password --domain domain.com --cert ./domain_com_cert.pem --certKey ./domain_com_cert_key.pem --tlsPort 443
```

> More parameters: $ zoro httpsserver -h<br/>
On local. Assume your remote zoro httpsserver is `1.2.3.4:9999`, your local HTTP 1.1 server is `127.0.0.1:8080`, want the remote server to open subdomain `hey`

```
$ zoro httpsclient -s 1.2.3.4:9999 -p password --serverSubdomain hey -c 127.0.0.1:8080
```

> More parameters: $ zoro httpsclient -h
Then access `https://hey.domain.com:443` equals to access `http://127.0.0.1:8080`

## Example of `server` and `client`

#### Expose local HTTP server
Expand Down Expand Up @@ -120,26 +140,6 @@ Then access `1.2.3.4:8888` equals to access `127.0.0.1:8080`, used to create a b
...
```

## `httpsserver` and `httpsclient`

On remote server. Assume your domain is `domain.com`, cert of `*.domain.com` is `./domain_com_cert.pem` and `./domain_com_cert_key.pem`, want https listen on `443`. Note that the firewall opens TCP on all relevant ports

```
$ zoro httpsserver -l :9999 -p password --domain domain.com --cert ./domain_com_cert.pem --certKey ./domain_com_cert_key.pem --tlsPort 443
```

> More parameters: $ zoro httpsserver -h<br/>
On local. Assume your remote zoro httpsserver is `1.2.3.4:9999`, your local HTTP 1.1 server is `127.0.0.1:8080`, want the remote server to open subdomain `hey`

```
$ zoro httpsclient -s 1.2.3.4:9999 -p password --serverSubdomain hey -c 127.0.0.1:8080
```

> More parameters: $ zoro httpsclient -h
Then access `https://hey.domain.com:443` equals to access `http://127.0.0.1:8080`

## About UDP

In some cases of multi-layer NAT, UDP may fail. I passed the test when I connected directly to the Wi-Fi provided by the ISP.
Expand Down
42 changes: 21 additions & 21 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ GLOBAL OPTIONS:
--version, -v print the version (default: false)
```

## `服务端``客户端` 使用教程
## `server``client` 使用教程

在远程服务器上. 注意防火墙开放所有相关端口的TCP和UDP协议

Expand All @@ -63,6 +63,26 @@ $ zoro client -s 1.2.3.4:9999 -p password --serverPort 8888 -c 127.0.0.1:8080
现在访问 `1.2.3.4:8888` 就等于 `127.0.0.1:8080`

## `httpsserver` 以及 `httpsclient`

在远程服务器上. 假设你的域名是 `domain.com`, 泛域名证书`*.domain.com``./domain_com_cert.pem``./domain_com_cert_key.pem`, 想让HTTPS监听 443`. 注意防火墙开放任何相关端口的TCP协议

```
$ zoro httpsserver -l :9999 -p password --domain domain.com --cert ./domain_com_cert.pem --certKey ./domain_com_cert_key.pem --tlsPort 443
```

> 更多参数: $ zoro httpsserver -h
在本地. 假设你的远程 zoro httpsserver 是 `1.2.3.4:9999`, 你的本地 HTTP 1.1 服务是 `127.0.0.1:8080`, 想让远程服务器开放子域名 `hey`

```
$ zoro httpsclient -s 1.2.3.4:9999 -p password --serverSubdomain hey -c 127.0.0.1:8080
```

> 更多参数: $ zoro httpsclient -h
现在访问 `https://hey.domain.com:443` 就等于 `http://127.0.0.1:8080`

## `服务端``客户端` 的使用例子

#### 暴露本地HTTP服务
Expand Down Expand Up @@ -120,26 +140,6 @@ $ zoro client -s 1.2.3.4:9999 -p password --serverPort 8888 -c 127.0.0.1:8080
...
```

## `httpsserver` 以及 `httpsclient`

在远程服务器上. 假设你的域名是 `domain.com`, 泛域名证书`*.domain.com``./domain_com_cert.pem``./domain_com_cert_key.pem`, 想让HTTPS监听 443`. 注意防火墙开放任何相关端口的TCP协议

```
$ zoro httpsserver -l :9999 -p password --domain domain.com --cert ./domain_com_cert.pem --certKey ./domain_com_cert_key.pem --tlsPort 443
```

> 更多参数: $ zoro httpsserver -h
在本地. 假设你的远程 zoro httpsserver 是 `1.2.3.4:9999`, 你的本地 HTTP 1.1 服务是 `127.0.0.1:8080`, 想让远程服务器开放子域名 `hey`

```
$ zoro httpsclient -s 1.2.3.4:9999 -p password --serverSubdomain hey -c 127.0.0.1:8080
```

> 更多参数: $ zoro httpsclient -h
现在访问 `https://hey.domain.com:443` 就等于 `http://127.0.0.1:8080`

## 关于UDP

在一些多层NAT情况下, 可能UDP会失败. 我在本地直接连接ISP提供的Wi-Fi的情况测试通过.
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/txthinking/zoro
go 1.16

require (
github.com/denisbrodbeck/machineid v1.0.1
github.com/gogo/protobuf v1.3.2
github.com/golang/protobuf v1.5.2
github.com/patrickmn/go-cache v2.1.0+incompatible
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/denisbrodbeck/machineid v1.0.1 h1:geKr9qtkB876mXguW2X6TU4ZynleN6ezuMSRhl4D7AQ=
github.com/denisbrodbeck/machineid v1.0.1/go.mod h1:dJUwb7PTidGDeYyUBmXZ2GphQBbjJCrnectwCyxcUSI=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
Expand Down Expand Up @@ -45,6 +47,7 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down

0 comments on commit 7aab01f

Please sign in to comment.