luci: fixed

This commit is contained in:
xiaorouji 2023-04-04 01:28:35 +08:00 committed by sbwml
parent 3b1c3d65c5
commit eee868fe92
3 changed files with 18 additions and 8 deletions

View File

@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall PKG_NAME:=luci-app-passwall
PKG_VERSION:=4.62 PKG_VERSION:=4.62
PKG_RELEASE:=5 PKG_RELEASE:=6
PKG_CONFIG_DEPENDS:= \ PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_$(PKG_NAME)_Iptables_Transparent_Proxy \ CONFIG_PACKAGE_$(PKG_NAME)_Iptables_Transparent_Proxy \

View File

@ -22,7 +22,7 @@ RULES_PATH=/usr/share/${CONFIG}/rules
DNS_N=dnsmasq DNS_N=dnsmasq
DNS_PORT=15353 DNS_PORT=15353
TUN_DNS="127.0.0.1#${DNS_PORT}" TUN_DNS="127.0.0.1#${DNS_PORT}"
LOCAL_DNS=119.29.29.29 LOCAL_DNS=119.29.29.29,223.5.5.5
DEFAULT_DNS= DEFAULT_DNS=
IFACES= IFACES=
ENABLED_DEFAULT_ACL=0 ENABLED_DEFAULT_ACL=0
@ -1623,8 +1623,8 @@ ISP_DNS=$(cat $RESOLVFILE 2>/dev/null | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+\.[0-9
ISP_DNS6=$(cat $RESOLVFILE 2>/dev/null | grep -E "([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4}" | awk -F % '{print $1}' | awk -F " " '{print $2}'| sort -u | grep -v -Fx ::1 | grep -v -Fx ::) ISP_DNS6=$(cat $RESOLVFILE 2>/dev/null | grep -E "([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4}" | awk -F % '{print $1}' | awk -F " " '{print $2}'| sort -u | grep -v -Fx ::1 | grep -v -Fx ::)
DEFAULT_DNS=$(uci show dhcp | grep "@dnsmasq" | grep "\.server=" | awk -F '=' '{print $2}' | sed "s/'//g" | tr ' ' '\n' | grep -v "\/" | head -2 | sed ':label;N;s/\n/,/;b label') DEFAULT_DNS=$(uci show dhcp | grep "@dnsmasq" | grep "\.server=" | awk -F '=' '{print $2}' | sed "s/'//g" | tr ' ' '\n' | grep -v "\/" | head -2 | sed ':label;N;s/\n/,/;b label')
[ -z "${DEFAULT_DNS}" ] && DEFAULT_DNS=$(echo -n $ISP_DNS | tr ' ' '\n' | head -2 | tr '\n' ',') [ -z "${DEFAULT_DNS}" ] && [ "$(echo $ISP_DNS | tr ' ' '\n' | wc -l)" -le 2 ] && DEFAULT_DNS=$(echo -n $ISP_DNS | tr ' ' '\n' | head -2 | tr '\n' ',')
LOCAL_DNS="${DEFAULT_DNS:-119.29.29.29}" LOCAL_DNS="${DEFAULT_DNS:-119.29.29.29,223.5.5.5}"
PROXY_IPV6=$(config_t_get global_forwarding ipv6_tproxy 0) PROXY_IPV6=$(config_t_get global_forwarding ipv6_tproxy 0)
DNS_QUERY_STRATEGY="UseIPv4" DNS_QUERY_STRATEGY="UseIPv4"

View File

@ -30,7 +30,7 @@ end
local var = api.get_args(arg) local var = api.get_args(arg)
local haproxy_path = var["-path"] local haproxy_path = var["-path"]
local haproxy_conf = var["-conf"] local haproxy_conf = var["-conf"]
local haproxy_dns = var["-dns"] or "119.29.29.29" local haproxy_dns = var["-dns"] or "119.29.29.29:53,223.5.5.5:53"
local health_check_type = uci:get(appname, "@global_haproxy[0]", "health_check_type") or "tcp" local health_check_type = uci:get(appname, "@global_haproxy[0]", "health_check_type") or "tcp"
local health_check_inter = uci:get(appname, "@global_haproxy[0]", "health_check_inter") or "10" local health_check_inter = uci:get(appname, "@global_haproxy[0]", "health_check_inter") or "10"
@ -69,19 +69,29 @@ defaults
maxconn 3000 maxconn 3000
resolvers mydns resolvers mydns
nameserver dns1 %s:53
resolve_retries 3 resolve_retries 3
timeout retry 3s timeout retry 3s
hold valid 600s hold valid 600s
]] ]]
f_out:write(string.format(haproxy_config, haproxy_path, health_check_type == "passwall_logic" and string.format([[ f_out:write(string.format(haproxy_config, haproxy_path, health_check_type == "passwall_logic" and string.format([[
external-check external-check
insecure-fork-wanted insecure-fork-wanted
]]) or "", haproxy_dns ]]) or ""
)) ))
local index = 0
string.gsub(haproxy_dns, '[^' .. "," .. ']+', function(w)
index = index + 1
local s = w:gsub("#", ":")
if not s:find(":") then
s = s .. ":53"
end
f_out:write(string.format([[
nameserver dns%s %s
]], index, s))
end)
local listens = {} local listens = {}
uci:foreach(appname, "haproxy_config", function(t) uci:foreach(appname, "haproxy_config", function(t)