feat: decouple reality handshake destination from fallback destination to support external SNIs on 443
Main / build (push) Waiting to run

This commit is contained in:
2026-07-08 01:37:42 +08:00
parent 1446138557
commit 585cb5e09d
+4 -11
View File
@@ -1160,7 +1160,7 @@ get() {
get file $2
if [[ $is_config_file ]]; then
is_json_str=$(cat $is_conf_dir/"$is_config_file" | sed s#//.*##)
is_json_data=$(jq '(.inbounds[0]|.type,.listen_port,(.users[0]|.uuid,.password,.username),.method,.password,.override_port,.override_address,(.transport|.type,.path,.headers.host),(.tls|.server_name,.reality.private_key,.reality.handshake.server_port)),(.outbounds[1].tag)' <<<$is_json_str)
is_json_data=$(jq '(.inbounds[0]|.type,.listen_port,(.users[0]|.uuid,.password,.username),.method,.password,.override_port,.override_address,(.transport|.type,.path,.headers.host),(.tls|.server_name,.reality.private_key,.fallback.server_port)),(.outbounds[1].tag)' <<<$is_json_str)
[[ $? != 0 ]] && err "无法读取此文件: $is_config_file"
is_up_var_set=(null is_protocol port uuid password username ss_method ss_password door_port door_addr net_type path host is_servername is_private_key is_reality_fallback_port is_public_key)
[[ $is_debug ]] && msg "\n------------- debug: $is_config_file -------------"
@@ -1297,22 +1297,15 @@ get() {
;;
*reality*)
net=reality
[[ $is_reality_fallback ]] && {
# If fallback is enabled, we MUST use their Caddy domain
[[ ! $is_servername || $is_servername == $is_random_servername ]] && {
msg "\n由于启用了 Caddy 回落,REALITY 必须借用你自己 Caddy 网站的域名和证书才能完成握手。"
ask string is_servername "请输入你在 Caddy 中配置的网站域名:"
}
}
[[ ! $is_servername ]] && is_servername=$is_random_servername
[[ ! $is_private_key ]] && get_pbk
local handshake_server=$is_servername
local handshake_port=443
local fallback_json=""
[[ $is_reality_fallback ]] && {
handshake_server="127.0.0.1"
handshake_port=4443
fallback_json=",fallback:{server:\"127.0.0.1\",server_port:4443}"
}
is_json_add="tls:{enabled:true,server_name:\"$is_servername\",reality:{enabled:true,handshake:{server:\"$handshake_server\",server_port:$handshake_port},private_key:\"$is_private_key\",short_id:[\"\"]}}"
is_json_add="tls:{enabled:true,server_name:\"$is_servername\",reality:{enabled:true,handshake:{server:\"$handshake_server\",server_port:$handshake_port},private_key:\"$is_private_key\",short_id:[\"\"]}$fallback_json}"
[[ $is_lower =~ "http" ]] && {
is_json_add="$is_json_add,transport:{type:\"http\"}"
} || {