fix: optimize bind-address value resolution

This commit is contained in:
libm committed 2025-09-24 14:22:19 +08:00
1 parent 5e44dfda05
commit de3355d817
1 file changed
+5 -2
+5 -2
View File
@@ -5,8 +5,11 @@ _set_system_proxy() {
local auth=$(sudo "$BIN_YQ" '.authentication[0] // ""' "$CLASH_CONFIG_RUNTIME")
[ -n "$auth" ] && auth=$auth@
local http_proxy_addr="http://${auth}127.0.0.1:${MIXED_PORT}"
local socks_proxy_addr="socks5h://${auth}127.0.0.1:${MIXED_PORT}"
local bind_addr=$(sudo "$BIN_YQ" '.bind-address // ""' "$CLASH_CONFIG_RUNTIME")
[[ -z "$bind_addr" || "$bind_addr" == "*" ]] && bind_addr='127.0.0.1'
local http_proxy_addr="http://${auth}${bind_addr}:${MIXED_PORT}"
local socks_proxy_addr="socks5h://${auth}${bind_addr}:${MIXED_PORT}"
local no_proxy_addr="localhost,127.0.0.1,::1"
export http_proxy=$http_proxy_addr