使用docker安装
yum install -y yum-utilsyum-config-manager \--add-repo \https://download.docker.com/linux/centos/docker-ce.repoyum install docker-ce docker-ce-cli containerd.io -ysystemctl start dockersystemctl enable docker
sudo apt-get updatesudo apt-get install \apt-transport-https \ca-certificates \curl \gnupg-agent \software-properties-common -ycurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -sudo add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/ubuntu \$(lsb_release -cs) \stable"sudo apt-get install docker-ce docker-ce-cli containerd.io -ysystemctl start dockersystemctl enable docker
curl -fsSL https://get.docker.com | bash -s dockercurl -L "https://github.com/docker/compose/releases/download/1.26.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-composechmod +x /usr/local/bin/docker-compose
git clone https://github.com/XrayR-project/XrayR-release
cd XrayR-release
编辑配置文件:
config.yml
,详见:配置文件说明启动docker:
docker-compose up -d
请注意指定config.yml
目录。
docker pull crackair/xrayr:latest && docker run --restart=always --name xrayr -d -v ${PATH_TO_CONFIG}/config.yml:/etc/XrayR/config.yml --network=host crackair/xrayr:latest
docker-compose仅需两条简单通用的命令即可实现更新、删除容器并重启。更新软件后config.yml
不会被更新覆盖。
注意在 docker-compose.yml 所在的目录下执行:
注意在 docker-compose.yml 所在的目录下执行:
docker-compose pulldocker-compose up -d
配置文件说明
主配置文件采用
yaml
格式,命名为xxx.yml
。默认XrayR会使用软件运行目录下的
config.yml
作为配置文件。
配置文件基本格式,Nodes下可以同时添加多个面板,多个节点配置信息,只需添加相同格式的Nodes item即可。
Log:Level: none # Log level: none, error, warning, info, debugAccessPath: # ./access.LogErrorPath: # ./error.logDnsConfigPath: # ./dns.json Path to dns configConnetionConfig:Handshake: 4 # Handshake time limit, SecondConnIdle: 10 # Connection idle time limit, SecondUplinkOnly: 2 # Time limit when the connection downstream is closed, SecondDownlinkOnly: 4 # Time limit when the connection is closed after the uplink is closed, SecondBufferSize: 64 # The internal cache size of each connection, kBNodes:-PanelType: "SSpanel" # Panel type: SSpanel, V2board, PMpanel, ProxypanelApiConfig:ApiHost: "http://127.0.0.1:667"ApiKey: "123"NodeID: 41NodeType: V2ray # Node type: V2ray, Trojan, Shadowsocks, Shadowsocks-PluginTimeout: 30 # Timeout for the api requestEnableVless: false # Enable Vless for V2ray TypeEnableXTLS: false # Enable XTLS for V2ray and TrojanSpeedLimit: 0 # Mbps, Local settings will replace remote settings, 0 means disableDeviceLimit: 0 # Local settings will replace remote settings, 0 means disableRuleListPath: # ./rulelist Path to local rulelist fileControllerConfig:ListenIP: 0.0.0.0 # IP address you want to listenSendIP: 0.0.0.0 # IP address you want to send pacakageUpdatePeriodic: 60 # Time to update the nodeinfo, how many sec.EnableDNS: false # Use custom DNS config, Please ensure that you set the dns.json wellDNSType: AsIs # AsIs, UseIP, UseIPv4, UseIPv6, DNS strategyEnableProxyProtocol: false # Only works for WebSocket and TCPEnableFallback: false # Only support for Trojan and VlessFallBackConfigs: # Support multiple fallbacks-SNI: # TLS SNI(Server Name Indication), Empty for anyPath: # HTTP PATH, Empty for anyDest: 80 # Required, Destination of fallback, check https://xtls.github.io/config/fallback/ for details.ProxyProtocolVer: 0 # Send PROXY protocol version, 0 for dsableCertConfig:CertMode: dns # Option about how to get certificate: none, file, http, dns. Choose "none" will forcedly disable the tls config.CertDomain: "node1.test.com" # Domain to certCertFile: ./cert/node1.test.com.cert # Provided if the CertMode is fileKeyFile: ./cert/node1.test.com.keyProvider: alidns # DNS cert provider, Get the full support list here: https://go-acme.github.io/lego/dns/Email: test@me.comDNSEnv: # DNS ENV option used by DNS providerALICLOUD_ACCESS_KEY: aaaALICLOUD_SECRET_KEY: bbb-PanelType: "V2board" # Panel type: SSpanel, V2boardApiConfig:ApiHost: "http://V2board.com"ApiKey: "123"NodeID: 42NodeType: Trojan # Node type: V2ray, Shadowsocks, TrojanTimeout: 30 # Timeout for the api requestEnableVless: false # Enable Vless for V2ray Type, Prefer remote configurationEnableXTLS: false # Enable XTLS for V2ray and Trojan, Prefer remote configurationControllerConfig:ListenIP: 0.0.0.0 # IP address you want to listenUpdatePeriodic: 60 # Time to update the nodeinfo, how many sec.EnableDNS: false # Enable custom DNS config, Please ensure that you set the dns.json wellCertConfig:CertMode: dns # Option about how to get certificate: none, file, http, dns. Choose "none" will forcedly disable the tls config.CertDomain: "node2.test.com" # Domain to certCertFile: ./cert/node2.test.com.cert # Provided if the CertMode is fileKeyFile: ./cert/node2.test.com.keyProvider: alidns # DNS cert provider, Get the full support list here: https://go-acme.github.io/lego/dns/Email: test@me.comDNSEnv: # DNS ENV option used by DNS providerALICLOUD_ACCESS_KEY: aaaALICLOUD_SECRET_KEY: bbb
基础配置是对所有节点生效的配置。
Log:Level: debug # Log level: none, error, warning, info, debugAccessPath: # ./access.LogErrorPath: # ./error.logDnsConfigPath: # ./dns.json Path to dns configConnetionConfig:Handshake: 4 # Handshake time limit, SecondConnIdle: 10 # Connection idle time limit, SecondUplinkOnly: 2 # Time limit when the connection downstream is closed, SecondDownlinkOnly: 4 # Time limit when the connection is closed after the uplink is closed, SecondBufferSize: 64 # The internal cache size of each connection, kB
日志配置用于控制XrayR-core的日志级别
Log:Level: debug # Log level: none, error, warning, info, debugAccessPath: # ./access.LogErrorPath: # ./error.log
参数 | 选项 | 说明 |
|
| 日志显示级别, |
| 无 | Access日志的保存路径 |
| 无 | Error日志的保存路径 |
指定自定义DNS配置文件的路径
DnsConfigPath: # ./dns.json Path to dns config
参数 | 选项 | 说明 |
| 无 | 自定义DNS配置文件的路径 |
自定义连接释放的相关配置,可以一定程度优化内存占用
ConnetionConfig:Handshake: 4 # Handshake time limit, SecondConnIdle: 10 # Connection idle time limit, SecondUplinkOnly: 2 # Time limit when the connection downstream is closed, SecondDownlinkOnly: 4 # Time limit when the connection is closed after the uplink is closed, SecondBufferSize: 64 # The internal cache size of each connection, kB
参数 | 选项 | 说明 |
| 无 | 连接建立时的握手时间限制。单位为秒。默认值为 4。在入站代理处理一个新连接时,在握手阶段如果使用的时间超过这个时间,则中断该连接。 |
| 无 | 连接空闲的时间限制。单位为秒。默认值为 10。如果在 |
| 无 | 当连接下行线路关闭后的时间限制。单位为秒。默认值为 2。当服务器(如远端网站)关闭下行连接时,出站代理会在等待 |
| 无 | 当连接上行线路关闭后的时间限制。单位为秒。默认值为 4。当服务器(如远端网站)关闭上行连接时,出站代理会在等待 |
| 无 | 每个连接的内部缓存大小。单位为 kB。当值为 0 时,内部缓存被禁用。减少该值有可能可以优化内存占用,但有可能导致CPU占用上升 |
提示: 1. 减少ConnIdle
有可能可以优化高连接数量时的内存占用,但是会导致用户连接延时变高。 2. 在 HTTP 浏览的场景中,可以将 UplinkOnly
和 DownlinkOnly
设为 0,以提高连接关闭的效率,减少内存占用。 3. 减少BufferSize
可以优化内存占用,但是可能会导致CPU占用上升。
每个节点是一个独立的配置,互相不会影响,XrayR支持单实例多节点启动,同时对接多个节点。
Nodes:-PanelType: "SSpanel" # Panel type: SSpanel, V2board, PMpanelApiConfig:ApiHost: "http://127.0.0.1:667"ApiKey: "123"NodeID: 41NodeType: V2ray # Node type: V2ray, Trojan, Shadowsocks, Shadowsocks-PluginTimeout: 30 # Timeout for the api request, Default is 5 secEnableVless: false # Enable Vless for V2ray TypeEnableXTLS: false # Enable XTLS for V2ray and TrojanSpeedLimit: 0 # Mbps, Local settings will replace remote settings, 0 means disableDeviceLimit: 0 # Local settings will replace remote settings, 0 means disableRuleListPath: # ./rulelist Path to local rulelist fileControllerConfig:ListenIP: 0.0.0.0 # IP address you want to listenSendIP: 0.0.0.0 # IP address you want to send pacakageUpdatePeriodic: 60 # Time to update the nodeinfo, how many sec.EnableDNS: false # Use custom DNS config, Please ensure that you set the dns.json wellDNSType: AsIs # AsIs, UseIP, UseIPv4, UseIPv6, DNS strategyEnableProxyProtocol: false # Only works for WebSocket and TCPEnableFallback: false # Only support for Trojan and VlessFallBackConfigs: # Support multiple fallbacks-SNI: # TLS SNI(Server Name Indication), Empty for anyPath: # HTTP PATH, Empty for anyDest: 80 # Required, Destination of fallback, check https://xtls.github.io/config/fallback/ for details.ProxyProtocolVer: 0 # Send PROXY protocol version, 0 for dsableCertConfig:CertMode: dns # Option about how to get certificate: none, file, http, dns. Choose "none" will forcedly disable the tls config.CertDomain: "node1.test.com" # Domain to certCertFile: ./cert/node1.test.com.cert # Provided if the CertMode is fileKeyFile: ./cert/node1.test.com.keyProvider: alidns # DNS cert provider, Get the full support list here: https://go-acme.github.io/lego/dns/Email: test@me.comDNSEnv: # DNS ENV option used by DNS providerALICLOUD_ACCESS_KEY: aaaALICLOUD_SECRET_KEY: bbb-PanelType: "V2board" # Panel type: SSpanel, V2board, PMpanelApiConfig:ApiHost: "http://V2board.com"ApiKey: "123"NodeID: 42NodeType: Trojan # Node type: V2ray, Shadowsocks, TrojanTimeout: 30 # Timeout for the api requestEnableVless: false # Enable Vless for V2ray TypeEnableXTLS: false # Enable XTLS for V2ray and TrojanSpeedLimit: 0 # Local settings will replace remote settings, 0 means disableDeviceLimit: 0 # Local settings will replace remote settings, 0 means disableRuleListPath: # ./rulelist Path to local rulelist fileControllerConfig:ListenIP: 0.0.0.0 # IP address you want to listenUpdatePeriodic: 60 # Time to update the nodeinfo, how many sec.EnableDNS: false # Enable custom DNS config, Please ensure that you set the dns.json wellCertConfig:CertMode: dns # Option about how to get certificate: none, file, http, dns. Choose "none" will forcedly disable the tls config.CertDomain: "node2.test.com" # Domain to certCertFile: ./cert/node2.test.com.cert # Provided if the CertMode is fileKeyFile: ./cert/node2.test.com.keyProvider: alidns # DNS cert provider, Get the full support list here: https://go-acme.github.io/lego/dns/Email: test@me.comDNSEnv: # DNS ENV option used by DNS providerALICLOUD_ACCESS_KEY: aaaALICLOUD_SECRET_KEY: bbb
PanelType: "V2board" # Panel type: SSpanel, V2board, PMpanel, Proxypanel
参数 | 选项 | 说明 |
|
| 对接前端面板类型 |
ApiConfig:ApiHost: "http://127.0.0.1:667"ApiKey: "123"NodeID: 41NodeType: V2ray # Node type: V2ray, Trojan, Shadowsocks, Shadowsocks-PluginTimeout: 30 # Timeout for the api request, Default is 5 secEnableVless: false # Enable Vless for V2ray TypeEnableXTLS: false # Enable XTLS for V2ray and TrojanSpeedLimit: 0 # Local settings will replace remote settings, 0 means disableDeviceLimit: 0 # Local settings will replace remote settings, 0 means disableRuleListPath: # ./rulelist Path to local rulelist file
参数 | 选项 | 说明 |
| 无 | 对接前端面板地址 |
| 无 | 前端对接通讯秘钥 |
| 无 | 节点ID |
|
| 节点类型 |
| 无 | 设定单次访问API超时时间,默认5秒 |
|
| 是否给V2ray启用Vless协议 |
|
| 是否使用XTLS |
| float | 单位Mbps, 本地限速设置,会覆盖远程设置,0为不启用 |
| int | 本地设备限制,会覆盖远程设置,0为不启用 |
| 无 | 本地规则设置,指定本地规则文件路径,规则文件格式 |
ControllerConfig:ListenIP: 0.0.0.0 # IP address you want to listenSendIP: 0.0.0.0 # IP address you want to send pacakageUpdatePeriodic: 60 # Time to update the nodeinfo, how many sec.EnableDNS: false # Use custom DNS config, Please ensure that you set the dns.json wellDNSType: AsIs # AsIs, UseIP, UseIPv4, UseIPv6, DNS strategyEnableProxyProtocol: false # Only works for WebSocket and TCPEnableFallback: false # Only support for Trojan and VlessFallBackConfigs: # Support multiple fallbacks-SNI: # TLS SNI(Server Name Indication), Empty for anyPath: # HTTP PATH, Empty for anyDest: 80 # Required, Destination of fallback, check https://xtls.github.io/config/fallback/ for details.ProxyProtocolVer: 0 # Send PROXY protocol version, 0 for dsable
参数 | 选项 | 说明 |
| 无 | 选择监听的IP地址, |
| 无 | 用于发送数据的 IP 地址 |
| 无 | 从前端更新节点、用户信息和上报用户使用信息的间隔,默认60秒 |
|
| 是否为当前节点启用自定义DNS,默认使用系统DNS |
|
| DNS解析类型, |
|
| 是否为当前节点启用ProxyProtocol获取中转IP,只对TCP和WS有效 |
|
| 是否为当前节点启用Fallback,只对Vless和Trojan协议有效 |
| list | Fallback 相关配置,请查看 Fallback功能说明 |
XrayR 支持多种自动申请证书配置。申请到的证书将会放在配置文件(config.yml)目录的cert
文件夹下。
CertConfig:CertMode: dns # Option about how to get certificate: none, file, http, dns. Choose "none" will forcedly disable the tls config.CertDomain: "node2.test.com" # Domain to certCertFile: ./cert/node2.test.com.cert # Provided if the CertMode is fileKeyFile: ./cert/node2.test.com.keyProvider: alidns # DNS cert provider, Get the full support list here: https://go-acme.github.io/lego/dns/Email: test@me.comDNSEnv: # DNS ENV option used by DNS providerALICLOUD_ACCESS_KEY: aaaALICLOUD_SECRET_KEY: bbb
参数 | 选项 | 说明 |
|
| 获取证书的方式。 |
| 无 | 申请证书域名 |
| 无 | 手动指定的证书路径 |
| 无 | 手动指定的私钥路径 |
| 无 | dns提供商,所有支持的dns提供商请在此获取:https://go-acme.github.io/lego/dns/ |
| 无 | 采用DNS申请证书需要的环境变量,请参考上文链接内,自己的dns提供商所需要的参数,填写于此。请注意一行一个,填写时需符合yaml文件格式。 |
0 评论