From d77a95ea5399fa174eb292bc5776c0559319176f Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Sun, 7 Nov 2021 22:17:34 +0800
Subject: [PATCH] update-11.07
---
luci-app-godproxy/rulesupdate.log | 85 +++++++++----------
luci-app-passwall/Makefile | 4 +-
.../model/cbi/passwall/client/rule_list.lua | 51 +++++++++++
luci-app-passwall/po/zh-cn/passwall.po | 17 +++-
.../root/usr/share/passwall/iptables.sh | 31 ++-----
.../usr/share/passwall/rules/lanlist_ipv4 | 9 ++
.../usr/share/passwall/rules/lanlist_ipv6 | 13 +++
7 files changed, 139 insertions(+), 71 deletions(-)
create mode 100644 luci-app-passwall/root/usr/share/passwall/rules/lanlist_ipv4
create mode 100644 luci-app-passwall/root/usr/share/passwall/rules/lanlist_ipv6
diff --git a/luci-app-godproxy/rulesupdate.log b/luci-app-godproxy/rulesupdate.log
index 012d34248..b55610fbf 100644
--- a/luci-app-godproxy/rulesupdate.log
+++ b/luci-app-godproxy/rulesupdate.log
@@ -1,43 +1,42 @@
-2021-11-07 00:34:13: ------------------- 规则更新 -----------------------
-2021-11-07 00:34:13: ====================================================
-2021-11-07 00:34:13: 开始更新koolproxy的规则,请等待...
-2021-11-07 00:34:13: ---------------------------------------------------------------------------------------
-2021-11-07 00:34:15: ABP规则的本地版本号: 202111050016
-2021-11-07 00:34:15: ABP规则的在线版本号: 202111070026
-2021-11-07 00:34:15: 检测到 ABP规则 已更新,现在开始更新...
-2021-11-07 00:34:15: 将临时的ABP规则文件移动到指定位置
-2021-11-07 00:34:15: kpr_our_rule2规则文件下载失败
-2021-11-07 00:34:15: yhosts规则本地版本号: !version: 202110242326
-2021-11-07 00:34:15: yhosts规则在线版本号: #version: 202110242326
-2021-11-07 00:34:15: 检测到 yhosts规则 已更新,现在开始更新...
-2021-11-07 00:34:15: 将临时文件覆盖到原始yhosts文件
-2021-11-07 00:34:15: 远程视频规则md5:
-2021-11-07 00:34:15: 您本地视频规则md5:48cdd7ed1e121aabf00b0884538e1cfe
-2021-11-07 00:34:15: 检测到新版视频规则.开始更新..........
-2021-11-07 00:34:15: 您下载的视频规则md5:d41d8cd98f00b204e9800998ecf8427e
-2021-11-07 00:34:15: 视频规则md5校验不通过...
-2021-11-07 00:34:15: fanboy规则本地版本号: 202103250121
-2021-11-07 00:34:15: fanboy规则在线版本号:
-2021-11-07 00:34:15: fanboy规则 文件下载失败!
-2021-11-07 00:34:15: antiad规则本地版本号: 20211105024137
-2021-11-07 00:34:15: antiad规则在线版本号: 20211105024137
-2021-11-07 00:34:16: 检测到 antiad规则 本地版本号和在线版本号相同,那还更新个毛啊!
-2021-11-07 00:34:16: StevenBlack规则本地版本号: 04 November
-2021-11-07 00:34:16: StevenBlack规则在线版本号: 04 November
-2021-11-07 00:34:16: 检测到 StevenBlack规则 本地版本号和在线版本号相同,那还更新个毛啊!
-2021-11-07 00:34:16: 跳过优化 fanboy规则。。。。。
-2021-11-07 00:34:16: 正在优化 ABP规则。。。。。
-2021-11-07 00:34:18: 正在优化 补充规则yhosts。。。。。
-2021-11-07 00:34:18: 跳过优化 补充规则antiad。。。。。
-2021-11-07 00:34:18: 跳过优化 补充规则adwars。。。。。
-2021-11-07 00:34:18: 跳过优化 补充规则ADgkStevenBlack。。。。。
-2021-11-07 00:34:18: 所有规则更新并优化完毕!
-2021-11-07 00:34:18: ====================================================
-2021-11-07 00:34:21: -------------------Yhosts规则 version !version: 202110242326
-2021-11-07 00:34:21: -------------------ABP规则 version 202111070026
-2021-11-07 00:34:21: -------------------Fanboy规则 version 202103250121
-2021-11-07 00:34:21: -------------------Antiad规则 version 20211105024137
-2021-11-07 00:34:21: -------------------静态规则 version 2020-02-27 23:00
-2021-11-07 00:34:21: -------------------乘风视频 version 202105021
-2021-11-07 00:34:21: ------------------- 内置规则更新成功! -------------------
-2021-11-07 00:34:21: ------------------- 规则更新成功! -------------------
+2021-11-07 13:30:55: ------------------- 规则更新 -----------------------
+2021-11-07 13:30:55: ====================================================
+2021-11-07 13:30:55: 开始更新koolproxy的规则,请等待...
+2021-11-07 13:30:55: ---------------------------------------------------------------------------------------
+2021-11-07 13:30:57: ABP规则的本地版本号: 202111070026
+2021-11-07 13:30:57: ABP规则的在线版本号: 202111071321
+2021-11-07 13:30:57: 检测到 ABP规则 已更新,现在开始更新...
+2021-11-07 13:30:57: 将临时的ABP规则文件移动到指定位置
+2021-11-07 13:30:58: yhosts规则本地版本号: !version: 202110242326
+2021-11-07 13:30:58: yhosts规则在线版本号: #version: 202110242326
+2021-11-07 13:30:58: 检测到 yhosts规则 已更新,现在开始更新...
+2021-11-07 13:30:58: 将临时文件覆盖到原始yhosts文件
+2021-11-07 13:30:58: 远程视频规则md5:
+2021-11-07 13:30:58: 您本地视频规则md5:48cdd7ed1e121aabf00b0884538e1cfe
+2021-11-07 13:30:58: 检测到新版视频规则.开始更新..........
+2021-11-07 13:30:58: 您下载的视频规则md5:d41d8cd98f00b204e9800998ecf8427e
+2021-11-07 13:30:58: 视频规则md5校验不通过...
+2021-11-07 13:31:00: fanboy规则本地版本号: 202103250121
+2021-11-07 13:31:00: fanboy规则在线版本号: 202111071300
+2021-11-07 13:31:00: 检测到新版本 fanboy规则 列表,开始更新...
+2021-11-07 13:31:00: 将临时文件覆盖到原始 fanboy规则 文件
+2021-11-07 13:31:00: antiad规则本地版本号: 20211105024137
+2021-11-07 13:31:00: antiad规则在线版本号: 20211105024137
+2021-11-07 13:31:00: 检测到 antiad规则 本地版本号和在线版本号相同,那还更新个毛啊!
+2021-11-07 13:31:00: Android规则本地版本号:
+2021-11-07 13:31:00: Android规则在线版本号:
+2021-11-07 13:31:00: Android规则 文件下载失败!
+2021-11-07 13:31:00: 正在优化 fanboy规则。。。。。
+2021-11-07 13:31:01: 正在优化 ABP规则。。。。。
+2021-11-07 13:31:02: 正在优化 补充规则yhosts。。。。。
+2021-11-07 13:31:02: 跳过优化 补充规则antiad。。。。。
+2021-11-07 13:31:02: 跳过优化 补充规则Android。。。。。
+2021-11-07 13:31:02: 所有规则更新并优化完毕!
+2021-11-07 13:31:02: ====================================================
+2021-11-07 13:31:04: -------------------Yhosts规则 version !version: 202110242326
+2021-11-07 13:31:04: -------------------ABP规则 version 202111071321
+2021-11-07 13:31:04: -------------------Fanboy规则 version 202111071300
+2021-11-07 13:31:04: -------------------Antiad规则 version 20211105024137
+2021-11-07 13:31:04: -------------------静态规则 version 2020-02-27 23:00
+2021-11-07 13:31:04: -------------------乘风视频 version 202111051
+2021-11-07 13:31:04: ------------------- 内置规则更新成功! -------------------
+2021-11-07 13:31:04: ------------------- 规则更新成功! -------------------
diff --git a/luci-app-passwall/Makefile b/luci-app-passwall/Makefile
index 18960f6d3..7a9876ed2 100644
--- a/luci-app-passwall/Makefile
+++ b/luci-app-passwall/Makefile
@@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall
-PKG_VERSION:=4.42
+PKG_VERSION:=4.43
PKG_RELEASE:=1
#20211103
@@ -153,6 +153,8 @@ define Package/$(PKG_NAME)/conffiles
/usr/share/passwall/rules/proxy_ip
/usr/share/passwall/rules/block_host
/usr/share/passwall/rules/block_ip
+/usr/share/passwall/rules/lanlist_ipv4
+/usr/share/passwall/rules/lanlist_ipv6
endef
include $(TOPDIR)/feeds/luci/luci.mk
diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua
index ff7108475..34681fc2b 100644
--- a/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua
+++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua
@@ -3,6 +3,7 @@ local appname = api.appname
local fs = api.fs
local datatypes = api.datatypes
local path = string.format("/usr/share/%s/rules/", appname)
+local route_hosts_path = "/etc/"
m = Map(appname)
@@ -13,6 +14,8 @@ s.anonymous = true
s:tab("direct_list", translate("Direct List"))
s:tab("proxy_list", translate("Proxy List"))
s:tab("block_list", translate("Block List"))
+s:tab("lan_ip_list", translate("Lan Ip List"))
+s:tab("route_hosts", translate("Route Hosts"))
---- Direct Hosts
local direct_host = path .. "direct_host"
@@ -128,4 +131,52 @@ o.validate = function(self, value)
return value
end
+---- Lan IPv4
+local lanlist_ipv4 = path .. "lanlist_ipv4"
+o = s:taboption("lan_ip_list", TextValue, "lanlist_ipv4", "", "" .. translate("The list is the IPv4 LAN IP list, which represents the direct connection IP of the LAN. If you need the LAN IP in the proxy list, please clear it from the list. Do not modify this list by default.") .. "")
+o.rows = 15
+o.wrap = "off"
+o.cfgvalue = function(self, section) return fs.readfile(lanlist_ipv4) or "" end
+o.write = function(self, section, value) fs.writefile(lanlist_ipv4, value:gsub("\r\n", "\n")) end
+o.remove = function(self, section, value) fs.writefile(lanlist_ipv4, "") end
+o.validate = function(self, value)
+ local ipmasks= {}
+ string.gsub(value, '[^' .. "\r\n" .. ']+', function(w) table.insert(ipmasks, w) end)
+ for index, ipmask in ipairs(ipmasks) do
+ if not ( datatypes.ipmask4(ipmask) or datatypes.ipmask6(ipmask) ) then
+ return nil, ipmask .. " " .. translate("Not valid IP format, please re-enter!")
+ end
+ end
+ return value
+end
+
+---- Lan IPv6
+local lanlist_ipv6 = path .. "lanlist_ipv6"
+o = s:taboption("lan_ip_list", TextValue, "lanlist_ipv6", "", "" .. translate("The list is the IPv6 LAN IP list, which represents the direct connection IP of the LAN. If you need the LAN IP in the proxy list, please clear it from the list. Do not modify this list by default.") .. "")
+o.rows = 15
+o.wrap = "off"
+o.cfgvalue = function(self, section) return fs.readfile(lanlist_ipv6) or "" end
+o.write = function(self, section, value) fs.writefile(lanlist_ipv6, value:gsub("\r\n", "\n")) end
+o.remove = function(self, section, value) fs.writefile(lanlist_ipv6, "") end
+o.validate = function(self, value)
+ local ipmasks= {}
+ string.gsub(value, '[^' .. "\r\n" .. ']+', function(w) table.insert(ipmasks, w) end)
+ for index, ipmask in ipairs(ipmasks) do
+ if not ( datatypes.ipmask4(ipmask) or datatypes.ipmask6(ipmask) ) then
+ return nil, ipmask .. " " .. translate("Not valid IP format, please re-enter!")
+ end
+ end
+ return value
+end
+
+---- Route Hosts
+local hosts = route_hosts_path .. "hosts"
+o = s:taboption("route_hosts", TextValue, "hosts", "", "" .. translate("Configure routing etc/hosts file, if you don't know what you are doing, please don't change the content.") .. "")
+o.rows = 15
+o.wrap = "off"
+o.cfgvalue = function(self, section) return fs.readfile(hosts) or "" end
+o.write = function(self, section, value) fs.writefile(hosts, value:gsub("\r\n", "\n")) end
+o.remove = function(self, section, value) fs.writefile(hosts, "") end
+
+
return m
diff --git a/luci-app-passwall/po/zh-cn/passwall.po b/luci-app-passwall/po/zh-cn/passwall.po
index 0d52723a0..0e3e29db8 100644
--- a/luci-app-passwall/po/zh-cn/passwall.po
+++ b/luci-app-passwall/po/zh-cn/passwall.po
@@ -71,7 +71,7 @@ msgid "Rule Manage"
msgstr "规则管理"
msgid "Rule List Manage"
-msgstr "直连/代理名单管理"
+msgstr "直连/代理/局域网/hosts名单管理"
msgid "Access control"
msgstr "访问控制"
@@ -922,6 +922,12 @@ msgstr "代理列表"
msgid "Block List"
msgstr "屏蔽列表"
+msgid "Lan Ip List"
+msgstr "局域网IP列表"
+
+msgid "Route Hosts"
+msgstr "路由Hosts文件"
+
msgid "Join the direct hosts list of domain names will not proxy."
msgstr "加入的域名不走代理,对所有模式有效。且优先级最高。"
@@ -937,6 +943,15 @@ msgstr "加入的IP段将走代理。可输入IP地址或地址段,如:35.24
msgid "These had been joined websites will be block. Please input the domain names of websites, every line can input only one website domain. For example: twitter.com."
msgstr "加入的域名将屏蔽。输入网站域名,如:twitter.com,每个地址段一行。"
+msgid "The list is the IPv4 LAN IP list, which represents the direct connection IP of the LAN. If you need the LAN IP in the proxy list, please clear it from the list. Do not modify this list by default."
+msgstr "列表中为IPv4的局域网IP列表,代表局域网直连IP。如果需要代理列表中的局域网IP,请将其在该列表中清除,并将其添加到代理列表中。默认情况下不要修改这个列表。"
+
+msgid "The list is the IPv6 LAN IP list, which represents the direct connection IP of the LAN. If you need the LAN IP in the proxy list, please clear it from the list. Do not modify this list by default."
+msgstr "列表中为IPv6的局域网IP列表,代表局域网直连IP。如果需要代理列表中的局域网IP,请将其在该列表中清除,并将其添加到代理列表中。默认情况下不要修改这个列表。"
+
+msgid "Configure routing etc/hosts file, if you don't know what you are doing, please don't change the content."
+msgstr "配置路由etc/hosts文件,如果你不知道自己在做什么,请不要改动内容。"
+
msgid "These had been joined ip addresses will be block. Please input the ip address or ip address segment, every line can input only one ip address."
msgstr "加入的IP段将屏蔽。可输入IP地址或地址段,每个地址段一行。"
diff --git a/luci-app-passwall/root/usr/share/passwall/iptables.sh b/luci-app-passwall/root/usr/share/passwall/iptables.sh
index 1f40c6dfa..a2bddf23b 100755
--- a/luci-app-passwall/root/usr/share/passwall/iptables.sh
+++ b/luci-app-passwall/root/usr/share/passwall/iptables.sh
@@ -26,6 +26,8 @@ ip6t_m="ip6tables -t mangle -w"
FWI=$(uci -q get firewall.passwall.path 2>/dev/null)
FAKE_IP=198.18.0.0/16
+app_name=$(lua -e "local api = require 'luci.model.cbi.passwall.api.api' print(api.appname)")
+
factor() {
if [ -z "$1" ] || [ -z "$2" ]; then
echo ""
@@ -141,36 +143,13 @@ get_action_chain_name() {
esac
}
+
gen_laniplist() {
- cat <<-EOF
- 0.0.0.0/8
- 10.0.0.0/8
- 100.64.0.0/10
- 127.0.0.0/8
- 169.254.0.0/16
- 172.16.0.0/12
- 192.168.0.0/16
- 224.0.0.0/4
- 240.0.0.0/4
- EOF
+ cat /usr/share/${app_name}/rules/lanlist_ipv4
}
gen_laniplist_6() {
- cat <<-EOF
- ::/128
- ::1/128
- ::ffff:0:0/96
- ::ffff:0:0:0/96
- 64:ff9b::/96
- 100::/64
- 2001::/32
- 2001:20::/28
- 2001:db8::/32
- 2002::/16
- fc00::/7
- fe80::/10
- ff00::/8
- EOF
+ cat /usr/share/${app_name}/rules/lanlist_ipv6
}
load_acl() {
diff --git a/luci-app-passwall/root/usr/share/passwall/rules/lanlist_ipv4 b/luci-app-passwall/root/usr/share/passwall/rules/lanlist_ipv4
new file mode 100644
index 000000000..3ccfd604b
--- /dev/null
+++ b/luci-app-passwall/root/usr/share/passwall/rules/lanlist_ipv4
@@ -0,0 +1,9 @@
+0.0.0.0/8
+10.0.0.0/8
+100.64.0.0/10
+127.0.0.0/8
+169.254.0.0/16
+172.16.0.0/12
+192.168.0.0/16
+224.0.0.0/4
+240.0.0.0/4
\ No newline at end of file
diff --git a/luci-app-passwall/root/usr/share/passwall/rules/lanlist_ipv6 b/luci-app-passwall/root/usr/share/passwall/rules/lanlist_ipv6
new file mode 100644
index 000000000..6ac03da58
--- /dev/null
+++ b/luci-app-passwall/root/usr/share/passwall/rules/lanlist_ipv6
@@ -0,0 +1,13 @@
+::/128
+::1/128
+::ffff:0:0/96
+::ffff:0:0:0/96
+64:ff9b::/96
+100::/64
+2001::/32
+2001:20::/28
+2001:db8::/32
+2002::/16
+fc00::/7
+fe80::/10
+ff00::/8
\ No newline at end of file