luci-app-passwall: bump to 4-18
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
@@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall
|
||||
PKG_VERSION:=4
|
||||
PKG_RELEASE:=17
|
||||
PKG_DATE:=20210314
|
||||
PKG_RELEASE:=18
|
||||
PKG_DATE:=20210325
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
|
||||
@@ -194,9 +194,9 @@ gen_dnsmasq_items() {
|
||||
local fwd_dns=${1}; shift 1
|
||||
local outf=${1}; shift 1
|
||||
|
||||
awk -v ipsetlist="${ipsetlist}" -v fwd_dns="${fwd_dns}" -v outf="${outf}" '
|
||||
awk -v ipsetlist="${ipsetlist}" -v ipsetoutf="${TMP_DNSMASQ_PATH}/ipset.conf" -v fwd_dns="${fwd_dns}" -v outf="${outf}" '
|
||||
BEGIN {
|
||||
if(outf == "") outf="/dev/stdout";
|
||||
if(outf == "") {outf="/dev/stdout"; ipsetoutf="/dev/stdout";}
|
||||
split(fwd_dns, dns, ","); setdns=length(dns)>0; setlist=length(ipsetlist)>0;
|
||||
if(setdns) for(i in dns) if(length(dns[i])==0) delete dns[i];
|
||||
fail=1;
|
||||
@@ -205,9 +205,10 @@ gen_dnsmasq_items() {
|
||||
fail=0
|
||||
if(! (setdns || setlist)) {printf("server=%s\n", $0) >>outf; next;}
|
||||
if(setdns) for(i in dns) printf("server=/.%s/%s\n", $0, dns[i]) >>outf;
|
||||
if(setlist) printf("ipset=/.%s/%s\n", $0, ipsetlist) >>outf;
|
||||
|
||||
if(setlist) printf("ipset=/.%s/%s\n", $0, ipsetlist) >>ipsetoutf;
|
||||
}
|
||||
END {fflush(outf); close(outf); exit(fail);}
|
||||
END {fflush(outf); close(outf); fflush(ipsetoutf); close(ipsetoutf); exit(fail);}
|
||||
'
|
||||
}
|
||||
|
||||
@@ -316,6 +317,20 @@ load_config() {
|
||||
echolog "没有选择节点!"
|
||||
NO_PROXY=1
|
||||
}
|
||||
|
||||
count_hosts_str=
|
||||
[ -f "${RULES_PATH}/direct_host" ] && direct_hosts_str="$(echo -n $(cat ${RULES_PATH}/direct_host) | sed "s/ /|/g")"
|
||||
[ -f "${RULES_PATH}/proxy_host" ] && proxy_hosts_str="$(echo -n $(cat ${RULES_PATH}/proxy_host) | sed "s/ /|/g")"
|
||||
[ -n "$direct_hosts_str" ] && {
|
||||
tmp="${direct_hosts_str}"
|
||||
[ -n "$count_hosts_str" ] && tmp="${count_hosts_str}|${direct_hosts_str}"
|
||||
count_hosts_str="$tmp"
|
||||
}
|
||||
[ -n "$proxy_hosts_str" ] && {
|
||||
tmp="${proxy_hosts_str}"
|
||||
[ -n "$count_hosts_str" ] && tmp="${count_hosts_str}|${proxy_hosts_str}"
|
||||
count_hosts_str="$tmp"
|
||||
}
|
||||
|
||||
global=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "global")
|
||||
returnhome=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "returnhome")
|
||||
@@ -871,7 +886,6 @@ start_dns() {
|
||||
esac
|
||||
|
||||
[ -n "$chnlist" ] && [ "$DNS_MODE" != "custom" ] && [ "$DNS_MODE" != "fake_ip" ] && {
|
||||
[ -f "${RULES_PATH}/chnlist" ] && cp -a "${RULES_PATH}/chnlist" "${TMP_PATH}/chnlist"
|
||||
[ -n "$(first_type chinadns-ng)" ] && {
|
||||
echolog "发现ChinaDNS-NG,将启动。"
|
||||
CHINADNS_NG=1
|
||||
@@ -894,17 +908,15 @@ start_dns() {
|
||||
msg="自定义DNS"
|
||||
fi
|
||||
|
||||
sed -n 's/^ipset=\/\.\?\([^/]*\).*$/\1/p' "${RULES_PATH}/gfwlist.conf" | sort -u > "${TMP_PATH}/gfwlist.txt"
|
||||
local gfwlist_param="${TMP_PATH}/chinadns_gfwlist"
|
||||
[ -f "${RULES_PATH}/gfwlist" ] && cp -a "${RULES_PATH}/gfwlist" "${gfwlist_param}"
|
||||
local chnlist_param="${TMP_PATH}/chinadns_chnlist"
|
||||
[ -f "${RULES_PATH}/chnlist" ] && cp -a "${RULES_PATH}/chnlist" "${chnlist_param}"
|
||||
|
||||
[ -f "${RULES_PATH}/proxy_host" ] && {
|
||||
cat "${RULES_PATH}/proxy_host" >> "${TMP_PATH}/gfwlist.txt" && sort -u "${TMP_PATH}/gfwlist.txt" > "${TMP_PATH}/gfwlist2.txt" && mv -f "${TMP_PATH}/gfwlist2.txt" "${TMP_PATH}/gfwlist.txt"
|
||||
local gfwlist_param="${TMP_PATH}/gfwlist.txt"
|
||||
cat "${RULES_PATH}/proxy_host" >> "${gfwlist_param}"
|
||||
echolog " | - [$?](chinadns-ng) 代理域名表合并到防火墙域名表"
|
||||
|
||||
for _host in $(cat ${RULES_PATH}/proxy_host); do
|
||||
sed -i "/$_host/d" "${TMP_PATH}/chnlist"
|
||||
done
|
||||
}
|
||||
local chnlist_param="${TMP_PATH}/chnlist"
|
||||
[ -f "${RULES_PATH}/direct_host" ] && {
|
||||
cat "${RULES_PATH}/direct_host" >> "${chnlist_param}"
|
||||
echolog " | - [$?](chinadns-ng) 域名白名单合并到中国域名表"
|
||||
@@ -942,10 +954,12 @@ add_dnsmasq() {
|
||||
echolog " - [$?]节点列表中的域名(vpsiplist):${fwd_dns:-默认}"
|
||||
|
||||
#始终用国内DNS解析直连(白名单)列表
|
||||
fwd_dns="${LOCAL_DNS}"
|
||||
[ -n "$CHINADNS_NG" ] && unset fwd_dns
|
||||
sort -u "${RULES_PATH}/direct_host" | gen_dnsmasq_items "whitelist,whitelist6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/11-direct_host.conf"
|
||||
echolog " - [$?]域名白名单(whitelist):${fwd_dns:-默认}"
|
||||
[ -f "${RULES_PATH}/direct_host" ] && {
|
||||
fwd_dns="${LOCAL_DNS}"
|
||||
[ -n "$CHINADNS_NG" ] && unset fwd_dns
|
||||
sort -u "${RULES_PATH}/direct_host" | gen_dnsmasq_items "whitelist,whitelist6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/11-direct_host.conf"
|
||||
echolog " - [$?]域名白名单(whitelist):${fwd_dns:-默认}"
|
||||
}
|
||||
|
||||
if [ "$(config_t_get global_subscribe subscribe_proxy 0)" = "0" ]; then
|
||||
#如果没有开启通过代理订阅
|
||||
@@ -969,15 +983,17 @@ add_dnsmasq() {
|
||||
fi
|
||||
|
||||
#始终使用远程DNS解析代理(黑名单)列表
|
||||
if [ "${DNS_MODE}" = "fake_ip" ]; then
|
||||
sort -u "${RULES_PATH}/proxy_host" | gen_dnsmasq_fake_items "11.1.1.1" "${TMP_DNSMASQ_PATH}/97-proxy_host.conf"
|
||||
else
|
||||
fwd_dns="${TUN_DNS}"
|
||||
[ -n "$CHINADNS_NG" ] && fwd_dns="${china_ng_gfw}"
|
||||
[ -n "$CHINADNS_NG" ] && unset fwd_dns
|
||||
sort -u "${RULES_PATH}/proxy_host" | gen_dnsmasq_items "blacklist,blacklist6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/97-proxy_host.conf"
|
||||
echolog " - [$?]代理域名表(blacklist):${fwd_dns:-默认}"
|
||||
fi
|
||||
[ -f "${RULES_PATH}/proxy_host" ] && {
|
||||
if [ "${DNS_MODE}" = "fake_ip" ]; then
|
||||
sort -u "${RULES_PATH}/proxy_host" | gen_dnsmasq_fake_items "11.1.1.1" "${TMP_DNSMASQ_PATH}/97-proxy_host.conf"
|
||||
else
|
||||
fwd_dns="${TUN_DNS}"
|
||||
[ -n "$CHINADNS_NG" ] && fwd_dns="${china_ng_gfw}"
|
||||
[ -n "$CHINADNS_NG" ] && unset fwd_dns
|
||||
sort -u "${RULES_PATH}/proxy_host" | gen_dnsmasq_items "blacklist,blacklist6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/97-proxy_host.conf"
|
||||
echolog " - [$?]代理域名表(blacklist):${fwd_dns:-默认}"
|
||||
fi
|
||||
}
|
||||
|
||||
#分流规则
|
||||
[ "$(config_n_get $TCP_NODE protocol)" = "_shunt" ] && {
|
||||
@@ -1002,35 +1018,58 @@ add_dnsmasq() {
|
||||
|
||||
#如果没有使用回国模式
|
||||
if [ -z "${returnhome}" ]; then
|
||||
[ ! -f "${TMP_PATH}/gfwlist.txt" ] && sed -n 's/^ipset=\/\.\?\([^/]*\).*$/\1/p' "${RULES_PATH}/gfwlist.conf" | sort -u > "${TMP_PATH}/gfwlist.txt"
|
||||
[ -f "${RULES_PATH}/gfwlist" ] && {
|
||||
if [ -n "$count_hosts_str" ]; then
|
||||
grep -v -E "$count_hosts_str" "${RULES_PATH}/gfwlist" > "${TMP_PATH}/gfwlist"
|
||||
else
|
||||
cp -a "${RULES_PATH}/gfwlist" "${TMP_PATH}/gfwlist"
|
||||
fi
|
||||
}
|
||||
if [ "${DNS_MODE}" = "fake_ip" ]; then
|
||||
sort -u "${TMP_PATH}/gfwlist.txt" | gen_dnsmasq_fake_items "11.1.1.1" "${TMP_DNSMASQ_PATH}/99-gfwlist.conf"
|
||||
sort -u "${TMP_PATH}/gfwlist" | gen_dnsmasq_fake_items "11.1.1.1" "${TMP_DNSMASQ_PATH}/99-gfwlist.conf"
|
||||
else
|
||||
fwd_dns="${TUN_DNS}"
|
||||
[ -n "$CHINADNS_NG" ] && fwd_dns="${china_ng_gfw}"
|
||||
[ -n "$CHINADNS_NG" ] && unset fwd_dns
|
||||
sort -u "${TMP_PATH}/gfwlist.txt" | gen_dnsmasq_items "gfwlist,gfwlist6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/99-gfwlist.conf"
|
||||
sort -u "${TMP_PATH}/gfwlist" | gen_dnsmasq_items "gfwlist,gfwlist6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/99-gfwlist.conf"
|
||||
echolog " - [$?]防火墙域名表(gfwlist):${fwd_dns:-默认}"
|
||||
rm -f "${TMP_PATH}/gfwlist"
|
||||
fi
|
||||
# Not China List 模式
|
||||
[ -n "${chnlist}" ] && {
|
||||
fwd_dns="${LOCAL_DNS}"
|
||||
[ -n "$CHINADNS_NG" ] && unset fwd_dns
|
||||
sort -u "${TMP_PATH}/chnlist" | gen_dnsmasq_items "chnroute,chnroute6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/19-chinalist_host.conf"
|
||||
echolog " - [$?]中国域名表(chnroute):${fwd_dns:-默认}"
|
||||
[ -f "${RULES_PATH}/chnlist" ] && {
|
||||
if [ -n "$count_hosts_str" ]; then
|
||||
grep -v -E "$count_hosts_str" "${RULES_PATH}/chnlist" | gen_dnsmasq_items "chnroute,chnroute6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/19-chinalist_host.conf"
|
||||
else
|
||||
sort -u "${RULES_PATH}/chnlist" | gen_dnsmasq_items "chnroute,chnroute6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/19-chinalist_host.conf"
|
||||
fi
|
||||
echolog " - [$?]中国域名表(chnroute):${fwd_dns:-默认}"
|
||||
}
|
||||
}
|
||||
else
|
||||
#回国模式
|
||||
[ -f "${RULES_PATH}/chnlist" ] && {
|
||||
if [ -n "$count_hosts_str" ]; then
|
||||
grep -v -E "$count_hosts_str" "${RULES_PATH}/chnlist" > "${TMP_PATH}/chnlist"
|
||||
else
|
||||
cp -a "${RULES_PATH}/chnlist" "${TMP_PATH}/chnlist"
|
||||
fi
|
||||
}
|
||||
if [ "${DNS_MODE}" = "fake_ip" ]; then
|
||||
sort -u "${RULES_PATH}/chnlist" | gen_dnsmasq_fake_items "11.1.1.1" "${TMP_DNSMASQ_PATH}/99-chinalist_host.conf"
|
||||
[ -f "${TMP_PATH}/chnlist" ] && sort -u "${TMP_PATH}/chnlist" | gen_dnsmasq_fake_items "11.1.1.1" "${TMP_DNSMASQ_PATH}/99-chinalist_host.conf"
|
||||
else
|
||||
fwd_dns="${TUN_DNS}"
|
||||
sort -u "${RULES_PATH}/chnlist" | gen_dnsmasq_items "chnroute,chnroute6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/99-chinalist_host.conf"
|
||||
[ -f "${TMP_PATH}/chnlist" ] && sort -u "${TMP_PATH}/chnlist" | gen_dnsmasq_items "chnroute,chnroute6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/99-chinalist_host.conf"
|
||||
echolog " - [$?]中国域名表(chnroute):${fwd_dns:-默认}"
|
||||
fi
|
||||
rm -f "${TMP_PATH}/chnlist"
|
||||
fi
|
||||
|
||||
#awk '{gsub(/ipset=\//,""); gsub(/\//," ");key=$1;value=$2;if (sum[key] != "") {sum[key]=sum[key]","value} else {sum[key]=sum[key]value}} END{for(i in sum) print "ipset=/"i"/"sum[i]}' "${TMP_DNSMASQ_PATH}/ipset.conf" > "${TMP_DNSMASQ_PATH}/ipset.conf2"
|
||||
#mv -f "${TMP_DNSMASQ_PATH}/ipset.conf2" "${TMP_DNSMASQ_PATH}/ipset.conf"
|
||||
fi
|
||||
|
||||
if [ "${DNS_MODE}" != "nouse" ]; then
|
||||
echo "conf-dir=${TMP_DNSMASQ_PATH}" > "/var/dnsmasq.d/dnsmasq-${CONFIG}.conf"
|
||||
|
||||
|
||||
@@ -25,11 +25,6 @@ local ip6_ipset_pattern = ":-[%x]+%:+[%x]-[%/][%d]+$"
|
||||
local domain_pattern = "([%w%-%_]+%.[%w%.%-%_]+)[%/%*]*"
|
||||
local excluded_domain = {"apple.com","sina.cn","sina.com.cn","baidu.com","byr.cn","jlike.com","weibo.com","zhongsou.com","youdao.com","sogou.com","so.com","soso.com","aliyun.com","taobao.com","jd.com","qq.com"}
|
||||
|
||||
-- gfwlist parameter
|
||||
local mydnsip = '127.0.0.1'
|
||||
local mydnsport = '7913'
|
||||
local ipsetname = 'gfwlist'
|
||||
|
||||
local gfwlist_url = ucic:get_first(name, 'global_rules', "gfwlist_url", "https://cdn.jsdelivr.net/gh/Loukky/gfwlist-by-loukky/gfwlist.txt")
|
||||
local chnroute_url = ucic:get_first(name, 'global_rules', "chnroute_url", "https://ispip.clang.cn/all_cn.txt")
|
||||
local chnroute6_url = ucic:get_first(name, 'global_rules', "chnroute6_url", "https://ispip.clang.cn/all_cn_ipv6.txt")
|
||||
@@ -124,8 +119,7 @@ local function fetch_gfwlist()
|
||||
|
||||
local out = io.open("/tmp/gfwlist_tmp", "w")
|
||||
for k,v in pairs(domains) do
|
||||
out:write(string.format("server=/.%s/%s#%s\n", k,mydnsip,mydnsport))
|
||||
out:write(string.format("ipset=/.%s/%s\n", k,ipsetname))
|
||||
out:write(string.format("%s\n", k))
|
||||
end
|
||||
out:close()
|
||||
end
|
||||
@@ -350,12 +344,12 @@ end
|
||||
log("开始更新规则...")
|
||||
if tonumber(gfwlist_update) == 1 then
|
||||
log("gfwlist 开始更新...")
|
||||
local old_md5 = luci.sys.exec("echo -n $(md5sum " .. rule_path .. "/gfwlist.conf | awk '{print $1}')")
|
||||
local old_md5 = luci.sys.exec("echo -n $(md5sum " .. rule_path .. "/gfwlist | awk '{print $1}')")
|
||||
local status = fetch_gfwlist()
|
||||
if status == 200 then
|
||||
local new_md5 = luci.sys.exec("echo -n $([ -f '/tmp/gfwlist_tmp' ] && md5sum /tmp/gfwlist_tmp | awk '{print $1}')")
|
||||
if old_md5 ~= new_md5 then
|
||||
luci.sys.exec("mv -f /tmp/gfwlist_tmp " .. rule_path .. "/gfwlist.conf")
|
||||
luci.sys.exec("mv -f /tmp/gfwlist_tmp " .. rule_path .. "/gfwlist")
|
||||
reboot = 1
|
||||
log("gfwlist 更新成功...")
|
||||
else
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1725,7 +1725,6 @@
|
||||
59.172.0.0/15
|
||||
59.174.0.0/15
|
||||
59.191.0.0/17
|
||||
59.191.240.0/20
|
||||
59.192.0.0/10
|
||||
60.0.0.0/13
|
||||
60.8.0.0/15
|
||||
@@ -3977,7 +3976,6 @@
|
||||
103.146.124.0/23
|
||||
103.146.126.0/23
|
||||
103.146.138.0/23
|
||||
103.146.147.0/24
|
||||
103.146.230.0/23
|
||||
103.146.236.0/23
|
||||
103.146.252.0/23
|
||||
@@ -4131,6 +4129,14 @@
|
||||
103.163.32.0/23
|
||||
103.163.46.0/23
|
||||
103.163.74.0/23
|
||||
103.163.180.0/23
|
||||
103.164.4.0/23
|
||||
103.164.32.0/23
|
||||
103.164.40.0/23
|
||||
103.164.42.0/23
|
||||
103.164.64.0/23
|
||||
103.164.76.0/23
|
||||
103.164.178.0/23
|
||||
103.192.0.0/22
|
||||
103.192.4.0/22
|
||||
103.192.8.0/22
|
||||
@@ -4410,7 +4416,6 @@
|
||||
103.205.252.0/22
|
||||
103.206.0.0/22
|
||||
103.206.44.0/22
|
||||
103.206.108.0/22
|
||||
103.206.148.0/22
|
||||
103.207.48.0/22
|
||||
103.207.104.0/22
|
||||
@@ -6200,6 +6205,7 @@
|
||||
157.156.0.0/16
|
||||
157.255.0.0/16
|
||||
158.79.0.0/16
|
||||
159.27.0.0/16
|
||||
159.75.0.0/16
|
||||
159.226.0.0/16
|
||||
160.19.208.0/22
|
||||
@@ -6266,6 +6272,7 @@
|
||||
163.177.0.0/16
|
||||
163.179.0.0/16
|
||||
163.204.0.0/16
|
||||
163.228.0.0/16
|
||||
164.52.0.0/17
|
||||
166.111.0.0/16
|
||||
167.139.0.0/16
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
2001:df2:5200::/48
|
||||
2001:df2:5780::/48
|
||||
2001:df2:5a80::/48
|
||||
2001:df2:6680::/48
|
||||
2001:df2:a580::/48
|
||||
2001:df3:1480::/48
|
||||
2001:df3:2a80::/48
|
||||
@@ -265,7 +264,6 @@
|
||||
2400:a040::/32
|
||||
2400:a380::/32
|
||||
2400:a480::/32
|
||||
2400:a6c0::/32
|
||||
2400:a780::/32
|
||||
2400:a8c0::/32
|
||||
2400:a900::/32
|
||||
@@ -717,7 +715,6 @@
|
||||
2402:ba80::/32
|
||||
2402:bac0::/32
|
||||
2402:bbc0::/32
|
||||
2402:bec0::/32
|
||||
2402:bf80::/32
|
||||
2402:c280::/32
|
||||
2402:c3c0::/32
|
||||
@@ -1776,8 +1773,16 @@
|
||||
2407:23c0::/32
|
||||
2407:2440::/32
|
||||
2407:2780::/32
|
||||
2407:2840::/32
|
||||
2407:2ac0::/32
|
||||
2407:31c0::/32
|
||||
2407:3340::/32
|
||||
2407:3540::/32
|
||||
2407:3700::/32
|
||||
2407:3740::/32
|
||||
2407:37c0::/32
|
||||
2407:3900::/32
|
||||
2407:3f40::/32
|
||||
2407:4580::/32
|
||||
2407:4680::/32
|
||||
2407:4880::/32
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
apple.com
|
||||
microsoft.com
|
||||
dyndns.com
|
||||
rrys.tv
|
||||
douyucdn.cn
|
||||
douyucdn2.cn
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
||||
googleapis.cn
|
||||
googleapis.com
|
||||
xn--ngstr-lra8j.com
|
||||
v2ex.com
|
||||
gstatic.com
|
||||
google.com.tw
|
||||
google.com.hk
|
||||
github.com
|
||||
gstatic.com
|
||||
xn--ngstr-lra8j.com
|
||||
github.com
|
||||
v2ex.com
|
||||
Reference in New Issue
Block a user