Merge Mainline

This commit is contained in:
CN_SZTL 2020-08-23 04:16:24 +08:00
commit daea828bc3
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
21 changed files with 2145 additions and 100 deletions

View File

@ -1,8 +1,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-vssr
PKG_VERSION:=1.11
PKG_RELEASE:=20200719
PKG_VERSION:=1.12
PKG_RELEASE:=20200822
PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server \
@ -35,7 +35,7 @@ define Package/luci-app-vssr
SUBMENU:=3. Applications
TITLE:=A New SS/SSR/V2Ray/Trojan LuCI interface
PKGARCH:=all
DEPENDS:=+shadowsocksr-libev-alt +ipset +ip-full +iptables-mod-tproxy +dnsmasq-full +coreutils +coreutils-base64 +bash +pdnsd-alt +wget +luasocket +jshn +lua-cjson +coreutils-nohup +lua-maxminddb \
DEPENDS:=+shadowsocksr-libev-alt +ipset +ip-full +iptables-mod-tproxy +dnsmasq-full +coreutils +coreutils-base64 +bash +pdnsd-alt +wget +luasocket +coreutils-nohup +lua-maxminddb \
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray:v2ray \
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:trojan \
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:ipt2socks \

View File

@ -57,7 +57,7 @@ end
-- 执行订阅
function get_subscribe()
local cjson = require "cjson"
local cjson = require "luci.jsonc"
local e = {}
local uci = luci.model.uci.cursor()
local auto_update = luci.http.formvalue("auto_update")
@ -74,7 +74,7 @@ function get_subscribe()
luci.sys.call(cmd1)
luci.sys.call(cmd2)
luci.sys.call(cmd3)
for k, v in ipairs(cjson.decode(subscribe_url)) do
for k, v in ipairs(cjson.parse(subscribe_url)) do
luci.sys.call(
'uci add_list vssr.@server_subscribe[0].subscribe_url="' .. v ..
'"')
@ -292,46 +292,6 @@ function check_port()
end
function JudgeIPString(ipStr)
if type(ipStr) ~= "string" then return false end
-- 判断长度
local len = string.len(ipStr)
if len < 7 or len > 15 then -- 长度不对
return false
end
-- 判断出现的非数字字符
local point = string.find(ipStr, "%p", 1) -- 字符"."出现的位置
local pointNum = 0 -- 字符"."出现的次数 正常ip有3个"."
while point ~= nil do
if string.sub(ipStr, point, point) ~= "." then -- 得到非数字符号不是字符"."
return false
end
pointNum = pointNum + 1
point = string.find(ipStr, "%p", point + 1)
if pointNum > 3 then return false end
end
if pointNum ~= 3 then -- 不是正确的ip格式
return false
end
-- 判断数字对不对
local num = {}
for w in string.gmatch(ipStr, "%d+") do
num[#num + 1] = w
local kk = tonumber(w)
if kk == nil or kk > 255 then -- 不是数字或超过ip正常取值范围了
return false
end
end
if #num ~= 4 then -- 不是4段数字
return false
end
return ipStr
end
-- 检测 当前节点ip 和 网站访问情况
function check_ip()
@ -341,7 +301,8 @@ function check_ip()
local d = {}
local mm = require 'maxminddb'
local db = mm.open('/usr/share/vssr/GeoLite2-Country.mmdb')
local ip = string.gsub(luci.sys.exec("content=`wget --no-check-certificate -q -O - https://api.ip.sb/ip`;echo $content"), "\n", "")
local http = require "luci.sys"
local ip = string.gsub(http.httpget("https://api.ip.sb/ip"), "\n", "")
local res = db:lookup(ip)
d.flag = string.lower(res:get("country", "iso_code"))
d.country = res:get("country", "names", "zh-CN")

View File

@ -102,6 +102,11 @@ for _,key in pairs(key_table_v2) do o:value(key,v2ray_table[key]) end
o:depends("v2ray_flow", "1")
o.default = "nil"
o = s:option(ListValue, "tvb_server", translate("TVB Video Proxy"))
o:value("nil", translate("Same as Global Server"))
for _,key in pairs(key_table_v2) do o:value(key,v2ray_table[key]) end
o:depends("v2ray_flow", "1")
o.default = "nil"
o = s:option(ListValue, "threads", translate("Multi Threads Option"))
o:value("0", translate("Auto Threads"))

View File

@ -1,7 +1,7 @@
-- Licensed to the public under the GNU General Public License v3.
local m, s, o
local vssr = "vssr"
local cjson = require("cjson")
local json = require "luci.jsonc"
local uci = luci.model.uci.cursor()
local server_count = 0
@ -27,7 +27,7 @@ s.sortable = false
s.des = server_count
s.current = uci:get("vssr", name, "global_server")
s.servers = cjson.encode(server_table)
s.servers = json.stringify(server_table)
s.template = "vssr/tblsection"
s.extedit = luci.dispatcher.build_url("admin/services/vssr/servers/%s")
function s.create(...)

View File

@ -636,6 +636,9 @@ msgstr "Diseny+ 代理"
msgid "Prime Video Proxy"
msgstr "Prime Video 代理"
msgid "TVB Video Proxy"
msgstr "TVB 视频代理"
msgid "adblock settings"
msgstr "广告屏蔽设置"

View File

@ -1 +1,22 @@
api.ip.sb
api.ip.sb
fast.com
netflix.ca
netflix.com
netflix.net
netflixinvestor.com
netflixtechblog.com
nflxext.com
nflximg.com
nflximg.net
nflxsearch.net
nflxso.net
nflxvideo.net
amazonprimevideos.com
amazonvideo.cc
amazonvideo.com
prime-video.com
primevideo.cc
primevideo.com
primevideo.info
primevideo.org
primevideo.tv

View File

@ -128,14 +128,14 @@ EOF
fw_rule() {
$IPT -N SS_SPEC_WAN_FW
$IPT -A SS_SPEC_WAN_FW -d 0.0.0.0/8 -j RETURN
$IPT -A SS_SPEC_WAN_FW -d 10.0.0.0/8 -j RETURN
$IPT -A SS_SPEC_WAN_FW -d 127.0.0.0/8 -j RETURN
$IPT -A SS_SPEC_WAN_FW -d 169.254.0.0/16 -j RETURN
$IPT -A SS_SPEC_WAN_FW -d 172.16.0.0/12 -j RETURN
$IPT -A SS_SPEC_WAN_FW -d 192.168.0.0/16 -j RETURN
$IPT -A SS_SPEC_WAN_FW -d 224.0.0.0/4 -j RETURN
$IPT -A SS_SPEC_WAN_FW -d 240.0.0.0/4 -j RETURN
$IPT -A SS_SPEC_WAN_FW -d 0.0.0.0/8 -j RETURN
$IPT -A SS_SPEC_WAN_FW -d 10.0.0.0/8 -j RETURN
$IPT -A SS_SPEC_WAN_FW -d 127.0.0.0/8 -j RETURN
$IPT -A SS_SPEC_WAN_FW -d 169.254.0.0/16 -j RETURN
$IPT -A SS_SPEC_WAN_FW -d 172.16.0.0/12 -j RETURN
$IPT -A SS_SPEC_WAN_FW -d 192.168.0.0/16 -j RETURN
$IPT -A SS_SPEC_WAN_FW -d 224.0.0.0/4 -j RETURN
$IPT -A SS_SPEC_WAN_FW -d 240.0.0.0/4 -j RETURN
$IPT -A SS_SPEC_WAN_FW -p tcp $PROXY_PORTS \
-j REDIRECT --to-ports $local_port 2>/dev/null || {
loger 3 "Can't redirect, please check the iptables."
@ -189,15 +189,15 @@ tp_rule() {
local ipt="iptables -t mangle"
$ipt -N SS_SPEC_TPROXY
$ipt -A SS_SPEC_TPROXY -p udp --dport 53 -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -d 0.0.0.0/8 -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -d 10.0.0.0/8 -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -d 127.0.0.0/8 -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -d 169.254.0.0/16 -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -d 172.16.0.0/12 -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -d 192.168.0.0/16 -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -d 224.0.0.0/4 -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -d 240.0.0.0/4 -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -d $SERVER -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -d 0.0.0.0/8 -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -d 10.0.0.0/8 -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -d 127.0.0.0/8 -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -d 169.254.0.0/16 -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -d 172.16.0.0/12 -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -d 192.168.0.0/16 -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -d 224.0.0.0/4 -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -d 240.0.0.0/4 -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -d $SERVER -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp $PROXY_PORTS -m set --match-set fplan src \
-j TPROXY --on-port "$LOCAL_PORT" --tproxy-mark 0x01/0x01

View File

@ -12,6 +12,7 @@ local tw_video_server = ucursor:get_first(name, 'global', 'tw_video_server')
local netflix_server = ucursor:get_first(name, 'global', 'netflix_server')
local disney_server = ucursor:get_first(name, 'global', 'disney_server')
local prime_server = ucursor:get_first(name, 'global', 'prime_server')
local tvb_server = ucursor:get_first(name, 'global', 'tvb_server')
function gen_outbound(server_node, tags)
local bound = {}
@ -87,21 +88,44 @@ if v2ray_flow == "1" then
table.insert(outbounds_table, gen_outbound(netflix_server, "netflix"))
table.insert(outbounds_table, gen_outbound(disney_server, "disney"))
table.insert(outbounds_table, gen_outbound(prime_server, "prime"))
table.insert(outbounds_table, gen_outbound(tvb_server, "tvb"))
end
-- rules gen
local youtube_rule = {
type = "field",
domain = {"youtube", "googlevideo.com", "gvt2.com", "youtu.be"},
domain = {
"youtube",
"ggpht.com",
"googlevideo.com",
"withyoutube.com",
"youtu.be",
"youtube-nocookie.com",
"youtube.com",
"youtubeeducation.com",
"youtubegaming.com",
"youtubei.googleapis.com",
"youtubekids.com",
"youtubemobilesupport.com",
"yt.be",
"ytimg.com"
},
outboundTag = "youtube"
}
local tw_video_rule = {
type = "field",
domain = {
"vidol.tv", "hinet.net", "books.com", "litv.tv", "pstatic.net",
"app-measurement.com", "kktv.com.tw", "gamer.com.tw","wetv.vip"
"vidol.tv",
"hinet.net",
"books.com",
"litv.tv",
"pstatic.net",
"app-measurement.com",
"kktv.com.tw",
"gamer.com.tw",
"wetv.vip"
},
outboundTag = "twvideo"
}
@ -109,8 +133,18 @@ local tw_video_rule = {
local netflix_rule = {
type = "field",
domain = {
"netflix", "nflxso.net", "nflxext.com",
"nflximg.com", "nflximg.net", "nflxvideo.net"
"fast.com",
"netflix.ca",
"netflix.com",
"netflix.net",
"netflixinvestor.com",
"netflixtechblog.com",
"nflxext.com",
"nflximg.com",
"nflximg.net",
"nflxsearch.net",
"nflxso.net",
"nflxvideo.net"
},
outboundTag = "netflix"
@ -127,10 +161,32 @@ local disney_rule = {
local prime_rule = {
type = "field",
domain = {"aiv-cdn.net", "amazonaws.com", "amazonvideo.com", "llnwd.net"},
domain = {
"aiv-cdn.net",
"amazonaws.com",
"amazonvideo.com",
"llnwd.net",
"amazonprimevideos.com",
"amazonvideo.cc",
"prime-video.com",
"primevideo.cc",
"primevideo.com",
"primevideo.info",
"primevideo.org",
"rimevideo.tv"
},
outboundTag = "prime"
}
local tvb_rule = {
type = "field",
domain = {
"tvsuper.com",
"tvb.com"
},
outboundTag = "tvb"
}
local rules_table = {}
if (youtube_server ~= "nil" and v2ray_flow == "1") then
@ -153,6 +209,10 @@ if (prime_server ~= "nil" and v2ray_flow == "1") then
table.insert(rules_table, prime_rule)
end
if (tvb_server ~= "nil" and v2ray_flow == "1") then
table.insert(rules_table, tvb_rule)
end
local v2ray = {
log = {
-- error = "/var/ssrplus.log",
@ -171,6 +231,6 @@ local v2ray = {
},
-- 传出连接
outbounds = outbounds_table,
routing = {domainStrategy = "IPIfNonMatch", rules = rules_table}
routing = {domainStrategy = "AsIs", rules = rules_table}
}
print(json.stringify(v2ray, 1))

View File

@ -1,4 +1,5 @@
#!/bin/sh
. /lib/functions.sh
mkdir -p /tmp/dnsmasq.ssr
@ -9,3 +10,36 @@ awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"blacklist"'\n",$0)}' /etc/config/black.li
awk '!/^$/&&!/^#/{printf("server=/.%s/'"127.0.0.1#5335"'\n",$0)}' /etc/config/black.list >> /tmp/dnsmasq.ssr/blacklist_forward.conf
awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"whitelist"'\n",$0)}' /etc/config/white.list > /tmp/dnsmasq.ssr/whitelist_forward.conf
function valid_ip()
{
ip=$1
read_ip=$(echo $ip|awk -F. '$1<=255&&$2<=255&&$3<=255&&$4<=255{print "yes"}')
if echo $ip|grep -E '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$' >/dev/null
then
if [ $read_ip == "yes" ]
then
return 0
else
return 1
fi
else
return 1
fi
}
config_load vssr
function addWhiteList() {
local iface="$1"
local host
config_get host "$iface" server
if valid_ip $host; then
ipset -! add whitelist $host
else
[ ! -z "$host" ] && echo "ipset=/.$host/whitelist" >> /tmp/dnsmasq.ssr/whitelist_forward.conf
fi
}
config_foreach addWhiteList

View File

@ -5,40 +5,45 @@
#
include $(TOPDIR)/rules.mk
ifeq ($(ARCH),x86_64)
PKG_ARCH_BROOK:=
endif
ifeq ($(ARCH),mipsel)
PKG_ARCH_BROOK:=_linux_mipsle
endif
ifeq ($(ARCH),mips)
PKG_ARCH_BROOK:=_linux_mips
endif
ifeq ($(ARCH),i386)
PKG_ARCH_BROOK:=_linux_386
PKG_ARCH_BROOK:=386
endif
ifeq ($(ARCH),x86_64)
PKG_ARCH_BROOK:=amd64
endif
ifeq ($(ARCH),arm)
PKG_ARCH_BROOK:=_linux_arm7
PKG_ARCH_BROOK:=arm7
endif
ifeq ($(BOARD),bcm53xx)
PKG_ARCH_BROOK:=_linux_arm6
PKG_ARCH_BROOK:=arm6
ifeq ($(word 2,$(subst +,$(space),$(call qstrip,$(CONFIG_CPU_TYPE)))),)
PKG_ARCH_BROOK:=_linux_arm5
PKG_ARCH_BROOK:=arm5
endif
endif
ifeq ($(BOARD),kirkwood)
PKG_ARCH_BROOK:=_linux_arm5
PKG_ARCH_BROOK:=arm5
endif
ifeq ($(ARCH),aarch64)
PKG_ARCH_BROOK:=_linux_arm64
PKG_ARCH_BROOK:=arm64
endif
ifeq ($(ARCH),mips)
PKG_ARCH_BROOK:=mips_softfloat
endif
ifeq ($(ARCH),mipsel)
PKG_ARCH_BROOK:=mipsle_softfloat
endif
ifeq ($(ARCH),mips64)
PKG_ARCH_BROOK:=mips64
endif
ifeq ($(ARCH),mips64el)
PKG_ARCH_BROOK:=mips64le
endif
PKG_NAME:=brook
PKG_VERSION:=20200901
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=brook$(PKG_ARCH_BROOK)
PKG_SOURCE:=brook_linux_$(PKG_ARCH_BROOK)
PKG_SOURCE_URL:=https://github.com/txthinking/brook/releases/download/v$(PKG_VERSION)
PKG_HASH:=skip
@ -48,7 +53,7 @@ define Package/$(PKG_NAME)
SECTION:=net
CATEGORY:=Network
TITLE:=Brook is a cross-platform proxy software
DEPENDS:=
DEPENDS:=@!(arc||armeb||powerpc)
URL:=https://github.com/txthinking/brook
endef
@ -57,7 +62,7 @@ define Package/$(PKG_NAME)/description
endef
define Build/Prepare
cp $(DL_DIR)/$(PKG_SOURCE) $(PKG_BUILD_DIR)
$(CP) $(DL_DIR)/$(PKG_SOURCE) $(PKG_BUILD_DIR)/
endef
define Build/Configure
@ -68,7 +73,7 @@ endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/brook$(PKG_ARCH_BROOK) $(1)/usr/bin/brook
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_SOURCE) $(1)/usr/bin/brook
endef
$(eval $(call BuildPackage,$(PKG_NAME)))
$(eval $(call BuildPackage,$(PKG_NAME)))

View File

@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall
PKG_VERSION:=3.9
PKG_RELEASE:=41
PKG_DATE:=20200820
PKG_RELEASE:=42
PKG_DATE:=20200822
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

View File

@ -21,7 +21,6 @@ function to_check(arch)
end
file_tree = "_linux_" .. file_tree
if file_tree == "_linux_amd64" then file_tree = "" end
local json = api.get_api_json(brook_api)

View File

@ -33,6 +33,12 @@ o:value("https://ispip.clang.cn/all_cn_cidr.txt", translate("Clang.CN.CIDR"))
o.default = "https://ispip.clang.cn/all_cn.txt"
--o:depends("enable_custom_url", 1)
----chnroute6 URL
o = s:option(Value, "chnroute6_url", translate("China IPv6s(chnroute6) Update URL"))
o:value("https://ispip.clang.cn/all_cn_ipv6.txt", translate("Clang.CN.IPv6"))
o.default = "https://ispip.clang.cn/all_cn_ipv6.txt"
--o:depends("enable_custom_url", 1)
---- Auto Update
o = s:option(Flag, "auto_update", translate("Enable auto update rules"))
o.default = 0

View File

@ -3,10 +3,12 @@ local api = require "luci.model.cbi.passwall.api.api"
local gfwlist_version = api.uci_get_type("global_rules", "gfwlist_version")
local chnroute_version = api.uci_get_type("global_rules", "chnroute_version")
local chnroute6_version = api.uci_get_type("global_rules", "chnroute6_version")
local chnlist_version = api.uci_get_type("global_rules", "chnlist_version")
local gfwlist_update = api.uci_get_type("global_rules", "gfwlist_update", "1") == "1" and "checked='checked'" or ""
local chnroute_update = api.uci_get_type("global_rules", "chnroute_update", "1") == "1" and "checked='checked'" or ""
local chnroute6_update = api.uci_get_type("global_rules", "chnroute6_update", "1") == "1" and "checked='checked'" or ""
local chnlist_update = api.uci_get_type("global_rules", "chnlist_update", "1") == "1" and "checked='checked'" or ""
-%>
@ -66,6 +68,18 @@ local chnlist_update = api.uci_get_type("global_rules", "chnlist_update", "1") =
</div>
</div>
</div>
<div class="cbi-value">
<label class="cbi-value-title">chnroute6
<%:Version%>
</label>
<div class="cbi-value-field">
<div class="cbi-value-description">
<span><%=chnroute6_version%> 】</span>
<input type="checkbox" name="chnroute6_update" value="1" <%=chnroute6_update%> />
</div>
</div>
</div>
<div class="cbi-value">
<label class="cbi-value-title">chnlist

View File

@ -622,6 +622,9 @@ msgstr "防火墙域名列表(gfwlist)更新URL"
msgid "China IPs(chnroute) Update URL"
msgstr "中国IP段(chnroute)更新URL"
msgid "China IPv6s(chnroute) Update URL"
msgstr "中国IPv6段(chnroute)更新URL"
msgid "Rule status"
msgstr "规则版本"
@ -880,6 +883,9 @@ msgstr "原版Trojan不支持'none'请选择TLS。"
msgid "Domain"
msgstr "域名"
msgid "allowInsecure"
msgstr "允许不安全连接"
msgid "Whether unsafe connections are allowed. When checked, Certificate validation will be skipped."
msgstr "是否允许不安全连接。当勾选时,将跳过证书验证。"

View File

@ -40,13 +40,16 @@ config global_rules
option auto_update '0'
option chnlist_update '1'
option chnroute_update '1'
option chnroute6_update '0'
option gfwlist_update '1'
option gfwlist_version '2020-08-20'
option chnroute_version '2020-08-20'
option chnroute6_version '2020-08-20'
option chnlist_version '2020-08-20'
option enable_custom_url '0'
option gfwlist_url 'https://cdn.jsdelivr.net/gh/Loukky/gfwlist-by-loukky/gfwlist.txt'
option chnroute_url 'https://ispip.clang.cn/all_cn.txt'
option chnroute6_url 'https://ispip.clang.cn/all_cn_ipv6.txt'
config global_app
option v2ray_file '/usr/bin/v2ray/'

View File

@ -772,6 +772,7 @@ add_dnsmasq() {
[ -n "${gfwlist}" ] || [ "${filtered_dns}" = "1" ] && [ -z "${returnhome}" ] && {
[ "${filtered_dns}" = "1" ] && [ "${DNS_MODE}" != "chinadns-ng" ] && unset fwd_dns
sort -u "${TMP_PATH}/gfwlist.txt" | gen_dnsmasq_items "gfwlist" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/gfwlist.conf"
#sort -u "${TMP_PATH}/gfwlist.txt" | gen_dnsmasq_items "gfwlist,gfwlist6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/gfwlist.conf"
echolog " - [$?]防火墙域名表(gfwlist)${fwd_dns:-默认}"
}

View File

@ -3,7 +3,9 @@
IPSET_LANIPLIST="laniplist"
IPSET_VPSIPLIST="vpsiplist"
IPSET_GFW="gfwlist"
#IPSET_GFW6="gfwlist6"
IPSET_CHN="chnroute"
IPSET_CHN6="chnroute6"
IPSET_BLACKLIST="blacklist"
IPSET_WHITELIST="whitelist"
@ -333,11 +335,14 @@ add_firewall_rule() {
ipset -! create $IPSET_LANIPLIST nethash
ipset -! create $IPSET_VPSIPLIST nethash
ipset -! create $IPSET_GFW nethash
#ipset -! create $IPSET_GFW6 nethash family inet6
ipset -! create $IPSET_CHN nethash
ipset -! create $IPSET_CHN6 nethash family inet6
ipset -! create $IPSET_BLACKLIST nethash
ipset -! create $IPSET_WHITELIST nethash
cat $RULES_PATH/chnroute | sed -e "/^$/d" | sed -e "s/^/add $IPSET_CHN &/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R
cat $RULES_PATH/chnroute6 | sed -e "/^$/d" | sed -e "s/^/add $IPSET_CHN6 &/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R
cat $RULES_PATH/proxy_ip | sed -e "/^$/d" | sed -e "s/^/add $IPSET_BLACKLIST &/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R
cat $RULES_PATH/direct_ip | sed -e "/^$/d" | sed -e "s/^/add $IPSET_WHITELIST &/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R
@ -577,7 +582,9 @@ del_firewall_rule() {
ipset -F $IPSET_LANIPLIST >/dev/null 2>&1 && ipset -X $IPSET_LANIPLIST >/dev/null 2>&1 &
ipset -F $IPSET_VPSIPLIST >/dev/null 2>&1 && ipset -X $IPSET_VPSIPLIST >/dev/null 2>&1 &
#ipset -F $IPSET_GFW >/dev/null 2>&1 && ipset -X $IPSET_GFW >/dev/null 2>&1 &
#ipset -F $IPSET_GFW6 >/dev/null 2>&1 && ipset -X $IPSET_GFW6 >/dev/null 2>&1 &
#ipset -F $IPSET_CHN >/dev/null 2>&1 && ipset -X $IPSET_CHN >/dev/null 2>&1 &
#ipset -F $IPSET_CHN6 >/dev/null 2>&1 && ipset -X $IPSET_CHN6 >/dev/null 2>&1 &
#ipset -F $IPSET_BLACKLIST >/dev/null 2>&1 && ipset -X $IPSET_BLACKLIST >/dev/null 2>&1 &
ipset -F $IPSET_WHITELIST >/dev/null 2>&1 && ipset -X $IPSET_WHITELIST >/dev/null 2>&1 &
#echolog "删除相关防火墙规则完成。"
@ -587,7 +594,9 @@ flush_ipset() {
ipset -F $IPSET_LANIPLIST >/dev/null 2>&1 && ipset -X $IPSET_LANIPLIST >/dev/null 2>&1 &
ipset -F $IPSET_VPSIPLIST >/dev/null 2>&1 && ipset -X $IPSET_VPSIPLIST >/dev/null 2>&1 &
ipset -F $IPSET_GFW >/dev/null 2>&1 && ipset -X $IPSET_GFW >/dev/null 2>&1 &
#ipset -F $IPSET_GFW6 >/dev/null 2>&1 && ipset -X $IPSET_GFW6 >/dev/null 2>&1 &
ipset -F $IPSET_CHN >/dev/null 2>&1 && ipset -X $IPSET_CHN >/dev/null 2>&1 &
ipset -F $IPSET_CHN6 >/dev/null 2>&1 && ipset -X $IPSET_CHN6 >/dev/null 2>&1 &
ipset -F $IPSET_BLACKLIST >/dev/null 2>&1 && ipset -X $IPSET_BLACKLIST >/dev/null 2>&1 &
ipset -F $IPSET_WHITELIST >/dev/null 2>&1 && ipset -X $IPSET_WHITELIST >/dev/null 2>&1 &
}

View File

@ -11,13 +11,14 @@ local url_main = 'https://cdn.jsdelivr.net/gh/hq450/fancyss/rules'
local reboot = 0
local gfwlist_update = 0
local chnroute_update = 0
local chnroute6_update = 0
local chnlist_update = 0
-- match comments/title/whitelist/ip address/excluded_domain
local comment_pattern = "^[!\\[@]+"
local ip_pattern = "^%d+%.%d+%.%d+%.%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"}
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'
@ -29,6 +30,7 @@ local enable_custom_url = ucic:get_first(name, 'global_rules', "enable_custom_ur
enable_custom_url = 1
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")
local chnlist_url_1 = 'https://cdn.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/accelerated-domains.china.conf'
local chnlist_url_2 = 'https://cdn.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/apple.china.conf'
local chnlist_url_3 = 'https://cdn.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/google.china.conf'
@ -125,6 +127,13 @@ local function fetch_chnroute()
return sret;
end
--获取chnroute6
local function fetch_chnroute6()
--请求chnroute6
local sret = curl(chnroute6_url, "/tmp/chnroute6_tmp")
return sret;
end
--获取chnlist
local function fetch_chnlist()
--请求chnlist
@ -213,6 +222,9 @@ if arg[2] then
end
if arg[2]:find("chnroute") then
chnroute_update = 1
end
if arg[2]:find("chnroute6") then
chnroute6_update = 1
end
if arg[2]:find("chnlist") then
chnlist_update = 1
@ -220,9 +232,10 @@ if arg[2] then
else
gfwlist_update = ucic:get_first(name, 'global_rules', "gfwlist_update", 1)
chnroute_update = ucic:get_first(name, 'global_rules', "chnroute_update", 1)
chnroute6_update = ucic:get_first(name, 'global_rules', "chnroute6_update", 1)
chnlist_update = ucic:get_first(name, 'global_rules', "chnlist_update", 1)
end
if gfwlist_update == 0 and chnroute_update == 0 and chnlist_update == 0 then
if gfwlist_update == 0 and chnroute_update == 0 and chnroute6_update == 0 and chnlist_update == 0 then
os.exit(0)
end
@ -271,6 +284,26 @@ if tonumber(enable_custom_url) == 1 then
end
os.remove("/tmp/chnroute_tmp")
end
if tonumber(chnroute6_update) == 1 then
log("开始更新chnroute6...")
local old_md5 = luci.sys.exec("echo -n $(md5sum " .. rule_path .. "/chnroute6 | awk '{print $1}')")
local status = fetch_chnroute6()
if status == 200 then
local new_md5 = luci.sys.exec("echo -n $([ -f '/tmp/chnroute6_tmp' ] && md5sum /tmp/chnroute6_tmp | awk '{print $1}')")
if old_md5 ~= new_md5 then
luci.sys.exec("mv -f /tmp/chnroute6_tmp " .. rule_path .. "/chnroute6")
ucic:set(name, ucic:get_first(name, 'global_rules'), "chnroute6_version", new_version)
reboot = 1
log("更新chnroute6成功...")
else
log("chnroute6版本一致不用更新。")
end
else
log("chnroute6文件下载失败")
end
os.remove("/tmp/chnroute6_tmp")
end
if tonumber(chnlist_update) == 1 then
log("开始更新chnlist...")
@ -382,6 +415,7 @@ end
ucic:set(name, ucic:get_first(name, 'global_rules'), "gfwlist_update", gfwlist_update)
ucic:set(name, ucic:get_first(name, 'global_rules'), "chnroute_update", chnroute_update)
ucic:set(name, ucic:get_first(name, 'global_rules'), "chnroute6_update", chnroute6_update)
ucic:set(name, ucic:get_first(name, 'global_rules'), "chnlist_update", chnlist_update)
ucic:save(name)
luci.sys.call("uci commit " .. name)

File diff suppressed because it is too large Load Diff

View File

@ -92,7 +92,7 @@ define Package/libcurl
CATEGORY:=Libraries
DEPENDS:= +LIBCURL_WOLFSSL:libwolfssl +LIBCURL_OPENSSL:libopenssl +LIBCURL_GNUTLS:libgnutls +LIBCURL_MBEDTLS:libmbedtls
DEPENDS += +LIBCURL_ZLIB:zlib +LIBCURL_THREADED_RESOLVER:libpthread +LIBCURL_LDAP:libopenldap +LIBCURL_LIBIDN2:libidn2
DEPENDS += +LIBCURL_SSH2:libssh2 +LIBCURL_NGHTTP2:libnghttp2 +ca-bundle
DEPENDS += +LIBCURL_SSH2:libssh2 +LIBCURL_NGHTTP2:libnghttp2 +ca-bundle +libzstd
TITLE:=A client-side URL transfer library
MENU:=1
ABI_VERSION:=4