-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.sh
138 lines (130 loc) · 2.6 KB
/
main.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
######请添加环境变量"uuid",否则xray无效
#删除panindex并重新启动以更新PanIndex.
#!/bin/bash
export PATH="~/nginx/sbin:brook:panindex$PATH"
if [ ! -d "~/nginx" ];then
\cp -ax .nginx ~/nginx
fi
chmod 777 ~/nginx/sbin/nginx
if [ ! -f "xray" ];then
curl -L https://github.com/XTLS/Xray-core/releases/download/v1.5.3/Xray-linux-64.zip -o xray.zip
unzip -o xray.zip
rm -f xray.zip
fi
chmod +x xray
if [ $uuid ];then
cat > config.json <<EOF
{
"log": null,
"routing": {
"rules": [
{
"inboundTag": [
"api"
],
"outboundTag": "api",
"type": "field"
},
{
"ip": [
"geoip:private"
],
"outboundTag": "blocked",
"type": "field"
},
{
"outboundTag": "blocked",
"protocol": [
"bittorrent"
],
"type": "field"
}
]
},
"dns": null,
"inbounds": [
{
"listen": "127.0.0.1",
"port": 62789,
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1"
},
"streamSettings": null,
"tag": "api",
"sniffing": null
},
{
"listen": null,
"port": 23333,
"protocol": "vless",
"settings": {
"clients": [
{
"id": "$uuid",
"flow": "xtls-rprx-direct"
}
],
"decryption": "none",
"fallbacks": []
},
"streamSettings": {
"network": "ws",
"security": "none",
"wsSettings": {
"path": "/23333",
"headers": {}
}
},
"tag": "inbound-23333",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
},
{
"protocol": "blackhole",
"settings": {},
"tag": "blocked"
}
],
"transport": null,
"policy": {
"system": {
"statsInboundDownlink": true,
"statsInboundUplink": true
}
},
"api": {
"services": [
"HandlerService",
"LoggerService",
"StatsService"
],
"tag": "api"
},
"stats": {},
"reverse": null,
"fakeDns": null
}
EOF
fi
if [ ! -f "panindex" ];then
curl -L https://github.com/libsgh/PanIndex/releases/latest/download/PanIndex-linux-amd64.tar.gz -o panindex.tar.gz
tar -zxvf panindex.tar.gz
mv PanIndex-linux-amd64 panindex
rm -f panindex.tar.gz & rm -f LICENSE
fi
chmod +x panindex
./xray &
./panindex &
nginx -g 'daemon off;'