Skip to content

Commit e66d07f

Browse files
committed
default add reality; add (add) command usage tips
1 parent babd38c commit e66d07f

File tree

4 files changed

+27
-12
lines changed

4 files changed

+27
-12
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
- 兼容 Xray 命令
1616
- 强大的快捷参数
1717
- 支持所有常用协议
18+
- 一键添加 VLESS-REALITY (默认)
1819
- 一键添加 Shadowsocks 2022
1920
- 一键添加 VMess-(TCP/mKCP/QUIC)
2021
- 一键添加 VMess-(WS/H2/gRPC)-TLS
2122
- 一键添加 VLESS-(WS/H2/gRPC)-TLS
2223
- 一键添加 Trojan-(WS/H2/gRPC)-TLS
23-
- 一键添加 VLESS-XTLS-uTLS-REALITY
2424
- 一键添加 VMess-(TCP/mKCP/QUIC) 动态端口
2525
- 一键启用 BBR
2626
- 一键更改伪装网站

install.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ main() {
425425

426426
load core.sh
427427
# create a tcp config
428-
add tcp
428+
add reality
429429
# remove tmp dir and exit.
430430
exit_and_del_tmpdir ok
431431
}

src/core.sh

+24-9
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ protocol_list=(
1010
VLESS-H2-TLS
1111
VLESS-WS-TLS
1212
VLESS-gRPC-TLS
13-
VLESS-XTLS-uTLS-REALITY
13+
VLESS-REALITY
1414
Trojan-H2-TLS
1515
Trojan-WS-TLS
1616
Trojan-gRPC-TLS
@@ -880,7 +880,7 @@ add() {
880880
is_new_protocol=$(sed -E "s/^V/VLESS-/;s/^T/Trojan-/;/^(W|H|G)/{s/^/VMess-/};s/G/g/" <<<${is_lower^^})-TLS
881881
;;
882882
r | reality)
883-
is_new_protocol=VLESS-XTLS-uTLS-REALITY
883+
is_new_protocol=VLESS-REALITY
884884
;;
885885
ss)
886886
is_new_protocol=Shadowsocks
@@ -913,6 +913,7 @@ add() {
913913
is_use_host=$2
914914
is_use_uuid=$3
915915
is_use_path=$4
916+
is_add_opts="[host] [uuid] [/path]"
916917
;;
917918
vmess*)
918919
is_use_port=$2
@@ -921,35 +922,49 @@ add() {
921922
is_use_dynamic_port_start=$5
922923
is_use_dynamic_port_end=$6
923924
[[ $(grep dynamic-port <<<$is_new_protocol) ]] && is_dynamic_port=1
925+
if [[ $is_dynamic_port ]]; then
926+
is_add_opts="[port] [uuid] [type] [start_port] [end_port]"
927+
else
928+
is_add_opts="[port] [uuid] [type]"
929+
fi
924930
;;
925931
*reality*)
926932
is_reality=1
927933
is_use_port=$2
928934
is_use_uuid=$3
929935
is_use_servername=$4
936+
is_add_opts="[port] [uuid] [sni]"
930937
;;
931938
shadowsocks)
932939
is_use_port=$2
933940
is_use_pass=$3
934941
is_use_method=$4
942+
is_add_opts="[port] [password] [method]"
935943
;;
936944
*door)
937945
is_use_port=$2
938946
is_use_door_addr=$3
939947
is_use_door_port=$4
948+
is_add_opts="[port] [remote_addr] [remote_port]"
940949
;;
941950
socks)
942951
is_socks=1
943952
is_use_port=$2
944953
is_use_socks_user=$3
945954
is_use_socks_pass=$4
955+
is_add_opts="[port] [username] [password]"
946956
;;
947957
*http)
948958
is_use_port=$2
959+
is_add_opts="[port]"
949960
;;
950961
esac
951962

952-
[[ $1 && ! $is_change ]] && msg "\n使用协议: $is_new_protocol"
963+
[[ $1 && ! $is_change ]] && {
964+
msg "\n使用协议: $is_new_protocol"
965+
# err msg tips
966+
is_err_tips="\n\n请使用: $(_green $is_core add $1 $is_add_opts) 来添加 $is_new_protocol 配置"
967+
}
953968

954969
# remove old protocol args
955970
if [[ $is_set_new_protocol ]]; then
@@ -998,28 +1013,28 @@ add() {
9981013

9991014
if [[ $is_use_port ]]; then
10001015
[[ ! $(is_test port ${is_use_port}) ]] && {
1001-
err "($is_use_port) 不是一个有效的端口."
1016+
err "($is_use_port) 不是一个有效的端口. $is_err_tips"
10021017
}
10031018
[[ $(is_test port_used $is_use_port) ]] && {
1004-
err "无法使用 ($is_use_port) 端口."
1019+
err "无法使用 ($is_use_port) 端口. $is_err_tips"
10051020
}
10061021
port=$is_use_port
10071022
fi
10081023
if [[ $is_use_door_port ]]; then
10091024
[[ ! $(is_test port ${is_use_door_port}) ]] && {
1010-
err "(${is_use_door_port}) 不是一个有效的目标端口."
1025+
err "(${is_use_door_port}) 不是一个有效的目标端口. $is_err_tips"
10111026
}
10121027
door_port=$is_use_door_port
10131028
fi
10141029
if [[ $is_use_uuid ]]; then
10151030
[[ ! $(is_test uuid $is_use_uuid) ]] && {
1016-
err "($is_use_uuid) 不是一个有效的 UUID."
1031+
err "($is_use_uuid) 不是一个有效的 UUID. $is_err_tips"
10171032
}
10181033
uuid=$is_use_uuid
10191034
fi
10201035
if [[ $is_use_path ]]; then
10211036
[[ ! $(is_test path $is_use_path) ]] && {
1022-
err "($is_use_path) 不是有效的路径."
1037+
err "($is_use_path) 不是有效的路径. $is_err_tips"
10231038
}
10241039
path=$is_use_path
10251040
fi
@@ -1039,7 +1054,7 @@ add() {
10391054
for v in ${is_tmp_list[@]}; do
10401055
msg "\t\t$v"
10411056
done
1042-
msg
1057+
msg "$is_err_tips\n"
10431058
exit 1
10441059
}
10451060
ss_method=$is_tmp_use_type

xray.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

33
args=$@
4-
is_sh_ver=v1.17
4+
is_sh_ver=v1.18
55

66
. /etc/xray/sh/src/init.sh

0 commit comments

Comments
 (0)