手搓X-ray的任意门

安装X-ray

https://github.com/XTLS/Xray-install

1
bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install

默认配置:

1
2
3
4
5
6
7
8
9
10
11
installed: /etc/systemd/system/xray.service
installed: /etc/systemd/system/[email protected]

installed: /usr/local/bin/xray
installed: /usr/local/etc/xray/*.json

installed: /usr/local/share/xray/geoip.dat
installed: /usr/local/share/xray/geosite.dat

installed: /var/log/xray/access.log
installed: /var/log/xray/error.log

修改配置文件

默认配置文件:/usr/local/etc/xray/config.json
忘了有没有了,没有自己建一个

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
"log": {
"loglevel": "warning",
"access": "/var/log/xray/access.log",#日志随意
"error": "/var/log/xray/error.log"#日志随意
},
"inbounds": [
{
"listen": null,
"port": 51346,#中转服务器端口
"protocol": "dokodemo-door",
"settings": {
"address": "192.168.0.1",#被中转的服务器IP
"port": 10290,#被中转的服务器端口
"network": "tcp,udp"
},
"streamSettings": {
"network": "tcp",
"security": "none",
"tcpSettings": {
"header": {
"type": "none"
}
}
},
"tag": "inbound-51346",#tag随意
"sniffing": {}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
},
{
"protocol": "blackhole",
"settings": {},
"tag": "blocked"
}
]
}

启动X-ray

1
systemctl start xray