Skip to content

Commit 5036f82

Browse files
committed
update reverse proxy
1 parent 8d05eac commit 5036f82

File tree

10 files changed

+229
-131
lines changed

10 files changed

+229
-131
lines changed

docs/concepts/hop.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ services:
109109
listener:
110110
type: tcp
111111
forwarder:
112-
name: hop-0
112+
hop: hop-0
113113
114114
hops:
115115
- name: hop-0

docs/concepts/observer.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ observers:
3030
`addr` (string, required)
3131
: 插件服务地址
3232

33-
`tls` (duration, default=null)
33+
`tls` (object, default=null)
3434
: 设置后将使用TLS加密传输,默认不使用TLS加密。
3535

3636
## 使用观测器
3737

3838
当服务的状态变化时会通过服务上的观测器上报状态,如果服务开启了统计(`enableStats`选项),同时也会上报连接和流量统计信息。
3939

40-
```yaml hl_lines="4 10"
40+
```yaml hl_lines="4 10 11"
4141
services:
4242
- name: service-0
4343
addr: ":8080"
@@ -48,6 +48,7 @@ services:
4848
type: tcp
4949
metadata:
5050
enableStats: true # 开启统计
51+
observePeriod: 5s
5152
5253
observers:
5354
- name: observer-0
@@ -59,6 +60,9 @@ observers:
5960
serverName: example.com
6061
```
6162

63+
`observePeriod` (duration, default=5s)
64+
: 观测器上报周期。
65+
6266
## HTTP插件
6367

6468
```yaml
@@ -67,8 +71,12 @@ observers:
6771
plugin:
6872
type: http
6973
addr: http://127.0.0.1:8000/observer
74+
timeout: 10s
7075
```
7176

77+
`timeout` (duration, default=0s)
78+
: 上报请求超时时长。
79+
7280
### 请求示例
7381

7482
**上报服务状态**
@@ -128,13 +136,15 @@ curl -XPOST http://127.0.0.1:8000/observer \
128136

129137
对于支持认证的代理服务(HTTP,HTTP2,SOCKS4,SOCKS5,Relay),观测器也可以用在处理器上。
130138

131-
```yaml hl_lines="6"
139+
```yaml hl_lines="6 8"
132140
services:
133141
- name: service-0
134142
addr: ":8080"
135143
handler:
136144
type: http
137145
observer: observer-0
146+
metadata:
147+
observePeriod: 5s
138148
listener:
139149
type: tcp
140150
@@ -144,6 +154,10 @@ observers:
144154
addr: 127.0.0.1:8000
145155
```
146156

157+
`observePeriod` (duration, default=5s)
158+
: 观测器上报周期。
159+
160+
147161
### 基于用户标识的流量统计
148162

149163
服务级别的观测器只能用来观测服务整体的统计信息,无法针对用户进行更细的划分。如果需要实现此功能需要组合使用认证器插件和处理器上的观测器插件。

docs/tutorials/probe-resistance.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ GOST对HTTP/HTTPS/HTTP2代理提供了探测防御功能。当代理服务收到
1212
=== "命令行"
1313

1414
```
15-
gost -L=http://gost:gost@:8080?probeResistance=code:400&knock=www.example.com
15+
gost -L=http://gost:gost@:8080?probeResist=code:400&knock=www.example.com
1616
```
1717

1818
=== "配置文件"
@@ -28,35 +28,35 @@ GOST对HTTP/HTTPS/HTTP2代理提供了探测防御功能。当代理服务收到
2828
password: gost
2929
metadata:
3030
knock: www.example.com
31-
probeResistance: code:404
31+
probeResist: code:404
3232
listener:
3333
type: tcp
3434
```
3535

36-
## probeResistance
36+
## `probeResist`选项
3737

38-
代理服务通过`probeResistance`参数来指定防御策略。参数值的格式为:`type:value`
38+
代理服务通过`probeResist`参数来指定防御策略。参数值的格式为:`type:value`
3939

4040
type可选值有:
4141

4242
* `code` - 对应value为HTTP响应码,代理服务器会回复客户端指定的响应码。例如:
4343
```
44-
gost -L=http://gost:gost@:8080?probeResistance=code:403
44+
gost -L=http://gost:gost@:8080?probeResist=code:403
4545
```
4646
4747
* `web` - 对应的value为URL,代理服务器会使用HTTP GET方式访问此URL,并将响应返回给客户端。例如:
4848
```
49-
gost -L=http://gost:gost@:8080?probeResistance=web:example.com/page.html
49+
gost -L=http://gost:gost@:8080?probeResist=web:example.com/page.html
5050
```
5151
5252
* `host` - 对应的value为主机地址,代理服务器会将客户端请求转发给设置的主机地址,并将主机的响应返回给客户端,代理服务器在这里相当于端口转发服务。例如:
5353
```
54-
gost -L=https://gost:gost@:443?probeResistance=host:www.example.com:8080
54+
gost -L=https://gost:gost@:443?probeResist=host:www.example.com:8080
5555
```
5656
5757
* `file` - 对应的value为本地文件路径,代理服务器会回复客户端200响应码,并将指定的文件内容作为Body发送给客户端。例如:
5858
```
59-
gost -L=http2://gost:gost@:443?probeResistance=file:/send/to/client/file.txt
59+
gost -L=http2://gost:gost@:443?probeResist=file:/send/to/client/file.txt
6060
```
6161
6262
## knock

docs/tutorials/reverse-proxy-tunnel.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,12 @@ services:
197197
nodes:
198198
- name: example-com
199199
addr: 192.168.1.1:80
200-
host: example.com
200+
filter:
201+
host: example.com
201202
- name: sub-example-com
202203
addr: 192.168.1.2:80
203-
host: sub.example.com
204+
filter:
205+
host: sub.example.com
204206
- name: fallback
205207
addr: 192.168.2.1:80
206208
chains:
@@ -378,10 +380,12 @@ services:
378380
nodes:
379381
- name: ssh
380382
addr: 192.168.2.1:22
381-
host: ssh.srv-2.local
383+
filter:
384+
host: ssh.srv-2.local
382385
- name: redis
383386
addr: 192.168.2.2:6379
384-
host: redis.srv-3.local
387+
filter:
388+
host: redis.srv-3.local
385389
chains:
386390
- name: chain-0
387391
hops:
@@ -471,10 +475,12 @@ services:
471475
nodes:
472476
- name: dns-1
473477
addr: 192.168.2.1:53
474-
host: dns.srv-2.local
478+
filter:
479+
host: dns.srv-2.local
475480
- name: dns-2
476481
addr: 192.168.2.2:53
477-
host: dns.srv-3.local
482+
filter:
483+
host: dns.srv-3.local
478484
chains:
479485
- name: chain-0
480486
hops:
@@ -651,7 +657,8 @@ TCP和UDP服务可以共用同一个隧道,隧道会对TCP和UDP的客户端
651657
nodes:
652658
- name: iperf
653659
addr: :5201
654-
host: iperf.local
660+
filter:
661+
host: iperf.local
655662
- name: iperf-udp
656663
addr: :0
657664
handler:
@@ -663,7 +670,8 @@ TCP和UDP服务可以共用同一个隧道,隧道会对TCP和UDP的客户端
663670
nodes:
664671
- name: iperf
665672
addr: :5201
666-
host: iperf.local
673+
filter:
674+
host: iperf.local
667675
chains:
668676
- name: chain-0
669677
hops:

0 commit comments

Comments
 (0)