Skip to content

Commit

Permalink
default add reality; add (add) command usage tips
Browse files Browse the repository at this point in the history
  • Loading branch information
233boy committed Feb 1, 2024
1 parent babd38c commit e66d07f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
- 兼容 Xray 命令
- 强大的快捷参数
- 支持所有常用协议
- 一键添加 VLESS-REALITY (默认)
- 一键添加 Shadowsocks 2022
- 一键添加 VMess-(TCP/mKCP/QUIC)
- 一键添加 VMess-(WS/H2/gRPC)-TLS
- 一键添加 VLESS-(WS/H2/gRPC)-TLS
- 一键添加 Trojan-(WS/H2/gRPC)-TLS
- 一键添加 VLESS-XTLS-uTLS-REALITY
- 一键添加 VMess-(TCP/mKCP/QUIC) 动态端口
- 一键启用 BBR
- 一键更改伪装网站
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ main() {

load core.sh
# create a tcp config
add tcp
add reality
# remove tmp dir and exit.
exit_and_del_tmpdir ok
}
Expand Down
33 changes: 24 additions & 9 deletions src/core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ protocol_list=(
VLESS-H2-TLS
VLESS-WS-TLS
VLESS-gRPC-TLS
VLESS-XTLS-uTLS-REALITY
VLESS-REALITY
Trojan-H2-TLS
Trojan-WS-TLS
Trojan-gRPC-TLS
Expand Down Expand Up @@ -880,7 +880,7 @@ add() {
is_new_protocol=$(sed -E "s/^V/VLESS-/;s/^T/Trojan-/;/^(W|H|G)/{s/^/VMess-/};s/G/g/" <<<${is_lower^^})-TLS
;;
r | reality)
is_new_protocol=VLESS-XTLS-uTLS-REALITY
is_new_protocol=VLESS-REALITY
;;
ss)
is_new_protocol=Shadowsocks
Expand Down Expand Up @@ -913,6 +913,7 @@ add() {
is_use_host=$2
is_use_uuid=$3
is_use_path=$4
is_add_opts="[host] [uuid] [/path]"
;;
vmess*)
is_use_port=$2
Expand All @@ -921,35 +922,49 @@ add() {
is_use_dynamic_port_start=$5
is_use_dynamic_port_end=$6
[[ $(grep dynamic-port <<<$is_new_protocol) ]] && is_dynamic_port=1
if [[ $is_dynamic_port ]]; then
is_add_opts="[port] [uuid] [type] [start_port] [end_port]"
else
is_add_opts="[port] [uuid] [type]"
fi
;;
*reality*)
is_reality=1
is_use_port=$2
is_use_uuid=$3
is_use_servername=$4
is_add_opts="[port] [uuid] [sni]"
;;
shadowsocks)
is_use_port=$2
is_use_pass=$3
is_use_method=$4
is_add_opts="[port] [password] [method]"
;;
*door)
is_use_port=$2
is_use_door_addr=$3
is_use_door_port=$4
is_add_opts="[port] [remote_addr] [remote_port]"
;;
socks)
is_socks=1
is_use_port=$2
is_use_socks_user=$3
is_use_socks_pass=$4
is_add_opts="[port] [username] [password]"
;;
*http)
is_use_port=$2
is_add_opts="[port]"
;;
esac

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

# remove old protocol args
if [[ $is_set_new_protocol ]]; then
Expand Down Expand Up @@ -998,28 +1013,28 @@ add() {

if [[ $is_use_port ]]; then
[[ ! $(is_test port ${is_use_port}) ]] && {
err "($is_use_port) 不是一个有效的端口."
err "($is_use_port) 不是一个有效的端口. $is_err_tips"
}
[[ $(is_test port_used $is_use_port) ]] && {
err "无法使用 ($is_use_port) 端口."
err "无法使用 ($is_use_port) 端口. $is_err_tips"
}
port=$is_use_port
fi
if [[ $is_use_door_port ]]; then
[[ ! $(is_test port ${is_use_door_port}) ]] && {
err "(${is_use_door_port}) 不是一个有效的目标端口."
err "(${is_use_door_port}) 不是一个有效的目标端口. $is_err_tips"
}
door_port=$is_use_door_port
fi
if [[ $is_use_uuid ]]; then
[[ ! $(is_test uuid $is_use_uuid) ]] && {
err "($is_use_uuid) 不是一个有效的 UUID."
err "($is_use_uuid) 不是一个有效的 UUID. $is_err_tips"
}
uuid=$is_use_uuid
fi
if [[ $is_use_path ]]; then
[[ ! $(is_test path $is_use_path) ]] && {
err "($is_use_path) 不是有效的路径."
err "($is_use_path) 不是有效的路径. $is_err_tips"
}
path=$is_use_path
fi
Expand All @@ -1039,7 +1054,7 @@ add() {
for v in ${is_tmp_list[@]}; do
msg "\t\t$v"
done
msg
msg "$is_err_tips\n"
exit 1
}
ss_method=$is_tmp_use_type
Expand Down
2 changes: 1 addition & 1 deletion xray.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

args=$@
is_sh_ver=v1.17
is_sh_ver=v1.18

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

0 comments on commit e66d07f

Please sign in to comment.