diff --git a/xray-manager.sh b/xray-manager.sh index 4a308a9..575d521 100755 --- a/xray-manager.sh +++ b/xray-manager.sh @@ -79,6 +79,10 @@ _init_vars() { _validate_config() { _log "config: validating uci syntax" "debug" + if [ -f "/etc/config/xray-manager" ]; then + sed -i 's/^ \+/ /g' /etc/config/xray-manager + fi + local dns_confdir dns_confdir=$(uci -q get dhcp.@dnsmasq[0].confdir) if [ -z "$dns_confdir" ] || ! echo "$dns_confdir" | grep -q "$DNSMASQ_DIR"; then @@ -127,7 +131,7 @@ _nft_init() { nft flush chain ip "$TABLE" prerouting nft add rule ip "$TABLE" prerouting fib daddr type local accept - nft add chain ip "$TABLE" output { type filter hook output priority -150 \; policy accept \; } 2>/dev/null + nft add chain ip "$TABLE" output { type route hook output priority -150 \; policy accept \; } 2>/dev/null nft flush chain ip "$TABLE" output nft add rule ip "$TABLE" output fib daddr type local accept @@ -355,7 +359,10 @@ _run() { config_foreach _process_section "xray-list" "exclude" _log "main: applying proxy bypass" "debug" - [ -n "$PROXY_SERVERS" ] && nft add rule ip "$TABLE" output ip daddr "@s_proxy_servers" accept 2>/dev/null + if [ -n "$PROXY_SERVERS" ]; then + _process_item "proxy_servers" "$PROXY_SERVERS" "ip" "out" "0" + nft add rule ip "$TABLE" output ip daddr "@s_proxy_servers" accept 2>/dev/null + fi _log "main: applying tproxy rules" "debug" mode_chain="prerouting"; config_foreach _process_section "xray-list" "main_rules"