-
Notifications
You must be signed in to change notification settings - Fork 3
/
add-xtls.sh
59 lines (50 loc) · 1.74 KB
/
add-xtls.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
#!/bin/bash
clear
source /var/lib/premium-script/ipvps.conf
if [[ "$IP" = "" ]]; then
domain=$(cat /etc/v2ray/domain)
else
domain=$IP
fi
# // Vless
vless1="$( cat /etc/xray/vless-direct.json | grep -w port | awk '{print $2}' | sed 's/,//g' )"
until [[ $user =~ ^[a-zA-Z0-9_]+$ && ${CLIENT_EXISTS} == '0' ]]; do
read -rp "User: " -e user
CLIENT_EXISTS=$(grep -w $user /etc/xray/vless-direct.json | wc -l)
if [[ ${CLIENT_EXISTS} == '1' ]]; then
echo ""
echo "A client with the specified name was already created, please choose another name."
exit 1
fi
done
uuid=$(cat /proc/sys/kernel/random/uuid)
read -p "Expired (days): " masaaktif
exp=`date -d "$masaaktif days" +"%Y-%m-%d"`
# // Input To Server
sed -i '/#XRay$/a\### '"$user $exp"'\
},{"id": "'""$uuid""'","flow": "xtls-rprx-direct","email": "'""$user""'"' /etc/xray/vless-direct.json
vless_direct="vless://${uuid}@${domain}:${vless1}?security=xtls&encryption=none&headerType=none&type=tcp&flow=xtls-rprx-direct&sni=bug.jinggo#$user"
# // Restarting Service
systemctl stop xray@vless-direct
systemctl disable xray@vless-direct
systemctl enable xray@vless-direct
systemctl start xray@vless-direct
systemctl restart xray@vless-direct
clear
echo -e ""
echo -e "==========-XRAYS VLESS XTLS-=========="
echo -e "Remarks : ${user}"
echo -e "Expired On : $exp"
echo -e "Domain : ${domain}"
echo -e "Port Direct : $vless1"
echo -e "id : ${uuid}"
echo -e "path : /xray"
echo -e "================================="
echo -e "Link Direct : ${vless_direct}"
echo -e ""
echo -e "================================="
echo -e "Gantikan bug.jinggo dengan BUG anda"
echo -e "================================="
echo ""
read -n 1 -s -r -p "Press any key to back on menu"
menu