-
Notifications
You must be signed in to change notification settings - Fork 426
/
reality.sh
144 lines (131 loc) · 3.97 KB
/
reality.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
#!/bin/sh
# forum: https://1024.day
if [[ $EUID -ne 0 ]]; then
clear
echo "Error: This script must be run as root!" 1>&2
exit 1
fi
timedatectl set-timezone Asia/Shanghai
v2uuid=$(cat /proc/sys/kernel/random/uuid)
read -t 15 -p "回车或等待15秒为默认端口443,或者自定义端口请输入(1-65535):" getPort
if [ -z $getPort ];then
getPort=443
fi
getIP(){
local serverIP=
serverIP=$(curl -s -4 http://www.cloudflare.com/cdn-cgi/trace | grep "ip" | awk -F "[=]" '{print $2}')
if [[ -z "${serverIP}" ]]; then
serverIP=$(curl -s -6 http://www.cloudflare.com/cdn-cgi/trace | grep "ip" | awk -F "[=]" '{print $2}')
fi
echo "${serverIP}"
}
install_xray(){
if [ -f "/usr/bin/apt-get" ]; then
apt-get update -y && apt-get upgrade -y
apt-get install -y gawk curl
else
yum update -y && yum upgrade -y
yum install -y epel-release
yum install -y gawk curl
fi
bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install
}
reconfig(){
reX25519Key=$(/usr/local/bin/xray x25519)
rePrivateKey=$(echo "${reX25519Key}" | head -1 | awk '{print $3}')
rePublicKey=$(echo "${reX25519Key}" | tail -n 1 | awk '{print $3}')
cat >/usr/local/etc/xray/config.json<<EOF
{
"inbounds": [
{
"port": $getPort,
"protocol": "vless",
"settings": {
"clients": [
{
"id": "$v2uuid",
"flow": "xtls-rprx-vision"
}
],
"decryption": "none"
},
"streamSettings": {
"network": "tcp",
"security": "reality",
"realitySettings": {
"show": false,
"dest": "www.amazon.com:443",
"xver": 0,
"serverNames": [
"www.amazon.com",
"addons.mozilla.org",
"www.un.org",
"www.tesla.com"
],
"privateKey": "$rePrivateKey",
"minClientVer": "",
"maxClientVer": "",
"maxTimeDiff": 0,
"shortIds": [
"88",
"123abc"
]
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"tag": "direct"
},
{
"protocol": "blackhole",
"tag": "blocked"
}
]
}
EOF
systemctl enable xray.service && systemctl restart xray.service
rm -f tcp-wss.sh install-release.sh reality.sh
cat >/usr/local/etc/xray/reclient.json<<EOF
{
===========配置参数=============
代理模式:vless
地址:$(getIP)
端口:${getPort}
UUID:${v2uuid}
流控:xtls-rprx-vision
传输协议:tcp
Public key:${rePublicKey}
底层传输:reality
SNI: www.amazon.com
shortIds: 88
====================================
vless://${v2uuid}@$(getIP):${getPort}?encryption=none&flow=xtls-rprx-vision&security=reality&sni=www.amazon.com&fp=chrome&pbk=${rePublicKey}&sid=88&type=tcp&headerType=none#1024-reality
}
EOF
clear
}
client_re(){
echo
echo "安装已经完成"
echo
echo "===========reality配置参数============"
echo "代理模式:vless"
echo "地址:$(getIP)"
echo "端口:${getPort}"
echo "UUID:${v2uuid}"
echo "流控:xtls-rprx-vision"
echo "传输协议:tcp"
echo "Public key:${rePublicKey}"
echo "底层传输:reality"
echo "SNI: www.amazon.com"
echo "shortIds: 88"
echo "===================================="
echo "vless://${v2uuid}@$(getIP):${getPort}?encryption=none&flow=xtls-rprx-vision&security=reality&sni=www.amazon.com&fp=chrome&pbk=${rePublicKey}&sid=88&type=tcp&headerType=none#1024-reality"
echo
}
install_xray
reconfig
client_re