This repository has been archived by the owner on Aug 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
config.sh
128 lines (125 loc) · 3.45 KB
/
config.sh
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/sh
# Get V2/X2 binary and decompress binary
mkdir /tmp/xray
curl --retry 10 --retry-max-time 60 -L -H "Cache-Control: no-cache" -fsSL github.com/XTLS/Xray-core/releases/latest/download/Xray-linux-64.zip -o /tmp/xray/xray.zip
busybox unzip /tmp/xray/xray.zip -d /tmp/xray
install -m 755 /tmp/xray/xray /usr/local/bin/xray
install -m 755 /tmp/xray/geosite.dat /usr/local/bin/geosite.dat
install -m 755 /tmp/xray/geoip.dat /usr/local/bin/geoip.dat
xray -version
rm -rf /tmp/xray
# V2/X2 new configuration
install -d /usr/local/etc/xray
cat << EOF > /usr/local/etc/xray/config.json
{
"log": {
"loglevel": "none"
},
"inbounds": [
{
"listen": "0.0.0.0",
"port": ${PORT},
"protocol": "vless",
"settings": {
"clients": [
{
"id": "$ID",
"level": 0,
"email": "love@v2fly.org"
}
],
"decryption": "none"
},
"streamSettings": {
"network": "ws",
"tlsSettings": {
"rejectUnknownSni": true,
"allowInsecure": false,
"fingerprint": "randomized"
},
"wsSettings": {
"path": "/$ID-vless"
}
},
"mux": {
"enabled": true,
"concurrency": 8
}
},
{
"listen": "0.0.0.0",
"port": ${PORT},
"protocol": "trojan",
"settings": {
"clients": [
{
"password":"$ID",
"level": 0,
"email": "love@v2fly.org"
}
],
"decryption": "none"
},
"streamSettings": {
"network": "ws",
"tlsSettings": {
"rejectUnknownSni": true,
"allowInsecure": false,
"fingerprint": "randomized"
},
"wsSettings": {
"path": "/$ID-trojan"
}
},
"mux": {
"enabled": true,
"concurrency": 8
}
}
],
"routing": {
"domainStrategy": "IPIfNonMatch",
"domainMatcher": "hybrid",
"rules": [
{
"type": "field",
"protocol": [
"bittorrent"
],
"domains": [
"geosite:cn",
"geosite:category-ads-all"
],
"outboundTag": "block"
}
]
},
"outbounds": [
{
"protocol": "freedom",
"settings": {
"domainStrategy": "UseIPv4",
"userLevel": 0
}
},
{
"protocol": "blackhole",
"tag": "block"
}
],
"dns": {
"servers": [
{
"address": "https+local://dns.google/dns-query",
"address": "https+local://cloudflare-dns.com/dns-query",
"skipFallback": true
}
],
"queryStrategy": "UseIPv4",
"disableCache": true,
"disableFallback": true
}
}
EOF
# Run V2/X2
/usr/local/bin/xray -config /usr/local/etc/xray/config.json