update-01.20

This commit is contained in:
github-actions[bot] 2022-01-20 09:14:17 +08:00
parent 45bf5e641f
commit 212b94d09f
17 changed files with 9984 additions and 9750 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=aliyundrive-webdav
PKG_VERSION:=1.1.1
PKG_VERSION:=1.2.0
PKG_RELEASE:=$(AUTORELESE)
PKG_LICENSE:=MIT

View File

@ -13,3 +13,5 @@ config server
option no_trash '0'
option domain_id ''
option read_only '0'
option tls_cert ''
option tls_key ''

View File

@ -26,6 +26,8 @@ start_service() {
local port=$(uci_get_by_type server port 8080)
local root=$(uci_get_by_type server root /)
local domain_id=$(uci_get_by_type server domain_id)
local tls_cert=$(uci_get_by_type server tls_cert)
local tls_key=$(uci_get_by_type server tls_key)
local extra_options="-I"
@ -47,6 +49,10 @@ start_service() {
esac
fi
if [[ ! -z "$tls_cert" && ! -z "$tls_key" ]]; then
extra_options="$extra_options --tls-cert $tls_cert --tls-key $tls_key"
fi
procd_open_instance
procd_set_param command /bin/sh -c "/usr/bin/$NAME $extra_options --host $host --port $port --root $root -S $read_buf_size --cache-size $cache_size --cache-ttl $cache_ttl --workdir /var/run/$NAME >>/var/log/$NAME.log 2>&1"
procd_set_param pidfile /var/run/$NAME.pid

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-aliyundrive-webdav
PKG_VERSION:=1.1.1
PKG_VERSION:=1.2.0
PKG_RELEASE:=1
PKG_PO_VERSION:=$(PKG_VERSION)-$(PKG_RELEASE)

View File

@ -28,6 +28,9 @@ port = e:option(Value, "port", translate("Port"))
port.default = "8080"
port.datatype = "port"
tls_cert = e:option(Value, "tls_cert", translate("TLS certificate file path"))
tls_key = e:option(Value, "tls_key", translate("TLS private key file path"))
auth_user = e:option(Value, "auth_user", translate("Username"))
auth_password = e:option(Value, "auth_password", translate("Password"))
auth_password.password = true

View File

@ -22,6 +22,12 @@ msgstr "监听主机"
msgid "Port"
msgstr "监听端口"
msgid "TLS certificate file path"
msgstr "TLS 证书文件路径"
msgid "TLS private key file path"
msgstr "TLS 私钥文件路径"
msgid "Username"
msgstr "用户名"

File diff suppressed because one or more lines are too long

View File

@ -4125,7 +4125,6 @@ game.rising.cn
game.subway.uu.cc
game.weibo.cn
game.weibo.com
gamehouse.com
gamesites100.net
gamesites200.com
gammamaximum.com

View File

@ -6,9 +6,9 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall
PKG_VERSION:=4.47
PKG_VERSION:=4.48
PKG_RELEASE:=1
#20220114
#20220120
PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Brook \

View File

@ -221,7 +221,6 @@ end
if has_xray then
o:value("xray", "Xray")
end
o:value("fakedns", "FakeDNS")
o = s:option(ListValue, "v2ray_dns_mode", " ")
o:value("tcp", "TCP")

View File

@ -176,6 +176,18 @@ udp_node:value("tcp", translate("Same as the tcp node"))
s:tab("DNS", translate("DNS"))
if api.is_finded("smartdns") then
dns_shunt = s:taboption("DNS", ListValue, "dns_shunt", translate("DNS Shunt"))
dns_shunt:value("dnsmasq", "Dnsmasq")
dns_shunt:value("smartdns", "SmartDNS")
group_domestic = s:taboption("DNS", Value, "group_domestic", translate("Domestic group name"))
group_domestic.placeholder = "default"
group_domestic.default = group_domestic.placeholder
group_domestic:depends("dns_shunt", "smartdns")
group_domestic.description = translate("You only need to configure domestic DNS packets in SmartDNS and set it redirect or as Dnsmasq upstream, and fill in the domestic DNS group name here.")
end
---- DNS Forward Mode
dns_mode = s:taboption("DNS", ListValue, "dns_mode", translate("Filter Mode"))
dns_mode.rmempty = false
@ -193,7 +205,6 @@ if has_xray then
dns_mode:value("xray", "Xray")
end
dns_mode:value("udp", translatef("Requery DNS By %s", "UDP"))
dns_mode:value("fakedns", "FakeDNS")
o = s:taboption("DNS", ListValue, "v2ray_dns_mode", " ")
o:value("tcp", "TCP")

View File

@ -142,6 +142,15 @@ msgstr "用于代理特定的列表。"
msgid "For proxy game network, DNS hijack etc."
msgstr "用于代理游戏或DNS劫持等..."
msgid "DNS Shunt"
msgstr "DNS分流"
msgid "Domestic group name"
msgstr "国内分组名"
msgid "You only need to configure domestic DNS packets in SmartDNS and set it redirect or as Dnsmasq upstream, and fill in the domestic DNS group name here."
msgstr "你只需要在SmartDNS配置好国内DNS分组并设置重定向或作为Dnsmasq上游此处填入国内DNS分组名。"
msgid "Filter Mode"
msgstr "过滤模式"

View File

@ -647,7 +647,7 @@ run_redir() {
UDP_NODE="nil"
}
_extra_param="${_extra_param} ${proto}"
[ "${DNS_MODE}" != "fakedns" ] && _extra_param="${_extra_param} -route_only 1"
_extra_param="${_extra_param} -route_only 1"
[ "${DNS_MODE}" = "v2ray" -o "${DNS_MODE}" = "xray" ] && {
local v2ray_dns_mode=$(config_t_get global v2ray_dns_mode tcp)
[ "$(config_t_get global dns_by)" = "tcp" -o "${v2ray_dns_mode}" = "fakedns" ] && {
@ -677,7 +677,6 @@ run_redir() {
echolog " - 域名解析 DNS Over HTTPS..."
;;
fakedns)
CHINADNS_NG=0
_extra_param="${_extra_param} -dns_listen_port ${dns_listen_port} -dns_fakedns 1"
echolog " - 域名解析 Fake DNS..."
;;
@ -1116,15 +1115,25 @@ start_dns() {
TUN_DNS="$(echo ${DNS_FORWARD} | sed 's/#/:/g' | sed -E 's/\:([^:]+)$/#\1/g')"
echolog " - 域名解析使用UDP协议请求DNS$TUN_DNS..."
;;
fakedns)
CHINADNS_NG=0
echolog " - 域名解析使用Dnsmasq直接返回假IP请确保代理工具支持域名嗅探..."
;;
esac
[ "${use_tcp_node_resolve_dns}" = "1" ] && echolog " * 请确认上游 DNS 支持 TCP 查询,如非直连地址,确保 TCP 代理打开,并且已经正确转发!"
[ "${use_udp_node_resolve_dns}" = "1" ] && echolog " * 要求代理 DNS 请求,如上游 DNS 非直连地址,确保 UDP 代理打开,并且已经正确转发!"
case "$DNS_SHUNT" in
smartdns)
if [ -n "$(first_type smartdns)" ]; then
local group_domestic=$(config_t_get global group_domestic default)
CHINADNS_NG=0
source $APP_PATH/helper_smartdns.sh add DNS_MODE=$DNS_MODE SMARTDNS_CONF=/tmp/etc/smartdns/$CONFIG.conf DEFAULT_DNS=$DEFAULT_DNS LOCAL_GROUP=$group_domestic TUN_DNS=$TUN_DNS TCP_NODE=$TCP_NODE PROXY_MODE=${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE} NO_PROXY_IPV6=${filter_proxy_ipv6}
source $APP_PATH/helper_smartdns.sh restart
echolog " - 域名解析使用SmartDNS请确保配置正常。"
else
DNS_SHUNT="dnsmasq"
fi
;;
esac
[ -n "$chnlist" ] && [ "$CHINADNS_NG" = "1" ] && [ -n "$(first_type chinadns-ng)" ] && [ -s "${RULES_PATH}/chnlist" ] && {
china_ng_listen_port=$(expr $dns_listen_port + 1)
china_ng_listen="127.0.0.1#${china_ng_listen_port}"
@ -1151,8 +1160,11 @@ start_dns() {
ln_run "$(first_type chinadns-ng)" chinadns-ng "$log_path" -v -b 0.0.0.0 -l "${china_ng_listen_port}" ${china_ng_chn:+-c "${china_ng_chn}"} ${chnlist_param} ${china_ng_gfw:+-t "${china_ng_gfw}"} ${gfwlist_param:+-g "${gfwlist_param}"} -f
echolog " + 过滤服务ChinaDNS-NG(:${china_ng_listen_port})国内DNS${china_ng_chn}可信DNS${china_ng_gfw}"
}
source $APP_PATH/helper_${DNS_N}.sh stretch
source $APP_PATH/helper_${DNS_N}.sh add DNS_MODE=$DNS_MODE TMP_DNSMASQ_PATH=$TMP_DNSMASQ_PATH DNSMASQ_CONF_FILE=/tmp/dnsmasq.d/dnsmasq-passwall.conf DEFAULT_DNS=$DEFAULT_DNS LOCAL_DNS=$LOCAL_DNS TUN_DNS=$TUN_DNS CHINADNS_DNS=$china_ng_listen TCP_NODE=$TCP_NODE PROXY_MODE=${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE} NO_PROXY_IPV6=${filter_proxy_ipv6}
[ "$DNS_SHUNT" = "dnsmasq" ] && {
source $APP_PATH/helper_dnsmasq.sh stretch
source $APP_PATH/helper_dnsmasq.sh add DNS_MODE=$DNS_MODE TMP_DNSMASQ_PATH=$TMP_DNSMASQ_PATH DNSMASQ_CONF_FILE=/tmp/dnsmasq.d/dnsmasq-passwall.conf DEFAULT_DNS=$DEFAULT_DNS LOCAL_DNS=$LOCAL_DNS TUN_DNS=$TUN_DNS CHINADNS_DNS=$china_ng_listen TCP_NODE=$TCP_NODE PROXY_MODE=${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE} NO_PROXY_IPV6=${filter_proxy_ipv6}
}
}
gen_pdnsd_config() {
@ -1406,8 +1418,10 @@ stop() {
unset V2RAY_LOCATION_ASSET
unset XRAY_LOCATION_ASSET
stop_crontab
source $APP_PATH/helper_${DNS_N}.sh del
source $APP_PATH/helper_${DNS_N}.sh restart no_log=1
source $APP_PATH/helper_smartdns.sh del
source $APP_PATH/helper_smartdns.sh restart no_log=1
source $APP_PATH/helper_dnsmasq.sh del
source $APP_PATH/helper_dnsmasq.sh restart no_log=1
rm -rf ${TMP_PATH}
rm -rf /tmp/lock/${CONFIG}_script.lock
echolog "清空并关闭相关程序和缓存完成。"
@ -1448,6 +1462,7 @@ global=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LO
returnhome=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "returnhome")
chnlist=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "chnroute")
gfwlist=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "gfwlist")
DNS_SHUNT=$(config_t_get global dns_shunt dnsmasq)
DNS_MODE=$(config_t_get global dns_mode pdnsd)
DNS_FORWARD=$(config_t_get global dns_forward 1.1.1.1:53 | sed 's/#/:/g' | sed -E 's/\:([^:]+)$/#\1/g')
DNS_CACHE=$(config_t_get global dns_cache 0)

View File

@ -156,16 +156,11 @@ add() {
echo -e "$subscribe_list" | sort -u | gen_dnsmasq_items "whitelist,whitelist6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/12-subscribe.conf"
echolog " - [$?]节点订阅域名(whitelist)${fwd_dns:-默认}"
else
if [ "$DNS_MODE" = "fakedns" ]; then
echo -e "$subscribe_list" | sort -u | gen_dnsmasq_address_items "198.18.0.1" "${TMP_DNSMASQ_PATH}/91-subscribe.conf"
echolog " - [$?]节点订阅域名(blacklist)198.18.0.1"
else
#如果开启了通过代理订阅
fwd_dns="${TUN_DNS}"
#[ -n "$CHINADNS_DNS" ] && unset fwd_dns
echo -e "$subscribe_list" | sort -u | gen_dnsmasq_items "blacklist,blacklist6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/91-subscribe.conf"
echolog " - [$?]节点订阅域名(blacklist)${fwd_dns:-默认}"
fi
#如果开启了通过代理订阅
fwd_dns="${TUN_DNS}"
#[ -n "$CHINADNS_DNS" ] && unset fwd_dns
echo -e "$subscribe_list" | sort -u | gen_dnsmasq_items "blacklist,blacklist6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/91-subscribe.conf"
echolog " - [$?]节点订阅域名(blacklist)${fwd_dns:-默认}"
fi
}
@ -176,16 +171,10 @@ add() {
ipset_flag="blacklist"
cat "${RULES_PATH}/proxy_host" | tr -s '\n' | grep -v "^#" | sort -u | gen_dnsmasq_address_items "::" "${TMP_DNSMASQ_PATH}/97-proxy_host-noipv6.conf"
fi
if [ "$DNS_MODE" = "fakedns" ]; then
cat "${RULES_PATH}/proxy_host" | tr -s '\n' | grep -v "^#" | sort -u | gen_dnsmasq_address_items "198.18.0.1" "${TMP_DNSMASQ_PATH}/97-proxy_host.conf"
echolog " - [$?]代理域名表(blacklist)198.18.0.1"
else
fwd_dns="${TUN_DNS}"
#[ -n "$CHINADNS_DNS" ] && unset fwd_dns
cat "${RULES_PATH}/proxy_host" | tr -s '\n' | grep -v "^#" | sort -u | gen_dnsmasq_items "${ipset_flag}" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/97-proxy_host.conf"
echolog " - [$?]代理域名表(blacklist)${fwd_dns:-默认}"
fi
fwd_dns="${TUN_DNS}"
#[ -n "$CHINADNS_DNS" ] && unset fwd_dns
cat "${RULES_PATH}/proxy_host" | tr -s '\n' | grep -v "^#" | sort -u | gen_dnsmasq_items "${ipset_flag}" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/97-proxy_host.conf"
echolog " - [$?]代理域名表(blacklist)${fwd_dns:-默认}"
}
#分流规则
@ -214,18 +203,10 @@ add() {
ipset_flag="shuntlist"
echo $str | sed "s/|/\n/g" | gen_dnsmasq_address_items "::" "${TMP_DNSMASQ_PATH}/98-shunt_host-noipv6.conf"
fi
if [ "$DNS_MODE" = "fakedns" ]; then
[ -n "$str" ] && {
echo $str | sed "s/|/\n/g" | gen_dnsmasq_address_items "198.18.0.1" "${TMP_DNSMASQ_PATH}/98-shunt_host.conf"
msg_dns="198.18.0.1"
}
else
[ -n "$str" ] && {
echo $str | sed "s/|/\n/g" | gen_dnsmasq_items "${ipset_flag}" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/98-shunt_host.conf"
msg_dns="${fwd_dns}"
}
fi
[ -n "$str" ] && {
echo $str | sed "s/|/\n/g" | gen_dnsmasq_items "${ipset_flag}" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/98-shunt_host.conf"
msg_dns="${fwd_dns}"
}
done
echolog " - [$?]V2ray/Xray分流规则(shuntlist)${msg_dns:-默认}"
}
@ -246,16 +227,10 @@ add() {
ipset_flag="gfwlist"
sort -u "${TMP_PATH}/gfwlist" | gen_dnsmasq_address_items "::" "${TMP_DNSMASQ_PATH}/99-gfwlist-noipv6.conf"
fi
if [ "$DNS_MODE" = "fakedns" ]; then
sort -u "${TMP_PATH}/gfwlist" | gen_dnsmasq_address_items "198.18.0.1" "${TMP_DNSMASQ_PATH}/99-gfwlist.conf"
echolog " - [$?]防火墙域名表(gfwlist)198.18.0.1"
else
fwd_dns="${TUN_DNS}"
[ -n "$CHINADNS_DNS" ] && unset fwd_dns
sort -u "${TMP_PATH}/gfwlist" | gen_dnsmasq_items "${ipset_flag}" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/99-gfwlist.conf"
echolog " - [$?]防火墙域名表(gfwlist)${fwd_dns:-默认}"
fi
fwd_dns="${TUN_DNS}"
[ -n "$CHINADNS_DNS" ] && unset fwd_dns
sort -u "${TMP_PATH}/gfwlist" | gen_dnsmasq_items "${ipset_flag}" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/99-gfwlist.conf"
echolog " - [$?]防火墙域名表(gfwlist)${fwd_dns:-默认}"
rm -f "${TMP_PATH}/gfwlist"
}
@ -278,15 +253,9 @@ add() {
ipset_flag="chnroute"
sort -u "${TMP_PATH}/chnlist" | gen_dnsmasq_address_items "::" "${TMP_DNSMASQ_PATH}/99-chinalist_host-noipv6.conf"
fi
if [ "$DNS_MODE" = "fakedns" ]; then
sort -u "${TMP_PATH}/chnlist" | gen_dnsmasq_address_items "198.18.0.1" "${TMP_DNSMASQ_PATH}/99-chinalist_host.conf"
echolog " - [$?]中国域名表(chnroute)198.18.0.1"
else
fwd_dns="${TUN_DNS}"
sort -u "${TMP_PATH}/chnlist" | gen_dnsmasq_items "chnroute,chnroute6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/99-chinalist_host.conf"
echolog " - [$?]中国域名表(chnroute)${fwd_dns:-默认}"
fi
fwd_dns="${TUN_DNS}"
sort -u "${TMP_PATH}/chnlist" | gen_dnsmasq_items "chnroute,chnroute6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/99-chinalist_host.conf"
echolog " - [$?]中国域名表(chnroute)${fwd_dns:-默认}"
rm -f "${TMP_PATH}/chnlist"
}
fi

View File

@ -0,0 +1,214 @@
#!/bin/sh
restart() {
local no_log
eval_set_val $@
_LOG_FILE=$LOG_FILE
[ -n "$no_log" ] && LOG_FILE="/dev/null"
rm -rf /tmp/smartdns.cache
/etc/init.d/smartdns reload >/dev/null 2>&1
/etc/init.d/dnsmasq restart >/dev/null 2>&1
LOG_FILE=${_LOG_FILE}
}
gen_items() {
local ipsets group address speed_check_mode outf
eval_set_val $@
awk -v ipsets="${ipsets}" -v group="${group}" -v speed_check_mode="${speed_check_mode}" -v address="${address}" -v outf="${outf}" '
BEGIN {
if(outf == "") outf="/dev/stdout";
if(group != "") group=" -n " group;
if(ipsets != "") ipsets=" -p " ipsets;
if(speed_check_mode != "") speed_check_mode=" -c " speed_check_mode;
if(address != "") address=" -a " address;
fail=1;
}
! /^$/&&!/^#/ {
fail=0
printf("domain-rules /%s/ %s%s%s%s\n", $0, group, ipsets, address, speed_check_mode) >>outf;
}
END {fflush(outf); close(outf); exit(fail);}
'
}
gen_address_items() {
local address=${1}; shift 1
local outf=${1}; shift 1
awk -v address="${address}" -v outf="${outf}" '
BEGIN {
if(outf == "") outf="/dev/stdout";
setaddress=length(address)>0;
fail=1;
}
! /^$/&&!/^#/ {
fail=0
if(setaddress) printf("address /%s/%s\n", $0, address) >>outf;
}
END {fflush(outf); close(outf); exit(fail);}
'
}
add() {
local fwd_dns fwd_group item servers msg
local DNS_MODE SMARTDNS_CONF DNSMASQ_CONF_FILE DEFAULT_DNS LOCAL_GROUP REMOTE_GROUP TUN_DNS TCP_NODE PROXY_MODE NO_LOGIC_LOG NO_PROXY_IPV6
eval_set_val $@
_LOG_FILE=$LOG_FILE
[ -n "$NO_LOGIC_LOG" ] && LOG_FILE="/dev/null"
global=$(echo "${PROXY_MODE}" | grep "global")
returnhome=$(echo "${PROXY_MODE}" | grep "returnhome")
chnlist=$(echo "${PROXY_MODE}" | grep "chnroute")
gfwlist=$(echo "${PROXY_MODE}" | grep "gfwlist")
touch ${SMARTDNS_CONF}
count_hosts_str="!"
[ -z "${REMOTE_GROUP}" ] && {
REMOTE_GROUP="${CONFIG}_proxy"
[ -n "${TUN_DNS}" ] && TUN_DNS="$(echo ${TUN_DNS} | sed 's/#/:/g')"
echo "server ${TUN_DNS} -group ${REMOTE_GROUP} -exclude-default-group" >> ${SMARTDNS_CONF}
}
#屏蔽列表
[ -s "${RULES_PATH}/block_host" ] && {
cat "${RULES_PATH}/block_host" | tr -s '\n' | grep -v "^#" | sort -u | gen_address_items "-" "${SMARTDNS_CONF}"
}
#始终用国内DNS解析节点域名
servers=$(uci show "${CONFIG}" | grep ".address=" | cut -d "'" -f 2)
hosts_foreach "servers" host_from_url | grep '[a-zA-Z]$' | sort -u | gen_items ipsets="#4:vpsiplist,#6:vpsiplist6" group="${LOCAL_GROUP}" outf="${SMARTDNS_CONF}"
echolog " - [$?]节点列表中的域名(vpsiplist)使用分组:${LOCAL_GROUP}"
#始终用国内DNS解析直连白名单列表
[ -s "${RULES_PATH}/direct_host" ] && {
cat "${RULES_PATH}/direct_host" | tr -s '\n' | grep -v "^#" | sort -u | gen_items ipsets="#4:whitelist,#6:whitelist6" group="${LOCAL_GROUP}" outf="${SMARTDNS_CONF}"
echolog " - [$?]域名白名单(whitelist)使用分组:${LOCAL_GROUP}"
}
subscribe_list=""
for item in $(get_enabled_anonymous_secs "@subscribe_list"); do
host=$(host_from_url "$(config_n_get ${item} url)")
subscribe_list="${subscribe_list}\n${host}"
done
[ -n "$subscribe_list" ] && {
if [ "$(config_t_get global_subscribe subscribe_proxy 0)" = "0" ]; then
#如果没有开启通过代理订阅
echo -e "$subscribe_list" | sort -u | gen_items ipsets="#4:whitelist,#6:whitelist6" group="${LOCAL_GROUP}" outf="${SMARTDNS_CONF}"
echolog " - [$?]节点订阅域名(whitelist)使用分组:${LOCAL_GROUP}"
else
#如果开启了通过代理订阅
echo -e "$subscribe_list" | sort -u | gen_items ipsets="blacklist,blacklist6" group="${REMOTE_GROUP}" speed_check_mode="none" outf="${SMARTDNS_CONF}"
echolog " - [$?]节点订阅域名(blacklist)使用分组:${REMOTE_GROUP}"
fi
}
#始终使用远程DNS解析代理黑名单列表
[ -s "${RULES_PATH}/proxy_host" ] && {
local ipset_flag="#4:blacklist,#6:blacklist6"
if [ "${NO_PROXY_IPV6}" = "1" ]; then
ipset_flag="#4:blacklist"
address="#6"
fi
cat "${RULES_PATH}/proxy_host" | tr -s '\n' | grep -v "^#" | sort -u | gen_items ipsets="${ipset_flag}" group="${REMOTE_GROUP}" address="${address}" speed_check_mode="none" outf="${SMARTDNS_CONF}"
echolog " - [$?]代理域名表(blacklist)使用分组:${REMOTE_GROUP}"
}
#分流规则
[ "$(config_n_get $TCP_NODE protocol)" = "_shunt" ] && {
local default_node_id=$(config_n_get $TCP_NODE default_node _direct)
local shunt_ids=$(uci show $CONFIG | grep "=shunt_rules" | awk -F '.' '{print $2}' | awk -F '=' '{print $1}')
for shunt_id in $shunt_ids; do
local shunt_node_id=$(config_n_get $TCP_NODE ${shunt_id} nil)
[ "$shunt_node_id" = "nil" ] && continue
[ "$shunt_node_id" = "_default" ] && shunt_node_id=$default_node_id
[ "$shunt_node_id" = "_blackhole" ] && continue
local str=$(echo -n $(config_n_get $shunt_id domain_list | grep -v 'regexp:\|geosite:\|ext:' | sed 's/domain:\|full:\|//g' | tr -s "\r\n" "\n" | sort -u) | sed "s/ /|/g")
[ -n "$str" ] && count_hosts_str="${count_hosts_str}|${str}"
[ "$shunt_node_id" = "_direct" ] && {
[ -n "$str" ] && echo $str | sed "s/|/\n/g" | gen_items ipsets="#4:whitelist,#6:whitelist6" group="${LOCAL_GROUP}" outf="${SMARTDNS_CONF}"
msg_dns="${LOCAL_GROUP}"
continue
}
local shunt_node=$(config_n_get $shunt_node_id address nil)
[ "$shunt_node" = "nil" ] && continue
local ipset_flag="#4:shuntlist,#6:shuntlist6"
if [ "${NO_PROXY_IPV6}" = "1" ]; then
ipset_flag="#4:shuntlist"
address="#6"
fi
[ -n "$str" ] && {
echo $str | sed "s/|/\n/g" | gen_items ipsets="${ipset_flag}" group="${REMOTE_GROUP}" address="${address}" speed_check_mode="none" outf="${SMARTDNS_CONF}"
msg_dns="${REMOTE_GROUP}"
}
done
echolog " - [$?]V2ray/Xray分流规则(shuntlist)${msg_dns:-默认}"
}
[ -s "${RULES_PATH}/direct_host" ] && direct_hosts_str="$(echo -n $(cat ${RULES_PATH}/direct_host | tr -s '\n' | grep -v "^#" | sort -u) | sed "s/ /|/g")"
[ -s "${RULES_PATH}/proxy_host" ] && proxy_hosts_str="$(echo -n $(cat ${RULES_PATH}/proxy_host | tr -s '\n' | grep -v "^#" | sort -u) | sed "s/ /|/g")"
[ -n "$direct_hosts_str" ] && count_hosts_str="${count_hosts_str}|${direct_hosts_str}"
[ -n "$proxy_hosts_str" ] && count_hosts_str="${count_hosts_str}|${proxy_hosts_str}"
#如果没有使用回国模式
if [ -z "${returnhome}" ]; then
# GFW 模式
[ -s "${RULES_PATH}/gfwlist" ] && {
grep -v -E "$count_hosts_str" "${RULES_PATH}/gfwlist" > "${TMP_PATH}/gfwlist"
local ipset_flag="#4:gfwlist,#6:gfwlist6"
if [ "${NO_PROXY_IPV6}" = "1" ]; then
ipset_flag="#4:gfwlist"
address="#6"
fi
sort -u "${TMP_PATH}/gfwlist" | gen_items ipsets="${ipset_flag}" group="${REMOTE_GROUP}" address="${address}" speed_check_mode="none" outf="${SMARTDNS_CONF}"
echolog " - [$?]防火墙域名表(gfwlist)使用分组:${REMOTE_GROUP}"
rm -f "${TMP_PATH}/gfwlist"
}
# 中国列表以外 模式
[ -s "${RULES_PATH}/chnlist" ] && [ -n "${chnlist}" ] && {
grep -v -E "$count_hosts_str" "${RULES_PATH}/chnlist" | gen_items ipsets="#4:chnroute,#6:chnroute6" group="${LOCAL_GROUP}" outf="${SMARTDNS_CONF}"
echolog " - [$?]中国域名表(chnroute)使用分组:${LOCAL_GROUP}"
}
else
#回国模式
[ -s "${RULES_PATH}/chnlist" ] && {
grep -v -E "$count_hosts_str" "${RULES_PATH}/chnlist" > "${TMP_PATH}/chnlist"
local ipset_flag="#4:chnroute,#6:chnroute6"
if [ "${NO_PROXY_IPV6}" = "1" ]; then
ipset_flag="#4:chnroute"
address="#6"
fi
sort -u "${TMP_PATH}/chnlist" | gen_items ipsets="#4:chnroute,#6:chnroute6" group="${REMOTE_GROUP}" address="${address}" speed_check_mode="none" outf="${SMARTDNS_CONF}"
echolog " - [$?]中国域名表(chnroute)使用分组:${REMOTE_GROUP}"
rm -f "${TMP_PATH}/chnlist"
}
fi
echo "conf-file ${SMARTDNS_CONF}" >> /etc/smartdns/custom.conf
echolog " - 请让SmartDNS作为Dnsmasq的上游或重定向"
LOG_FILE=${_LOG_FILE}
}
del() {
rm -rf /tmp/etc/smartdns/passwall.conf
sed -i "/passwall/d" /etc/smartdns/custom.conf >/dev/null 2>&1
rm -rf /tmp/smartdns.cache
/etc/init.d/smartdns reload
}
arg1=$1
shift
case $arg1 in
add)
add $@
;;
del)
del $@
;;
restart)
restart $@
;;
*) ;;
esac

View File

@ -49,7 +49,7 @@ return view.extend({
o.value('255.0.0.0');
o.default = '255.255.255.0';
o = s.taboption('netsetup', form.DynamicList, 'lan_dns', _('Use custom DNS servers'), _('留空则使用运营商DNS, 推荐: 223.5.5.5'));
o = s.taboption('netsetup', form.DynamicList, 'lan_dns', _('Use custom DNS servers'), _('留空则使用主路由DNS'));
o.datatype = 'ip4addr';
o.cast = 'string';

View File

@ -56,14 +56,15 @@ add_wizard() {
config_get autoupgrade_pkg "$cfg" autoupgrade_pkg
[ "$dhcp" == "0" ] && dhcp="1"
if [[ -n "${lan_gateway} != $(uci -q get network.lan.gateway)" || -n "${dhcp} != $(uci -q get dhcp.lan.ignore)" ]]; then
if [[ "${lan_gateway}" != "$(uci -q get network.lan.gateway)" || "${dhcp}" != "$(uci -q get dhcp.lan.ignore)" ]]; then
if [ "${siderouter}" == "1" ]; then
uci -q set network.lan.gateway="${lan_gateway}"
[ -n "$lan_dns" ] || lan_dns='223.5.5.5'
[ -n "$lan_dns" ] || lan_dns="${lan_gateway}"
[ -n "$dhcp" ] && uci -q set dhcp.lan.ignore="1" || uci -q del dhcp.lan.ignore
elif [ "${siderouter}" == "0" ]; then
uci -q del network.lan.gateway
uci -q del dhcp.lan.ignore
fi
fi