add (add) command usage tips
This commit is contained in:
28
src/core.sh
28
src/core.sh
@@ -918,6 +918,7 @@ add() {
|
|||||||
is_use_host=$2
|
is_use_host=$2
|
||||||
is_use_uuid=$3
|
is_use_uuid=$3
|
||||||
is_use_path=$4
|
is_use_path=$4
|
||||||
|
is_add_opts="[host] [uuid] [/path]"
|
||||||
;;
|
;;
|
||||||
vmess*)
|
vmess*)
|
||||||
is_use_port=$2
|
is_use_port=$2
|
||||||
@@ -926,6 +927,11 @@ add() {
|
|||||||
is_use_dynamic_port_start=$5
|
is_use_dynamic_port_start=$5
|
||||||
is_use_dynamic_port_end=$6
|
is_use_dynamic_port_end=$6
|
||||||
[[ $(grep dynamic-port <<<$is_new_protocol) ]] && is_dynamic_port=1
|
[[ $(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*)
|
# *reality*)
|
||||||
# is_reality=1
|
# is_reality=1
|
||||||
@@ -937,24 +943,32 @@ add() {
|
|||||||
is_use_port=$2
|
is_use_port=$2
|
||||||
is_use_pass=$3
|
is_use_pass=$3
|
||||||
is_use_method=$4
|
is_use_method=$4
|
||||||
|
is_add_opts="[port] [password] [method]"
|
||||||
;;
|
;;
|
||||||
*door)
|
*door)
|
||||||
is_use_port=$2
|
is_use_port=$2
|
||||||
is_use_door_addr=$3
|
is_use_door_addr=$3
|
||||||
is_use_door_port=$4
|
is_use_door_port=$4
|
||||||
|
is_add_opts="[port] [remote_addr] [remote_port]"
|
||||||
;;
|
;;
|
||||||
socks)
|
socks)
|
||||||
is_socks=1
|
is_socks=1
|
||||||
is_use_port=$2
|
is_use_port=$2
|
||||||
is_use_socks_user=$3
|
is_use_socks_user=$3
|
||||||
is_use_socks_pass=$4
|
is_use_socks_pass=$4
|
||||||
|
is_add_opts="[port] [username] [password]"
|
||||||
;;
|
;;
|
||||||
*http)
|
*http)
|
||||||
is_use_port=$2
|
is_use_port=$2
|
||||||
|
is_add_opts="[port]"
|
||||||
;;
|
;;
|
||||||
esac
|
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
|
# remove old protocol args
|
||||||
if [[ $is_set_new_protocol ]]; then
|
if [[ $is_set_new_protocol ]]; then
|
||||||
@@ -1003,28 +1017,28 @@ add() {
|
|||||||
|
|
||||||
if [[ $is_use_port ]]; then
|
if [[ $is_use_port ]]; then
|
||||||
[[ ! $(is_test port ${is_use_port}) ]] && {
|
[[ ! $(is_test port ${is_use_port}) ]] && {
|
||||||
err "($is_use_port) 不是一个有效的端口."
|
err "($is_use_port) 不是一个有效的端口. $is_err_tips"
|
||||||
}
|
}
|
||||||
[[ $(is_test port_used $is_use_port) ]] && {
|
[[ $(is_test port_used $is_use_port) ]] && {
|
||||||
err "无法使用 ($is_use_port) 端口."
|
err "无法使用 ($is_use_port) 端口. $is_err_tips"
|
||||||
}
|
}
|
||||||
port=$is_use_port
|
port=$is_use_port
|
||||||
fi
|
fi
|
||||||
if [[ $is_use_door_port ]]; then
|
if [[ $is_use_door_port ]]; then
|
||||||
[[ ! $(is_test port ${is_use_door_port}) ]] && {
|
[[ ! $(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
|
door_port=$is_use_door_port
|
||||||
fi
|
fi
|
||||||
if [[ $is_use_uuid ]]; then
|
if [[ $is_use_uuid ]]; then
|
||||||
[[ ! $(is_test uuid $is_use_uuid) ]] && {
|
[[ ! $(is_test uuid $is_use_uuid) ]] && {
|
||||||
err "($is_use_uuid) 不是一个有效的 UUID."
|
err "($is_use_uuid) 不是一个有效的 UUID. $is_err_tips"
|
||||||
}
|
}
|
||||||
uuid=$is_use_uuid
|
uuid=$is_use_uuid
|
||||||
fi
|
fi
|
||||||
if [[ $is_use_path ]]; then
|
if [[ $is_use_path ]]; then
|
||||||
[[ ! $(is_test path $is_use_path) ]] && {
|
[[ ! $(is_test path $is_use_path) ]] && {
|
||||||
err "($is_use_path) 不是有效的路径."
|
err "($is_use_path) 不是有效的路径. $is_err_tips"
|
||||||
}
|
}
|
||||||
path=$is_use_path
|
path=$is_use_path
|
||||||
fi
|
fi
|
||||||
@@ -1044,7 +1058,7 @@ add() {
|
|||||||
for v in ${is_tmp_list[@]}; do
|
for v in ${is_tmp_list[@]}; do
|
||||||
msg "\t\t$v"
|
msg "\t\t$v"
|
||||||
done
|
done
|
||||||
msg
|
msg "$is_err_tips\n"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
ss_method=$is_tmp_use_type
|
ss_method=$is_tmp_use_type
|
||||||
|
Reference in New Issue
Block a user