update
This commit is contained in:
@@ -269,6 +269,7 @@ By default, the log is displayed directly in the console. If you want to save to
|
|||||||
|
|
||||||
For example: --log proxy.log, the log will be output to the proxy.log to facilitate troubleshooting.
|
For example: --log proxy.log, the log will be output to the proxy.log to facilitate troubleshooting.
|
||||||
|
|
||||||
|
Logging INFO and WARN by default, you can set `--warn` to output warn logging only.
|
||||||
|
|
||||||
### 5. Generate the certificate file required for encrypted communication
|
### 5. Generate the certificate file required for encrypted communication
|
||||||
|
|
||||||
@@ -624,6 +625,8 @@ And the analysis result cache time (--dns-ttl) seconds, to avoid system dns inte
|
|||||||
For example:
|
For example:
|
||||||
`proxy http -p ":33080" --dns-address "8.8.8.8:53" --dns-ttl 300`
|
`proxy http -p ":33080" --dns-address "8.8.8.8:53" --dns-ttl 300`
|
||||||
|
|
||||||
|
`--dns-address` supports multiple dns addresses, load balancing, separated by comma. For example: `--dns-address "1.1.1.1:53,8.8.8.8:53"`
|
||||||
|
|
||||||
### 1.12 Custom encryption
|
### 1.12 Custom encryption
|
||||||
The proxy's http(s) proxy can encrypt tcp data via tls standard encryption and kcp protocol on top of tcp, in addition to support customization after tls and kcp.
|
The proxy's http(s) proxy can encrypt tcp data via tls standard encryption and kcp protocol on top of tcp, in addition to support customization after tls and kcp.
|
||||||
Encryption, that is to say, custom encryption and tls|kcp can be used in combination. The internal use of AES256 encryption, you only need to define a password when you use it.
|
Encryption, that is to say, custom encryption and tls|kcp can be used in combination. The internal use of AES256 encryption, you only need to define a password when you use it.
|
||||||
@@ -857,12 +860,25 @@ In addition, the `IP` part of the `--bind-ip` parameter supports specifying the
|
|||||||
|
|
||||||
### 2.8 Speed limit, connections limit
|
### 2.8 Speed limit, connections limit
|
||||||
|
|
||||||
|
- **Limit count of connections**
|
||||||
The parameter `--max-conns` can limit the maximum number of connections per port.
|
The parameter `--max-conns` can limit the maximum number of connections per port.
|
||||||
For example, limit the maximum number of connections per port:
|
For example, limit the maximum number of connections per port to 1000:
|
||||||
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --max-conns 1000`
|
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --max-conns 1000`
|
||||||
|
- **Limit tcp connection rate**
|
||||||
The parameter `--rate-limit` can limit the rate of each tcp connection.
|
The parameter `--rate-limit` can limit the rate of each tcp connection.
|
||||||
For example, limit the connection rate of each tcp to 100k/s:
|
For example, limit the rate of each tcp connection to 100k/s:
|
||||||
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --rate-limit 100k`
|
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --rate-limit 100k`
|
||||||
|
- **Limit client IP total rate**
|
||||||
|
The parameter `--ip-rate` limit the total rate of each client IP.
|
||||||
|
For example, limit the total IP rate of each client to 1M/s:
|
||||||
|
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --ip-rate 1M`
|
||||||
|
- **Limit port total rate**
|
||||||
|
The parameter `--port-rate` limit the total rate of each service port.
|
||||||
|
For example, limit the total rate of each port to 10M/s:
|
||||||
|
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --port-rate 10M`
|
||||||
|
- **Joint Speed Limit**
|
||||||
|
`--rate-limit` and (`--ip-rate` or `--port-rate`) can be used together.
|
||||||
|
Both limit the total rate and limit the rate of a single tcp.
|
||||||
|
|
||||||
### 2.9 Compressed transmission
|
### 2.9 Compressed transmission
|
||||||
|
|
||||||
@@ -1518,7 +1534,7 @@ such as:
|
|||||||
|
|
||||||
The complete format of `-P` is as follows:
|
The complete format of `-P` is as follows:
|
||||||
|
|
||||||
`protocol://a:[email protected]:33080#1`
|
`protocol://a:[email protected]:33080#1`
|
||||||
|
|
||||||
Each section is explained below:
|
Each section is explained below:
|
||||||
|
|
||||||
@@ -1799,7 +1815,7 @@ Tip:
|
|||||||
The host file format specified by the --hosts parameter is the same as the system hosts file, and the domain name supports wildcards. You can refer to the hosts file.
|
The host file format specified by the --hosts parameter is the same as the system hosts file, and the domain name supports wildcards. You can refer to the hosts file.
|
||||||
The parsing forwarding rule file specified by the --forward parameter can be referenced to the resolve.rules file. The domain name supports wildcards. It supports multiple dns servers for each domain name to be parsed concurrently. Whoever resolves the fastest resolution will use the resolution result.
|
The parsing forwarding rule file specified by the --forward parameter can be referenced to the resolve.rules file. The domain name supports wildcards. It supports multiple dns servers for each domain name to be parsed concurrently. Whoever resolves the fastest resolution will use the resolution result.
|
||||||
The -q parameter can specify multiple remote dns servers to perform concurrent parsing. Whoever resolves the fastest parsing success, the default is: 1.1.1.1, 8.8.8.8, 9.9.9.9, multiple comma-separated,
|
The -q parameter can specify multiple remote dns servers to perform concurrent parsing. Whoever resolves the fastest parsing success, the default is: 1.1.1.1, 8.8.8.8, 9.9.9.9, multiple comma-separated,
|
||||||
For example, you can also bring ports: 1.1.1.1, 8.8.8.8#53, 9.9.9.9
|
For example, you can also bring ports: 1.1.1.1, 8.8.8.8#53, 9.9.9.9
|
||||||
|
|
||||||
If you are a standalone service, you don't need a upstream:
|
If you are a standalone service, you don't need a upstream:
|
||||||
Can perform:
|
Can perform:
|
||||||
@@ -1887,6 +1903,7 @@ The proxy's http(s)/socks5/sps proxy function supports user-to-agent access via
|
|||||||
- Dynamic upstream, can dynamically obtain its upstream from the API according to the user or client IP, and support http(s)/socks5/ss upstream.
|
- Dynamic upstream, can dynamically obtain its upstream from the API according to the user or client IP, and support http(s)/socks5/ss upstream.
|
||||||
- Authenticate every connection, regardless of whether client authentication is required.
|
- Authenticate every connection, regardless of whether client authentication is required.
|
||||||
- Cache authentication results, time can be set to reduce API pressure.
|
- Cache authentication results, time can be set to reduce API pressure.
|
||||||
|
- Limit the total bandwidth speed by `user` or `client ip` or `server port`.
|
||||||
|
|
||||||
#### Specific use
|
#### Specific use
|
||||||
The proxy's http(s)/socks5/sps proxy API function is controlled by three parameters: `--auth-url` and `--auth-nouser` and `--auth-cache`.
|
The proxy's http(s)/socks5/sps proxy API function is controlled by three parameters: `--auth-url` and `--auth-nouser` and `--auth-cache`.
|
||||||
@@ -1944,6 +1961,9 @@ if($ok){
|
|||||||
header("ipqps:2");
|
header("ipqps:2");
|
||||||
header("upstream:http://127.0.0.1:3500?parent-type=tcp");
|
header("upstream:http://127.0.0.1:3500?parent-type=tcp");
|
||||||
header("outgoing:1.1.1.1");
|
header("outgoing:1.1.1.1");
|
||||||
|
header("userTotalRate:1024000");
|
||||||
|
//header("ipTotalRate:10240");
|
||||||
|
//header("portTotalRate:10240");
|
||||||
header("HTTP/1.1 204 No Content");
|
header("HTTP/1.1 204 No Content");
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -1957,6 +1977,15 @@ if($ok){
|
|||||||
`ipqps`: The maximum number of connections per second (QPS) for the client IP, not limited to 0 or not set this header.
|
`ipqps`: The maximum number of connections per second (QPS) for the client IP, not limited to 0 or not set this header.
|
||||||
`upstream`: The upstream used, not empty, or not set this header.
|
`upstream`: The upstream used, not empty, or not set this header.
|
||||||
`outgoing`: The outgoing ip,this option only working which upstream is empty. And the IP must belong to the machine running proxy。
|
`outgoing`: The outgoing ip,this option only working which upstream is empty. And the IP must belong to the machine running proxy。
|
||||||
|
`userTotalRate`: Limit the `user` total bandwidth speed (bytes per second), unit is byte, not limited to 0 or not set this header.
|
||||||
|
`ipTotalRate`:Limit the `client ip` total bandwidth speed (bytes per second), unit is byte, not limited to 0 or not set this header.
|
||||||
|
`portTotalRate`:Limit the `server port` total bandwidth speed (bytes per second), unit is byte, not limited to 0 or not set this header.
|
||||||
|
|
||||||
|
#### Details of total bandwidth speed limitation
|
||||||
|
1. `userrate`、`iprate` and `userTotalRate`、`ipTotalRate`、`portTotalRate` can be set at same time,
|
||||||
|
for example: set `userrate` with 1024000 to limit the user's total bandwidth speed to 1M/s of user's all tcp connections. And set `userrate` with 102400 to limit the user one tcp connection speed to 100K/s.
|
||||||
|
2. if `userTotalRate`、`ipTotalRate` 、`portTotalRate` set at same time, the valid order is : `userTotalRate` -> `ipTotalRate` -> `portTotalRate`
|
||||||
|
3. if `userTotalRate`、`portTotalRate` set at same time, and set `--auth-nouser`,all clients that not send username will be as an "empty username" user,they are using a same limiter.
|
||||||
|
|
||||||
#### Tips
|
#### Tips
|
||||||
1. By default, `--auth-url` is required to provide the user name and password. If you do not need the client to provide the username and password, and authenticate, you can add `--auth-nouser`. The visit will still access the authentication address `--auth-url` for authentication. Only the $user authentication username and the $pass authentication password received in the php interface are empty when client didn't send username and password.
|
1. By default, `--auth-url` is required to provide the user name and password. If you do not need the client to provide the username and password, and authenticate, you can add `--auth-nouser`. The visit will still access the authentication address `--auth-url` for authentication. Only the $user authentication username and the $pass authentication password received in the php interface are empty when client didn't send username and password.
|
||||||
|
|||||||
+39
-10
@@ -308,6 +308,8 @@ http
|
|||||||
|
|
||||||
比如: --log proxy.log,日志就会输出到proxy.log方便排除问题。
|
比如: --log proxy.log,日志就会输出到proxy.log方便排除问题。
|
||||||
|
|
||||||
|
默认会输出info和warn日志,如果只关注warn日志,可以使用`--warn`参数,只输出warn日志。
|
||||||
|
|
||||||
### 5. 生成加密通讯需要的证书文件
|
### 5. 生成加密通讯需要的证书文件
|
||||||
|
|
||||||
http(s)代理、tcp代理、udp代理、socks5代理、内网穿透等功能和上级通讯的时候,为了安全我们采用TLS加密通讯,当然可以选择不加密通信通讯,本教程所有和上级通讯都采用加密,需要证书文件。
|
http(s)代理、tcp代理、udp代理、socks5代理、内网穿透等功能和上级通讯的时候,为了安全我们采用TLS加密通讯,当然可以选择不加密通信通讯,本教程所有和上级通讯都采用加密,需要证书文件。
|
||||||
@@ -657,6 +659,8 @@ iptables -t nat -A OUTPUT -p tcp -j PROXY
|
|||||||
比如:
|
比如:
|
||||||
`proxy http -p ":33080" --dns-address "8.8.8.8:53" --dns-ttl 300`
|
`proxy http -p ":33080" --dns-address "8.8.8.8:53" --dns-ttl 300`
|
||||||
|
|
||||||
|
`--dns-address` 支持设置多个dns地址,负载均衡,英文半角逗号分割。比如:--dns-address "1.1.1.1:53,8.8.8.8:53"
|
||||||
|
|
||||||
### 1.12 自定义加密
|
### 1.12 自定义加密
|
||||||
|
|
||||||
proxy的http(s)代理在tcp之上可以通过tls标准加密以及kcp协议加密tcp数据,除此之外还支持在tls和kcp之后进行自定义
|
proxy的http(s)代理在tcp之上可以通过tls标准加密以及kcp协议加密tcp数据,除此之外还支持在tls和kcp之后进行自定义
|
||||||
@@ -927,12 +931,24 @@ port:代理的端口
|
|||||||
|
|
||||||
### 2.8 限速,限制连接数
|
### 2.8 限速,限制连接数
|
||||||
|
|
||||||
|
- **限制连接数**
|
||||||
参数`--max-conns`可以限制每个端口的最大连接数。
|
参数`--max-conns`可以限制每个端口的最大连接数。
|
||||||
比如限制每个端口最多1000个连接数:
|
比如限制每个端口最多1000个连接数:
|
||||||
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --max-conns 1000`
|
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --max-conns 1000`
|
||||||
|
- **限制tcp连接速率**
|
||||||
参数`--rate-limit`可以限制每个tcp连接的速率。
|
参数`--rate-limit`可以限制每个tcp连接的速率。
|
||||||
比如限制每个tcp连接速率为100k/s:
|
比如限制每个tcp连接速率为100k/s:
|
||||||
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --rate-limit 100k`
|
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --rate-limit 100k`
|
||||||
|
- **限制客户端IP总速率**
|
||||||
|
参数`--ip-rate`可以IP维度,限制每个客户端IP的总速率。
|
||||||
|
比如限制每个客户端IP总速率为1M/s:
|
||||||
|
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --ip-rate 1M`
|
||||||
|
- **限制端口总速率**
|
||||||
|
参数`--port-rate`可以在`服务IP:端口`维度,限制每个服务端口总速率。
|
||||||
|
比如限制每个端口总速率为10M/s:
|
||||||
|
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --port-rate 10M`
|
||||||
|
- **联合限速**
|
||||||
|
`--rate-limit`和(`--ip-rate`或`--port-rate`)可以同时使用。既限制总速率,也限制单个tcp速率。
|
||||||
|
|
||||||
### 2.9 压缩传输
|
### 2.9 压缩传输
|
||||||
|
|
||||||
@@ -2049,6 +2065,7 @@ proxy的http(s)/socks5/sps代理功能,支持通过API控制用户对代理对
|
|||||||
- 动态上级,可以根据用户或者客户端IP,动态的从API获取其上级,支持http(s)/socks5/ss上级。
|
- 动态上级,可以根据用户或者客户端IP,动态的从API获取其上级,支持http(s)/socks5/ss上级。
|
||||||
- 认证每一个连接,无论是否要求客户端认证。
|
- 认证每一个连接,无论是否要求客户端认证。
|
||||||
- 缓存认证结果,时间可以设置,减轻API压力。
|
- 缓存认证结果,时间可以设置,减轻API压力。
|
||||||
|
- 用户维度、客户端IP维度、端口维度的总限速。
|
||||||
|
|
||||||
#### 具体使用
|
#### 具体使用
|
||||||
|
|
||||||
@@ -2109,20 +2126,32 @@ if($ok){
|
|||||||
header("ipqps:2");
|
header("ipqps:2");
|
||||||
header("upstream:http://127.0.0.1:3500?parent-type=tcp");
|
header("upstream:http://127.0.0.1:3500?parent-type=tcp");
|
||||||
header("outgoing:1.1.1.1");
|
header("outgoing:1.1.1.1");
|
||||||
|
header("userTotalRate:1024000");
|
||||||
|
//header("ipTotalRate:10240");
|
||||||
|
//header("portTotalRate:10240");
|
||||||
header("HTTP/1.1 204 No Content");
|
header("HTTP/1.1 204 No Content");
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### HTTP HEADER 头部字段解释
|
#### HTTP HEADER 头部字段解释
|
||||||
|
|
||||||
`userconns`:用户的最大连接数,不限制为0或者不设置这个头部。
|
- `userconns`:用户的最大连接数,不限制为0或者不设置这个头部。
|
||||||
`ipconns`:IP的最大连接数,不限制为0或者不设置这个头部。
|
- `ipconns`:IP的最大连接数,不限制为0或者不设置这个头部。
|
||||||
`userrate`:用户的单个TCP连接速率限制,单位:字节/秒,不限制为0或者不设置这个头部。
|
- `userrate`:用户的单个TCP连接速率限制,单位:字节/秒,不限制为0或者不设置这个头部。
|
||||||
`iprate`:IP的单个TCP连接速率限制,单位:字节/秒,不限制为0或者不设置这个头部。
|
- `iprate`:IP的单个TCP连接速率限制,单位:字节/秒,不限制为0或者不设置这个头部。
|
||||||
`userqps`:用户每秒可以建立的最大连接数,不限制为0或者不设置这个头部。
|
- `userqps`:用户每秒可以建立的最大连接数,不限制为0或者不设置这个头部。
|
||||||
`ipqps`:IP每秒可以建立的最大连接数,不限制为0或者不设置这个头部。
|
- `ipqps`:IP每秒可以建立的最大连接数,不限制为0或者不设置这个头部。
|
||||||
`upstream`:使用的上级,没有为空,或者不设置这个头部。
|
- `upstream`:使用的上级,没有为空,或者不设置这个头部。
|
||||||
`outgoing`: 使用的出口IP,这个设置,只有在upstream为空的的时候才有效,这里设置的IP必须是proxy所在机器具有的IP。
|
- `outgoing`: 使用的出口IP,这个设置,只有在upstream为空的的时候才有效,这里设置的IP必须是proxy所在机器具有的IP。
|
||||||
|
- `userTotalRate`:用户维度,限制用户的总带宽速度(byte/s),单位是字节byte,没有留空,或者不设置这个头部。
|
||||||
|
- `ipTotalRate`:客户端IP维度,限制客户端IP的总带宽速度(byte/s),单位是字节byte,没有留空,或者不设置这个头部。
|
||||||
|
- `portTotalRate`:带宽维度,限制一个带宽总带宽速度(byte/s),单位是字节byte,没有留空,或者不设置这个头部。
|
||||||
|
|
||||||
|
#### 限速详细说明
|
||||||
|
1. 单个tcp限速(`userrate`、`iprate`)和总带宽速度(`userTotalRate`、`ipTotalRate`、`portTotalRate`)可以同时设置,
|
||||||
|
比如:设置用户总带宽速度是1M/s(`userTotalRate`设置1024000),还可以同时设置单个tcp速度是100K/s(`userrate`设置102400)
|
||||||
|
2. 如果同时设置了`userTotalRate`、`ipTotalRate` 、`portTotalRate`,有效优先级是:`userTotalRate` -> `ipTotalRate` -> `portTotalRate`
|
||||||
|
3. 如果同时设置了`userTotalRate`、`portTotalRate`,而且设置了`--auth-nouser`,那么所有没有发用户名的客户端会被认为是`同一个空用户名用户`,共用同一个限制。
|
||||||
|
|
||||||
#### 提示
|
#### 提示
|
||||||
|
|
||||||
@@ -2130,8 +2159,8 @@ if($ok){
|
|||||||
进行认证,当客户端没有发生认证信息当时候,php接口里面接收的$user认证用户名和$pass认证密码都为空。
|
进行认证,当客户端没有发生认证信息当时候,php接口里面接收的$user认证用户名和$pass认证密码都为空。
|
||||||
2. 连接数限制优先级:用户认证文件连接数限制-》文件ip.limit连接数限制-》API用户连接数限制-》API的IP连接数限制-》命令行全局连接数限制。
|
2. 连接数限制优先级:用户认证文件连接数限制-》文件ip.limit连接数限制-》API用户连接数限制-》API的IP连接数限制-》命令行全局连接数限制。
|
||||||
3. 速率限制优先级:用户认证文件速率限制-》文件ip.limit速率限制-》API用户速率限制-》API的IP速率限制-》命令行全局速率限制。
|
3. 速率限制优先级:用户认证文件速率限制-》文件ip.limit速率限制-》API用户速率限制-》API的IP速率限制-》命令行全局速率限制。
|
||||||
3.上级获取优先级:用户认证文件的upstream-》文件ip.limit的upstream-》API的upstream-》命令行指定的上级。
|
4. 上级获取优先级:用户认证文件的upstream-》文件ip.limit的upstream-》API的upstream-》命令行指定的上级。
|
||||||
4.`--auth-cache`认证缓存,对认证结果缓存一定时间,提升性能,降低认证接口压力,--auth-cache 单位秒,默认0, 设置0是关闭缓存。
|
5. `--auth-cache`认证缓存,对认证结果缓存一定时间,提升性能,降低认证接口压力,--auth-cache 单位秒,默认0, 设置0是关闭缓存。
|
||||||
|
|
||||||
#### upstream详细说明
|
#### upstream详细说明
|
||||||
|
|
||||||
|
|||||||
+33
-4
@@ -62,6 +62,7 @@ By default, the log is displayed directly in the console. If you want to save to
|
|||||||
|
|
||||||
For example: --log proxy.log, the log will be output to the proxy.log to facilitate troubleshooting.
|
For example: --log proxy.log, the log will be output to the proxy.log to facilitate troubleshooting.
|
||||||
|
|
||||||
|
Logging INFO and WARN by default, you can set `--warn` to output warn logging only.
|
||||||
|
|
||||||
### 5. Generate the certificate file required for encrypted communication
|
### 5. Generate the certificate file required for encrypted communication
|
||||||
|
|
||||||
@@ -417,6 +418,8 @@ And the analysis result cache time (--dns-ttl) seconds, to avoid system dns inte
|
|||||||
For example:
|
For example:
|
||||||
`proxy http -p ":33080" --dns-address "8.8.8.8:53" --dns-ttl 300`
|
`proxy http -p ":33080" --dns-address "8.8.8.8:53" --dns-ttl 300`
|
||||||
|
|
||||||
|
`--dns-address` supports multiple dns addresses, load balancing, separated by comma. For example: `--dns-address "1.1.1.1:53,8.8.8.8:53"`
|
||||||
|
|
||||||
### 1.12 Custom encryption
|
### 1.12 Custom encryption
|
||||||
The proxy's http(s) proxy can encrypt tcp data via tls standard encryption and kcp protocol on top of tcp, in addition to support customization after tls and kcp.
|
The proxy's http(s) proxy can encrypt tcp data via tls standard encryption and kcp protocol on top of tcp, in addition to support customization after tls and kcp.
|
||||||
Encryption, that is to say, custom encryption and tls|kcp can be used in combination. The internal use of AES256 encryption, you only need to define a password when you use it.
|
Encryption, that is to say, custom encryption and tls|kcp can be used in combination. The internal use of AES256 encryption, you only need to define a password when you use it.
|
||||||
@@ -650,12 +653,25 @@ In addition, the `IP` part of the `--bind-ip` parameter supports specifying the
|
|||||||
|
|
||||||
### 2.8 Speed limit, connections limit
|
### 2.8 Speed limit, connections limit
|
||||||
|
|
||||||
|
- **Limit count of connections**
|
||||||
The parameter `--max-conns` can limit the maximum number of connections per port.
|
The parameter `--max-conns` can limit the maximum number of connections per port.
|
||||||
For example, limit the maximum number of connections per port:
|
For example, limit the maximum number of connections per port to 1000:
|
||||||
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --max-conns 1000`
|
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --max-conns 1000`
|
||||||
|
- **Limit tcp connection rate**
|
||||||
The parameter `--rate-limit` can limit the rate of each tcp connection.
|
The parameter `--rate-limit` can limit the rate of each tcp connection.
|
||||||
For example, limit the connection rate of each tcp to 100k/s:
|
For example, limit the rate of each tcp connection to 100k/s:
|
||||||
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --rate-limit 100k`
|
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --rate-limit 100k`
|
||||||
|
- **Limit client IP total rate**
|
||||||
|
The parameter `--ip-rate` limit the total rate of each client IP.
|
||||||
|
For example, limit the total IP rate of each client to 1M/s:
|
||||||
|
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --ip-rate 1M`
|
||||||
|
- **Limit port total rate**
|
||||||
|
The parameter `--port-rate` limit the total rate of each service port.
|
||||||
|
For example, limit the total rate of each port to 10M/s:
|
||||||
|
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --port-rate 10M`
|
||||||
|
- **Joint Speed Limit**
|
||||||
|
`--rate-limit` and (`--ip-rate` or `--port-rate`) can be used together.
|
||||||
|
Both limit the total rate and limit the rate of a single tcp.
|
||||||
|
|
||||||
### 2.9 Compressed transmission
|
### 2.9 Compressed transmission
|
||||||
|
|
||||||
@@ -1311,7 +1327,7 @@ such as:
|
|||||||
|
|
||||||
The complete format of `-P` is as follows:
|
The complete format of `-P` is as follows:
|
||||||
|
|
||||||
`protocol://a:[email protected]:33080#1`
|
`protocol://a:[email protected]:33080#1`
|
||||||
|
|
||||||
Each section is explained below:
|
Each section is explained below:
|
||||||
|
|
||||||
@@ -1592,7 +1608,7 @@ Tip:
|
|||||||
The host file format specified by the --hosts parameter is the same as the system hosts file, and the domain name supports wildcards. You can refer to the hosts file.
|
The host file format specified by the --hosts parameter is the same as the system hosts file, and the domain name supports wildcards. You can refer to the hosts file.
|
||||||
The parsing forwarding rule file specified by the --forward parameter can be referenced to the resolve.rules file. The domain name supports wildcards. It supports multiple dns servers for each domain name to be parsed concurrently. Whoever resolves the fastest resolution will use the resolution result.
|
The parsing forwarding rule file specified by the --forward parameter can be referenced to the resolve.rules file. The domain name supports wildcards. It supports multiple dns servers for each domain name to be parsed concurrently. Whoever resolves the fastest resolution will use the resolution result.
|
||||||
The -q parameter can specify multiple remote dns servers to perform concurrent parsing. Whoever resolves the fastest parsing success, the default is: 1.1.1.1, 8.8.8.8, 9.9.9.9, multiple comma-separated,
|
The -q parameter can specify multiple remote dns servers to perform concurrent parsing. Whoever resolves the fastest parsing success, the default is: 1.1.1.1, 8.8.8.8, 9.9.9.9, multiple comma-separated,
|
||||||
For example, you can also bring ports: 1.1.1.1, 8.8.8.8#53, 9.9.9.9
|
For example, you can also bring ports: 1.1.1.1, 8.8.8.8#53, 9.9.9.9
|
||||||
|
|
||||||
If you are a standalone service, you don't need a upstream:
|
If you are a standalone service, you don't need a upstream:
|
||||||
Can perform:
|
Can perform:
|
||||||
@@ -1680,6 +1696,7 @@ The proxy's http(s)/socks5/sps proxy function supports user-to-agent access via
|
|||||||
- Dynamic upstream, can dynamically obtain its upstream from the API according to the user or client IP, and support http(s)/socks5/ss upstream.
|
- Dynamic upstream, can dynamically obtain its upstream from the API according to the user or client IP, and support http(s)/socks5/ss upstream.
|
||||||
- Authenticate every connection, regardless of whether client authentication is required.
|
- Authenticate every connection, regardless of whether client authentication is required.
|
||||||
- Cache authentication results, time can be set to reduce API pressure.
|
- Cache authentication results, time can be set to reduce API pressure.
|
||||||
|
- Limit the total bandwidth speed by `user` or `client ip` or `server port`.
|
||||||
|
|
||||||
#### Specific use
|
#### Specific use
|
||||||
The proxy's http(s)/socks5/sps proxy API function is controlled by three parameters: `--auth-url` and `--auth-nouser` and `--auth-cache`.
|
The proxy's http(s)/socks5/sps proxy API function is controlled by three parameters: `--auth-url` and `--auth-nouser` and `--auth-cache`.
|
||||||
@@ -1737,6 +1754,9 @@ if($ok){
|
|||||||
header("ipqps:2");
|
header("ipqps:2");
|
||||||
header("upstream:http://127.0.0.1:3500?parent-type=tcp");
|
header("upstream:http://127.0.0.1:3500?parent-type=tcp");
|
||||||
header("outgoing:1.1.1.1");
|
header("outgoing:1.1.1.1");
|
||||||
|
header("userTotalRate:1024000");
|
||||||
|
//header("ipTotalRate:10240");
|
||||||
|
//header("portTotalRate:10240");
|
||||||
header("HTTP/1.1 204 No Content");
|
header("HTTP/1.1 204 No Content");
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -1750,6 +1770,15 @@ if($ok){
|
|||||||
`ipqps`: The maximum number of connections per second (QPS) for the client IP, not limited to 0 or not set this header.
|
`ipqps`: The maximum number of connections per second (QPS) for the client IP, not limited to 0 or not set this header.
|
||||||
`upstream`: The upstream used, not empty, or not set this header.
|
`upstream`: The upstream used, not empty, or not set this header.
|
||||||
`outgoing`: The outgoing ip,this option only working which upstream is empty. And the IP must belong to the machine running proxy。
|
`outgoing`: The outgoing ip,this option only working which upstream is empty. And the IP must belong to the machine running proxy。
|
||||||
|
`userTotalRate`: Limit the `user` total bandwidth speed (bytes per second), unit is byte, not limited to 0 or not set this header.
|
||||||
|
`ipTotalRate`:Limit the `client ip` total bandwidth speed (bytes per second), unit is byte, not limited to 0 or not set this header.
|
||||||
|
`portTotalRate`:Limit the `server port` total bandwidth speed (bytes per second), unit is byte, not limited to 0 or not set this header.
|
||||||
|
|
||||||
|
#### Details of total bandwidth speed limitation
|
||||||
|
1. `userrate`、`iprate` and `userTotalRate`、`ipTotalRate`、`portTotalRate` can be set at same time,
|
||||||
|
for example: set `userrate` with 1024000 to limit the user's total bandwidth speed to 1M/s of user's all tcp connections. And set `userrate` with 102400 to limit the user one tcp connection speed to 100K/s.
|
||||||
|
2. if `userTotalRate`、`ipTotalRate` 、`portTotalRate` set at same time, the valid order is : `userTotalRate` -> `ipTotalRate` -> `portTotalRate`
|
||||||
|
3. if `userTotalRate`、`portTotalRate` set at same time, and set `--auth-nouser`,all clients that not send username will be as an "empty username" user,they are using a same limiter.
|
||||||
|
|
||||||
#### Tips
|
#### Tips
|
||||||
1. By default, `--auth-url` is required to provide the user name and password. If you do not need the client to provide the username and password, and authenticate, you can add `--auth-nouser`. The visit will still access the authentication address `--auth-url` for authentication. Only the $user authentication username and the $pass authentication password received in the php interface are empty when client didn't send username and password.
|
1. By default, `--auth-url` is required to provide the user name and password. If you do not need the client to provide the username and password, and authenticate, you can add `--auth-nouser`. The visit will still access the authentication address `--auth-url` for authentication. Only the $user authentication username and the $pass authentication password received in the php interface are empty when client didn't send username and password.
|
||||||
|
|||||||
+39
-10
@@ -87,6 +87,8 @@ http
|
|||||||
|
|
||||||
比如: --log proxy.log,日志就会输出到proxy.log方便排除问题。
|
比如: --log proxy.log,日志就会输出到proxy.log方便排除问题。
|
||||||
|
|
||||||
|
默认会输出info和warn日志,如果只关注warn日志,可以使用`--warn`参数,只输出warn日志。
|
||||||
|
|
||||||
### 5. 生成加密通讯需要的证书文件
|
### 5. 生成加密通讯需要的证书文件
|
||||||
|
|
||||||
http(s)代理、tcp代理、udp代理、socks5代理、内网穿透等功能和上级通讯的时候,为了安全我们采用TLS加密通讯,当然可以选择不加密通信通讯,本教程所有和上级通讯都采用加密,需要证书文件。
|
http(s)代理、tcp代理、udp代理、socks5代理、内网穿透等功能和上级通讯的时候,为了安全我们采用TLS加密通讯,当然可以选择不加密通信通讯,本教程所有和上级通讯都采用加密,需要证书文件。
|
||||||
@@ -436,6 +438,8 @@ iptables -t nat -A OUTPUT -p tcp -j PROXY
|
|||||||
比如:
|
比如:
|
||||||
`proxy http -p ":33080" --dns-address "8.8.8.8:53" --dns-ttl 300`
|
`proxy http -p ":33080" --dns-address "8.8.8.8:53" --dns-ttl 300`
|
||||||
|
|
||||||
|
`--dns-address` 支持设置多个dns地址,负载均衡,英文半角逗号分割。比如:--dns-address "1.1.1.1:53,8.8.8.8:53"
|
||||||
|
|
||||||
### 1.12 自定义加密
|
### 1.12 自定义加密
|
||||||
|
|
||||||
proxy的http(s)代理在tcp之上可以通过tls标准加密以及kcp协议加密tcp数据,除此之外还支持在tls和kcp之后进行自定义
|
proxy的http(s)代理在tcp之上可以通过tls标准加密以及kcp协议加密tcp数据,除此之外还支持在tls和kcp之后进行自定义
|
||||||
@@ -706,12 +710,24 @@ port:代理的端口
|
|||||||
|
|
||||||
### 2.8 限速,限制连接数
|
### 2.8 限速,限制连接数
|
||||||
|
|
||||||
|
- **限制连接数**
|
||||||
参数`--max-conns`可以限制每个端口的最大连接数。
|
参数`--max-conns`可以限制每个端口的最大连接数。
|
||||||
比如限制每个端口最多1000个连接数:
|
比如限制每个端口最多1000个连接数:
|
||||||
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --max-conns 1000`
|
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --max-conns 1000`
|
||||||
|
- **限制tcp连接速率**
|
||||||
参数`--rate-limit`可以限制每个tcp连接的速率。
|
参数`--rate-limit`可以限制每个tcp连接的速率。
|
||||||
比如限制每个tcp连接速率为100k/s:
|
比如限制每个tcp连接速率为100k/s:
|
||||||
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --rate-limit 100k`
|
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --rate-limit 100k`
|
||||||
|
- **限制客户端IP总速率**
|
||||||
|
参数`--ip-rate`可以IP维度,限制每个客户端IP的总速率。
|
||||||
|
比如限制每个客户端IP总速率为1M/s:
|
||||||
|
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --ip-rate 1M`
|
||||||
|
- **限制端口总速率**
|
||||||
|
参数`--port-rate`可以在`服务IP:端口`维度,限制每个服务端口总速率。
|
||||||
|
比如限制每个端口总速率为10M/s:
|
||||||
|
`proxy tcp -p ":33080" -T tcp -P "192.168.22.33:22" --port-rate 10M`
|
||||||
|
- **联合限速**
|
||||||
|
`--rate-limit`和(`--ip-rate`或`--port-rate`)可以同时使用。既限制总速率,也限制单个tcp速率。
|
||||||
|
|
||||||
### 2.9 压缩传输
|
### 2.9 压缩传输
|
||||||
|
|
||||||
@@ -1828,6 +1844,7 @@ proxy的http(s)/socks5/sps代理功能,支持通过API控制用户对代理对
|
|||||||
- 动态上级,可以根据用户或者客户端IP,动态的从API获取其上级,支持http(s)/socks5/ss上级。
|
- 动态上级,可以根据用户或者客户端IP,动态的从API获取其上级,支持http(s)/socks5/ss上级。
|
||||||
- 认证每一个连接,无论是否要求客户端认证。
|
- 认证每一个连接,无论是否要求客户端认证。
|
||||||
- 缓存认证结果,时间可以设置,减轻API压力。
|
- 缓存认证结果,时间可以设置,减轻API压力。
|
||||||
|
- 用户维度、客户端IP维度、端口维度的总限速。
|
||||||
|
|
||||||
#### 具体使用
|
#### 具体使用
|
||||||
|
|
||||||
@@ -1888,20 +1905,32 @@ if($ok){
|
|||||||
header("ipqps:2");
|
header("ipqps:2");
|
||||||
header("upstream:http://127.0.0.1:3500?parent-type=tcp");
|
header("upstream:http://127.0.0.1:3500?parent-type=tcp");
|
||||||
header("outgoing:1.1.1.1");
|
header("outgoing:1.1.1.1");
|
||||||
|
header("userTotalRate:1024000");
|
||||||
|
//header("ipTotalRate:10240");
|
||||||
|
//header("portTotalRate:10240");
|
||||||
header("HTTP/1.1 204 No Content");
|
header("HTTP/1.1 204 No Content");
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### HTTP HEADER 头部字段解释
|
#### HTTP HEADER 头部字段解释
|
||||||
|
|
||||||
`userconns`:用户的最大连接数,不限制为0或者不设置这个头部。
|
- `userconns`:用户的最大连接数,不限制为0或者不设置这个头部。
|
||||||
`ipconns`:IP的最大连接数,不限制为0或者不设置这个头部。
|
- `ipconns`:IP的最大连接数,不限制为0或者不设置这个头部。
|
||||||
`userrate`:用户的单个TCP连接速率限制,单位:字节/秒,不限制为0或者不设置这个头部。
|
- `userrate`:用户的单个TCP连接速率限制,单位:字节/秒,不限制为0或者不设置这个头部。
|
||||||
`iprate`:IP的单个TCP连接速率限制,单位:字节/秒,不限制为0或者不设置这个头部。
|
- `iprate`:IP的单个TCP连接速率限制,单位:字节/秒,不限制为0或者不设置这个头部。
|
||||||
`userqps`:用户每秒可以建立的最大连接数,不限制为0或者不设置这个头部。
|
- `userqps`:用户每秒可以建立的最大连接数,不限制为0或者不设置这个头部。
|
||||||
`ipqps`:IP每秒可以建立的最大连接数,不限制为0或者不设置这个头部。
|
- `ipqps`:IP每秒可以建立的最大连接数,不限制为0或者不设置这个头部。
|
||||||
`upstream`:使用的上级,没有为空,或者不设置这个头部。
|
- `upstream`:使用的上级,没有为空,或者不设置这个头部。
|
||||||
`outgoing`: 使用的出口IP,这个设置,只有在upstream为空的的时候才有效,这里设置的IP必须是proxy所在机器具有的IP。
|
- `outgoing`: 使用的出口IP,这个设置,只有在upstream为空的的时候才有效,这里设置的IP必须是proxy所在机器具有的IP。
|
||||||
|
- `userTotalRate`:用户维度,限制用户的总带宽速度(byte/s),单位是字节byte,没有留空,或者不设置这个头部。
|
||||||
|
- `ipTotalRate`:客户端IP维度,限制客户端IP的总带宽速度(byte/s),单位是字节byte,没有留空,或者不设置这个头部。
|
||||||
|
- `portTotalRate`:带宽维度,限制一个带宽总带宽速度(byte/s),单位是字节byte,没有留空,或者不设置这个头部。
|
||||||
|
|
||||||
|
#### 限速详细说明
|
||||||
|
1. 单个tcp限速(`userrate`、`iprate`)和总带宽速度(`userTotalRate`、`ipTotalRate`、`portTotalRate`)可以同时设置,
|
||||||
|
比如:设置用户总带宽速度是1M/s(`userTotalRate`设置1024000),还可以同时设置单个tcp速度是100K/s(`userrate`设置102400)
|
||||||
|
2. 如果同时设置了`userTotalRate`、`ipTotalRate` 、`portTotalRate`,有效优先级是:`userTotalRate` -> `ipTotalRate` -> `portTotalRate`
|
||||||
|
3. 如果同时设置了`userTotalRate`、`portTotalRate`,而且设置了`--auth-nouser`,那么所有没有发用户名的客户端会被认为是`同一个空用户名用户`,共用同一个限制。
|
||||||
|
|
||||||
#### 提示
|
#### 提示
|
||||||
|
|
||||||
@@ -1909,8 +1938,8 @@ if($ok){
|
|||||||
进行认证,当客户端没有发生认证信息当时候,php接口里面接收的$user认证用户名和$pass认证密码都为空。
|
进行认证,当客户端没有发生认证信息当时候,php接口里面接收的$user认证用户名和$pass认证密码都为空。
|
||||||
2. 连接数限制优先级:用户认证文件连接数限制-》文件ip.limit连接数限制-》API用户连接数限制-》API的IP连接数限制-》命令行全局连接数限制。
|
2. 连接数限制优先级:用户认证文件连接数限制-》文件ip.limit连接数限制-》API用户连接数限制-》API的IP连接数限制-》命令行全局连接数限制。
|
||||||
3. 速率限制优先级:用户认证文件速率限制-》文件ip.limit速率限制-》API用户速率限制-》API的IP速率限制-》命令行全局速率限制。
|
3. 速率限制优先级:用户认证文件速率限制-》文件ip.limit速率限制-》API用户速率限制-》API的IP速率限制-》命令行全局速率限制。
|
||||||
3.上级获取优先级:用户认证文件的upstream-》文件ip.limit的upstream-》API的upstream-》命令行指定的上级。
|
4. 上级获取优先级:用户认证文件的upstream-》文件ip.limit的upstream-》API的upstream-》命令行指定的上级。
|
||||||
4.`--auth-cache`认证缓存,对认证结果缓存一定时间,提升性能,降低认证接口压力,--auth-cache 单位秒,默认0, 设置0是关闭缓存。
|
5. `--auth-cache`认证缓存,对认证结果缓存一定时间,提升性能,降低认证接口压力,--auth-cache 单位秒,默认0, 设置0是关闭缓存。
|
||||||
|
|
||||||
#### upstream详细说明
|
#### upstream详细说明
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user