-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.sh
150 lines (147 loc) · 3.94 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/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": [
{
"port": ${PORT},
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "$ID"
}
],
"disableInsecureEncryption": true
},
"streamSettings": {
"network": "ws",
"allowInsecure": false,
"wsSettings": {
"path": "/$ID-vmess"
}
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
},
{
"port": ${PORT},
"protocol": "vless",
"settings": {
"clients": [
{
"id": "$ID",
"level": 0,
"email": "love@v2fly.org"
}
],
"decryption": "none"
},
"streamSettings": {
"network": "ws",
"allowInsecure": false,
"wsSettings": {
"path": "/$ID-vless"
}
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
},
{
"port": ${PORT},
"protocol": "trojan",
"settings": {
"clients": [
{
"password":"$ID",
"level": 0,
"email": "love@v2fly.org"
}
],
"decryption": "none"
},
"streamSettings": {
"network": "ws",
"allowInsecure": false,
"wsSettings": {
"path": "/$ID-trojan"
}
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
}
],
"routing": {
"domainStrategy": "IPIfNonMatch",
"domainMatcher": "mph",
"rules": [
{
"type": "field",
"protocol": [
"bittorrent"
],
"domains": [
"geosite:cn",
"geosite:category-ads-all"
],
"outboundTag": "blocked"
}
]
},
"outbounds": [
{
"protocol": "freedom",
"settings": {
"domainStrategy": "UseIPv4",
"userLevel": 0
}
},
{
"protocol": "blackhole",
"tag": "blocked"
}
],
"dns": {
"servers": [
{
"address": "https+local://dns.google/dns-query",
"address": "https+local://cloudflare-dns.com/dns-query",
"skipFallback": true
}
],
"queryStrategy": "UseIPv4",
"disableCache": true,
"disableFallbackIfMatch": true
}
}
EOF
# Run V2/X2
/usr/local/bin/xray -config /usr/local/etc/xray/config.json