feat: prompt for Caddy fallback on port 443 regardless of port occupancy status
Main / build (push) Waiting to run

This commit is contained in:
2026-07-08 01:04:46 +08:00
parent 5309bf254b
commit fcdeee1249
+29 -21
View File
@@ -301,18 +301,22 @@ ask() {
msg "$is_err 请输入正确的端口, 可选(1-65535)"
continue
}
if [[ $(is_test port_used $REPLY) && $is_ask_set != 'door_port' ]]; then
if [[ $REPLY == 443 && $is_caddy && ${is_new_protocol,,} =~ "reality" ]]; then
msg "\n检测到 443 端口已被 Caddy 占用。"
msg "你可以选择启用 REALITY 回落分流功能,将非科学上网流量转发给本地 Caddy (4443 端口)。"
msg "这需要你后续手动将 Caddyfile 中的默认 https 端口修改为 4443 并重启 Caddy。"
ask string is_enable_fallback "是否启用 Caddy 回落分流?(y/n):"
if [[ $is_enable_fallback =~ ^[Yy]$ ]]; then
is_reality_fallback=1
export $is_ask_set=$REPLY
break
fi
if [[ $REPLY == 443 && $is_caddy && ${is_new_protocol,,} =~ "reality" ]]; then
msg "\n检测到你的系统已启用 Caddy。"
msg "你可以选择启用 REALITY 回落分流功能,将非科学上网流量转发给本地 Caddy (4443 端口)。"
if [[ $(is_test port_used 443) ]]; then
msg "这需要自动或手动将 Caddyfile 中的默认 https 端口修改为 4443 并重启 Caddy。"
else
msg "检测到 443 端口当前空闲(可能是已转移到了 4443 端口)。"
fi
ask string is_enable_fallback "是否启用 Caddy 回落分流?(y/n):"
if [[ $is_enable_fallback =~ ^[Yy]$ ]]; then
is_reality_fallback=1
export $is_ask_set=$REPLY
break
fi
fi
if [[ $(is_test port_used $REPLY) && $is_ask_set != 'door_port' ]]; then
msg "$is_err 无法使用 ($REPLY) 端口."
continue
fi
@@ -966,17 +970,21 @@ add() {
[[ ! $(is_test port ${is_use_port}) ]] && {
err "($is_use_port) 不是一个有效的端口. $is_err_tips"
}
[[ $(is_test port_used $is_use_port) && ! $is_gen ]] && {
if [[ $is_use_port == 443 && $is_caddy && ${is_new_protocol,,} =~ "reality" ]]; then
msg "\n检测到 443 端口已被 Caddy 占用。"
msg "你可以选择启用 REALITY 回落分流功能,将非科学上网流量转发给本地 Caddy (4443 端口)。"
msg "这需要你后续手动将 Caddyfile 中的默认 https 端口修改为 4443 并重启 Caddy。"
ask string is_enable_fallback "是否启用 Caddy 回落分流?(y/n):"
if [[ $is_enable_fallback =~ ^[Yy]$ ]]; then
is_reality_fallback=1
fi
if [[ $is_use_port == 443 && $is_caddy && ${is_new_protocol,,} =~ "reality" ]]; then
msg "\n检测到你的系统已启用 Caddy。"
msg "你可以选择启用 REALITY 回落分流功能,将非科学上网流量转发给本地 Caddy (4443 端口)。"
if [[ $(is_test port_used 443) ]]; then
msg "这需要自动或手动将 Caddyfile 中的默认 https 端口修改为 4443 并重启 Caddy。"
else
msg "检测到 443 端口当前空闲(可能是已转移到了 4443 端口)。"
fi
[[ ! $is_reality_fallback ]] && err "无法使用 ($is_use_port) 端口. $is_err_tips"
ask string is_enable_fallback "是否启用 Caddy 回落分流?(y/n):"
if [[ $is_enable_fallback =~ ^[Yy]$ ]]; then
is_reality_fallback=1
fi
fi
[[ $(is_test port_used $is_use_port) && ! $is_gen && ! $is_reality_fallback ]] && {
err "无法使用 ($is_use_port) 端口. $is_err_tips"
}
port=$is_use_port
fi