-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathxvei.sh
584 lines (519 loc) · 18.8 KB
/
xvei.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
#!/bin/bash
XRAY_GIT_SCRIPT="https://github.com/XTLS/Xray-install/raw/main/install-release.sh"
ROOT_GIT_REPO="https://raw.githubusercontent.com/Shark-vil/xray_vless_easy_install_script/master"
REPO_XRAY_CONFIG="$ROOT_GIT_REPO/config/xray/config.json"
REPO_XRAY_CONFIG_WARP="$ROOT_GIT_REPO/config/xray/config_warp.json"
REPO_XRAY_CONFIG_TOR="$ROOT_GIT_REPO/config/xray/config_tor.json"
REPO_NGINX_CONFIG="$ROOT_GIT_REPO/config/nginx/default"
REPO_XRAY_CONFIG_VLESS="$ROOT_GIT_REPO/config/xray/user/vless.json"
REPO_XRAY_CONFIG_VLESS_WS="$ROOT_GIT_REPO/config/xray/user/vless_ws.json"
REPO_XRAY_CONFIG_VLESS_LINK="$ROOT_GIT_REPO/config/xray/user/vless_link.txt"
REPO_XRAY_CONFIG_VLESS_LINK_WS="$ROOT_GIT_REPO/config/xray/user/vless_ws_link.txt"
REPO_XRAY_CONFIG_SHADOWSOCKS_LINK="$ROOT_GIT_REPO/config/xray/user/shadowsocks_link.txt"
NGINX_DEFAULT_CONFIG_SRC="/etc/nginx/sites-available/default"
NGINX_DEFAULT_CONFIG_LINK="/etc/nginx/sites-enabled/default"
NGINX_NEW_CONFIG="/etc/nginx/sites-enabled/default.conf"
CONFIG_DIST_PATH="$HOME/xray_eis"
CONFIG_VLESS_CLIENT_PATH="$CONFIG_DIST_PATH/vless_client_config.json"
CONFIG_VLESS_LINK_CLIENT_PATH="$CONFIG_DIST_PATH/vless_client_link.txt"
CONFIG_SHADOWSOCKS_PASSWORD_PATH="$CONFIG_DIST_PATH/shadowsocks_password.txt"
CONFIG_SHADOWSOCKS_LINK_CLIENT_PATH="$CONFIG_DIST_PATH/shadowsocks_client_link.txt"
XRAY_CONFIG_PATH="/usr/local/etc/xray/config.json"
XRAY_SHADOWSOCKS_PORT_DEFAULT="5465"
PARAM_RENEW_CONFIG="0"
PARAM_INSTALL_CUSTOMIZE="0"
VALUE_ENCRYPTION_METHOD="2022-blake3-aes-128-gcm"
VALUE_XRAY_SHADOWSOCKS_PORT="$XRAY_SHADOWSOCKS_PORT_DEFAULT"
VALUE_OUTBOUNDS_PROXY=""
print_log() {
local message="$1"
local prefix_color="\033[96m"
local reset_color="\033[0m"
local prefix="[Xray|INFO] "
echo -e "${prefix_color}${prefix}${reset_color}${message}"
}
print_error() {
local message="$1"
local prefix_color="\033[91m"
local reset_color="\033[0m"
local prefix="[Xray|ERROR] "
echo -e "${prefix_color}${prefix}${reset_color}${message}"
}
write_text_in_file() {
local file_path=$1
local write_content=$2
if [ ! -e $file_path ]; then
touch $file_path
fi
echo "$write_content" > "$file_path"
}
check_service() {
if systemctl is-active --quiet $1; then
print_log "The '$1' service is working correctly!"
else
print_error "The '$1' service is running with errors!"
fi
}
apt_update() {
print_log "Update packages"
apt-get update
}
apt_install() {
print_log "Insstall '$1' package"
apt-get install -y $1
}
confirm_changes() {
local prompt="$1"
local response
while true; do
local green="\033[32m"
local red="\033[31m"
local reset="\033[0m"
local confirm_value
print_log "${prompt} (${green}Yes${reset}/${red}No${reset}): "
read confirm_value < /dev/tty
confirm_value=$(echo "$confirm_value" | tr '[:upper:]' '[:lower:]')
case "$confirm_value" in
d | y | yes)
return 0
;;
n | no)
return 1
;;
*)
;;
esac
done
}
is_number() {
local value="$1"
if [[ "$value" =~ ^-?[0-9]+$ ]]; then
return 0;
else
return 1;
fi
}
replace_text_in_file() {
sed -i "s|%$1%|$2|g" "$3"
print_log "SET $1=$2 IN $3"
}
install_tor_network() {
apt_update
apt_install "tor"
}
install_warp_docker() {
docker run -d \
--name warp-xray \
--restart always \
-p 1080:1080 \
-e WARP_SLEEP=2 \
--cap-add NET_ADMIN \
--sysctl net.ipv6.conf.all.disable_ipv6=0 \
--sysctl net.ipv4.conf.all.src_valid_mark=1 \
-v $HOME/warp-xray/data:/var/lib/cloudflare-warp \
caomingjun/warp
}
install_docker() {
apt-get update
apt-get install -y ca-certificates curl
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install -y docker-ce \
docker-ce-cli \
containerd.io \
docker-buildx-plugin \
docker-compose-plugin
}
set_encryption_method() {
local select_type_number
while true; do
print_log "Choise shadowsocks encryption method (Default: 2022-blake3-aes-128-gcm):"
print_log "1. 2022-blake3-aes-128-gcm"
print_log "2. 2022-blake3-aes-256-gcm"
print_log "3. 2022-blake3-chacha20-poly1305"
print_log "4. aes-128-gcm"
print_log "5. aes-256-gcm"
print_log "6. chacha20-poly1305"
print_log "7. chacha20-ietf-poly1305"
print_log "8. xchacha20-poly1305"
print_log "9. xchacha20-ietf-poly1305"
read -r select_type_number < /dev/tty
case "$select_type_number" in
1)
VALUE_ENCRYPTION_METHOD="2022-blake3-aes-128-gcm"
;;
2)
VALUE_ENCRYPTION_METHOD="2022-blake3-aes-256-gcm"
;;
3)
VALUE_ENCRYPTION_METHOD="2022-blake3-chacha20-poly1305"
;;
4)
VALUE_ENCRYPTION_METHOD="aes-128-gcm"
;;
5)
VALUE_ENCRYPTION_METHOD="aes-256-gcm"
;;
6)
VALUE_ENCRYPTION_METHOD="chacha20-poly1305"
;;
7)
VALUE_ENCRYPTION_METHOD="chacha20-ietf-poly1305"
;;
8)
VALUE_ENCRYPTION_METHOD="xchacha20-poly1305"
;;
9)
VALUE_ENCRYPTION_METHOD="xchacha20-ietf-poly1305"
;;
*)
VALUE_ENCRYPTION_METHOD="2022-blake3-aes-128-gcm"
;;
esac
if confirm_changes "'$VALUE_ENCRYPTION_METHOD' - Is this the correct method?"; then
break
fi
print_error "Method not correct. Try again."
done
}
read_domain() {
while true; do
print_log "Print your REAL domain name (example: mysite.com):"
read -r VALUE_YOUR_DOMAIN < /dev/tty
if confirm_changes "'$VALUE_YOUR_DOMAIN' - Is this the correct domain?"; then
break
fi
print_error "Domain not correct. Try again."
done
}
read_mail() {
while true; do
print_log "Print your REAL email (example: [email protected]):"
read -r VALUE_YOUR_EMAIL < /dev/tty
if confirm_changes "'$VALUE_YOUR_EMAIL' - Is this the correct domain?"; then
break
fi
print_error "Mail not correct. Try again."
done
}
set_shadowsocks_port() {
while true; do
print_log "Print shadowsocks port (default: $XRAY_SHADOWSOCKS_PORT_DEFAULT):"
read VALUE_XRAY_SHADOWSOCKS_PORT < /dev/tty
if ! is_number $VALUE_XRAY_SHADOWSOCKS_PORT; then
VALUE_XRAY_SHADOWSOCKS_PORT="$XRAY_SHADOWSOCKS_PORT_DEFAULT"
fi
if ss -tuln | grep -q ":$VALUE_XRAY_SHADOWSOCKS_PORT"; then
print_error "The port $VALUE_XRAY_SHADOWSOCKS_PORT is already in use"
VALUE_XRAY_SHADOWSOCKS_PORT="$XRAY_SHADOWSOCKS_PORT_DEFAULT"
fi
if confirm_changes "Port: $VALUE_XRAY_SHADOWSOCKS_PORT. Is this the correct port?"; then
break
fi
done
}
letsencrypt_install_cert_from_domain() {
local domain=$1
local mail=$2
VALUE_LETSENCRYPT_FULLCHAIN="/etc/letsencrypt/live/$domain/fullchain.pem"
VALUE_LETSENCRYPT_PRIVKEY="/etc/letsencrypt/live/$domain/privkey.pem"
if [ -e $VALUE_LETSENCRYPT_FULLCHAIN ] && [ -e $VALUE_LETSENCRYPT_PRIVKEY ]; then
print_log "SSL certificates are already installed"
else
print_log "Installing SSL certificates"
certbot certonly --standalone --non-interactive --agree-tos --email $mail -d $domain
fi
local letsencrypt_domain_conf="/etc/letsencrypt/renewal/$domain.conf"
local letsencrypt_add_line="renew_hook = systemctl reload xray"
if ! grep -Fxq "$letsencrypt_add_line" "$letsencrypt_domain_conf"; then
echo "$letsencrypt_add_line" >> "$letsencrypt_domain_conf"
fi
}
xray_update_config_template() {
VALUE_XRAY_USER_PASSWORD="$(tr -dc 'A-Za-z0-9' < /dev/urandom | head -c 18)"
VALUE_XRAY_USER_PASSWORD_BASE64=$(echo -n "$VALUE_XRAY_USER_PASSWORD" | base64)
VALUE_XRAY_USER_UUID=$(cat /proc/sys/kernel/random/uuid)
VALUE_XRAY_WS_PATH="$(tr -dc 'a-z' < /dev/urandom | head -c 24)"
replace_text_in_file "LETSENCRYPT_FULLCHAIN" $VALUE_LETSENCRYPT_FULLCHAIN $XRAY_CONFIG_PATH
replace_text_in_file "LETSENCRYPT_PRIVKEY" $VALUE_LETSENCRYPT_PRIVKEY $XRAY_CONFIG_PATH
replace_text_in_file "SHADOWSOCKS_PORT" $VALUE_XRAY_SHADOWSOCKS_PORT $XRAY_CONFIG_PATH
replace_text_in_file "ENCRYPTION_METHOD" $VALUE_ENCRYPTION_METHOD $XRAY_CONFIG_PATH
replace_text_in_file "PASSWORD" $VALUE_XRAY_USER_PASSWORD_BASE64 $XRAY_CONFIG_PATH
replace_text_in_file "CLIENT_UUID" $VALUE_XRAY_USER_UUID $XRAY_CONFIG_PATH
replace_text_in_file "CLIENT_MAIL" $VALUE_YOUR_EMAIL $XRAY_CONFIG_PATH
replace_text_in_file "WEBSOCKET_PATH" $VALUE_XRAY_WS_PATH $XRAY_CONFIG_PATH
}
nginx_update_default_config() {
print_log "Replace default nginx config"
if [ -e $NGINX_DEFAULT_CONFIG_LINK ]; then
rm -f $NGINX_DEFAULT_CONFIG_LINK
fi
wget -O $NGINX_NEW_CONFIG $REPO_NGINX_CONFIG
}
xray_set_vless_config_type() {
local select_type_number
local select_type
print_log "Select VLESS type:"
print_log "1: Standard - direct connection to the server by domain"
print_log "2: WebSocket - connect to the server by domain, BUT using Cloudflare proxy"
while true; do
read select_type_number < /dev/tty
case "$select_type_number" in
1)
select_type="def"
break
;;
2)
select_type="ws"
break
;;
*)
;;
esac
done
if [ "$select_type" = "ws" ]; then
VALUE_XRAY_SELECT_USER_CONFIG=$REPO_XRAY_CONFIG_VLESS_WS
wget -O $CONFIG_VLESS_LINK_CLIENT_PATH $REPO_XRAY_CONFIG_VLESS_LINK_WS
else
VALUE_XRAY_SELECT_USER_CONFIG=$REPO_XRAY_CONFIG_VLESS
wget -O $CONFIG_VLESS_LINK_CLIENT_PATH $REPO_XRAY_CONFIG_VLESS_LINK
fi
replace_text_in_file "CLIENT_UUID" $VALUE_XRAY_USER_UUID $CONFIG_VLESS_LINK_CLIENT_PATH
replace_text_in_file "WEBSOCKET_PATH" $VALUE_XRAY_WS_PATH $CONFIG_VLESS_LINK_CLIENT_PATH
replace_text_in_file "DOMAIN_NAME" $VALUE_YOUR_DOMAIN $CONFIG_VLESS_LINK_CLIENT_PATH
wget -O $CONFIG_SHADOWSOCKS_LINK_CLIENT_PATH $REPO_XRAY_CONFIG_SHADOWSOCKS_LINK
replace_text_in_file "PASSWORD" $VALUE_XRAY_USER_PASSWORD_BASE64 $CONFIG_SHADOWSOCKS_LINK_CLIENT_PATH
replace_text_in_file "SERVER_IP" $(curl -s ifconfig.me) $CONFIG_SHADOWSOCKS_LINK_CLIENT_PATH
replace_text_in_file "SHADOWSOCKS_PORT" $VALUE_XRAY_SHADOWSOCKS_PORT $CONFIG_SHADOWSOCKS_LINK_CLIENT_PATH
replace_text_in_file "ENCRYPTION_METHOD" $VALUE_ENCRYPTION_METHOD $CONFIG_SHADOWSOCKS_LINK_CLIENT_PATH
VALUE_XRAY_VLESS_CONNECT=$(cat $CONFIG_VLESS_LINK_CLIENT_PATH)
VALUE_XRAY_SHADOWSOCKS_CONNECT=$(cat $CONFIG_SHADOWSOCKS_LINK_CLIENT_PATH)
print_log "Select config: $VALUE_XRAY_SELECT_USER_CONFIG"
}
xray_update_user_config_template() {
wget -O $CONFIG_VLESS_CLIENT_PATH $VALUE_XRAY_SELECT_USER_CONFIG
replace_text_in_file "CLIENT_UUID" $VALUE_XRAY_USER_UUID $CONFIG_VLESS_CLIENT_PATH
replace_text_in_file "WEBSOCKET_PATH" $VALUE_XRAY_WS_PATH $CONFIG_VLESS_CLIENT_PATH
replace_text_in_file "DOMAIN_NAME" $VALUE_YOUR_DOMAIN $CONFIG_VLESS_CLIENT_PATH
}
print_result_install() {
print_log "Your user vless config:"
print_log "---------------------"
print_log "> ! SAVE PASSWORD ! <"
print_log $VALUE_XRAY_USER_PASSWORD
print_log "---------------------"
echo ""
echo ""
cat $CONFIG_VLESS_CLIENT_PATH
echo ""
echo ""
print_log "---------------------"
print_log "> VLESS CONNECT LUNK <"
print_log $VALUE_XRAY_VLESS_CONNECT
print_log "---------------------"
print_log "> SHADOWSOCKS CONNECT LUNK <"
print_log $VALUE_XRAY_SHADOWSOCKS_CONNECT
print_log "---------------------"
print_log "Config path: $CONFIG_VLESS_CLIENT_PATH"
print_log "If you need get info, print: cat $CONFIG_VLESS_CLIENT_PATH"
print_log "---------------------"
print_log "Vless connect link: $CONFIG_VLESS_LINK_CLIENT_PATH"
print_log "If you need get vless link, print: cat $CONFIG_VLESS_LINK_CLIENT_PATH"
print_log "---------------------"
print_log "Shadowsocks connect link: $CONFIG_SHADOWSOCKS_LINK_CLIENT_PATH"
print_log "If you need get shadowsocks link, print: cat $CONFIG_SHADOWSOCKS_LINK_CLIENT_PATH"
print_log "---------------------"
print_log "Shadowsocks password path: $CONFIG_SHADOWSOCKS_PASSWORD_PATH"
print_log "If you need get shadowsocks password, print: cat $CONFIG_SHADOWSOCKS_PASSWORD_PATH"
print_log "---------------------"
print_log "@+@+@+@+@+@+@+@+@+@+@"
print_log "Allow installed!"
print_log "@+@+@+@+@+@+@+@+@+@+@"
}
remove_xray() {
docker rm -f waro-xray
systemctl stop nginx.service
systemctl stop xray.service
if [ -e $CONFIG_DIST_PATH ]; then
rm -rf $CONFIG_DIST_PATH
print_log "Remove: '$CONFIG_DIST_PATH'"
fi
if [ -e "$HOME/warp-xray" ]; then
rm -rf "$HOME/warp-xray"
print_log "Remove: '$HOME/warp-xray'"
fi
if [ -e $NGINX_NEW_CONFIG ]; then
rm -f $NGINX_NEW_CONFIG
print_log "Remove: '$NGINX_NEW_CONFIG'"
fi
if [ -e $NGINX_DEFAULT_CONFIG_SRC ] && [ ! -e $NGINX_DEFAULT_CONFIG_LINK ]; then
ln -s $NGINX_DEFAULT_CONFIG_SRC $NGINX_DEFAULT_CONFIG_LINK
print_log "Link: '$NGINX_DEFAULT_CONFIG_LINK'"
fi
if [ -e $XRAY_CONFIG_PATH ]; then
rm -f $XRAY_CONFIG_PATH
print_log "Remove: '$XRAY_CONFIG_PATH'"
fi
print_log "Remove git script '$XRAY_GIT_SCRIPT'"
bash -c "$(curl -L $XRAY_GIT_SCRIPT)" @ remove --purge
systemctl start nginx.service
print_log "Start nginx service"
check_service "nginx"
}
set_outbounds_proxy() {
if ! confirm_changes "Do you want to hide the server IP to the outside world?"; then
return
fi
local select_type_number
while true; do
print_log "Select the type of proxy (Default: WARP):"
print_log "1. WARP (Cloudflare)"
print_log "2. TOR (Tor network)"
read -r select_type_number < /dev/tty
case "$select_type_number" in
1)
VALUE_OUTBOUNDS_PROXY="warp"
;;
2)
VALUE_OUTBOUNDS_PROXY="tor"
;;
*)
VALUE_OUTBOUNDS_PROXY="warp"
;;
esac
if confirm_changes "'$VALUE_OUTBOUNDS_PROXY' - Is this the correct method?"; then
break
fi
print_error "Method not correct. Try again."
done
}
install_xray() {
if [ "$PARAM_RENEW_CONFIG" = "0" ]; then
apt_update
apt_install "curl"
if ! curl --head --silent --fail "$XRAY_GIT_SCRIPT" > /dev/null; then
echo "File $XRAY_GIT_SCRIPT not found :("
return 0
fi
apt_install "ca-certificates"
apt_install "wget"
apt_install "git"
apt_install "nginx"
apt_install "certbot"
apt_install "qrencode"
print_log "Run git script '$XRAY_GIT_SCRIPT'"
bash -c "$(curl -L $XRAY_GIT_SCRIPT)" @ install -u root
fi
systemctl stop nginx.service
systemctl stop xray.service
read_domain
read_mail
letsencrypt_install_cert_from_domain $VALUE_YOUR_DOMAIN $VALUE_YOUR_EMAIL
mkdir $CONFIG_DIST_PATH
if [ "$PARAM_INSTALL_CUSTOMIZE" = "1" ]; then
set_shadowsocks_port
set_encryption_method
set_outbounds_proxy
case "$VALUE_OUTBOUNDS_PROXY" in
"tor")
wget -O $XRAY_CONFIG_PATH $REPO_XRAY_CONFIG_TOR
install_tor_network
;;
"warp")
wget -O $XRAY_CONFIG_PATH $REPO_XRAY_CONFIG_WARP
install_docker
install_warp_docker
;;
*)
wget -O $XRAY_CONFIG_PATH $REPO_XRAY_CONFIG
;;
esac
else
wget -O $XRAY_CONFIG_PATH $REPO_XRAY_CONFIG
fi
xray_update_config_template
nginx_update_default_config
xray_set_vless_config_type
xray_update_user_config_template
journalctl --vacuum-time=1s -u xray
systemctl restart systemd-journald
systemctl start nginx.service
systemctl start xray.service
check_service "nginx"
check_service "xray"
write_text_in_file \
$CONFIG_SHADOWSOCKS_PASSWORD_PATH \
$VALUE_XRAY_USER_PASSWORD
print_result_install
}
print_help() {
print_log "Arguments:"
print_log "--help - Print help info"
print_log "--install - Installing Xray"
print_log "--remove - Deletes Xray"
print_log "--reinstall - Reinstalls all configs and services"
print_log "--renew - Reinstalls ONLY configuration files, without reinstalling services"
print_log "--vless-qr - Outputs the Vless connection code to the terminal"
print_log "--shadowsocks-qr - Outputs the Shadowsocks connection code to the terminal"
}
while [[ $# -gt 0 ]]; do
case $1 in
--help)
print_help
exit 0
;;
--install-expert)
PARAM_INSTALL_CUSTOMIZE="1"
install_xray
exit 0
;;
--install)
install_xray
exit 0
;;
--reinstall)
remove_xray
install_xray
exit 0
;;
--renew)
PARAM_RENEW_CONFIG="1"
install_xray
exit 0
;;
--vless-qr)
if [ -e $CONFIG_VLESS_LINK_CLIENT_PATH ]; then
qrencode -t ASCII "$(cat $CONFIG_VLESS_LINK_CLIENT_PATH)"
else
print_error "File $CONFIG_VLESS_LINK_CLIENT_PATH not found!"
fi
exit 0
;;
--shadowsocks-qr)
if [ -e $CONFIG_SHADOWSOCKS_LINK_CLIENT_PATH ]; then
qrencode -t ASCII "$(cat $CONFIG_SHADOWSOCKS_LINK_CLIENT_PATH)"
else
print_error "File $CONFIG_SHADOWSOCKS_LINK_CLIENT_PATH not found!"
fi
exit 0
;;
--remove)
remove_xray
exit 0
;;
*)
print_error "The unknown argument"
print_help
exit 1
;;
esac
shift
done
print_help