mirror of
https://github.com/XrayR-project/XrayR-doc.git
synced 2025-06-08 13:39:54 +00:00
add: global devicelimit
This commit is contained in:
parent
38838ab558
commit
712dad2991
@ -10,9 +10,35 @@
|
|||||||
每一个独立IP地址视为一个设备。
|
每一个独立IP地址视为一个设备。
|
||||||
{% endhint %}
|
{% endhint %}
|
||||||
|
|
||||||
## 全局设备限制
|
## SSPanel 全局设备限制
|
||||||
|
|
||||||
当XrayR版本>=v0.7.1,SSpanel版本>=[2021.9](https://github.com/Anankke/SSPanel-Uim/releases/tag/2021.9),XrayR将会针对SSpanel启用全局设备限制功能。此时,不同后端结点将会全局限制独立IP连接数量,而非各后端本地限制。
|
当XrayR版本>=v0.7.1,SSpanel版本>=[2021.9](https://github.com/Anankke/SSPanel-Uim/releases/tag/2021.9),XrayR将会针对SSPanel启用全局设备限制功能。此时,不同后端结点将会全局限制独立IP连接数量,而非各后端本地限制。
|
||||||
|
|
||||||
当设备限制为1时,不同结点之间的切换会受到限制,建议至少设置设备数为2。并且由于SSPanel面板限制,IP连接信息可能需要至少2分钟才能传递到全部的后端结点,因此在2分钟内的同时连接将不能被限制。
|
当设备限制为1时,不同结点之间的切换会受到限制,建议至少设置设备数为2。并且由于SSPanel面板限制,IP连接信息可能需要至少2分钟才能传递到全部的后端结点,因此在2分钟内的同时连接将不能被限制。
|
||||||
|
|
||||||
|
## 全局设备限制
|
||||||
|
|
||||||
|
当XrayR版本>=v0.8.6,可以启用基于redis的全局设备限制功能,可以跨节点支持基于IP的设备限制,兼容所有面板。可在`ControllerConfig` 中配置如下项。
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
GlobalDeviceLimitConfig:
|
||||||
|
Limit: 0 # The global device limit of a user, 0 means disable
|
||||||
|
RedisAddr: 127.0.0.1:6379 # The redis server address
|
||||||
|
RedisPassword: YOUR PASSWORD # Redis password
|
||||||
|
RedisDB: 0 # Redis DB
|
||||||
|
Timeout: 5 # Timeout for redis request
|
||||||
|
Expiry: 60 # Expiry time (second)
|
||||||
|
```
|
||||||
|
|
||||||
|
| 参数 | 说明 |
|
||||||
|
| ------------- | -------------------------------------------------------------------- |
|
||||||
|
| Limit | 每个用户限制独立IP数量,设置为0则禁用 |
|
||||||
|
| RedisAddr | redis连接地址,不同节点需要连接到同一redis数据库,来实现全局设备限制 |
|
||||||
|
| RedisPassword | redis密码 |
|
||||||
|
| RedisDB | redis数据库编号 |
|
||||||
|
| Timeout | 连接redis超时时间,单位:秒 |
|
||||||
|
| Expiry | redis中存储的在线用户过期时间,单位:秒 |
|
||||||
|
|
||||||
|
{% hint style="info" %}
|
||||||
|
为保证最大效率,启用全局设备限制后,建议将其他设备限制相关配置设为0,包括配置文件中的`DeviceLimit`和面板相关配置。
|
||||||
|
{% endhint %}
|
||||||
|
@ -16,7 +16,7 @@ DnsConfigPath: # /etc/XrayR/dns.json # Path to dns config, check https://xtls.gi
|
|||||||
RouteConfigPath: # /etc/XrayR/route.json # Path to route config, check https://xtls.github.io/config/routing.html for help
|
RouteConfigPath: # /etc/XrayR/route.json # Path to route config, check https://xtls.github.io/config/routing.html for help
|
||||||
InboundConfigPath: # /etc/XrayR/custom_inbound.json # Path to custom inbound config, check https://xtls.github.io/config/inbound.html for help
|
InboundConfigPath: # /etc/XrayR/custom_inbound.json # Path to custom inbound config, check https://xtls.github.io/config/inbound.html for help
|
||||||
OutboundConfigPath: # /etc/XrayR/custom_outbound.json # Path to custom outbound config, check https://xtls.github.io/config/outbound.html for help
|
OutboundConfigPath: # /etc/XrayR/custom_outbound.json # Path to custom outbound config, check https://xtls.github.io/config/outbound.html for help
|
||||||
ConnetionConfig:
|
ConnectionConfig:
|
||||||
Handshake: 4 # Handshake time limit, Second
|
Handshake: 4 # Handshake time limit, Second
|
||||||
ConnIdle: 10 # Connection idle time limit, Second
|
ConnIdle: 10 # Connection idle time limit, Second
|
||||||
UplinkOnly: 2 # Time limit when the connection downstream is closed, Second
|
UplinkOnly: 2 # Time limit when the connection downstream is closed, Second
|
||||||
@ -52,6 +52,13 @@ Nodes:
|
|||||||
WarnTimes: 0 # After (WarnTimes) consecutive warnings, the user will be limited. Set to 0 to punish overspeed user immediately.
|
WarnTimes: 0 # After (WarnTimes) consecutive warnings, the user will be limited. Set to 0 to punish overspeed user immediately.
|
||||||
LimitSpeed: 0 # The speedlimit of a limited user (unit: mbps)
|
LimitSpeed: 0 # The speedlimit of a limited user (unit: mbps)
|
||||||
LimitDuration: 0 # How many minutes will the limiting last (unit: minute)
|
LimitDuration: 0 # How many minutes will the limiting last (unit: minute)
|
||||||
|
GlobalDeviceLimitConfig:
|
||||||
|
Limit: 0 # The global device limit of a user, 0 means disable
|
||||||
|
RedisAddr: 127.0.0.1:6379 # The redis server address
|
||||||
|
RedisPassword: YOUR PASSWORD # Redis password
|
||||||
|
RedisDB: 0 # Redis DB
|
||||||
|
Timeout: 5 # Timeout for redis request
|
||||||
|
Expiry: 60 # Expiry time (second)
|
||||||
EnableFallback: false # Only support for Trojan and Vless
|
EnableFallback: false # Only support for Trojan and Vless
|
||||||
FallBackConfigs: # Support multiple fallbacks
|
FallBackConfigs: # Support multiple fallbacks
|
||||||
-
|
-
|
||||||
@ -112,7 +119,7 @@ DnsConfigPath: # /etc/XrayR/dns.json # Path to dns config, check https://xtls.gi
|
|||||||
RouteConfigPath: # /etc/XrayR/route.json # Path to route config, check https://xtls.github.io/config/routing.html for help
|
RouteConfigPath: # /etc/XrayR/route.json # Path to route config, check https://xtls.github.io/config/routing.html for help
|
||||||
InboundConfigPath: # /etc/XrayR/custom_inbound.json # Path to custom inbound config, check https://xtls.github.io/config/inbound.html for help
|
InboundConfigPath: # /etc/XrayR/custom_inbound.json # Path to custom inbound config, check https://xtls.github.io/config/inbound.html for help
|
||||||
OutboundConfigPath: # /etc/XrayR/custom_outbound.json # Path to custom outbound config, check https://xtls.github.io/config/outbound.html for help
|
OutboundConfigPath: # /etc/XrayR/custom_outbound.json # Path to custom outbound config, check https://xtls.github.io/config/outbound.html for help
|
||||||
ConnetionConfig:
|
ConnectionConfig:
|
||||||
Handshake: 4 # Handshake time limit, Second
|
Handshake: 4 # Handshake time limit, Second
|
||||||
ConnIdle: 10 # Connection idle time limit, Second
|
ConnIdle: 10 # Connection idle time limit, Second
|
||||||
UplinkOnly: 2 # Time limit when the connection downstream is closed, Second
|
UplinkOnly: 2 # Time limit when the connection downstream is closed, Second
|
||||||
@ -186,7 +193,7 @@ OutboundConfigPath: # /etc/XrayR/custom_outbound.json # Path to custom outbound
|
|||||||
自定义连接释放的相关配置,可以一定程度优化内存占用
|
自定义连接释放的相关配置,可以一定程度优化内存占用
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
ConnetionConfig:
|
ConnectionConfig:
|
||||||
Handshake: 4 # Handshake time limit, Second
|
Handshake: 4 # Handshake time limit, Second
|
||||||
ConnIdle: 10 # Connection idle time limit, Second
|
ConnIdle: 10 # Connection idle time limit, Second
|
||||||
UplinkOnly: 2 # Time limit when the connection downstream is closed, Second
|
UplinkOnly: 2 # Time limit when the connection downstream is closed, Second
|
||||||
@ -338,6 +345,13 @@ ControllerConfig:
|
|||||||
WarnTimes: 0 # After (WarnTimes) consecutive warnings, the user will be limited. Set to 0 to punish overspeed user immediately.
|
WarnTimes: 0 # After (WarnTimes) consecutive warnings, the user will be limited. Set to 0 to punish overspeed user immediately.
|
||||||
LimitSpeed: 0 # The speedlimit of a limited user (unit: mbps)
|
LimitSpeed: 0 # The speedlimit of a limited user (unit: mbps)
|
||||||
LimitDuration: 0 # How many minutes will the limiting last (unit: minute)
|
LimitDuration: 0 # How many minutes will the limiting last (unit: minute)
|
||||||
|
GlobalDeviceLimitConfig:
|
||||||
|
Limit: 0 # The global device limit of a user, 0 means disable
|
||||||
|
RedisAddr: 127.0.0.1:6379 # The redis server address
|
||||||
|
RedisPassword: YOUR PASSWORD # Redis password
|
||||||
|
RedisDB: 0 # Redis DB
|
||||||
|
Timeout: 5 # Timeout for redis request
|
||||||
|
Expiry: 60 # Expiry time (second)
|
||||||
EnableFallback: false # Only support for Trojan and Vless
|
EnableFallback: false # Only support for Trojan and Vless
|
||||||
FallBackConfigs: # Support multiple fallbacks
|
FallBackConfigs: # Support multiple fallbacks
|
||||||
-
|
-
|
||||||
@ -360,6 +374,7 @@ ControllerConfig:
|
|||||||
| `DisableSniffing` | `false`, `true` | 是否关闭domain sniffing,默认`false` |
|
| `DisableSniffing` | `false`, `true` | 是否关闭domain sniffing,默认`false` |
|
||||||
| `EnableProxyProtocol` | `true`,`false` | 是否为当前节点启用ProxyProtocol获取中转IP |
|
| `EnableProxyProtocol` | `true`,`false` | 是否为当前节点启用ProxyProtocol获取中转IP |
|
||||||
| `AutoSpeedLimitConfig` | list | 动态限速相关配置,请查看 [动态限速](../gong-neng-shuo-ming/speedlimit.md) |
|
| `AutoSpeedLimitConfig` | list | 动态限速相关配置,请查看 [动态限速](../gong-neng-shuo-ming/speedlimit.md) |
|
||||||
|
| `GlobalDeviceLimitConfig` | list | 全局设备限制相关配置,请查看 [全局设备限制](../gong-neng-shuo-ming/devicelimit.md) |
|
||||||
| `EnableFallback` | `true`,`false` | 是否为当前节点启用Fallback,只对Vless和Trojan协议有效 |
|
| `EnableFallback` | `true`,`false` | 是否为当前节点启用Fallback,只对Vless和Trojan协议有效 |
|
||||||
| `FallBackConfigs` | list | Fallback 相关配置,请查看 [Fallback功能说明](../gong-neng-shuo-ming/fallback.md) |
|
| `FallBackConfigs` | list | Fallback 相关配置,请查看 [Fallback功能说明](../gong-neng-shuo-ming/fallback.md) |
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## 链接控制优化
|
## 链接控制优化
|
||||||
|
|
||||||
通过自定义`ConnetionConfig`连接释放的[相关配置](../xrayr-pei-zhi-wen-jian-shuo-ming/config.md#lian-jie-kong-zhi),可以一定程度优化内存占用
|
通过自定义`ConnectionConfig`连接释放的[相关配置](../xrayr-pei-zhi-wen-jian-shuo-ming/config.md#lian-jie-kong-zhi),可以一定程度优化内存占用
|
||||||
|
|
||||||
1. 减少`ConnIdle`有可能可以优化高连接数量时的内存占用,但是会导致用户连接延时变高。
|
1. 减少`ConnIdle`有可能可以优化高连接数量时的内存占用,但是会导致用户连接延时变高。
|
||||||
2. 在 HTTP 浏览的场景中,可以将 `UplinkOnly` 和 `DownlinkOnly` 设为 0,以提高连接关闭的效率,减少内存占用。
|
2. 在 HTTP 浏览的场景中,可以将 `UplinkOnly` 和 `DownlinkOnly` 设为 0,以提高连接关闭的效率,减少内存占用。
|
||||||
|
Loading…
x
Reference in New Issue
Block a user