A Xray backend framework that can easily support many panels.
一个基于Xray的后端框架,支持V2ay,Trojan,Shadowsocks协议,极易扩展,支持多面板对接。
如果您喜欢本项目,可以右上角点个star+watch,持续关注本项目的进展。
本项目只是本人个人学习开发并维护,本人不保证任何可用性,也不对使用本软件造成的任何后果负责。
- 永久开源且免费。
- 支持V2ray,Trojan, Shadowsocks多种协议。
- 支持Vless和XTLS等新特性。
- 支持单实例对接多面板、多节点,无需重复启动。
- 支持限制在线IP
- 支持节点端口级别、用户级别限速。
- 配置简单明了。
- 修改配置自动重启实例。
- 方便编译和升级,可以快速更新核心版本, 支持Xray-core新特性。
- 在线用户统计和限制
- 限速实现
- 审计规则
- 对接ProxyPanel
- 对接v2board
功能 | v2ray | trojan | shadowsocks |
---|---|---|---|
获取节点信息 | √ | √ | √ |
获取用户信息 | √ | √ | √ |
用户流量统计 | √ | √ | √ |
服务器信息上报 | √ | √ | √ |
自动申请tls证书 | √ | √ | √ |
自动续签tls证书 | √ | √ | √ |
在线人数统计 | √ | √ | √ |
在线用户限制 | √ | √ | √ |
审计规则 | √ | √ | √ |
节点端口限速 | √ | √ | √ |
按照用户限速 | √ | √ | √ |
自定义DNS | √ | √ | √ |
前端 | v2ray | trojan | shadowsocks |
---|---|---|---|
sspanel-uim | √ | √ | √ (Shadowsocks - 单端口多用户) |
ProxyPanel | TODO | TODO | TODO |
v2board | √ | √ | √ |
Mozilla Public License Version 2.0
bash <(curl -Ls https://raw.githubusercontent.com/amfiyong/XrayR-release/master/install.sh)
- 在此处,根据自身系统选择合适的版本:Release
- 解压压缩包,之后运行:
./XrayR -config config.yml
- go 1.16.0
- 依次运行
git clone https://github.com/amfiyong/XrayR
cd XrayR/main
go mod tidy
go build -o XrayR -ldflags "-s -w"
./XrayR -config config.yml
cp config.yml.example config.yml
- nano config.yml
配置文件基本格式,Nodes下可以同时添加多个面板,多个节点配置信息,只需添加相同格式的Nodes item即可。
Log:
Level: debug # Log level: none, error, warning, info, debug
AccessPath: # ./access.Log
ErrorPath: # ./error.log
DnsConfigPath: # ./dns.json Path to dns config
Nodes:
-
PanelType: "SSpanel" # Panel type: SSpanel
ApiConfig:
ApiHost: "https://example.com"
ApiKey: "123"
NodeID: 41
NodeType: V2ray # Node type: V2ray, Shadowsocks, Trojan
Timeout: 30 # Timeout for the api request, Default is 5 sec
EnableVless: false # Enable Vless for V2ray Type, Prefer remote configuration
EnableXTLS: false # Enable XTLS for V2ray and Trojan, Prefer remote configuration
ControllerConfig:
ListenIP: 0.0.0.0 # IP address you want to listen
UpdatePeriodic: 60 # Time to update the nodeinfo, how many sec.
EnableDNS: false # Enable custom DNS config, Please ensure that you set the dns.json well
CertConfig:
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 cert
CertFile: ./cert/node1.test.com.cert # Provided if the CertMode is file
KeyFile: ./cert/node1.test.com.key
Provider: cloudflare # DNS cert provider, Get the full support list here: https://go-acme.github.io/lego/dns/
Email: test@me.com
DNSEnv: # DNS ENV option used by DNS provider
CF_API_EMAIL:
CF_API_KEY:
-
PanelType: "V2board" # Panel type: SSpanel, V2board
ApiConfig:
ApiHost: "https://example.com"
ApiKey: "123"
NodeID: 42
NodeType: Trojan # Node type: V2ray, Shadowsocks, Trojan
Timeout: 30 # Timeout for the api request
EnableVless: false # Enable Vless for V2ray Type, Prefer remote configuration
EnableXTLS: false # Enable XTLS for V2ray and Trojan, Prefer remote configuration
ControllerConfig:
ListenIP: 0.0.0.0 # IP address you want to listen
UpdatePeriodic: 60 # Time to update the nodeinfo, how many sec.
EnableDNS: false # Enable custom DNS config, Please ensure that you set the dns.json well
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 cert
CertFile: ./cert/node2.test.com.cert # Provided if the CertMode is file
KeyFile: ./cert/node2.test.com.key
Provider: cloudflare # DNS cert provider, Get the full support list here: https://go-acme.github.io/lego/dns/
Email: test@me.com
DNSEnv: # DNS ENV option used by DNS provider
CF_API_EMAIL:
CF_API_KEY:
- 节点限速:请在SSpanel的节点限速处填写,单位mbps。
- 用户限速:请在SSpanel的用户设置处填写,单位mbps。
- 限速值设为0,则为不限速。
请在前端审计规则处填写任意正则表达式,如 baidu.com
将屏蔽所有baidu的域名。暂不支持bt协议的审计。
XrayR支持为不同节点设置不同的DNS策略,具体方法如下:
- 编写dns.json文件,此配置与Xray DNS配置完全相同,请查看:https://xtls.github.io/config/base/dns/ 获取帮助。
- 在
config.yml
中配置DnsConfigPath
为dns.json的路径。 - 在所需要启用自定义DNS的节点中,将
EnableDNS: true
设为true。如设为false或者不填则是使用本机DNS。 - 如果要启用geoip相关配置,请确保
geoip.dat
和geosite.dat
处于和config.yml
同一目录。
- 在
config.yml
中配置PanelType: "V2board"
。 - V2board只有V2ray节点类型支持审计规则。
- 启用vless和xtls,请在配置文件中手动启动,V2board不支持在线配置。
协议 | 支持情况 |
---|---|
VMess | tcp, tcp+tls, ws, ws+tls, h2c, h2+tls |
VMessAEAD | tcp, tcp+tls, ws, ws+tls, h2c, h2+tls |
VLess | tcp, tcp+tls/xtls, ws, ws+tls/xtls, h2c, h2+tls/xtls |
IP;监听端口;alterId;(tcp或ws);(tls或xtls或不填);path=/xxx|host=xxxx.com|server=xxx.com|outside_port=xxx|enable_vless=(true或false)
alterId设为0,则自动启用VMessAEAD。
ip;12345;2;tcp;;server=域名
示例:1.3.5.7;12345;2;tcp;;server=hk.domain.com
ip;12345;2;tcp;tls;server=域名|host=域名
示例:1.3.5.7;12345;2;tcp;tls;server=hk.domain.com|host=hk.domain.com
ip;80;2;ws;;path=/xxx|server=域名|host=CDN域名
示例:1.3.5.7;80;2;ws;;path=/v2ray|server=hk.domain.com|host=hk.domain.com
ip;443;2;tls;ws;path=/xxx|server=域名|host=CDN域名
示例:1.3.5.7;443;2;ws;tls;path=/v2ray|server=hk.domain.com|host=hk.domain.com
在任一配置组合后增加|outside_port=xxx
,此项为用户连接端口。
示例:1.3.5.7;80;2;ws;;path=/v2ray|server=hk.domain.com|host=hk.domain.com|outside_port=12345
在任一配置组合后增加|enable_vless=true
.
示例:1.3.5.7;12345;2;tcp;tls;server=hk.domain.com|host=hk.domain.com|enable_vless=true
请开启vless同时务必使用tls或者xtls。
替换tls为xtls
示例:1.3.5.7;12345;2;tcp;xtls;server=hk.domain.com|host=hk.domain.com
协议 | 支持情况 |
---|---|
Trojan | √ |
域名或IP;port=监听端口#用户连接端口|host=xx
示例:gz.aaa.com;port=443|host=gz.aaa.com
示例:gz.aaa.com;port=443#12345|host=hk.aaa.com
在配置后增加|enable_xtls=true
.
示例:gz.aaa.com;port=443#12345|host=hk.aaa.com|enable_xtls=true
协议 | 支持情况 | 加密方法 |
---|---|---|
ShadowsocksAEAD | √ | aes-128-gcm, aes-256-gcm, chacha20-poly1305 |
- 请注意,节点类型请选择:
Shadowsocks
- 单端口多用户承载用户加密方式请选择:
aes-128-gcm
,aes-256-gcm
,chacha20-ietf-poly1305
三者之一。 - XrayR目前只支持一个单端口多用户承载用户,有多个承载用户时只使用第一个。
域名或IP;port=监听端口#连接端口;server=xx
示例:gz.aaa.com;port=80#1234;server=gz.aaa.com