Skip to content

Commit

Permalink
Add v0.7.0 for simple-tls.
Browse files Browse the repository at this point in the history
  • Loading branch information
loyess committed Apr 9, 2024
1 parent d25dc39 commit 24f984e
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 13 deletions.
41 changes: 35 additions & 6 deletions prepare/simple_tls_prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ improt_package "utils" "gen_certificates.sh"
SIMPLE_TLS_VERSION=(
v0.3.4
v0.4.7
v0.7.0
latest
)

Expand Down Expand Up @@ -65,7 +66,31 @@ is_enable_padding_data_for_v047(){
done
}

is_enable_auth_for_latest(){
is_enable_ws_for_v070(){
while true
do
echo
_read "是否启用WebSocket (ws) (默认: n) [y/n]: "
local yn="${inputInfo}"
[ -z "${yn}" ] && yn="N"
case "${yn:0:1}" in
y|Y)
isEnableWs=enable
;;
n|N)
isEnableWs=disable
;;
*)
_echo -e "输入有误,请重新输入."
continue
;;
esac
_echo -r " ws = ${isEnableWs}"
break
done
}

is_enable_auth_for_v070(){
while true
do
echo
Expand All @@ -89,7 +114,7 @@ is_enable_auth_for_latest(){
done
}

get_input_auth_passwd_for_latest(){
get_input_auth_passwd_for_v070(){
gen_random_str
_read "请输入身份验证密码 (默认: ${ran_str12}):"
auth="${inputInfo}"
Expand Down Expand Up @@ -162,7 +187,7 @@ version_047_logic(){
fi
}

version_latest_logic(){
version_v070_logic(){
do_you_have_domain
if [ "${doYouHaveDomian}" = "No" ]; then
firewallNeedOpenPort="${shadowsocksport}"
Expand All @@ -177,9 +202,13 @@ version_latest_logic(){
get_specified_type_domain "DNS-Only"
fi
is_disable_mux_logic
is_enable_auth_for_latest
is_enable_auth_for_v070
if [ "${isEnableAuth}" = "enable" ]; then
get_input_auth_passwd_for_latest
get_input_auth_passwd_for_v070
fi
is_enable_ws_for_v070
if [ "${isEnableWs}" = "enable" ]; then
get_input_ws_path
fi
if [ "${domainType}" = "DNS-Only" ]; then
acme_get_certificate_by_force "${domain}"
Expand All @@ -195,6 +224,6 @@ install_prepare_libev_simple_tls(){
elif [ "${SimpleTlsVer}" = "2" ]; then
version_047_logic
elif [ "${SimpleTlsVer}" = "3" ]; then
version_latest_logic
version_v070_logic
fi
}
4 changes: 4 additions & 0 deletions templates/config/simple_tls_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ config_ss_simple_tls(){
fi
ss_plugin_server_config
# ata: against traffic analysis
if [ "${isEnableWs}" = "enable" ]; then
wsArgs=";ws;ws-path=${path}"
sed "s|\"plugin_opts\":\"s|\"plugin_opts\":\"s;ws;ws-path=${path}|" -i "${SHADOWSOCKS_CONFIG}"
fi
if [ "${isEnableRh}" = "enable" ]; then
ataArgs=';rh'
sed 's/"plugin_opts":"s/"plugin_opts":"s;rh/' -i "${SHADOWSOCKS_CONFIG}"
Expand Down
6 changes: 3 additions & 3 deletions templates/sslinks/simple_tls_link.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ gen_ss_simple_tls_link(){
elif [ "${SimpleTlsVer}" = "3" ]; then
if [ "${doYouHaveDomian}" = "No" ]; then
if [ "${certificateTypeOptNum}" = "1" ]; then
clientPluginOpts="n=${domain};no-verify${ataArgs}${clientMux}"
clientPluginOpts="n=${domain};no-verify${ataArgs}${wsArgs}${clientMux}"
elif [ "${certificateTypeOptNum}" = "2" ]; then
clientPluginOpts="n=${domain};no-verify;cert-hash=${hashCert}${ataArgs}${clientMux}"
clientPluginOpts="n=${domain};no-verify;cert-hash=${hashCert}${ataArgs}${wsArgs}${clientMux}"
fi
elif [ "${doYouHaveDomian}" = "Yes" ]; then
clientPluginOpts="${ataArgs};n=${domain}${clientMux}"
clientPluginOpts="n=${domain}${ataArgs}${wsArgs}${clientMux}"
fi
fi
ss_plugins_client_links
Expand Down
6 changes: 4 additions & 2 deletions utils/downloads.sh
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,15 @@ download_plugins_file(){
download_service_file ${RABBIT_INIT} ${RABBIT_INIT_ONLINE} ${RABBIT_INIT_LOCAL}
elif [[ "${plugin_num}" == "8" ]]; then
local pluginName="simple-tls"
# simple_tls_ver=$(get_plugins_version "${pluginName}")
simple_tls_ver="0.5.2"
simple_tls_ver=$(get_plugins_version "${pluginName}")
# simple_tls_ver="0.5.2"
judge_latest_version_num_is_none_and_output_error_info "${pluginName}" "${simple_tls_ver}"
if [[ ${SimpleTlsVer} = "1" ]]; then
simple_tls_ver="0.3.4"
elif [[ ${SimpleTlsVer} = "2" ]]; then
simple_tls_ver="0.4.7"
elif [[ ${SimpleTlsVer} = "3" ]]; then
simple_tls_ver="0.7.0"
fi

# wriet version num
Expand Down
4 changes: 2 additions & 2 deletions utils/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ judge_not_update_when_simple_tls_is_specified_version(){
local currentVersion=$2

if [[ -e ${SIMPLE_TLS_BIN_PATH} ]]; then
if ! check_latest_version "0.4.7" ${currentVersion}; then
echo -e "${Point} ${appName}当前版本是${currentVersion}及以下版本,与最新版本不兼容,脚本不提供更新."
if ! check_latest_version "0.7.0" ${currentVersion}; then
echo -e "${Point} ${appName}当前版本 v${currentVersion} 是 v0.7.0 及以下的指定版本,与最新版本不兼容,脚本不提供更新."
exit 0
fi
fi
Expand Down

0 comments on commit 24f984e

Please sign in to comment.