update 2022-11-05 20:16:29

This commit is contained in:
github-actions[bot] 2022-11-05 20:16:29 +08:00
parent 77a5597610
commit 3e4174fa79
152 changed files with 68339 additions and 1268 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-openclash PKG_NAME:=luci-app-openclash
PKG_VERSION:=0.45.59 PKG_VERSION:=0.45.69
PKG_RELEASE:=beta PKG_RELEASE:=beta
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash> PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>
@ -123,6 +123,7 @@ define Package/$(PKG_NAME)/postrm
rm -rf /tmp/dnsmasq.d/dnsmasq_openclash_custom_domain.conf >/dev/null 2>&1 rm -rf /tmp/dnsmasq.d/dnsmasq_openclash_custom_domain.conf >/dev/null 2>&1
rm -rf /tmp/dnsmasq.d/dnsmasq_openclash_chnroute_pass.conf >/dev/null 2>&1 rm -rf /tmp/dnsmasq.d/dnsmasq_openclash_chnroute_pass.conf >/dev/null 2>&1
rm -rf /tmp/dnsmasq.d/dnsmasq_openclash_chnroute6_pass.conf >/dev/null 2>&1 rm -rf /tmp/dnsmasq.d/dnsmasq_openclash_chnroute6_pass.conf >/dev/null 2>&1
rm -rf /tmp/dnsmasq.d/dnsmasq_accelerated-domains.china.conf >/dev/null 2>&1
rm -rf /tmp/dler* >/dev/null 2>&1 rm -rf /tmp/dler* >/dev/null 2>&1
rm -rf /tmp/etc/openclash >/dev/null 2>&1 rm -rf /tmp/etc/openclash >/dev/null 2>&1
rm -rf /tmp/openclash_edit_file_name >/dev/null 2>&1 rm -rf /tmp/openclash_edit_file_name >/dev/null 2>&1

View File

@ -198,7 +198,7 @@ local function db_foward_ssl()
end end
local function check_lastversion() local function check_lastversion()
luci.sys.exec("sh /usr/share/openclash/openclash_version.sh 2>/dev/null") luci.sys.exec("bash /usr/share/openclash/openclash_version.sh 2>/dev/null")
return luci.sys.exec("sed -n '/^https:/,$p' /tmp/openclash_last_version 2>/dev/null") return luci.sys.exec("sed -n '/^https:/,$p' /tmp/openclash_last_version 2>/dev/null")
end end
@ -223,7 +223,7 @@ local function coremodel()
if opkg and opkg.info("libc") and opkg.info("libc")["libc"] then if opkg and opkg.info("libc") and opkg.info("libc")["libc"] then
return opkg.info("libc")["libc"]["Architecture"] return opkg.info("libc")["libc"]["Architecture"]
else else
return luci.sys.exec("opkg status libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' 2>/dev/null") return luci.sys.exec("rm -f /var/lock/opkg.lock && opkg status libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' 2>/dev/null")
end end
end end
@ -252,7 +252,7 @@ local function coremetacv()
end end
local function corelv() local function corelv()
luci.sys.call("sh /usr/share/openclash/clash_version.sh") luci.sys.call("bash /usr/share/openclash/clash_version.sh")
local core_lv = luci.sys.exec("sed -n 1p /tmp/clash_last_version 2>/dev/null") local core_lv = luci.sys.exec("sed -n 1p /tmp/clash_last_version 2>/dev/null")
local core_tun_lv = luci.sys.exec("sed -n 2p /tmp/clash_last_version 2>/dev/null") local core_tun_lv = luci.sys.exec("sed -n 2p /tmp/clash_last_version 2>/dev/null")
local core_meta_lv = luci.sys.exec("sed -n 3p /tmp/clash_last_version 2>/dev/null") local core_meta_lv = luci.sys.exec("sed -n 3p /tmp/clash_last_version 2>/dev/null")
@ -263,26 +263,26 @@ local function opcv()
if opkg and opkg.info("luci-app-openclash") and opkg.info("luci-app-openclash")["luci-app-openclash"] then if opkg and opkg.info("luci-app-openclash") and opkg.info("luci-app-openclash")["luci-app-openclash"] then
return "v" .. opkg.info("luci-app-openclash")["luci-app-openclash"]["Version"] return "v" .. opkg.info("luci-app-openclash")["luci-app-openclash"]["Version"]
else else
return luci.sys.exec("opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F 'Version: ' '{print \"v\"$2}'") return luci.sys.exec("rm -f /var/lock/opkg.lock && opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F 'Version: ' '{print \"v\"$2}'")
end end
end end
local function oplv() local function oplv()
local new = luci.sys.call(string.format("sh /usr/share/openclash/openclash_version.sh")) local new = luci.sys.call(string.format("bash /usr/share/openclash/openclash_version.sh"))
local oplv = luci.sys.exec("sed -n 1p /tmp/openclash_last_version 2>/dev/null") local oplv = luci.sys.exec("sed -n 1p /tmp/openclash_last_version 2>/dev/null")
return oplv .. "," .. new return oplv .. "," .. new
end end
local function opup() local function opup()
luci.sys.call("rm -rf /tmp/*_last_version 2>/dev/null && sh /usr/share/openclash/openclash_version.sh >/dev/null 2>&1") luci.sys.call("rm -rf /tmp/*_last_version 2>/dev/null && bash /usr/share/openclash/openclash_version.sh >/dev/null 2>&1")
return luci.sys.call("sh /usr/share/openclash/openclash_update.sh >/dev/null 2>&1 &") return luci.sys.call("bash /usr/share/openclash/openclash_update.sh >/dev/null 2>&1 &")
end end
local function coreup() local function coreup()
uci:set("openclash", "config", "enable", "1") uci:set("openclash", "config", "enable", "1")
uci:commit("openclash") uci:commit("openclash")
local type = luci.http.formvalue("core_type") local type = luci.http.formvalue("core_type")
luci.sys.call("rm -rf /tmp/*_last_version 2>/dev/null && sh /usr/share/openclash/clash_version.sh >/dev/null 2>&1") luci.sys.call("rm -rf /tmp/*_last_version 2>/dev/null && bash /usr/share/openclash/clash_version.sh >/dev/null 2>&1")
return luci.sys.call(string.format("/usr/share/openclash/openclash_core.sh '%s' >/dev/null 2>&1 &", type)) return luci.sys.call(string.format("/usr/share/openclash/openclash_core.sh '%s' >/dev/null 2>&1 &", type))
end end
@ -378,7 +378,7 @@ function action_remove_all_core()
end end
function action_one_key_update() function action_one_key_update()
return luci.sys.call("sh /usr/share/openclash/openclash_update.sh 'one_key_update' >/dev/null 2>&1 &") return luci.sys.call("bash /usr/share/openclash/openclash_update.sh 'one_key_update' >/dev/null 2>&1 &")
end end
local function dler_login_info_save() local function dler_login_info_save()
@ -1145,31 +1145,49 @@ function action_refresh_log()
line = log_tb[i]:reverse() line = log_tb[i]:reverse()
line_trans = line line_trans = line
ex_match = false ex_match = false
core_match = false
time_format = false
while true do while true do
ex_keys = {"UDP%-Receive%-Buffer%-Size", "^Sec%-Fetch%-Mode", "^User%-Agent", "^Access%-Control", "^Accept", "^Origin", "^Referer", "^Connection", "^Pragma", "^Cache-"} ex_keys = {"UDP%-Receive%-Buffer%-Size", "^Sec%-Fetch%-Mode", "^User%-Agent", "^Access%-Control", "^Accept", "^Origin", "^Referer", "^Connection", "^Pragma", "^Cache-"}
for key=1, #ex_keys do for key=1, #ex_keys do
if string.find (line, ex_keys[key]) then if string.find (line, ex_keys[key]) then
ex_match = true ex_match = true
break break
end end
end
if ex_match then break end
if not string.find (line, "level=") then
if not string.find (line, "") or not string.find (line, "") then
line_trans = trans_line_nolabel(line)
else
line_trans = trans_line(line)
end end
end if ex_match then break end
if data == "" then
data = line_trans core_keys = {" DBG ", " INF ", "level=", " WRN ", " ERR "}
elseif log_len == 0 and i == limit then for key=1, #core_keys do
data = data .."\n" .. line_trans .. "\n..." if string.find(string.sub(line, 0, 13), core_keys[key]) or (string.find(line, core_keys[key]) and core_keys[key] == "level=") then
else core_match = true
data = data .."\n" .. line_trans if core_keys[key] ~= "level=" then
end time_format = true
break end
end break
end
end
if time_format then
if string.match(string.sub(line, 0, 8), "%d%d:%d%d:%d%d") then
line_trans = '"'..os.date("%Y-%m-%d %H:%M:%S", tonumber(string.sub(line, 0, 8)))..'"'..string.sub(line, 9, -1)
end
end
if not core_match then
if not string.find (line, "") or not string.find (line, "") then
line_trans = trans_line_nolabel(line)
else
line_trans = trans_line(line)
end
end
if data == "" then
data = line_trans
elseif log_len == 0 and i == limit then
data = data .."\n" .. line_trans .. "\n..."
else
data = data .."\n" .. line_trans
end
break
end
end end
luci.http.write_json({ luci.http.write_json({
len = len, len = len,
@ -1551,7 +1569,7 @@ function all_proxies_stream_test()
end end
function trans_line_nolabel(data) function trans_line_nolabel(data)
local line_trans = "data" local line_trans = ""
if string.match(string.sub(data, 0, 19), "%d%d%d%d%-%d%d%-%d%d %d%d:%d%d:%d%d") then if string.match(string.sub(data, 0, 19), "%d%d%d%d%-%d%d%-%d%d %d%d:%d%d:%d%d") then
line_trans = string.sub(data, 0, 20)..luci.i18n.translate(string.sub(data, 21, -1)) line_trans = string.sub(data, 0, 20)..luci.i18n.translate(string.sub(data, 21, -1))
else else

View File

@ -251,6 +251,31 @@ o:depends("type", "socks5")
o:depends("type", "trojan") o:depends("type", "trojan")
o:depends({type = "snell", snell_version = "3"}) o:depends({type = "snell", snell_version = "3"})
o = s:option(ListValue, "xudp", translate("XUDP Enable")..translate("(Only Meta Core)"))
o.rmempty = true
o.default = "false"
o:value("true")
o:value("false")
o:depends({type = "vmess", udp = "true"})
o = s:option(Value, "packet_encoding", translate("Packet-Encoding")..translate("(Only Meta Core)"))
o.rmempty = true
o:depends("type", "vmess")
o = s:option(ListValue, "global_padding", translate("Global-Padding")..translate("(Only Meta Core)"))
o.rmempty = true
o.default = "false"
o:value("true")
o:value("false")
o:depends("type", "vmess")
o = s:option(ListValue, "authenticated_length", translate("Authenticated-Length")..translate("(Only Meta Core)"))
o.rmempty = true
o.default = "false"
o:value("true")
o:value("false")
o:depends("type", "vmess")
o = s:option(ListValue, "obfs", translate("obfs-mode")) o = s:option(ListValue, "obfs", translate("obfs-mode"))
o.rmempty = true o.rmempty = true
o.default = "none" o.default = "none"
@ -449,9 +474,9 @@ o:value("http/1.1")
o:depends("type", "trojan") o:depends("type", "trojan")
-- [[ alpn ]]-- -- [[ alpn ]]--
o = s:option(Value, "hysteria_alpn", translate("alpn")) o = s:option(DynamicList, "hysteria_alpn", translate("alpn"))
o.rmempty = false o.rmempty = false
o.default = "h3" o:value("h3")
o:depends("type", "hysteria") o:depends("type", "hysteria")
-- [[ grpc ]]-- -- [[ grpc ]]--

View File

@ -118,12 +118,21 @@ o:depends("en_mode", "redir-host")
o:depends("en_mode", "redir-host-tun") o:depends("en_mode", "redir-host-tun")
o:depends("en_mode", "redir-host-mix") o:depends("en_mode", "redir-host-mix")
o = s:taboption("op_mode", Flag, "china_ip_route", translate("China IP Route")) if op_mode == "redir-host" then
o.description = translate("Bypass The China Network Flows, Improve Performance") o = s:taboption("op_mode", Flag, "china_ip_route", translate("China IP Route"))
o.default = 0 o.description = translate("Bypass The China Network Flows, Improve Performance")
o:depends("en_mode", "redir-host") o.default = 0
o:depends("en_mode", "redir-host-tun") else
o:depends("en_mode", "redir-host-mix") o = s:taboption("op_mode", Flag, "china_ip_route", translate("China IP Route"))
o.description = translate("Bypass The China Network Flows, Improve Performance, Depend on Dnsmasq")
o.default = 0
o = s:taboption("op_mode", Value, "custom_china_domain_dns_server", translate("Specify CN DNS Server"))
o.description = translate("Specify DNS Server For CN Domain Lists, Only One IP Server Address Support")
o.default = "114.114.114.114"
o.placeholder = translate("114.114.114.114 or 127.0.0.1#5300")
o:depends("china_ip_route", "1")
end
o = s:taboption("op_mode", Flag, "intranet_allowed", translate("Only intranet allowed")) o = s:taboption("op_mode", Flag, "intranet_allowed", translate("Only intranet allowed"))
o.description = translate("When Enabled, The Control Panel And The Connection Broker Port Will Not Be Accessible From The Public Network") o.description = translate("When Enabled, The Control Panel And The Connection Broker Port Will Not Be Accessible From The Public Network")
@ -164,6 +173,7 @@ o = s:taboption("settings", Value, "github_address_mod", font_red..bold_on..tran
o.description = translate("Modify The Github Address In The Config And OpenClash With Proxy(CDN) To Prevent File Download Faild. Format Reference:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://ghproxy.com/\")'>https://ghproxy.com/</a>" o.description = translate("Modify The Github Address In The Config And OpenClash With Proxy(CDN) To Prevent File Download Faild. Format Reference:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://ghproxy.com/\")'>https://ghproxy.com/</a>"
o:value("0", translate("Disable")) o:value("0", translate("Disable"))
o:value("https://fastly.jsdelivr.net/") o:value("https://fastly.jsdelivr.net/")
o:value("https://testingcf.jsdelivr.net/")
o:value("https://raw.fastgit.org/") o:value("https://raw.fastgit.org/")
o:value("https://cdn.jsdelivr.net/") o:value("https://cdn.jsdelivr.net/")
o.default = "0" o.default = "0"
@ -380,6 +390,11 @@ o.description = font_red..bold_on..translate("Sniffer Will Prevent Domain Name P
o.default = 1 o.default = 1
o:depends("enable_meta_core", "1") o:depends("enable_meta_core", "1")
o = s:taboption("meta", Flag, "enable_meta_sniffer_pure_ip", translate("Forced Sniff Pure IP"))
o.description = translate("Forced Sniff Pure IP Connections")
o.default = 1
o:depends("enable_meta_sniffer", "1")
o = s:taboption("meta", Flag, "enable_meta_sniffer_custom", translate("Custom Sniffer Settings")) o = s:taboption("meta", Flag, "enable_meta_sniffer_custom", translate("Custom Sniffer Settings"))
o.description = translate("Custom The Force and Skip Sniffing Doamin Lists") o.description = translate("Custom The Force and Skip Sniffing Doamin Lists")
o.default = 0 o.default = 0
@ -483,9 +498,10 @@ o = s:taboption("meta", Value, "geoip_custom_url")
o.title = translate("Custom GeoIP Dat URL") o.title = translate("Custom GeoIP Dat URL")
o.rmempty = true o.rmempty = true
o.description = translate("Custom GeoIP Dat URL, Click Button Below To Refresh After Edit") o.description = translate("Custom GeoIP Dat URL, Click Button Below To Refresh After Edit")
o:value("https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat", translate("Loyalsoldier-Version")..translate("(Default)")) o:value("https://testingcf.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat", translate("Loyalsoldier-testingcf-jsdelivr-Version")..translate("(Default)"))
o:value("https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat", translate("Loyalsoldier-fastly-jsdelivr-Version"))
o:value("https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/v/v2/v2raya/dists/v2ray-rules-dat/geoip.dat", translate("OSDN-Version")..translate("(Default)")) o:value("https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/v/v2/v2raya/dists/v2ray-rules-dat/geoip.dat", translate("OSDN-Version")..translate("(Default)"))
o.default = "https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat" o.default = "https://testingcf.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat"
o:depends("geoip_auto_update", "1") o:depends("geoip_auto_update", "1")
o = s:taboption("meta", Button, translate("GEOIP Dat Update")) o = s:taboption("meta", Button, translate("GEOIP Dat Update"))
@ -527,9 +543,10 @@ o = s:taboption("meta", Value, "geosite_custom_url")
o.title = translate("Custom GeoSite URL") o.title = translate("Custom GeoSite URL")
o.rmempty = true o.rmempty = true
o.description = translate("Custom GeoSite Data URL, Click Button Below To Refresh After Edit") o.description = translate("Custom GeoSite Data URL, Click Button Below To Refresh After Edit")
o:value("https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat", translate("Loyalsoldier-Version")..translate("(Default)")) o:value("https://testingcf.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat", translate("Loyalsoldier-testingcf-jsdelivr-Version")..translate("(Default)"))
o:value("https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat", translate("Loyalsoldier-fastly-jsdelivr-Version"))
o:value("https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/v/v2/v2raya/dists/v2ray-rules-dat/geosite.dat", translate("OSDN-Version")..translate("(Default)")) o:value("https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/v/v2/v2raya/dists/v2ray-rules-dat/geosite.dat", translate("OSDN-Version")..translate("(Default)"))
o.default = "https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat" o.default = "https://testingcf.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat"
o:depends("geosite_auto_update", "1") o:depends("geosite_auto_update", "1")
o = s:taboption("meta", Button, translate("GEOSITE Update")) o = s:taboption("meta", Button, translate("GEOSITE Update"))
@ -637,7 +654,6 @@ function o.write(self, section, value)
end end
end end
if op_mode == "redir-host" then
o = s:taboption("lan_ac", Value, "chnroute_pass", translate("Chnroute Bypassed List")) o = s:taboption("lan_ac", Value, "chnroute_pass", translate("Chnroute Bypassed List"))
o.template = "cbi/tvalue" o.template = "cbi/tvalue"
o.description = translate("Domains or IPs in The List Will Not be Affected by The China IP Route Option, Depend on Dnsmasq") o.description = translate("Domains or IPs in The List Will Not be Affected by The China IP Route Option, Depend on Dnsmasq")
@ -675,7 +691,7 @@ function o.write(self, section, value)
end end
end end
end end
end
---- Rules Settings ---- Rules Settings
o = s:taboption("rules", Flag, "rule_source", translate("Enable Other Rules")) o = s:taboption("rules", Flag, "rule_source", translate("Enable Other Rules"))
o.description = translate("Use Other Rules") o.description = translate("Use Other Rules")
@ -1291,9 +1307,9 @@ o = s:taboption("geo_update", Value, "geo_custom_url")
o.title = translate("Custom GEOIP URL") o.title = translate("Custom GEOIP URL")
o.rmempty = true o.rmempty = true
o.description = translate("Custom GEOIP Data URL, Click Button Below To Refresh After Edit") o.description = translate("Custom GEOIP Data URL, Click Button Below To Refresh After Edit")
o:value("https://fastly.jsdelivr.net/gh/alecthw/mmdb_china_ip_list@release/lite/Country.mmdb", translate("Alecthw-lite-Version")..translate("(Default mmdb)")) o:value("https://testingcf.jsdelivr.net/gh/alecthw/mmdb_china_ip_list@release/lite/Country.mmdb", translate("Alecthw-lite-Version")..translate("(Default mmdb)"))
o:value("https://fastly.jsdelivr.net/gh/alecthw/mmdb_china_ip_list@release/Country.mmdb", translate("Alecthw-Version")..translate("(All Info mmdb)")) o:value("https://testingcf.jsdelivr.net/gh/alecthw/mmdb_china_ip_list@release/Country.mmdb", translate("Alecthw-Version")..translate("(All Info mmdb)"))
o:value("https://fastly.jsdelivr.net/gh/Hackl0us/GeoIP2-CN@release/Country.mmdb", translate("Hackl0us-Version")..translate("(Only CN)")) o:value("https://testingcf.jsdelivr.net/gh/Hackl0us/GeoIP2-CN@release/Country.mmdb", translate("Hackl0us-Version")..translate("(Only CN)"))
o:value("https://geolite.clash.dev/Country.mmdb", translate("Geolite.clash.dev")) o:value("https://geolite.clash.dev/Country.mmdb", translate("Geolite.clash.dev"))
o.default = "http://www.ideame.top/mmdb/Country.mmdb" o.default = "http://www.ideame.top/mmdb/Country.mmdb"
o:depends("enable_geoip_dat", 0) o:depends("enable_geoip_dat", 0)
@ -1337,7 +1353,8 @@ o.rmempty = false
o.description = translate("Custom Chnroute Lists URL, Click Button Below To Refresh After Edit") o.description = translate("Custom Chnroute Lists URL, Click Button Below To Refresh After Edit")
o:value("https://ispip.clang.cn/all_cn.txt", translate("Clang-CN")..translate("(Default)")) o:value("https://ispip.clang.cn/all_cn.txt", translate("Clang-CN")..translate("(Default)"))
o:value("https://ispip.clang.cn/all_cn_cidr.txt", translate("Clang-CN-CIDR")) o:value("https://ispip.clang.cn/all_cn_cidr.txt", translate("Clang-CN-CIDR"))
o:value("https://fastly.jsdelivr.net/gh/Hackl0us/GeoIP2-CN@release/CN-ip-cidr.txt", translate("Hackl0us-CN-CIDR")..translate("(Large Size)")) o:value("https://fastly.jsdelivr.net/gh/Hackl0us/GeoIP2-CN@release/CN-ip-cidr.txt", translate("Hackl0us-CN-CIDR-fastly-jsdelivr")..translate("(Large Size)"))
o:value("https://testingcf.jsdelivr.net/gh/Hackl0us/GeoIP2-CN@release/CN-ip-cidr.txt", translate("Hackl0us-CN-CIDR-testingcf-jsdelivr")..translate("(Large Size)"))
o.default = "https://ispip.clang.cn/all_cn.txt" o.default = "https://ispip.clang.cn/all_cn.txt"
o = s:taboption("chnr_update", Value, "chnr6_custom_url") o = s:taboption("chnr_update", Value, "chnr6_custom_url")
@ -1347,6 +1364,16 @@ o.description = translate("Custom Chnroute6 Lists URL, Click Button Below To Ref
o:value("https://ispip.clang.cn/all_cn_ipv6.txt", translate("Clang-CN-IPV6")..translate("(Default)")) o:value("https://ispip.clang.cn/all_cn_ipv6.txt", translate("Clang-CN-IPV6")..translate("(Default)"))
o.default = "https://ispip.clang.cn/all_cn_ipv6.txt" o.default = "https://ispip.clang.cn/all_cn_ipv6.txt"
o = s:taboption("chnr_update", Value, "cndomain_custom_url")
o.title = translate("Custom CN Doamin Lists URL")
o.rmempty = false
o.description = translate("Custom CN Doamin Dnsmasq Conf URL, Click Button Below To Refresh After Edit")
o:value("https://testingcf.jsdelivr.net/gh/felixonmars/dnsmasq-china-list@master/accelerated-domains.china.conf", translate("dnsmasq-china-list-testingcf-jsdelivr")..translate("(Default)"))
o:value("https://fastly.jsdelivr.net/gh/felixonmars/dnsmasq-china-list@master/accelerated-domains.china.conf", translate("dnsmasq-china-list-fastly-jsdelivr"))
o:value("https://raw.fastgit.org/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf", translate("dnsmasq-china-list-fastgit"))
o:value("https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf", translate("dnsmasq-china-list-github"))
o.default = "https://testingcf.jsdelivr.net/gh/felixonmars/dnsmasq-china-list@master/accelerated-domains.china.conf"
o = s:taboption("chnr_update", Button, translate("Chnroute Lists Update")) o = s:taboption("chnr_update", Button, translate("Chnroute Lists Update"))
o.title = translate("Update Chnroute Lists") o.title = translate("Update Chnroute Lists")
o.inputtitle = translate("Check And Update") o.inputtitle = translate("Check And Update")

View File

@ -231,7 +231,13 @@ function line_tolocal(str){
var dt = new Date(res[1]); var dt = new Date(res[1]);
} }
if (dt && dt != "Invalid Date"){ if (dt && dt != "Invalid Date"){
cstrt[cn]=dt.getFullYear()+"-"+p(dt.getMonth()+1)+"-"+p(dt.getDate())+" "+p(dt.getHours())+":"+p(dt.getMinutes())+":"+p(dt.getSeconds())+v.substring(res[1].length + 7); if (v.indexOf("level=") != -1) {
var log_info = v.substring(res[1].length + 7);
}
else {
var log_info = v.substring(res[1].length + 2);
}
cstrt[cn]=dt.getFullYear()+"-"+p(dt.getMonth()+1)+"-"+p(dt.getDate())+" "+p(dt.getHours())+":"+p(dt.getMinutes())+":"+p(dt.getSeconds())+log_info;
cn = cn + 1; cn = cn + 1;
} }
else{ else{

View File

@ -307,10 +307,7 @@
} }
}; };
HTTP.runcheck();
IP.getIpifyIP();
//IP.getSpeedIP();
function getPcolIP(data){ function getPcolIP(data){
let pcisp = data.addr.split(' '); let pcisp = data.addr.split(' ');
$$.getElementById('ip-pcol').innerHTML = data.ip; $$.getElementById('ip-pcol').innerHTML = data.ip;
@ -326,8 +323,6 @@
$$.getElementById('ip-taobao').innerHTML = data.ip; $$.getElementById('ip-taobao').innerHTML = data.ip;
IP.parseIPIpip(data.ip, 'ip-taobao-geo'); IP.parseIPIpip(data.ip, 'ip-taobao-geo');
}; };
window.onload=myip_Load();
function myip_Load() function myip_Load()
{ {
@ -350,31 +345,18 @@
tbipScript.src='https://www.taobao.com/help/getip.php?callback=ipCallback'; tbipScript.src='https://www.taobao.com/help/getip.php?callback=ipCallback';
tbip.appendChild(sbipScript); tbip.appendChild(sbipScript);
const $$ = document; //HTTP.runcheck();
random = parseInt(Math.random() * 100000000);
HTTP.runcheck();
IP.getIpifyIP(); IP.getIpifyIP();
//IP.getSpeedIP(); //IP.getSpeedIP();
function getPcolIP(data){
let pcisp = data.addr.split(' ');
$$.getElementById('ip-pcol').innerHTML = data.ip;
$$.getElementById('ip-pcol-geo').innerHTML = `${data.pro}${data.city}${data.region} ${pcisp[1]}`;
};
function getIpsbIP(data){
$$.getElementById('ip-ipsb').innerHTML = data.ip;
IP.parseIPIpip(data.ip, 'ip-ipsb-geo');
};
function ipCallback(data){
$$.getElementById('ip-taobao').innerHTML = data.ip;
IP.parseIPIpip(data.ip, 'ip-taobao-geo');
};
setTimeout("myip_Load()",Math.floor(Math.random()*(30-10+1)+10)*1000);
} }
HTTP.runcheck();
IP.getIpifyIP();
//IP.getSpeedIP();
setInterval("HTTP.runcheck()", Math.floor(Math.random()*(10-5+1)+5)*1000);
setInterval("myip_Load()", Math.floor(Math.random()*(30-10+1)+10)*1000);
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
document.write('<script defer="defer" src="https://whois.pconline.com.cn/ipJson.jsp?callback=getPcolIP&z='+parseInt(Math.random() * 100000000)+'" type="text/javascript"><\/script>'); document.write('<script defer="defer" src="https://whois.pconline.com.cn/ipJson.jsp?callback=getPcolIP&z='+parseInt(Math.random() * 100000000)+'" type="text/javascript"><\/script>');

View File

@ -39,7 +39,7 @@ sub_info_get_<%=idname%>();
function progressbar_<%=idname%>(v, m, pc, np, f, t, tr) { function progressbar_<%=idname%>(v, m, pc, np, f, t, tr) {
return String.format( return String.format(
'<div style="width:250px; max-width:500px; position:relative; border:1px solid #999999; border-radius: 6px">' + '<div style="width:250px; max-width:500px; position:relative; border:1px solid #999999; border-radius: 6px">' +
(pc <= 50 ? '<div style="background-color:#9edd9e; width:%d%%; height:36px; border-radius: 6px">' : (pc > 50 && pc <= 80 ? '<div style="background-color:#ffc99f; width:%d%%; height:35px">' : '<div style="background-color:#ffb9b9; width:%d%%; height:35px">')) + (pc >= 50 ? '<div style="background-color:#9edd9e; width:%d%%; height:36px; border-radius: 6px">' : (pc < 50 && pc >= 20 ? '<div style="background-color:#ffc99f; width:%d%%; height:35px">' : '<div style="background-color:#ffb9b9; width:%d%%; height:35px">')) +
'<div style="position:absolute; left:0;' + (tr == "null" ? 'top:12px;' : 'top:0;') + 'text-align:center; width:100%%">' + '<div style="position:absolute; left:0;' + (tr == "null" ? 'top:12px;' : 'top:0;') + 'text-align:center; width:100%%">' +
'<small>%s '+ (f ? f : '/') +' %s ' + (np ? "" : '(%s%%)') + (tr == "null" ? '<div style="visibility: hidden;">' : '<div style="visibility: visible;">') + '%s (<%:Remaining%> %s <%:days%>)</small>' + '<small>%s '+ (f ? f : '/') +' %s ' + (np ? "" : '(%s%%)') + (tr == "null" ? '<div style="visibility: hidden;">' : '<div style="visibility: visible;">') + '%s (<%:Remaining%> %s <%:days%>)</small>' +
'</div>' + '</div>' +
@ -60,7 +60,7 @@ function sub_info_get_<%=idname%>()
} }
else { else {
//document.getElementById('<%=idname%>').innerHTML = "<%:Plan Traffic%>" + ": " + "<span style=color:green>" + save_info.used + "</span> | <span style=color:green>" + save_info.total + "</span> <br/> <%:Plan Expiration Time%>: " + "<span style=color:green>" + save_info.expire + "</span>"; //document.getElementById('<%=idname%>').innerHTML = "<%:Plan Traffic%>" + ": " + "<span style=color:green>" + save_info.used + "</span> | <span style=color:green>" + save_info.total + "</span> <br/> <%:Plan Expiration Time%>: " + "<span style=color:green>" + save_info.expire + "</span>";
document.getElementById('<%=idname%>').innerHTML = progressbar_<%=idname%>((save_info.used), (save_info.total), (save_info.percent ? save_info.percent : 0), false, false, (save_info.expire), (save_info.day_left ? save_info.day_left : 0)); document.getElementById('<%=idname%>').innerHTML = progressbar_<%=idname%>((save_info.used), (save_info.total), (save_info.percent ? (100-save_info.percent) : 0), false, false, (save_info.expire), (save_info.day_left ? save_info.day_left : 0));
} }
}; };
@ -71,7 +71,7 @@ function sub_info_get_<%=idname%>()
retry_<%=idname%> = 0; retry_<%=idname%> = 0;
localStorage.setItem("<%=filename%>",JSON.stringify(status)); localStorage.setItem("<%=filename%>",JSON.stringify(status));
document.getElementById('<%=idname%>').className = "sub_tab_show"; document.getElementById('<%=idname%>').className = "sub_tab_show";
document.getElementById('<%=idname%>').innerHTML = progressbar_<%=idname%>((status.used), (status.total), (status.percent), false, false, (status.expire), (status.day_left)); document.getElementById('<%=idname%>').innerHTML = progressbar_<%=idname%>((status.used), (status.total), (100-status.percent), false, false, (status.expire), (status.day_left));
//document.getElementById('<%=idname%>').innerHTML = "<%:Plan Traffic%>" + ": " + "<span style=color:green>" + status.used + "</span> | <span style=color:green>" + status.total + "</span> <br/> <%:Plan Expiration Time%>: " + "<span style=color:green>" + status.expire + "</span>"; //document.getElementById('<%=idname%>').innerHTML = "<%:Plan Traffic%>" + ": " + "<span style=color:green>" + status.used + "</span> | <span style=color:green>" + status.total + "</span> <br/> <%:Plan Expiration Time%>: " + "<span style=color:green>" + status.expire + "</span>";
} }
else if ( x && x.status == 200 && status.sub_info == "No Sub Info Found" ) { else if ( x && x.status == 200 && status.sub_info == "No Sub Info Found" ) {

View File

@ -14,7 +14,7 @@
<option value="linux-armv5"><%:linux-armv5%></option> <option value="linux-armv5"><%:linux-armv5%></option>
<option value="linux-armv6"><%:linux-armv6%></option> <option value="linux-armv6"><%:linux-armv6%></option>
<option value="linux-armv7"><%:linux-armv7%></option> <option value="linux-armv7"><%:linux-armv7%></option>
<option value="linux-armv8"><%:linux-armv8%></option> <option value="linux-arm64"><%:linux-arm64(armv8)%></option>
<option value="linux-mips-hardfloat"><%:linux-mips-hardfloat%></option> <option value="linux-mips-hardfloat"><%:linux-mips-hardfloat%></option>
<option value="linux-mips-softfloat"><%:linux-mips-softfloat%></option> <option value="linux-mips-softfloat"><%:linux-mips-softfloat%></option>
<option value="linux-mips64"><%:linux-mips64%></option> <option value="linux-mips64"><%:linux-mips64%></option>

View File

@ -170,6 +170,9 @@ msgstr "实验性:绕过中国大陆 IPv6"
msgid "Bypass The China Network Flows, Improve Performance" msgid "Bypass The China Network Flows, Improve Performance"
msgstr "启用后中国大陆流量将不再经过内核,提升系统性能" msgstr "启用后中国大陆流量将不再经过内核,提升系统性能"
msgid "Bypass The China Network Flows, Improve Performance, Depend on Dnsmasq"
msgstr "启用后中国大陆流量将不再经过内核,提升系统性能,此功能依赖于 Dnsmasq"
msgid "Log Level" msgid "Log Level"
msgstr "日志等级" msgstr "日志等级"
@ -730,6 +733,9 @@ msgstr "混淆参数(可选)"
msgid "UDP Enable" msgid "UDP Enable"
msgstr "UDP 支持" msgstr "UDP 支持"
msgid "XUDP Enable"
msgstr "XUDP 支持"
msgid "obfs-mode" msgid "obfs-mode"
msgstr "传输协议" msgstr "传输协议"
@ -1450,6 +1456,9 @@ msgstr "大陆IPv6段更新URL"
msgid "Custom Chnroute Lists URL" msgid "Custom Chnroute Lists URL"
msgstr "大陆IP段更新URL" msgstr "大陆IP段更新URL"
msgid "Custom CN Doamin Lists URL"
msgstr "大陆域名列表文件更新URL"
msgid "Custom GEOIP Data URL, Click Button Below To Refresh After Edit" msgid "Custom GEOIP Data URL, Click Button Below To Refresh After Edit"
msgstr "自定义 GEOIP 数据库的更新来源,编辑后点击下方按钮生效" msgstr "自定义 GEOIP 数据库的更新来源,编辑后点击下方按钮生效"
@ -1462,6 +1471,9 @@ msgstr "自定义大陆 IP 段的更新来源,编辑后点击下方按钮生
msgid "Custom Chnroute6 Lists URL, Click Button Below To Refresh After Edit" msgid "Custom Chnroute6 Lists URL, Click Button Below To Refresh After Edit"
msgstr "自定义大陆 IPv6 段的更新来源,编辑后点击下方按钮生效" msgstr "自定义大陆 IPv6 段的更新来源,编辑后点击下方按钮生效"
msgid "Custom CN Doamin Dnsmasq Conf URL, Click Button Below To Refresh After Edit"
msgstr "自定义大陆域名列表配置文件Dnsmasq Conf的更新来源编辑后点击下方按钮生效"
msgid "(Default)" msgid "(Default)"
msgstr "(默认)" msgstr "(默认)"
@ -1720,36 +1732,54 @@ msgstr "开始下载大陆 IP 白名单..."
msgid "Start Downloading The Chnroute6 Cidr List..." msgid "Start Downloading The Chnroute6 Cidr List..."
msgstr "开始下载大陆 IPv6 白名单..." msgstr "开始下载大陆 IPv6 白名单..."
msgid "Start Downloading The CN Domains List..."
msgstr "开始下载大陆域名白名单..."
msgid "Chnroute Cidr List Download Success, Check Updated..." msgid "Chnroute Cidr List Download Success, Check Updated..."
msgstr "大陆 IP 白名单下载成功,检查版本是否更新..." msgstr "大陆 IP 白名单下载成功,检查版本是否更新..."
msgid "Chnroute6 Cidr List Download Success, Check Updated..." msgid "Chnroute6 Cidr List Download Success, Check Updated..."
msgstr "大陆 IPv6 白名单下载成功,检查版本是否更新..." msgstr "大陆 IPv6 白名单下载成功,检查版本是否更新..."
msgid "CN Domains List Download Success, Check Updated..."
msgstr "大陆域名白名单下载成功,检查版本是否更新..."
msgid "Chnroute Cidr List Has Been Updated, Starting To Replace The Old Version..." msgid "Chnroute Cidr List Has Been Updated, Starting To Replace The Old Version..."
msgstr "大陆 IP 白名单有更新,开始替换旧版本..." msgstr "大陆 IP 白名单有更新,开始替换旧版本..."
msgid "Chnroute6 Cidr List Has Been Updated, Starting To Replace The Old Version..." msgid "Chnroute6 Cidr List Has Been Updated, Starting To Replace The Old Version..."
msgstr "大陆 IPv6 白名单有更新,开始替换旧版本..." msgstr "大陆 IPv6 白名单有更新,开始替换旧版本..."
msgid "CN Domains List Has Been Updated, Starting To Replace The Old Version..."
msgstr "大陆域名白名单有更新,开始替换旧版本..."
msgid "Chnroute Cidr List Update Successful!" msgid "Chnroute Cidr List Update Successful!"
msgstr "大陆 IP 白名单更新成功!" msgstr "大陆 IP 白名单更新成功!"
msgid "Chnroute6 Cidr List Update Successful!" msgid "Chnroute6 Cidr List Update Successful!"
msgstr "大陆 IPv6 白名单更新成功!" msgstr "大陆 IPv6 白名单更新成功!"
msgid "CN Domains List Update Successful!"
msgstr "大陆域名白名单更新成功!"
msgid "Updated Chnroute Cidr List No Change, Do Nothing..." msgid "Updated Chnroute Cidr List No Change, Do Nothing..."
msgstr "大陆 IP 白名单没有更新,停止继续操作..." msgstr "大陆 IP 白名单没有更新,停止继续操作..."
msgid "Updated Chnroute6 Cidr List No Change, Do Nothing..." msgid "Updated Chnroute6 Cidr List No Change, Do Nothing..."
msgstr "大陆 IPv6 白名单没有更新,停止继续操作..." msgstr "大陆 IPv6 白名单没有更新,停止继续操作..."
msgid "Updated CN Domains List No Change, Do Nothing..."
msgstr "大陆域名白名单没有更新,停止继续操作..."
msgid "Chnroute Cidr List Update Error, Please Try Again Later..." msgid "Chnroute Cidr List Update Error, Please Try Again Later..."
msgstr "大陆 IP 白名单下载失败,请检查网络或稍后再试..." msgstr "大陆 IP 白名单下载失败,请检查网络或稍后再试..."
msgid "Chnroute6 Cidr List Update Error, Please Try Again Later..." msgid "Chnroute6 Cidr List Update Error, Please Try Again Later..."
msgstr "大陆 IPv6 白名单下载失败,请检查网络或稍后再试..." msgstr "大陆 IPv6 白名单下载失败,请检查网络或稍后再试..."
msgid "CN Domains List Update Error, Please Try Again Later..."
msgstr "大陆域名白名单下载失败,请检查网络或稍后再试..."
msgid "Start Downloading GeoSite Database..." msgid "Start Downloading GeoSite Database..."
msgstr "开始下载 GeoSite 数据库..." msgstr "开始下载 GeoSite 数据库..."
@ -1942,7 +1972,7 @@ msgstr "提示: 检测到 GEOIP Dat 数据库文件不存在,准备开始下
msgid "Tip: Detected that the Core is not Installed, Ready to Download..." msgid "Tip: Detected that the Core is not Installed, Ready to Download..."
msgstr "提示: 检测到内核文件不存在,准备开始下载..." msgstr "提示: 检测到内核文件不存在,准备开始下载..."
msgid "Tip: Detected that the Chnroute Cidr List is not Installed, Ready to Download..." msgid "Tip: Detected that the Chnroute Cidr or CN Domains List is not Installed, Ready to Download..."
msgstr "提示: 检测到大陆白名单列表不存在,准备开始下载..." msgstr "提示: 检测到大陆白名单列表不存在,准备开始下载..."
msgid "Tip: Detected that the Chnroute Cidr List Format is wrong, Ready to Reformat..." msgid "Tip: Detected that the Chnroute Cidr List Format is wrong, Ready to Reformat..."
@ -2617,8 +2647,8 @@ msgstr "Bilibili 策略组:"
msgid "Google Group:" msgid "Google Group:"
msgstr "Google 策略组:" msgstr "Google 策略组:"
msgid "full support." msgid "full support"
msgstr "完整解锁" msgstr "完整解锁"
msgid "full support, area:" msgid "full support, area:"
msgstr "完整解锁,区域:" msgstr "完整解锁,区域:"
@ -2629,8 +2659,8 @@ msgstr "仅支持自制剧!"
msgid "unlock test faild!" msgid "unlock test faild!"
msgstr "解锁检测失败!" msgstr "解锁检测失败!"
msgid "the type of group is not select, auto select could not work!" msgid ", the type of group is not select, auto select could not work!"
msgstr "当前策略组类型非Select无法进行自动选择" msgstr "当前策略组类型非Select无法进行自动选择"
msgid "Start auto select unlock proxy..." msgid "Start auto select unlock proxy..."
msgstr "开始进行解锁节点自动选择..." msgstr "开始进行解锁节点自动选择..."
@ -2683,20 +2713,26 @@ msgstr "解锁节点自动选择失败,未找到区域匹配的节点,回退
msgid "unlock node auto selected successfully, no node match the old region, rolled back to other full support node" msgid "unlock node auto selected successfully, no node match the old region, rolled back to other full support node"
msgstr "解锁节点自动选择成功,未找到与先前解锁区域匹配的节点,回退到其他区域且符合条件的解锁节点" msgstr "解锁节点自动选择成功,未找到与先前解锁区域匹配的节点,回退到其他区域且符合条件的解锁节点"
msgid "full support but not match the regex!" msgid ", but not match the regex!"
msgstr "完整解锁但区域不匹配!" msgstr ",但区域与设置不匹配!"
msgid "full support but not match the old region!" msgid "full support but not match the old region!"
msgstr "完整解锁但与先前解锁区域不匹配!" msgstr "完整解锁但与先前解锁区域不匹配!"
msgid "but not match the regex! the type of group is not select, auto select could not work!" msgid ", but not match the old region:"
msgstr "完整解锁但区域不匹配!当前策略组类型非 Select无法进行自动选择" msgstr ",但不匹配先前解锁区域:"
msgid "the type of group is not select, auto select could not work!"
msgstr "当前策略组类型非 Select无法进行自动选择"
msgid "but not match the regex! the type of group is not select, auto select could not work!"
msgstr "完整解锁但区域与设置不匹配!当前策略组类型非 Select无法进行自动选择"
msgid "but not match the old region! the type of group is not select, auto select could not work!" msgid "but not match the old region! the type of group is not select, auto select could not work!"
msgstr "完整解锁但与先前解锁区域不匹配!当前策略组类型非 Select无法进行自动选择" msgstr "但与先前解锁区域不匹配!当前策略组类型非 Select无法进行自动选择"
msgid "full support but not match the regex! start auto select unlock proxy..." msgid ", but not match the regex! start auto select unlock proxy..."
msgstr "完整解锁但区域不匹配!开始进行解锁节点自动选择..." msgstr ",但区域与设置不匹配!开始进行解锁节点自动选择..."
msgid "unlock node test finished, rolled back to the full support node" msgid "unlock node test finished, rolled back to the full support node"
msgstr "解锁检测完成,回退到完整解锁的节点" msgstr "解锁检测完成,回退到完整解锁的节点"
@ -3141,3 +3177,42 @@ msgstr "Google 非送中"
msgid "In Fake-ip Mode, Even If This Option is Turned Off, Domain Type Connections Still Pass Through The Core For The Availability" msgid "In Fake-ip Mode, Even If This Option is Turned Off, Domain Type Connections Still Pass Through The Core For The Availability"
msgstr "在 Fake-IP 模式时,即使关闭此选项,域名类型的连接仍将通过核心以保证可用性" msgstr "在 Fake-IP 模式时,即使关闭此选项,域名类型的连接仍将通过核心以保证可用性"
msgid "Warning: TUN Interface Start Failed, Please Check The Dependence or Try to Restart Again!"
msgstr "警告TUN 接口启动失败,请检查依赖情况或稍后重试!"
msgid "Warning: TUN Interface Start Failed, Try to Restart Again..."
msgstr "警告TUN 接口启动失败,尝试重启内核..."
msgid "Forced Sniff Pure IP Connections"
msgstr "强制探测(嗅探)所有纯 IP 的连接"
msgid "Forced Sniff Pure IP"
msgstr "探测(嗅探)纯 IP 连接"
msgid "Download Failed:"
msgstr "下载失败:"
msgid "Tip: Waiting for TUN Interface Start..."
msgstr "提示:正在等待 TUN 接口启动..."
msgid "Tip: You Can Try to Restart With Meta Core"
msgstr "提示:您可以尝试使用 Meta 内核启动"
msgid "Warning: Dnsmasq not Support nftset, Use ipset..."
msgstr "警告Dnsmasq 不支持 nftset, 使用 ipset 代替..."
msgid "Tip: Firewall4 was Detected, Use NFTABLE Rules..."
msgstr "提示:检测到 Firewall4使用 NFTABLE 规则..."
msgid "Specify CN DNS Server"
msgstr "大陆域名 DNS 服务器"
msgid "Specify DNS Server For CN Domain Lists, Only One IP Server Address Support"
msgstr "指定大陆域名的 DNS 服务器只支持填写一个IP地址"
msgid "Tip: Dnsmasq Work is Normal, Restore The Firewall DNS Hijacking Rules..."
msgstr "提示:检测到 Dnsmasq 正常工作,还原防火墙 DNS 劫持规则..."
msgid "Tip: Bypass the China IP May Cause the Dnsmasq Load For a Long Time After Restart in FAKE-IP Mode, Hijack the DNS to Core Untill the Dnsmasq Works Well..."
msgstr "提示:在 FAKE-IP 模式下绕过中国 IP 可能会导致 Dnsmasq 加载时间过长,暂时劫持 DNS 至内核直到 Dnsmasq 正常工作..."

View File

@ -58,11 +58,12 @@ config openclash 'config'
option dashboard_type 'Official' option dashboard_type 'Official'
option yacd_type 'Official' option yacd_type 'Official'
option append_default_dns '1' option append_default_dns '1'
option geo_custom_url 'https://fastly.jsdelivr.net/gh/alecthw/mmdb_china_ip_list@release/lite/Country.mmdb' option geo_custom_url 'https://testingcf.jsdelivr.net/gh/alecthw/mmdb_china_ip_list@release/lite/Country.mmdb'
option geosite_custom_url 'https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat' option geosite_custom_url 'https://testingcf.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat'
option geoip_custom_url 'https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat' option geoip_custom_url 'https://testingcf.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat'
option chnr_custom_url 'https://ispip.clang.cn/all_cn.txt' option chnr_custom_url 'https://ispip.clang.cn/all_cn.txt'
option chnr6_custom_url 'https://ispip.clang.cn/all_cn_ipv6.txt' option chnr6_custom_url 'https://ispip.clang.cn/all_cn_ipv6.txt'
option cndomain_custom_url 'https://testingcf.jsdelivr.net/gh/felixonmars/dnsmasq-china-list@master/accelerated-domains.china.conf'
config dns_servers config dns_servers
option group 'nameserver' option group 'nameserver'

View File

@ -249,6 +249,7 @@ if [ -z "$(pidof clash)" ] && [ "$provider_path_check" == "false" ]; then
LOG_OUT "Error: Failed To Download Rule-providers, Please Check The Log Page For Detailed error information!" LOG_OUT "Error: Failed To Download Rule-providers, Please Check The Log Page For Detailed error information!"
fi fi
LOG_ALERT LOG_ALERT
LOG_OUT "Tip: You Can Try to Restart With Meta Core"
start_fail start_fail
fi fi
} }
@ -365,7 +366,7 @@ yml_other_rules_get()
check_run_quick() check_run_quick()
{ {
quick_start=true quick_start=true
check_file="$(echo $RAW_CONFIG_FILE | tr " " "?") /etc/openclash/custom/openclash_custom_domain_dns.list /etc/openclash/custom/openclash_custom_domain_dns_policy.list /etc/openclash/custom/openclash_custom_fake_filter.list /etc/openclash/custom/openclash_custom_fallback_filter.yaml /etc/openclash/custom/openclash_custom_hosts.list /etc/openclash/custom/openclash_custom_rules.list /etc/openclash/custom/openclash_custom_rules_2.list $dev_core_path $tun_core_path $meta_core_path $ipdb_path $geosite_path $geoip_path $chnr_path $chnr6_path /usr/share/openclash/res/ConnersHua.yaml /usr/share/openclash/res/ConnersHua_return.yaml /usr/share/openclash/res/lhie1.yaml /etc/openclash/custom/openclash_force_sniffing_domain.yaml /etc/openclash/custom/openclash_sniffing_domain_filter.yaml /etc/openclash/custom/openclash_sniffing_port_filter.yaml /etc/openclash/custom/openclash_custom_localnetwork_ipv4.list /etc/openclash/custom/openclash_custom_localnetwork_ipv6.list /etc/openclash/custom/openclash_custom_chnroute_pass.list /etc/openclash/custom/openclash_custom_chnroute6_pass.list" check_file="$(echo $RAW_CONFIG_FILE | tr " " "?") /etc/openclash/custom/openclash_custom_domain_dns.list /etc/openclash/custom/openclash_custom_domain_dns_policy.list /etc/openclash/custom/openclash_custom_fake_filter.list /etc/openclash/custom/openclash_custom_fallback_filter.yaml /etc/openclash/custom/openclash_custom_hosts.list /etc/openclash/custom/openclash_custom_rules.list /etc/openclash/custom/openclash_custom_rules_2.list $dev_core_path $tun_core_path $meta_core_path $ipdb_path $geosite_path $geoip_path $chnr_path $chnr6_path /usr/share/openclash/res/ConnersHua.yaml /usr/share/openclash/res/ConnersHua_return.yaml /usr/share/openclash/res/lhie1.yaml /etc/openclash/custom/openclash_force_sniffing_domain.yaml /etc/openclash/custom/openclash_sniffing_domain_filter.yaml /etc/openclash/custom/openclash_sniffing_port_filter.yaml /etc/openclash/custom/openclash_custom_localnetwork_ipv4.list /etc/openclash/custom/openclash_custom_localnetwork_ipv6.list /etc/openclash/custom/openclash_custom_chnroute_pass.list /etc/openclash/custom/openclash_custom_chnroute6_pass.list $cndomain_path"
if [ ! -f "$CONFIG_FILE" ] || [ ! -f "/tmp/openclash_config.tmp" ] || [ ! -f "/tmp/openclash.change" ]; then if [ ! -f "$CONFIG_FILE" ] || [ ! -f "/tmp/openclash_config.tmp" ] || [ ! -f "/tmp/openclash.change" ]; then
quick_start=false quick_start=false
return return
@ -467,11 +468,13 @@ do_run_file()
chnr6_path="/etc/openclash/china_ip6_route.ipset" chnr6_path="/etc/openclash/china_ip6_route.ipset"
geosite_path="/etc/openclash/GeoSite.dat" geosite_path="/etc/openclash/GeoSite.dat"
geoip_path="/etc/openclash/GeoIP.dat" geoip_path="/etc/openclash/GeoIP.dat"
cndomain_path="/etc/openclash/accelerated-domains.china.conf"
mv "/tmp/etc/openclash/Country.mmdb" "$ipdb_path" 2>/dev/null mv "/tmp/etc/openclash/Country.mmdb" "$ipdb_path" 2>/dev/null
mv "/tmp/etc/openclash/china_ip_route.ipset" "$chnr_path" 2>/dev/null mv "/tmp/etc/openclash/china_ip_route.ipset" "$chnr_path" 2>/dev/null
mv "/tmp/etc/openclash/china_ip6_route.ipset" "$chnr6_path" 2>/dev/null mv "/tmp/etc/openclash/china_ip6_route.ipset" "$chnr6_path" 2>/dev/null
mv "/tmp/etc/openclash/GeoSite.dat" "$geosite_path" 2>/dev/null mv "/tmp/etc/openclash/GeoSite.dat" "$geosite_path" 2>/dev/null
mv "/tmp/etc/openclash/GeoIP.dat" "$geoip_path" 2>/dev/null mv "/tmp/etc/openclash/GeoIP.dat" "$geoip_path" 2>/dev/null
mv "/tmp/etc/openclash/accelerated-domains.china.conf" "$cndomain_path" 2>/dev/null
mv "/tmp/etc/openclash/core/" "/etc/openclash" 2>/dev/null mv "/tmp/etc/openclash/core/" "/etc/openclash" 2>/dev/null
if [ "$CACHE_PATH" != "/tmp/etc/openclash/cache.db" ]; then if [ "$CACHE_PATH" != "/tmp/etc/openclash/cache.db" ]; then
rm -rf "/tmp/etc/openclash" 2>/dev/null rm -rf "/tmp/etc/openclash" 2>/dev/null
@ -485,11 +488,13 @@ do_run_file()
chnr6_path="/tmp/etc/openclash/china_ip6_route.ipset" chnr6_path="/tmp/etc/openclash/china_ip6_route.ipset"
geosite_path="/tmp/etc/openclash/GeoSite.dat" geosite_path="/tmp/etc/openclash/GeoSite.dat"
geoip_path="/tmp/etc/openclash/GeoIP.dat" geoip_path="/tmp/etc/openclash/GeoIP.dat"
cndomain_path="/tmp/etc/openclash/accelerated-domains.china.conf"
[ ! -h "/etc/openclash/Country.mmdb" ] && mv "/etc/openclash/Country.mmdb" "$ipdb_path" 2>/dev/null [ ! -h "/etc/openclash/Country.mmdb" ] && mv "/etc/openclash/Country.mmdb" "$ipdb_path" 2>/dev/null
[ ! -h "/etc/openclash/china_ip_route.ipset" ] && mv "/etc/openclash/china_ip_route.ipset" "$chnr_path" 2>/dev/null [ ! -h "/etc/openclash/china_ip_route.ipset" ] && mv "/etc/openclash/china_ip_route.ipset" "$chnr_path" 2>/dev/null
[ ! -h "/etc/openclash/china_ip6_route.ipset" ] && mv "/etc/openclash/china_ip6_route.ipset" "$chnr6_path" 2>/dev/null [ ! -h "/etc/openclash/china_ip6_route.ipset" ] && mv "/etc/openclash/china_ip6_route.ipset" "$chnr6_path" 2>/dev/null
[ ! -h "/etc/openclash/GeoSite.dat" ] && mv "/etc/openclash/GeoSite.dat" "$geosite_path" 2>/dev/null [ ! -h "/etc/openclash/GeoSite.dat" ] && mv "/etc/openclash/GeoSite.dat" "$geosite_path" 2>/dev/null
[ ! -h "/etc/openclash/GeoIP.dat" ] && mv "/etc/openclash/GeoIP.dat" "$geoip_path" 2>/dev/null [ ! -h "/etc/openclash/GeoIP.dat" ] && mv "/etc/openclash/GeoIP.dat" "$geoip_path" 2>/dev/null
[ ! -h "/etc/openclash/accelerated-domains.china.conf" ] && mv "/etc/openclash/accelerated-domains.china.conf" "$cndomain_path" 2>/dev/null
mv "/etc/openclash/core/" "/tmp/etc/openclash" 2>/dev/null mv "/etc/openclash/core/" "/tmp/etc/openclash" 2>/dev/null
fi fi
@ -559,7 +564,7 @@ do_run_file()
start_fail start_fail
else else
del_lock del_lock
restart stop
exit 0 exit 0
fi fi
} }
@ -590,7 +595,11 @@ do_run_file()
if [ "$china_ip_route" = "1" ] || [ "$china_ip6_route" = "1" ] || [ "$disable_udp_quic" = "1" ]; then if [ "$china_ip_route" = "1" ] || [ "$china_ip6_route" = "1" ] || [ "$disable_udp_quic" = "1" ]; then
if [ ! -f "$chnr_path" ] || [ ! -f "$chnr6_path" ]; then if [ ! -f "$chnr_path" ] || [ ! -f "$chnr6_path" ]; then
LOG_OUT "Tip: Detected that the Chnroute Cidr List is not Installed, Ready to Download..." LOG_OUT "Tip: Detected that the Chnroute Cidr or CN Domains List is not Installed, Ready to Download..."
/usr/share/openclash/openclash_chnroute.sh
fi
if [ ! -f "$cndomain_path" ] && [ "$en_mode" = "fake-ip" ] && [ "$china_ip_route" = "1" ]; then
LOG_OUT "Tip: Detected that the Chnroute Cidr or CN Domains List is not Installed, Ready to Download..."
/usr/share/openclash/openclash_chnroute.sh /usr/share/openclash/openclash_chnroute.sh
fi fi
if [ -n "$FW4" ]; then if [ -n "$FW4" ]; then
@ -613,6 +622,9 @@ do_run_file()
if [ ! -f "$chnr_path" ] || [ ! -f "$chnr6_path" ]; then if [ ! -f "$chnr_path" ] || [ ! -f "$chnr6_path" ]; then
start_fail start_fail
fi fi
if [ ! -f "$cndomain_path" ] && [ "$en_mode" = "fake-ip" ] && [ "$china_ip_route" = "1" ]; then
start_fail
fi
fi fi
[ ! -x "$tun_core_path" ] && chmod 4755 "$tun_core_path" 2>/dev/null [ ! -x "$tun_core_path" ] && chmod 4755 "$tun_core_path" 2>/dev/null
@ -638,6 +650,10 @@ do_run_file()
[ -f "$chnr6_path" ] && [ "$small_flash_memory" = "1" ] && { [ -f "$chnr6_path" ] && [ "$small_flash_memory" = "1" ] && {
ln -s "$chnr6_path" /etc/openclash/china_ip6_route.ipset 2>/dev/null ln -s "$chnr6_path" /etc/openclash/china_ip6_route.ipset 2>/dev/null
} }
[ -f "$cndomain_path" ] && [ "$small_flash_memory" = "1" ] && {
ln -s "$cndomain_path" /etc/openclash/accelerated-domains.china.conf 2>/dev/null
}
#Restore history cache #Restore history cache
if [ -f "$HISTORY_PATH" ] && [ -f "$HISTORY_PATH_OLD" ]; then if [ -f "$HISTORY_PATH" ] && [ -f "$HISTORY_PATH_OLD" ]; then
@ -1214,9 +1230,11 @@ if dnsmasq --version | grep -q 'Compile time options:.* nftset'; then
nftflag="inet#fw4#" nftflag="inet#fw4#"
else else
settype="ipset" settype="ipset"
[ -n "$FW4" ] && LOG_OUT "Warning: Dnsmasq not Support nftset, Use ipset..."
fi fi
if [ -n "$FW4" ]; then if [ -n "$FW4" ]; then
LOG_OUT "Tip: Firewall4 was Detected, Use NFTABLE Rules..."
if [ "$china_ip_route" = "1" ] || [ "$disable_udp_quic" = "1" ]; then if [ "$china_ip_route" = "1" ] || [ "$disable_udp_quic" = "1" ]; then
nft 'flush set inet fw4 china_ip_route' nft 'flush set inet fw4 china_ip_route'
nft -f '/etc/openclash/china_ip_route.ipset' 2>/dev/null nft -f '/etc/openclash/china_ip_route.ipset' 2>/dev/null
@ -1239,15 +1257,34 @@ if [ -n "$FW4" ]; then
nft 'flush set inet fw4 china_ip_route_pass' 2>/dev/null nft 'flush set inet fw4 china_ip_route_pass' 2>/dev/null
nft -f '/tmp/openclash_china_ip_route_pass.list' 2>/dev/null nft -f '/tmp/openclash_china_ip_route_pass.list' 2>/dev/null
rm -rf /tmp/openclash_china_ip_route_pass.list 2>/dev/null rm -rf /tmp/openclash_china_ip_route_pass.list 2>/dev/null
if [ "$en_mode" = "fake-ip" ] && [ "$china_ip_route" = "1" ]; then
cp "$cndomain_path" /tmp/dnsmasq.d/dnsmasq_accelerated-domains.china.conf 2>/dev/null
cat "$cndomain_path" |awk -v dns="${custom_china_domain_dns_server}" -F '/' '!/^$/&&!/^#/{print $1"/"$2"/"dns}' >/tmp/dnsmasq.d/dnsmasq_accelerated-domains.china.conf 2>/dev/null
for i in `awk '!/^$/&&!/^#/&&!/(^([1-9]|1[0-9]|1[1-9]{2}|2[0-4][0-9]|25[0-5])\.)(([0-9]{1,2}|1[1-9]{2}|2[0-4][0-9]|25[0-5])\.){2}([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-5][0-9]|25[0-4])((\/[0-9][0-9])?)$/{printf("%s\n",$0)}' /etc/openclash/custom/openclash_custom_chnroute_pass.list`
do
sed -i "/server=\/${i}\//d" /tmp/dnsmasq.d/dnsmasq_accelerated-domains.china.conf 2>/dev/null
done 2>/dev/null
fi
fi fi
DNSPORT=$(uci -q get dhcp.@dnsmasq[0].port)
if [ -z "$DNSPORT" ]; then
DNSPORT=$(netstat -nlp |grep -E '127.0.0.1:.*dnsmasq' |awk -F '127.0.0.1:' '{print $2}' |awk '{print $1}' |head -1 || echo 53)
fi
if [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(nft list chain inet fw4 dstnat |grep 'OpenClash DNS Hijack')"]; then if [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(nft list chain inet fw4 dstnat |grep 'OpenClash DNS Hijack')"]; then
DNSPORT=$(uci -q get dhcp.@dnsmasq[0].port) nft insert rule inet fw4 dstnat position 0 tcp dport 53 counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
if [ -z "$DNSPORT" ]; then nft insert rule inet fw4 dstnat position 0 udp dport 53 counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
DNSPORT=$(netstat -nlp |grep -E '127.0.0.1:.*dnsmasq' |awk -F '127.0.0.1:' '{print $2}' |awk '{print $1}' |head -1 || echo "$dns_port") fi
fi if [ "$en_mode" = "fake-ip" ] && [ "$china_ip_route" = "1" ]; then
nft insert rule inet fw4 dstnat position 0 tcp dport 53 redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null LOG_OUT "Tip: Bypass the China IP May Cause the Dnsmasq Load For a Long Time After Restart in FAKE-IP Mode, Hijack the DNS to Core Untill the Dnsmasq Works Well..."
nft insert rule inet fw4 dstnat position 0 udp dport 53 redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null nft insert rule inet fw4 dstnat position 0 tcp dport 53 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft insert rule inet fw4 dstnat position 0 udp dport 53 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft 'add chain inet fw4 nat_output { type nat hook output priority -1; }' 2>/dev/null
nft add rule inet fw4 nat_output position 0 tcp dport 53 meta skuid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 nat_output position 0 udp dport 53 meta skuid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 nat_output position 0 tcp dport 5353 meta skuid != 65534 counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 nat_output position 0 udp dport 5353 meta skuid != 65534 counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
fi fi
#lan_google_dns_ac #lan_google_dns_ac
@ -1345,6 +1382,7 @@ if [ -n "$FW4" ]; then
#nft 'delete chain inet fw4 openclash_post' 2>/dev/null #nft 'delete chain inet fw4 openclash_post' 2>/dev/null
nft 'add chain inet fw4 openclash_post' 2>/dev/null nft 'add chain inet fw4 openclash_post' 2>/dev/null
nft 'flush chain inet fw4 openclash_post' 2>/dev/null nft 'flush chain inet fw4 openclash_post' 2>/dev/null
nft 'add rule inet fw4 openclash_post ip saddr @localnetwork tcp sport @lan_ac_black_ports counter return' 2>/dev/null
nft add rule inet fw4 openclash_post meta mark "$PROXY_FWMARK" counter accept 2>/dev/null nft add rule inet fw4 openclash_post meta mark "$PROXY_FWMARK" counter accept 2>/dev/null
nft 'add rule inet fw4 openclash_post ip daddr @localnetwork counter return' 2>/dev/null nft 'add rule inet fw4 openclash_post ip daddr @localnetwork counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_post meta nfproto {ipv4} fib saddr type != { local } meta skuid != 65534 counter masquerade' 2>/dev/null nft 'add rule inet fw4 openclash_post meta nfproto {ipv4} fib saddr type != { local } meta skuid != 65534 counter masquerade' 2>/dev/null
@ -1383,9 +1421,9 @@ if [ -n "$FW4" ]; then
if [ "$en_mode" = "redir-host" ]; then if [ "$en_mode" = "redir-host" ]; then
nft 'add rule inet fw4 openclash tcp dport != @common_ports counter return' 2>/dev/null nft 'add rule inet fw4 openclash tcp dport != @common_ports counter return' 2>/dev/null
if [ "$china_ip_route" = "1" ]; then fi
nft 'add rule inet fw4 openclash ip daddr @china_ip_route ip daddr != @china_ip_route_pass counter return' 2>/dev/null if [ "$china_ip_route" = "1" ]; then
fi nft 'add rule inet fw4 openclash ip daddr @china_ip_route ip daddr != @china_ip_route_pass counter return' 2>/dev/null
fi fi
nft add rule inet fw4 openclash ip protocol tcp counter redirect to "$proxy_port" 2>/dev/null nft add rule inet fw4 openclash ip protocol tcp counter redirect to "$proxy_port" 2>/dev/null
nft 'add rule inet fw4 dstnat ip protocol tcp counter jump openclash' 2>/dev/null nft 'add rule inet fw4 dstnat ip protocol tcp counter jump openclash' 2>/dev/null
@ -1413,9 +1451,9 @@ if [ -n "$FW4" ]; then
if [ "$en_mode" = "redir-host" ]; then if [ "$en_mode" = "redir-host" ]; then
nft 'add rule inet fw4 openclash_mangle udp dport != @common_ports counter return' 2>/dev/null nft 'add rule inet fw4 openclash_mangle udp dport != @common_ports counter return' 2>/dev/null
if [ "$china_ip_route" = "1" ]; then fi
nft 'add rule inet fw4 openclash_mangle ip daddr @china_ip_route ip daddr != @china_ip_route_pass counter return' 2>/dev/null if [ "$china_ip_route" = "1" ]; then
fi nft 'add rule inet fw4 openclash_mangle ip daddr @china_ip_route ip daddr != @china_ip_route_pass counter return' 2>/dev/null
fi fi
nft add rule inet fw4 openclash_mangle meta l4proto { udp } mark set "$PROXY_FWMARK" tproxy ip to 127.0.0.1:"$tproxy_port" counter accept 2>/dev/null nft add rule inet fw4 openclash_mangle meta l4proto { udp } mark set "$PROXY_FWMARK" tproxy ip to 127.0.0.1:"$tproxy_port" counter accept 2>/dev/null
@ -1453,12 +1491,12 @@ if [ -n "$FW4" ]; then
nft add rule inet fw4 openclash_output tcp dport != @common_ports skuid != 65534 counter return 2>/dev/null nft add rule inet fw4 openclash_output tcp dport != @common_ports skuid != 65534 counter return 2>/dev/null
if [ "$en_mode" = "redir-host" ]; then if [ "$en_mode" = "redir-host" ]; then
nft 'add rule inet fw4 openclash_output ip daddr @wan_ac_black_ips counter return' 2>/dev/null nft 'add rule inet fw4 openclash_output ip daddr @wan_ac_black_ips counter return' 2>/dev/null
if [ "$china_ip_route" = "1" ]; then fi
nft 'add rule inet fw4 openclash_output skuid != 65534 ip daddr @china_ip_route ip daddr != @china_ip_route_pass counter return' 2>/dev/null if [ "$china_ip_route" = "1" ]; then
fi nft 'add rule inet fw4 openclash_output skuid != 65534 ip daddr @china_ip_route ip daddr != @china_ip_route_pass counter return' 2>/dev/null
fi fi
nft add rule inet fw4 openclash_output ip protocol tcp skuid != 65534 counter redirect to "$proxy_port" 2>/dev/null nft add rule inet fw4 openclash_output ip protocol tcp skuid != 65534 counter redirect to "$proxy_port" 2>/dev/null
nft 'add chain inet fw4 nat_output { type nat hook output priority -1; }' nft 'add chain inet fw4 nat_output { type nat hook output priority -1; }' 2>/dev/null
nft 'add rule inet fw4 nat_output ip protocol tcp counter jump openclash_output' 2>/dev/null nft 'add rule inet fw4 nat_output ip protocol tcp counter jump openclash_output' 2>/dev/null
fi fi
@ -1466,15 +1504,34 @@ if [ -n "$FW4" ]; then
#TUN模式 #TUN模式
#启动TUN #启动TUN
TUN_WAIT=0 TUN_WAIT=0
TUN_RESTART=1
ip link set utun up ip link set utun up
while ( [ -n "$(pidof clash)" ] && [ -z "$(ip route list |grep utun)" ] && [ "$TUN_WAIT" -le 3 ] ) LOG_OUT "Tip: Waiting for TUN Interface Start..."
while ( [ -n "$(pidof clash)" ] && [ -z "$(ip route list |grep utun)" ] && [ "$TUN_WAIT" -le 10 ] )
do do
ip link set utun up ip link set utun up
let TUN_WAIT++ let TUN_WAIT++
sleep 2 sleep 2
done done
if [ -n "$(pidof clash)" ] && [ -z "$(ip route list |grep utun)" ] && [ "$TUN_WAIT" -gt 10 ]; then
while ( [ -n "$(pidof clash)" ] && [ -z "$(ip route list |grep utun)" ] && [ "$TUN_RESTART" -le 3 ] )
do
LOG_OUT "Warning: TUN Interface Start Failed, Try to Restart Again..."
kill_clash
sleep 3
start_run_core
check_core_status
sleep 10
let TUN_RESTART++
done
if [ -n "$(pidof clash)" ] && [ -z "$(ip route list |grep utun)" ] && [ "$TUN_RESTART" -gt 3 ]; then
LOG_OUT "Warning: TUN Interface Start Failed, Please Check The Dependence or Try to Restart Again!"
start_fail
fi
fi
ip route replace default dev utun table "$PROXY_ROUTE_TABLE" ip route replace default dev utun table "$PROXY_ROUTE_TABLE"
ip rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE" ip rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE"
@ -1490,8 +1547,14 @@ if [ -n "$FW4" ]; then
if [ "$en_mode_tun" -eq 1 ]; then if [ "$en_mode_tun" -eq 1 ]; then
nft add rule inet fw4 openclash_mangle_output meta l4proto {tcp,udp} th dport { 0-65535 } ip daddr {198.18.0.0/16} mark set "$PROXY_FWMARK" 2>/dev/null nft add rule inet fw4 openclash_mangle_output meta l4proto {tcp,udp} th dport { 0-65535 } ip daddr {198.18.0.0/16} mark set "$PROXY_FWMARK" 2>/dev/null
nft 'add rule inet fw4 openclash_mangle_output meta l4proto {tcp,udp} th dport != @common_ports skuid != 65534 counter return' 2>/dev/null nft 'add rule inet fw4 openclash_mangle_output meta l4proto {tcp,udp} th dport != @common_ports skuid != 65534 counter return' 2>/dev/null
if [ "$china_ip_route" = "1" ]; then
nft 'add rule inet fw4 openclash_mangle_output skuid != 65534 ip daddr @china_ip_route ip daddr != @china_ip_route_pass counter return' 2>/dev/null
fi
nft add rule inet fw4 openclash_mangle_output tcp dport { 0-65535 } skuid != 65534 meta mark set "$PROXY_FWMARK" 2>/dev/null nft add rule inet fw4 openclash_mangle_output tcp dport { 0-65535 } skuid != 65534 meta mark set "$PROXY_FWMARK" 2>/dev/null
else else
if [ "$china_ip_route" = "1" ]; then
nft 'add rule inet fw4 openclash_mangle_output skuid != 65534 ip daddr @china_ip_route ip daddr != @china_ip_route_pass counter return' 2>/dev/null
fi
nft add rule inet fw4 openclash_mangle_output skuid != 65534 udp dport { 0-65535 } ip daddr {198.18.0.0/16} meta mark set "$PROXY_FWMARK" 2>/dev/null nft add rule inet fw4 openclash_mangle_output skuid != 65534 udp dport { 0-65535 } ip daddr {198.18.0.0/16} meta mark set "$PROXY_FWMARK" 2>/dev/null
fi fi
elif [ "$en_mode" = "redir-host" ] && [ "$en_mode_tun" -eq 1 ]; then elif [ "$en_mode" = "redir-host" ] && [ "$en_mode_tun" -eq 1 ]; then
@ -1520,9 +1583,9 @@ if [ -n "$FW4" ]; then
if [ "$en_mode" = "redir-host" ]; then if [ "$en_mode" = "redir-host" ]; then
nft 'add rule inet fw4 openclash_mangle meta l4proto {tcp,udp} th dport != @common_ports counter return' 2>/dev/null nft 'add rule inet fw4 openclash_mangle meta l4proto {tcp,udp} th dport != @common_ports counter return' 2>/dev/null
if [ "$china_ip_route" = "1" ]; then fi
nft 'add rule inet fw4 openclash_mangle ip daddr @china_ip_route ip daddr != @china_ip_route_pass counter return' 2>/dev/null if [ "$china_ip_route" = "1" ]; then
fi nft 'add rule inet fw4 openclash_mangle ip daddr @china_ip_route ip daddr != @china_ip_route_pass counter return' 2>/dev/null
fi fi
nft add rule inet fw4 openclash_mangle meta l4proto {tcp,udp} th dport { 0-65535 } mark set "$PROXY_FWMARK" 2>/dev/null nft add rule inet fw4 openclash_mangle meta l4proto {tcp,udp} th dport { 0-65535 } mark set "$PROXY_FWMARK" 2>/dev/null
@ -1563,6 +1626,12 @@ if [ -n "$FW4" ]; then
nft insert rule inet fw4 dstnat position 0 meta nfproto {ipv6} tcp dport 53 counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null nft insert rule inet fw4 dstnat position 0 meta nfproto {ipv6} tcp dport 53 counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft insert rule inet fw4 dstnat position 0 meta nfproto {ipv6} udp dport 53 counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null nft insert rule inet fw4 dstnat position 0 meta nfproto {ipv6} udp dport 53 counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
fi fi
if [ "$en_mode" = "fake-ip" ] && [ "$china_ip_route" = "1" ]; then
nft insert rule inet fw4 dstnat position 0 meta nfproto {ipv6} tcp dport 53 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft insert rule inet fw4 dstnat position 0 meta nfproto {ipv6} udp dport 53 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 nat_output position 0 meta nfproto {ipv6} tcp dport 53 meta skuid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 nat_output position 0 meta nfproto {ipv6} udp dport 53 meta skuid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
fi
if [ "$china_ip6_route" = "1" ] || [ "$disable_udp_quic" = "1" ]; then if [ "$china_ip6_route" = "1" ] || [ "$disable_udp_quic" = "1" ]; then
nft 'flush set inet fw4 china_ip6_route' nft 'flush set inet fw4 china_ip6_route'
@ -1582,11 +1651,28 @@ if [ -n "$FW4" ]; then
echo "}" >>/tmp/openclash_china_ip6_route_pass.list echo "}" >>/tmp/openclash_china_ip6_route_pass.list
echo 'add element inet fw4 china_ip6_route_pass $china_ip6_route_pass' >>/tmp/openclash_china_ip6_route_pass.list echo 'add element inet fw4 china_ip6_route_pass $china_ip6_route_pass' >>/tmp/openclash_china_ip6_route_pass.list
} }
awk '!/^$/&&!/^#/&&/^(\*?\.?)*[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})*$/{printf("'${settype}'=/%s/'${nftflag}'china_ip6_route_pass'" "'\n",$0)}' /etc/openclash/custom/openclash_custom_chnroute6_pass.list >>/tmp/dnsmasq.d/dnsmasq_openclash_chnroute6_pass.conf 2>/dev/null awk '!/^$/&&!/^#/&&/^(\*?\.?)*[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})*$/{printf("'${settype}'=/%s/'${nftflag}'china_ip_route_pass'" "'\n",$0)}' /etc/openclash/custom/openclash_custom_chnroute6_pass.list >>/tmp/dnsmasq.d/dnsmasq_openclash_chnroute6_pass.conf 2>/dev/null
nft 'flush set inet fw4 china_ip6_route_pass' 2>/dev/null nft 'flush set inet fw4 china_ip6_route_pass' 2>/dev/null
nft -f '/tmp/openclash_china_ip6_route_pass.list' 2>/dev/null nft -f '/tmp/openclash_china_ip6_route_pass.list' 2>/dev/null
rm -rf /tmp/openclash_china_ip6_route_pass.list 2>/dev/null rm -rf /tmp/openclash_china_ip6_route_pass.list 2>/dev/null
#Prevent domain repeat
for i in `grep -wf /tmp/dnsmasq.d/dnsmasq_openclash_chnroute6_pass.conf /tmp/dnsmasq.d/dnsmasq_openclash_chnroute_pass.conf`
do
if [ -n "$nftflag" ]; then
sed -i "s:${i}:${i},6#${nftflag}china_ip6_route_pass:g" /tmp/dnsmasq.d/dnsmasq_openclash_chnroute_pass.conf
else
sed -i "s:${i}:${i},china_ip6_route_pass:g" /tmp/dnsmasq.d/dnsmasq_openclash_chnroute_pass.conf
fi
sed -i 's:'$i':EXCLUSIVE:;/EXCLUSIVE/d' /tmp/dnsmasq.d/dnsmasq_openclash_chnroute6_pass.conf
done 2>/dev/null
if [ -n "$nftflag" ]; then
sed -i "s/\/${nftflag}/\/4#${nftflag}/g" /tmp/dnsmasq.d/dnsmasq_openclash_chnroute_pass.conf 2>/dev/null
sed -i "s/${nftflag}china_ip_route_pass/6#${nftflag}china_ip6_route_pass/g" /tmp/dnsmasq.d/dnsmasq_openclash_chnroute6_pass.conf 2>/dev/null
else
sed -i "s/china_ip_route_pass/china_ip6_route_pass/g" /tmp/dnsmasq.d/dnsmasq_openclash_chnroute6_pass.conf 2>/dev/null
fi
fi fi
#local #local
@ -1670,6 +1756,7 @@ if [ -n "$FW4" ]; then
#nft 'delete chain inet fw4 openclash_post_v6' 2>/dev/null #nft 'delete chain inet fw4 openclash_post_v6' 2>/dev/null
nft 'add chain inet fw4 openclash_post_v6' 2>/dev/null nft 'add chain inet fw4 openclash_post_v6' 2>/dev/null
nft 'flush chain inet fw4 openclash_post_v6' 2>/dev/null nft 'flush chain inet fw4 openclash_post_v6' 2>/dev/null
nft 'add rule inet fw4 openclash_post_v6 ip6 saddr @localnetwork6 meta nfproto {ipv6} sport @lan_ac_black_ports counter return' 2>/dev/null
nft add rule inet fw4 openclash_post_v6 meta nfproto {ipv6} meta mark "$PROXY_FWMARK" counter accept 2>/dev/null nft add rule inet fw4 openclash_post_v6 meta nfproto {ipv6} meta mark "$PROXY_FWMARK" counter accept 2>/dev/null
nft 'add rule inet fw4 openclash_post_v6 ip6 daddr @localnetwork6 counter return' 2>/dev/null nft 'add rule inet fw4 openclash_post_v6 ip6 daddr @localnetwork6 counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_post_v6 meta nfproto {ipv6} fib saddr type != { local } meta skuid != 65534 counter masquerade' 2>/dev/null nft 'add rule inet fw4 openclash_post_v6 meta nfproto {ipv6} fib saddr type != { local } meta skuid != 65534 counter masquerade' 2>/dev/null
@ -1712,15 +1799,33 @@ else
ipset -! flush china_ip_route_pass 2>/dev/null ipset -! flush china_ip_route_pass 2>/dev/null
ipset -! restore </tmp/openclash_china_ip_route_pass.list 2>/dev/null ipset -! restore </tmp/openclash_china_ip_route_pass.list 2>/dev/null
rm -rf /tmp/openclash_china_ip_route_pass.list 2>/dev/null rm -rf /tmp/openclash_china_ip_route_pass.list 2>/dev/null
if [ "$en_mode" = "fake-ip" ] && [ "$china_ip_route" = "1" ]; then
cp "$cndomain_path" /tmp/dnsmasq.d/dnsmasq_accelerated-domains.china.conf 2>/dev/null
cat "$cndomain_path" |awk -v dns="${custom_china_domain_dns_server}" -F '/' '!/^$/&&!/^#/{print $1"/"$2"/"dns}' >/tmp/dnsmasq.d/dnsmasq_accelerated-domains.china.conf 2>/dev/null
for i in `awk '!/^$/&&!/^#/&&!/(^([1-9]|1[0-9]|1[1-9]{2}|2[0-4][0-9]|25[0-5])\.)(([0-9]{1,2}|1[1-9]{2}|2[0-4][0-9]|25[0-5])\.){2}([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-5][0-9]|25[0-4])((\/[0-9][0-9])?)$/{printf("%s\n",$0)}' /etc/openclash/custom/openclash_custom_chnroute_pass.list`
do
sed -i "/server=\/${i}\//d" /tmp/dnsmasq.d/dnsmasq_accelerated-domains.china.conf 2>/dev/null
done 2>/dev/null
fi
fi fi
DNSPORT=$(uci -q get dhcp.@dnsmasq[0].port)
if [ -z "$DNSPORT" ]; then
DNSPORT=$(netstat -nlp |grep -E '127.0.0.1:.*dnsmasq' |awk -F '127.0.0.1:' '{print $2}' |awk '{print $1}' |head -1 || echo 53)
fi
if [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(iptables -t nat -nL PREROUTING --line-number |grep 'OpenClash DNS Hijack')"]; then if [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(iptables -t nat -nL PREROUTING --line-number |grep 'OpenClash DNS Hijack')"]; then
DNSPORT=$(uci -q get dhcp.@dnsmasq[0].port) iptables -t nat -I PREROUTING -p udp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
if [ -z "$DNSPORT" ]; then iptables -t nat -I PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
DNSPORT=$(netstat -nlp |grep -E '127.0.0.1:.*dnsmasq' |awk -F '127.0.0.1:' '{print $2}' |awk '{print $1}' |head -1 || echo "$dns_port") fi
fi if [ "$en_mode" = "fake-ip" ] && [ "$china_ip_route" = "1" ]; then
iptables -t nat -I PREROUTING -p udp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" LOG_OUT "Tip: Bypass the China IP May Cause the Dnsmasq Load For a Long Time After Restart in FAKE-IP Mode, Hijack the DNS to Core Untill the Dnsmasq Works Well..."
iptables -t nat -I PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" iptables -t nat -I PREROUTING -p udp --dport 53 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
iptables -t nat -I PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
iptables -t nat -I OUTPUT -p udp --dport 53 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
iptables -t nat -I OUTPUT -p tcp --dport 53 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
iptables -t nat -I OUTPUT -p udp --dport 5353 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
iptables -t nat -I OUTPUT -p tcp --dport 5353 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
fi fi
#lan_google_dns_ac #lan_google_dns_ac
@ -1824,10 +1929,11 @@ else
if [ "$bypass_gateway_compatible" -eq 1 ]; then if [ "$bypass_gateway_compatible" -eq 1 ]; then
iptables -t nat -N openclash_post iptables -t nat -N openclash_post
iptables -t nat -F openclash_post iptables -t nat -F openclash_post
iptables -t nat -A openclash_post -m mark --mark "$PROXY_FWMARK" -m comment --comment "OpenClash Bypass Gateway Compatible" -j ACCEPT iptables -t nat -A openclash_post -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN >/dev/null 2>&1
iptables -t nat -A openclash_post -m comment --comment "OpenClash Bypass Gateway Compatible" -m set --match-set localnetwork dst -j RETURN iptables -t nat -A openclash_post -m mark --mark "$PROXY_FWMARK" -j ACCEPT
iptables -t nat -A openclash_post -m addrtype ! --src-type LOCAL -m owner ! --uid-owner 65534 -m comment --comment "OpenClash Bypass Gateway Compatible" -j MASQUERADE iptables -t nat -A openclash_post -m set --match-set localnetwork dst -j RETURN
iptables -t nat -A POSTROUTING -j openclash_post iptables -t nat -A openclash_post -m addrtype ! --src-type LOCAL -m owner ! --uid-owner 65534 -j MASQUERADE
iptables -t nat -A POSTROUTING -m comment --comment "OpenClash Bypass Gateway Compatible" -j openclash_post
fi fi
#intranet allowed #intranet allowed
@ -1852,7 +1958,7 @@ else
if [ -z "$en_mode_tun" ] && [ "$en_mode" = "fake-ip" ]; then if [ -z "$en_mode_tun" ] && [ "$en_mode" = "fake-ip" ]; then
iptables -t nat -A openclash -p tcp -d 198.18.0.0/16 -j REDIRECT --to-ports "$proxy_port" iptables -t nat -A openclash -p tcp -d 198.18.0.0/16 -j REDIRECT --to-ports "$proxy_port"
fi fi
iptables -t nat -A openclash -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN iptables -t nat -A openclash -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN >/dev/null 2>&1
iptables -t nat -A openclash -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1 iptables -t nat -A openclash -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1
iptables -t nat -A openclash -m set --match-set lan_ac_black_ips src -j RETURN >/dev/null 2>&1 iptables -t nat -A openclash -m set --match-set lan_ac_black_ips src -j RETURN >/dev/null 2>&1
iptables -t nat -A openclash -m set --match-set lan_ac_black_macs src -j RETURN >/dev/null 2>&1 iptables -t nat -A openclash -m set --match-set lan_ac_black_macs src -j RETURN >/dev/null 2>&1
@ -1860,9 +1966,9 @@ else
iptables -t nat -A openclash -m set ! --match-set lan_ac_white_ips src -j RETURN >/dev/null 2>&1 iptables -t nat -A openclash -m set ! --match-set lan_ac_white_ips src -j RETURN >/dev/null 2>&1
if [ "$en_mode" = "redir-host" ]; then if [ "$en_mode" = "redir-host" ]; then
iptables -t nat -A openclash -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1 iptables -t nat -A openclash -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
if [ "$china_ip_route" = "1" ]; then fi
iptables -t nat -A openclash -m set --match-set china_ip_route dst -m set ! --match-set china_ip_route_pass dst -j RETURN >/dev/null 2>&1 if [ "$china_ip_route" = "1" ]; then
fi iptables -t nat -A openclash -m set --match-set china_ip_route dst -m set ! --match-set china_ip_route_pass dst -j RETURN >/dev/null 2>&1
fi fi
iptables -t nat -A openclash -p tcp -j REDIRECT --to-ports "$proxy_port" iptables -t nat -A openclash -p tcp -j REDIRECT --to-ports "$proxy_port"
iptables -t nat -A PREROUTING -p tcp -j openclash iptables -t nat -A PREROUTING -p tcp -j openclash
@ -1882,7 +1988,7 @@ else
if [ "$en_mode" = "fake-ip" ]; then if [ "$en_mode" = "fake-ip" ]; then
iptables -t mangle -A openclash -p udp -d 198.18.0.0/16 -j TPROXY --on-port "$tproxy_port" --tproxy-mark "$PROXY_FWMARK" iptables -t mangle -A openclash -p udp -d 198.18.0.0/16 -j TPROXY --on-port "$tproxy_port" --tproxy-mark "$PROXY_FWMARK"
fi fi
iptables -t mangle -A openclash -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN iptables -t mangle -A openclash -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1 iptables -t mangle -A openclash -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash -m set --match-set lan_ac_black_macs src -j RETURN >/dev/null 2>&1 iptables -t mangle -A openclash -m set --match-set lan_ac_black_macs src -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash -m set --match-set lan_ac_black_ips src -j RETURN >/dev/null 2>&1 iptables -t mangle -A openclash -m set --match-set lan_ac_black_ips src -j RETURN >/dev/null 2>&1
@ -1890,9 +1996,9 @@ else
iptables -t mangle -A openclash -m set ! --match-set lan_ac_white_macs src -j RETURN >/dev/null 2>&1 iptables -t mangle -A openclash -m set ! --match-set lan_ac_white_macs src -j RETURN >/dev/null 2>&1
if [ "$en_mode" = "redir-host" ]; then if [ "$en_mode" = "redir-host" ]; then
iptables -t mangle -A openclash -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1 iptables -t mangle -A openclash -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
if [ "$china_ip_route" = "1" ]; then fi
iptables -t mangle -A openclash -m set --match-set china_ip_route dst -m set ! --match-set china_ip_route_pass dst -j RETURN >/dev/null 2>&1 if [ "$china_ip_route" = "1" ]; then
fi iptables -t mangle -A openclash -m set --match-set china_ip_route dst -m set ! --match-set china_ip_route_pass dst -j RETURN >/dev/null 2>&1
fi fi
iptables -t mangle -A openclash -p udp -j TPROXY --on-port "$tproxy_port" --tproxy-mark "$PROXY_FWMARK" iptables -t mangle -A openclash -p udp -j TPROXY --on-port "$tproxy_port" --tproxy-mark "$PROXY_FWMARK"
@ -1926,13 +2032,13 @@ else
iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -p tcp -d 198.18.0.0/16 -j REDIRECT --to-ports "$proxy_port" iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -p tcp -d 198.18.0.0/16 -j REDIRECT --to-ports "$proxy_port"
fi fi
iptables -t nat -A openclash_output -m set --match-set localnetwork dst -j RETURN iptables -t nat -A openclash_output -m set --match-set localnetwork dst -j RETURN
iptables -t nat -A openclash_output -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN iptables -t nat -A openclash_output -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN >/dev/null 2>&1
iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1 iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
if [ "$en_mode" = "redir-host" ]; then if [ "$en_mode" = "redir-host" ]; then
iptables -t nat -A openclash_output -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1 iptables -t nat -A openclash_output -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1
if [ "$china_ip_route" = "1" ]; then fi
iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -m set --match-set china_ip_route dst -m set ! --match-set china_ip_route_pass dst -j RETURN >/dev/null 2>&1 if [ "$china_ip_route" = "1" ]; then
fi iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -m set --match-set china_ip_route dst -m set ! --match-set china_ip_route_pass dst -j RETURN >/dev/null 2>&1
fi fi
iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -p tcp -j REDIRECT --to-ports "$proxy_port" iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -p tcp -j REDIRECT --to-ports "$proxy_port"
else else
@ -1940,7 +2046,7 @@ else
iptables -t nat -N openclash_output iptables -t nat -N openclash_output
iptables -t nat -F openclash_output iptables -t nat -F openclash_output
iptables -t nat -A openclash_output -m set --match-set localnetwork dst -j RETURN iptables -t nat -A openclash_output -m set --match-set localnetwork dst -j RETURN
iptables -t nat -A openclash_output -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN iptables -t nat -A openclash_output -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN >/dev/null 2>&1
iptables -t nat -A openclash_output -p tcp -d 198.18.0.0/16 -j REDIRECT --to-ports "$proxy_port" iptables -t nat -A openclash_output -p tcp -d 198.18.0.0/16 -j REDIRECT --to-ports "$proxy_port"
fi fi
fi fi
@ -1951,15 +2057,34 @@ else
#TUN模式 #TUN模式
#启动TUN #启动TUN
TUN_WAIT=0 TUN_WAIT=0
TUN_RESTART=1
ip link set utun up ip link set utun up
while ( [ -n "$(pidof clash)" ] && [ -z "$(ip route list |grep utun)" ] && [ "$TUN_WAIT" -le 3 ] ) LOG_OUT "Tip: Waiting for TUN Interface Start..."
while ( [ -n "$(pidof clash)" ] && [ -z "$(ip route list |grep utun)" ] && [ "$TUN_WAIT" -le 10 ] )
do do
ip link set utun up ip link set utun up
let TUN_WAIT++ let TUN_WAIT++
sleep 2 sleep 2
done done
if [ -n "$(pidof clash)" ] && [ -z "$(ip route list |grep utun)" ] && [ "$TUN_WAIT" -gt 10 ]; then
while ( [ -n "$(pidof clash)" ] && [ -z "$(ip route list |grep utun)" ] && [ "$TUN_RESTART" -le 3 ] )
do
LOG_OUT "Warning: TUN Interface Start Failed, Try to Restart Again..."
kill_clash
sleep 3
start_run_core
check_core_status
sleep 10
let TUN_RESTART++
done
if [ -n "$(pidof clash)" ] && [ -z "$(ip route list |grep utun)" ] && [ "$TUN_RESTART" -gt 3 ]; then
LOG_OUT "Warning: TUN Interface Start Failed, Please Check The Dependence or Try to Restart Again!"
start_fail
fi
fi
ip route replace default dev utun table "$PROXY_ROUTE_TABLE" ip route replace default dev utun table "$PROXY_ROUTE_TABLE"
ip rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE" ip rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE"
@ -1971,16 +2096,22 @@ else
iptables -t mangle -N openclash_output iptables -t mangle -N openclash_output
iptables -t mangle -F openclash_output iptables -t mangle -F openclash_output
iptables -t mangle -A openclash_output -m set --match-set localnetwork dst -j RETURN iptables -t mangle -A openclash_output -m set --match-set localnetwork dst -j RETURN
iptables -t mangle -A openclash_output -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN iptables -t mangle -A openclash_output -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN >/dev/null 2>&1
if [ "$en_mode_tun" -eq 1 ]; then if [ "$en_mode_tun" -eq 1 ]; then
if [ -z "$_koolshare" ]; then if [ -z "$_koolshare" ]; then
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -d 198.18.0.0/16 -j MARK --set-mark "$PROXY_FWMARK" iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -d 198.18.0.0/16 -j MARK --set-mark "$PROXY_FWMARK"
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1 iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
if [ "$china_ip_route" = "1" ]; then
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -m set --match-set china_ip_route dst -m set ! --match-set china_ip_route_pass dst -j RETURN >/dev/null 2>&1
fi
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -p tcp -j MARK --set-mark "$PROXY_FWMARK" iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -p tcp -j MARK --set-mark "$PROXY_FWMARK"
else else
iptables -t mangle -A openclash_output -d 198.18.0.0/16 -j MARK --set-mark "$PROXY_FWMARK" iptables -t mangle -A openclash_output -d 198.18.0.0/16 -j MARK --set-mark "$PROXY_FWMARK"
fi fi
elif [ -z "$_koolshare" ]; then elif [ -z "$_koolshare" ]; then
if [ "$china_ip_route" = "1" ]; then
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -m set --match-set china_ip_route dst -m set ! --match-set china_ip_route_pass dst -j RETURN >/dev/null 2>&1
fi
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -p udp -d 198.18.0.0/16 -j MARK --set-mark "$PROXY_FWMARK" iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -p udp -d 198.18.0.0/16 -j MARK --set-mark "$PROXY_FWMARK"
fi fi
iptables -t mangle -A OUTPUT -j openclash_output iptables -t mangle -A OUTPUT -j openclash_output
@ -1988,7 +2119,7 @@ else
iptables -t mangle -N openclash_output iptables -t mangle -N openclash_output
iptables -t mangle -F openclash_output iptables -t mangle -F openclash_output
iptables -t mangle -A openclash_output -m set --match-set localnetwork dst -j RETURN iptables -t mangle -A openclash_output -m set --match-set localnetwork dst -j RETURN
iptables -t mangle -A openclash_output -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN iptables -t mangle -A openclash_output -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash_output -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1 iptables -t mangle -A openclash_output -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1 iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
if [ "$china_ip_route" = "1" ]; then if [ "$china_ip_route" = "1" ]; then
@ -2004,7 +2135,7 @@ else
iptables -t mangle -F openclash_dns_hijack iptables -t mangle -F openclash_dns_hijack
#其他流量 #其他流量
iptables -t mangle -A openclash -m set --match-set localnetwork dst -j RETURN >/dev/null 2>&1 iptables -t mangle -A openclash -m set --match-set localnetwork dst -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN iptables -t mangle -A openclash -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1 iptables -t mangle -A openclash -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash -m set --match-set lan_ac_black_ips src -j RETURN >/dev/null 2>&1 iptables -t mangle -A openclash -m set --match-set lan_ac_black_ips src -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash -m set --match-set lan_ac_black_macs src -j RETURN >/dev/null 2>&1 iptables -t mangle -A openclash -m set --match-set lan_ac_black_macs src -j RETURN >/dev/null 2>&1
@ -2012,9 +2143,9 @@ else
iptables -t mangle -A openclash -m set ! --match-set lan_ac_white_macs src -j RETURN >/dev/null 2>&1 iptables -t mangle -A openclash -m set ! --match-set lan_ac_white_macs src -j RETURN >/dev/null 2>&1
if [ "$en_mode" = "redir-host" ]; then if [ "$en_mode" = "redir-host" ]; then
iptables -t mangle -A openclash -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1 iptables -t mangle -A openclash -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
if [ "$china_ip_route" = "1" ]; then fi
iptables -t mangle -A openclash -m set --match-set china_ip_route dst -m set ! --match-set china_ip_route_pass dst -j RETURN >/dev/null 2>&1 if [ "$china_ip_route" = "1" ]; then
fi iptables -t mangle -A openclash -m set --match-set china_ip_route dst -m set ! --match-set china_ip_route_pass dst -j RETURN >/dev/null 2>&1
fi fi
iptables -t mangle -A openclash -j MARK --set-mark "$PROXY_FWMARK" iptables -t mangle -A openclash -j MARK --set-mark "$PROXY_FWMARK"
@ -2054,8 +2185,14 @@ else
#ipv6 #ipv6
if [ "$ipv6_enable" -eq 1 ] && [ -n "$(ip6tables -t mangle -L 2>&1 | grep -o 'Chain')" ]; then if [ "$ipv6_enable" -eq 1 ] && [ -n "$(ip6tables -t mangle -L 2>&1 | grep -o 'Chain')" ]; then
if [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(ip6tables -t nat -nL PREROUTING --line-number |grep 'DNS Hijack')"]; then if [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(ip6tables -t nat -nL PREROUTING --line-number |grep 'DNS Hijack')"]; then
ip6tables -t nat -I PREROUTING -p udp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" ip6tables -t nat -I PREROUTING -p udp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
ip6tables -t nat -I PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" ip6tables -t nat -I PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
fi
if [ "$en_mode" = "fake-ip" ] && [ "$china_ip_route" = "1" ]; then
ip6tables -t nat -I PREROUTING -p udp --dport 53 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
ip6tables -t nat -I PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
ip6tables -t nat -I OUTPUT -p udp --dport 53 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
ip6tables -t nat -I OUTPUT -p tcp --dport 53 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
fi fi
if [ "$china_ip6_route" = "1" ] || [ "$disable_udp_quic" = "1" ]; then if [ "$china_ip6_route" = "1" ] || [ "$disable_udp_quic" = "1" ]; then
@ -2064,10 +2201,18 @@ else
mkdir -p /tmp/dnsmasq.d 2>/dev/null mkdir -p /tmp/dnsmasq.d 2>/dev/null
echo "create china_ip6_route_pass hash:net family inet6 hashsize 1024 maxelem 1000000" >/tmp/openclash_china_ip6_route_pass.list echo "create china_ip6_route_pass hash:net family inet6 hashsize 1024 maxelem 1000000" >/tmp/openclash_china_ip6_route_pass.list
awk '!/^$/&&!/^#/&&!/^(\*?\.?)*[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})*$/{printf("add china_ip6_route_pass %s'" "'\n",$0)}' /etc/openclash/custom/openclash_custom_chnroute6_pass.list >>/tmp/openclash_china_ip6_route_pass.list 2>/dev/null awk '!/^$/&&!/^#/&&!/^(\*?\.?)*[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})*$/{printf("add china_ip6_route_pass %s'" "'\n",$0)}' /etc/openclash/custom/openclash_custom_chnroute6_pass.list >>/tmp/openclash_china_ip6_route_pass.list 2>/dev/null
awk '!/^$/&&!/^#/&&/^(\*?\.?)*[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})*$/{printf("ipset=/%s/china_ip6_route_pass'" "'\n",$0)}' /etc/openclash/custom/openclash_custom_chnroute6_pass.list >>/tmp/dnsmasq.d/dnsmasq_openclash_chnroute6_pass.conf 2>/dev/null awk '!/^$/&&!/^#/&&/^(\*?\.?)*[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})*$/{printf("ipset=/%s/china_ip_route_pass'" "'\n",$0)}' /etc/openclash/custom/openclash_custom_chnroute6_pass.list >>/tmp/dnsmasq.d/dnsmasq_openclash_chnroute6_pass.conf 2>/dev/null
ipset -! flush china_ip6_route_pass 2>/dev/null ipset -! flush china_ip6_route_pass 2>/dev/null
ipset -! restore </tmp/openclash_china_ip6_route_pass.list 2>/dev/null ipset -! restore </tmp/openclash_china_ip6_route_pass.list 2>/dev/null
rm -rf /tmp/openclash_china_ip6_route_pass.list 2>/dev/null rm -rf /tmp/openclash_china_ip6_route_pass.list 2>/dev/null
#Prevent domain repeat
for i in `grep -wf /tmp/dnsmasq.d/dnsmasq_openclash_chnroute6_pass.conf /tmp/dnsmasq.d/dnsmasq_openclash_chnroute_pass.conf`
do
sed -i "s:${i}:${i},china_ip6_route_pass:g" /tmp/dnsmasq.d/dnsmasq_openclash_chnroute_pass.conf
sed -i 's:'$i':EXCLUSIVE:;/EXCLUSIVE/d' /tmp/dnsmasq.d/dnsmasq_openclash_chnroute6_pass.conf
done 2>/dev/null
sed -i "s/china_ip_route_pass/china_ip6_route_pass/g" /tmp/dnsmasq.d/dnsmasq_openclash_chnroute6_pass.conf 2>/dev/null
fi fi
#local #local
@ -2117,7 +2262,7 @@ else
ip6tables -t mangle -F openclash ip6tables -t mangle -F openclash
ip6tables -t mangle -A openclash -m set --match-set localnetwork6 dst -j RETURN ip6tables -t mangle -A openclash -m set --match-set localnetwork6 dst -j RETURN
ip6tables -t mangle -A openclash -p udp --dport 53 -j RETURN >/dev/null 2>&1 ip6tables -t mangle -A openclash -p udp --dport 53 -j RETURN >/dev/null 2>&1
ip6tables -t mangle -A openclash -m set --match-set localnetwork6 src -m set --match-set lan_ac_black_ports src -j RETURN ip6tables -t mangle -A openclash -m set --match-set localnetwork6 src -m set --match-set lan_ac_black_ports src -j RETURN >/dev/null 2>&1
ip6tables -t mangle -A openclash -m set --match-set wan_ac_black_ipv6s dst -j RETURN >/dev/null 2>&1 ip6tables -t mangle -A openclash -m set --match-set wan_ac_black_ipv6s dst -j RETURN >/dev/null 2>&1
if [ "$en_mode" == "redir-host" ]; then if [ "$en_mode" == "redir-host" ]; then
ip6tables -t mangle -A openclash -m set --match-set lan_ac_black_macs src -j RETURN >/dev/null 2>&1 ip6tables -t mangle -A openclash -m set --match-set lan_ac_black_macs src -j RETURN >/dev/null 2>&1
@ -2136,7 +2281,7 @@ else
ip6tables -t mangle -N openclash_output ip6tables -t mangle -N openclash_output
ip6tables -t mangle -F openclash_output ip6tables -t mangle -F openclash_output
ip6tables -t mangle -A openclash_output -m set --match-set localnetwork6 dst -j RETURN ip6tables -t mangle -A openclash_output -m set --match-set localnetwork6 dst -j RETURN
ip6tables -t mangle -A openclash_output -m set --match-set localnetwork6 src -m set --match-set lan_ac_black_ports src -j RETURN ip6tables -t mangle -A openclash_output -m set --match-set localnetwork6 src -m set --match-set lan_ac_black_ports src -j RETURN >/dev/null 2>&1
ip6tables -t mangle -A openclash_output -m set --match-set wan_ac_black_ipv6s dst -j RETURN >/dev/null 2>&1 ip6tables -t mangle -A openclash_output -m set --match-set wan_ac_black_ipv6s dst -j RETURN >/dev/null 2>&1
ip6tables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1 ip6tables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
if [ "$china_ip6_route" = "1" ]; then if [ "$china_ip6_route" = "1" ]; then
@ -2160,10 +2305,11 @@ else
if [ "$bypass_gateway_compatible" -eq 1 ]; then if [ "$bypass_gateway_compatible" -eq 1 ]; then
ip6tables -t nat -N openclash_post ip6tables -t nat -N openclash_post
ip6tables -t nat -F openclash_post ip6tables -t nat -F openclash_post
ip6tables -t nat -A openclash_post -m mark --mark "$PROXY_FWMARK" -m comment --comment "OpenClash Bypass Gateway Compatible" -j ACCEPT ip6tables -t nat -A openclash_post -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN >/dev/null 2>&1
ip6tables -t nat -A openclash_post -m comment --comment "OpenClash Bypass Gateway Compatible" -m set --match-set localnetwork6 dst -j RETURN ip6tables -t nat -A openclash_post -m mark --mark "$PROXY_FWMARK" -j ACCEPT
ip6tables -t nat -A openclash_post -m addrtype ! --src-type LOCAL -m owner ! --uid-owner 65534 -m comment --comment "OpenClash Bypass Gateway Compatible" -j MASQUERADE ip6tables -t nat -A openclash_post -m set --match-set localnetwork6 dst -j RETURN
ip6tables -t nat -A POSTROUTING -j openclash_post ip6tables -t nat -A openclash_post -m addrtype ! --src-type LOCAL -m owner ! --uid-owner 65534 -j MASQUERADE
ip6tables -t nat -A POSTROUTING -m comment --comment "OpenClash Bypass Gateway Compatible" -j openclash_post
fi fi
#google_dns_block #google_dns_block
@ -2207,6 +2353,7 @@ revert_firewall()
rm -rf /var/etc/openclash.include >/dev/null 2>&1 rm -rf /var/etc/openclash.include >/dev/null 2>&1
rm -rf /tmp/dnsmasq.d/dnsmasq_openclash_chnroute_pass.conf >/dev/null 2>&1 rm -rf /tmp/dnsmasq.d/dnsmasq_openclash_chnroute_pass.conf >/dev/null 2>&1
rm -rf /tmp/dnsmasq.d/dnsmasq_openclash_chnroute6_pass.conf >/dev/null 2>&1 rm -rf /tmp/dnsmasq.d/dnsmasq_openclash_chnroute6_pass.conf >/dev/null 2>&1
rm -rf /tmp/dnsmasq.d/dnsmasq_accelerated-domains.china.conf >/dev/null 2>&1
ip rule del fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE" >/dev/null 2>&1 ip rule del fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE" >/dev/null 2>&1
ip route del local 0.0.0.0/0 dev lo table "$PROXY_ROUTE_TABLE" >/dev/null 2>&1 ip route del local 0.0.0.0/0 dev lo table "$PROXY_ROUTE_TABLE" >/dev/null 2>&1
@ -2221,6 +2368,11 @@ revert_firewall()
ip link set dev utun down >/dev/null 2>&1 ip link set dev utun down >/dev/null 2>&1
ip tuntap del utun mode tun >/dev/null 2>&1 ip tuntap del utun mode tun >/dev/null 2>&1
ip -6 rule del oif utun table 2022 >/dev/null 2>&1
ip -6 route del default dev utun table 2022 >/dev/null 2>&1
ip -6 link set dev utun down >/dev/null 2>&1
ip -6 tuntap del utun mode tun >/dev/null 2>&1
if [ -n "$FW4" ]; then if [ -n "$FW4" ]; then
for nft in "input" "forward" "dstnat" "srcnat" "nat_output" "mangle_prerouting" "mangle_output"; do for nft in "input" "forward" "dstnat" "srcnat" "nat_output" "mangle_prerouting" "mangle_output"; do
local handles=$(nft -a list chain inet fw4 ${nft} |grep -E "openclash|OpenClash" |awk -F '# handle ' '{print$2}') local handles=$(nft -a list chain inet fw4 ${nft} |grep -E "openclash|OpenClash" |awk -F '# handle ' '{print$2}')
@ -2284,6 +2436,7 @@ revert_firewall()
ipset destroy lan_block_google_dns_ips >/dev/null 2>&1 ipset destroy lan_block_google_dns_ips >/dev/null 2>&1
ipset destroy lan_block_google_dns_macs >/dev/null 2>&1 ipset destroy lan_block_google_dns_macs >/dev/null 2>&1
ipset destroy openclash_google_dns_ips >/dev/null 2>&1 ipset destroy openclash_google_dns_ips >/dev/null 2>&1
ipset destroy lan_ac_black_ports >/dev/null 2>&1
fi fi
} }
@ -2335,6 +2488,8 @@ get_config()
enable_geoip_dat=$(uci -q get openclash.config.enable_geoip_dat || echo 0) enable_geoip_dat=$(uci -q get openclash.config.enable_geoip_dat || echo 0)
enable_tcp_concurrent=$(uci -q get openclash.config.enable_tcp_concurrent || echo 0) enable_tcp_concurrent=$(uci -q get openclash.config.enable_tcp_concurrent || echo 0)
append_default_dns=$(uci -q get openclash.config.append_default_dns || echo 1) append_default_dns=$(uci -q get openclash.config.append_default_dns || echo 1)
enable_meta_sniffer_pure_ip=$(uci -q get openclash.config.enable_meta_sniffer_pure_ip || echo 1)
custom_china_domain_dns_server=$(uci -q get openclash.config.custom_china_domain_dns_server || echo 114.114.114.114)
_koolshare=$(cat /usr/lib/os-release 2>/dev/null |grep OPENWRT_RELEASE 2>/dev/null |grep -i koolshare 2>/dev/null) _koolshare=$(cat /usr/lib/os-release 2>/dev/null |grep OPENWRT_RELEASE 2>/dev/null |grep -i koolshare 2>/dev/null)
[ -z "$dns_port" ] && dns_port=7874 && uci -q set openclash.config.dns_port=7874 [ -z "$dns_port" ] && dns_port=7874 && uci -q set openclash.config.dns_port=7874
uci -q set openclash.config.restricted_mode=0 && uci -q commit openclash uci -q set openclash.config.restricted_mode=0 && uci -q commit openclash
@ -2363,7 +2518,7 @@ start()
if ! $quick_start; then if ! $quick_start; then
LOG_OUT "Step 3: Modify The Config File..." LOG_OUT "Step 3: Modify The Config File..."
config_check config_check
/usr/share/openclash/yml_change.sh 2>/dev/null "$en_mode" "$da_password" "$cn_port" "$proxy_port" "$TMP_CONFIG_FILE" "$ipv6_enable" "$http_port" "$socks_port" "$log_level" "$proxy_mode" "$en_mode_tun" "$stack_type" "$dns_port" "$mixed_port" "$tproxy_port" "$ipv6_dns" "$store_fakeip" "$stream_domains_prefetch" "$dns_remote" "$enable_meta_core" "$enable_meta_sniffer" "$enable_geoip_dat" "$geodata_loader" "$enable_meta_sniffer_custom" "$interface_name" "$enable_tcp_concurrent" "$core_type" "$append_default_dns" /usr/share/openclash/yml_change.sh 2>/dev/null "$en_mode" "$da_password" "$cn_port" "$proxy_port" "$TMP_CONFIG_FILE" "$ipv6_enable" "$http_port" "$socks_port" "$log_level" "$proxy_mode" "$en_mode_tun" "$stack_type" "$dns_port" "$mixed_port" "$tproxy_port" "$ipv6_dns" "$store_fakeip" "$stream_domains_prefetch" "$dns_remote" "$enable_meta_core" "$enable_meta_sniffer" "$enable_geoip_dat" "$geodata_loader" "$enable_meta_sniffer_custom" "$interface_name" "$enable_tcp_concurrent" "$core_type" "$append_default_dns" "$enable_meta_sniffer_pure_ip"
/usr/share/openclash/yml_rules_change.sh 2>/dev/null "$rule_source" "$enable_custom_clash_rules" "$TMP_CONFIG_FILE" "$enable_rule_proxy" "$CONFIG_NAME" "$router_self_proxy" "$lan_ip" "$proxy_port" "$tproxy_port" "$enable_meta_core" /usr/share/openclash/yml_rules_change.sh 2>/dev/null "$rule_source" "$enable_custom_clash_rules" "$TMP_CONFIG_FILE" "$enable_rule_proxy" "$CONFIG_NAME" "$router_self_proxy" "$lan_ip" "$proxy_port" "$tproxy_port" "$enable_meta_core"
/usr/share/openclash/openclash_server_fake_filter.sh >/dev/null 2>&1 /usr/share/openclash/openclash_server_fake_filter.sh >/dev/null 2>&1
/usr/share/openclash/openclash_custom_domain_dns.sh >/dev/null 2>&1 /usr/share/openclash/openclash_custom_domain_dns.sh >/dev/null 2>&1
@ -2464,6 +2619,7 @@ stop()
rm -rf /tmp/dnsmasq.d/dnsmasq_openclash_custom_domain.conf >/dev/null 2>&1 rm -rf /tmp/dnsmasq.d/dnsmasq_openclash_custom_domain.conf >/dev/null 2>&1
rm -rf /tmp/dnsmasq.d/dnsmasq_openclash_chnroute_pass.conf >/dev/null 2>&1 rm -rf /tmp/dnsmasq.d/dnsmasq_openclash_chnroute_pass.conf >/dev/null 2>&1
rm -rf /tmp/dnsmasq.d/dnsmasq_openclash_chnroute6_pass.conf >/dev/null 2>&1 rm -rf /tmp/dnsmasq.d/dnsmasq_openclash_chnroute6_pass.conf >/dev/null 2>&1
rm -rf /tmp/dnsmasq.d/dnsmasq_accelerated-domains.china.conf >/dev/null 2>&1
rm -rf /tmp/openclash_last_version >/dev/null 2>&1 rm -rf /tmp/openclash_last_version >/dev/null 2>&1
rm -rf /tmp/openclash_config.tmp >/dev/null 2>&1 rm -rf /tmp/openclash_config.tmp >/dev/null 2>&1
rm -rf /tmp/openclash.change >/dev/null 2>&1 rm -rf /tmp/openclash.change >/dev/null 2>&1

File diff suppressed because it is too large Load Diff

View File

@ -128,7 +128,6 @@ ff.dorado.sdo.com
shark007.net shark007.net
#Mijia #Mijia
Mijia Cloud Mijia Cloud
+.dns.google
#招商银行 #招商银行
+.cmbchina.com +.cmbchina.com
+.cmbimg.com +.cmbimg.com

View File

@ -1,4 +1,4 @@
payload: payload:
# > ABC # > ABC
- DOMAIN-SUFFIX,edgedatg.com - DOMAIN-SUFFIX,edgedatg.com
- DOMAIN-SUFFIX,go.com - DOMAIN-SUFFIX,go.com

View File

@ -1,4 +1,4 @@
payload: payload:
# > AbemaTV # > AbemaTV
# - USER-AGENT,AbemaTV* # - USER-AGENT,AbemaTV*
- PROCESS-NAME,tv.abema - PROCESS-NAME,tv.abema

View File

@ -1,4 +1,4 @@
payload: payload:
# > Amazon Prime Video # > Amazon Prime Video
# - USER-AGENT,InstantVideo.US* # - USER-AGENT,InstantVideo.US*
# - USER-AGENT,Prime%20Video* # - USER-AGENT,Prime%20Video*
@ -7,28 +7,39 @@ payload:
- DOMAIN-SUFFIX,aiv-cdn.net - DOMAIN-SUFFIX,aiv-cdn.net
- DOMAIN-SUFFIX,aiv-delivery.net - DOMAIN-SUFFIX,aiv-delivery.net
- DOMAIN-SUFFIX,amazonvideo.com - DOMAIN-SUFFIX,amazonprimevideos.com
- DOMAIN-SUFFIX,amazonvideo.cc - DOMAIN-SUFFIX,amazonvideo.cc
- DOMAIN-SUFFIX,amazonvideo.com
- DOMAIN-SUFFIX,amazonvideodirect.cc
- DOMAIN-SUFFIX,atv-ext.amazon.com
- DOMAIN-SUFFIX,atv-ext-eu.amazon.com
- DOMAIN-SUFFIX,atv-ext-fe.amazon.com
- DOMAIN-SUFFIX,atv-ps.amazon.com
- DOMAIN-SUFFIX,atv-ps-eu.amazon.co.uk
- DOMAIN-SUFFIX,atv-ps-eu.amazon.com
- DOMAIN-SUFFIX,atv-ps-fe.amazon.co.jp
- DOMAIN-SUFFIX,atv-ps-fe.amazon.com
- DOMAIN-SUFFIX,fls-na.amazon.com
- DOMAIN-SUFFIX,media-amazon.com - DOMAIN-SUFFIX,media-amazon.com
- DOMAIN-SUFFIX,primevideo.cc
- DOMAIN-SUFFIX,primevideo.com - DOMAIN-SUFFIX,primevideo.com
- DOMAIN-SUFFIX,prime-video.com - DOMAIN-SUFFIX,prime-video.com
- DOMAIN-SUFFIX,primevideo.cc
- DOMAIN-SUFFIX,primevideo.info - DOMAIN-SUFFIX,primevideo.info
- DOMAIN-SUFFIX,primevideo.org - DOMAIN-SUFFIX,primevideo.org
- DOMAIN-SUFFIX,primevideo.tv - DOMAIN-SUFFIX,primevideo.tv
- DOMAIN-SUFFIX,amazonvideodirect.cc - DOMAIN-SUFFIX,pv-cdn.net
- DOMAIN-SUFFIX,amazonprimevideos.com - DOMAIN-SUFFIX,video.a2z.com
- DOMAIN,atv-ps.amazon.com
- DOMAIN,fls-na.amazon.com
- DOMAIN,avodmp4s3ww-a.akamaihd.net - DOMAIN,avodmp4s3ww-a.akamaihd.net
- DOMAIN,d1v5ir2lpwr8os.cloudfront.net - DOMAIN,d1v5ir2lpwr8os.cloudfront.net
- DOMAIN,d1y002tclu9djj.cloudfront.net
- DOMAIN,d22qjgkvxw22r6.cloudfront.net - DOMAIN,d22qjgkvxw22r6.cloudfront.net
- DOMAIN,d25xi40x97liuc.cloudfront.net - DOMAIN,d25xi40x97liuc.cloudfront.net
- DOMAIN,dmqdd6hw24ucf.cloudfront.net - DOMAIN,dmqdd6hw24ucf.cloudfront.net
- DOMAIN,d27xxe7juh1us6.cloudfront.net - DOMAIN,d27xxe7juh1us6.cloudfront.net
- DOMAIN,dualstack.pefs-alb-266603904.eu-west-1.elb.amazonaws.com
# // 美区网页版需二选一走代理,如 URL-REGEX 则需 MITM www.amazon.com # // 美区网页版需二选一走代理,如 URL-REGEX 则需 MITM www.amazon.com
# // DOMAIN,www.amazon.com # // DOMAIN,www.amazon.com
# URL-REGEX,^https?:\/\/www\.amazon\.com\/(Amazon-Video|gp\/video)\/ # URL-REGEX,^https?:\/\/www\.amazon\.com\/(Amazon-Video|gp\/video)\/

View File

@ -26,6 +26,7 @@ payload:
- IP-CIDR,205.180.175.0/24,no-resolve - IP-CIDR,205.180.175.0/24,no-resolve
# > Apple News # > Apple News
- DOMAIN-SUFFIX,apple.comscoreresearch.com
- DOMAIN-SUFFIX,apple.news - DOMAIN-SUFFIX,apple.news
# > Apple Maps # > Apple Maps

View File

@ -0,0 +1,16 @@
payload:
# > Apple Music
# - USER-AGENT,Music*
- PROCESS-NAME,music
- DOMAIN-SUFFIX,applemusic.com
- DOMAIN-SUFFIX,blobstore.apple.com
- DOMAIN-SUFFIX,music.apple.com
- DOMAIN,aod.itunes.apple.com
- DOMAIN,aod-ssl.itunes.apple.com
- DOMAIN,audio.itunes.apple.com
- DOMAIN,audio-ssl.itunes.apple.com
- DOMAIN,mvod.itunes.apple.com
- DOMAIN,streamingaudio.itunes.apple.com
# iCloud Music Library
- DOMAIN-SUFFIX,blobstore.apple.com

View File

@ -1,4 +1,4 @@
payload: payload:
# > Apple News and Apple Map TOMTOM Version # > Apple News and Apple Map TOMTOM Version
# - USER-AGENT,AppleNews* # - USER-AGENT,AppleNews*
# - USER-AGENT,com.apple.news* # - USER-AGENT,com.apple.news*

View File

@ -1,5 +1,5 @@
payload: payload:
# > Apple TV # > Apple TV
- DOMAIN,np-edge.itunes.apple.com - DOMAIN,np-edge.itunes.apple.com
- DOMAIN,play-edge.itunes.apple.com - DOMAIN,play-edge.itunes.apple.com
- DOMAIN-SUFFIX,tv.apple.com - DOMAIN-SUFFIX,tv.apple.com

View File

@ -1,4 +1,4 @@
payload: payload:
# > BBC iPlayer # > BBC iPlayer
- PROCESS-NAME,bbc.iplayer.android - PROCESS-NAME,bbc.iplayer.android
- DOMAIN-KEYWORD,bbcfmt - DOMAIN-KEYWORD,bbcfmt

View File

@ -1,8 +1,8 @@
payload: payload:
# > Bahamut # > Bahamut
# - USER-AGENT,Anime* # - USER-AGENT,Anime*
- PROCESS-NAME,tw.com.gamer.android.animad - PROCESS-NAME,tw.com.gamer.android.animad
- DOMAIN-SUFFIX,bahamut.com.tw - DOMAIN-SUFFIX,bahamut.com.tw
- DOMAIN-SUFFIX,gamer.com.tw - DOMAIN-SUFFIX,gamer.com.tw
- DOMAIN,gamer-cds.cdn.hinet.net - DOMAIN,gamer-cds.cdn.hinet.net
- DOMAIN,gamer2-cds.cdn.hinet.net - DOMAIN,gamer2-cds.cdn.hinet.net

View File

@ -1,4 +1,4 @@
payload: payload:
# > Bilibili # > Bilibili
# - USER-AGENT,bili* # - USER-AGENT,bili*
- DOMAIN-SUFFIX,acg.tv - DOMAIN-SUFFIX,acg.tv
@ -13,4 +13,4 @@ payload:
- DOMAIN,upos-hz-mirrorakam.akamaized.net - DOMAIN,upos-hz-mirrorakam.akamaized.net
# Hong Kong, Macau, Taiwan # Hong Kong, Macau, Taiwan
# - USER-AGENT,bili-inter* # - USER-AGENT,bili-inter*
- DOMAIN,apiintl.biliapi.net - DOMAIN,apiintl.biliapi.net

View File

@ -14,16 +14,12 @@ payload:
- DOMAIN-SUFFIX,coinbase.com - DOMAIN-SUFFIX,coinbase.com
- DOMAIN-SUFFIX,coincheck.com - DOMAIN-SUFFIX,coincheck.com
- DOMAIN-SUFFIX,coinone.co.kr - DOMAIN-SUFFIX,coinone.co.kr
- DOMAIN-SUFFIX,ftx.com
- DOMAIN-SUFFIX,gate.io
- DOMAIN-SUFFIX,gemini.com - DOMAIN-SUFFIX,gemini.com
- DOMAIN-SUFFIX,korbit.co.kr - DOMAIN-SUFFIX,korbit.co.kr
- DOMAIN-SUFFIX,kraken.com - DOMAIN-SUFFIX,kraken.com
- DOMAIN-SUFFIX,kucoin.com - DOMAIN-SUFFIX,kucoin.com
- DOMAIN-SUFFIX,liquid.com - DOMAIN-SUFFIX,liquid.com
- DOMAIN-SUFFIX,poloniex.com - DOMAIN-SUFFIX,poloniex.com
- DOMAIN-SUFFIX,sushi.com
- DOMAIN-SUFFIX,uniswap.org
- DOMAIN-SUFFIX,bitbank.cc - DOMAIN-SUFFIX,bitbank.cc
- DOMAIN-SUFFIX,bitcoin.org - DOMAIN-SUFFIX,bitcoin.org
- DOMAIN-SUFFIX,bitquick.co - DOMAIN-SUFFIX,bitquick.co
@ -31,6 +27,16 @@ payload:
- DOMAIN-SUFFIX,cex.io - DOMAIN-SUFFIX,cex.io
- DOMAIN-SUFFIX,dogecoin.com - DOMAIN-SUFFIX,dogecoin.com
- DOMAIN-SUFFIX,paxful.com - DOMAIN-SUFFIX,paxful.com
- DOMAIN-SUFFIX,tether.to
- DOMAIN-SUFFIX,dydx.exchange
- DOMAIN-SUFFIX,solana.com
- DOMAIN-SUFFIX,avax.network
- DOMAIN-SUFFIX,optimism.io
- DOMAIN-SUFFIX,arbitrum.io
- DOMAIN-SUFFIX,poly.network
- DOMAIN-SUFFIX,zkscan.io
- DOMAIN-SUFFIX,zksync.io
- DOMAIN-SUFFIX,boba.network
# > Binance # > Binance
- DOMAIN-SUFFIX,binance.cc - DOMAIN-SUFFIX,binance.cc
@ -65,7 +71,11 @@ payload:
- DOMAIN-SUFFIX,binancezh.pro - DOMAIN-SUFFIX,binancezh.pro
- DOMAIN-SUFFIX,binancezh.sh - DOMAIN-SUFFIX,binancezh.sh
- DOMAIN-SUFFIX,binancezh.top - DOMAIN-SUFFIX,binancezh.top
- DOMAIN-SUFFIX,bnappzh.mobi
- DOMAIN-SUFFIX,bsc.getblock.io
- DOMAIN-SUFFIX,bscscan.com
- PROCESS-NAME,Binance.exe
- DOMAIN-KEYWORD,binance
# > Huobi # > Huobi
- DOMAIN-SUFFIX,hbabit.com - DOMAIN-SUFFIX,hbabit.com
@ -82,34 +92,58 @@ payload:
- DOMAIN-SUFFIX,hbfile.net - DOMAIN-SUFFIX,hbfile.net
- DOMAIN-SUFFIX,huobi.br.com - DOMAIN-SUFFIX,huobi.br.com
- DOMAIN-SUFFIX,bitderiv.com - DOMAIN-SUFFIX,bitderiv.com
- DOMAIN-SUFFIX,hecochain.com
- DOMAIN-SUFFIX,huobi.ws
- DOMAIN-SUFFIX,huobi.ug
- DOMAIN-SUFFIX,huobi.co.ma
- DOMAIN-SUFFIX,huobi.br.com
- PROCESS-NAME,Huobi.exe
- DOMAIN-KEYWORD,huobi
# > OKX # > OKX
- DOMAIN-SUFFIX,okex.com - DOMAIN-SUFFIX,okex.com
- DOMAIN-SUFFIX,okx.com - DOMAIN-SUFFIX,okx.com
- PROCESS-NAME,OKX.exe
- DOMAIN-KEYWORD,okx
# > asproex # > asproex
- DOMAIN-SUFFIX,asproex.com - DOMAIN-SUFFIX,asproex.com
- DOMAIN-SUFFIX,asproexapi.com - DOMAIN-SUFFIX,asproexapi.com
# > bitflyer # > bitflyer
- DOMAIN-SUFFIX,bitflyer.com - DOMAIN-SUFFIX,bitflyer.com
- DOMAIN-SUFFIX,bitflyer.jp - DOMAIN-SUFFIX,bitflyer.jp
# > bitsquare # > bitsquare
- DOMAIN-SUFFIX,bisq.io - DOMAIN-SUFFIX,bisq.io
- DOMAIN-SUFFIX,bisq.network - DOMAIN-SUFFIX,bisq.network
- DOMAIN-SUFFIX,bitsquare.io - DOMAIN-SUFFIX,bitsquare.io
# > coinone # > coinone
- DOMAIN-SUFFIX,coinone.co.kr - DOMAIN-SUFFIX,coinone.co.kr
- DOMAIN-SUFFIX,coinonecore.com - DOMAIN-SUFFIX,coinonecore.com
- DOMAIN-SUFFIX,coinonecorp.com - DOMAIN-SUFFIX,coinonecorp.com
# > ethereum # > ethereum
- DOMAIN-SUFFIX,devcon.org - DOMAIN-SUFFIX,devcon.org
- DOMAIN-SUFFIX,ethereum.foundation - DOMAIN-SUFFIX,ethereum.foundation
- DOMAIN-SUFFIX,ethereum.org - DOMAIN-SUFFIX,ethereum.org
- DOMAIN-SUFFIX,etherscan.io
- DOMAIN-SUFFIX,nansen.ai
- DOMAIN-SUFFIX,ethgasstation.info
- DOMAIN-SUFFIX,watchtheburn.com
- DOMAIN-SUFFIX,flashbots.net
- DOMAIN-SUFFIX,cryptofees.info
- DOMAIN-SUFFIX,etherscan.io
- DOMAIN-SUFFIX,ethereum-magicians.org
- DOMAIN-SUFFIX,vitalik.ca
- DOMAIN-SUFFIX,ethfans.org
- DOMAIN-SUFFIX,ethereum.cn
- DOMAIN-SUFFIX,ethereum.stackexchange.com
- DOMAIN-SUFFIX,etherscan.com
- DOMAIN-SUFFIX,parity.io
- DOMAIN-SUFFIX,ethernodes.org
# > localbitcoins # > localbitcoins
- DOMAIN-SUFFIX,localbitcoins.com - DOMAIN-SUFFIX,localbitcoins.com
- DOMAIN-SUFFIX,localbitcoinschain.com - DOMAIN-SUFFIX,localbitcoinschain.com
@ -119,10 +153,148 @@ payload:
- DOMAIN-SUFFIX,zb.com - DOMAIN-SUFFIX,zb.com
- DOMAIN-SUFFIX,zb.io - DOMAIN-SUFFIX,zb.io
- DOMAIN-SUFFIX,zb.live - DOMAIN-SUFFIX,zb.live
# Analysis # > Analysis
- DOMAIN-SUFFIX,aicoin.com - DOMAIN-SUFFIX,aicoin.com
- DOMAIN-SUFFIX,aimoon.com - DOMAIN-SUFFIX,aimoon.com
- DOMAIN-SUFFIX,coingecko.com - DOMAIN-SUFFIX,coingecko.com
- DOMAIN-SUFFIX,coinmarketcap.com - DOMAIN-SUFFIX,coinmarketcap.com
- DOMAIN-SUFFIX,glassnode.com
- DOMAIN-SUFFIX,coinmetrics.io
- DOMAIN-SUFFIX,tokenview.com
- DOMAIN-SUFFIX,oklink.com
- DOMAIN-SUFFIX,blockchair.com
- DOMAIN-SUFFIX,intotheblock.com
- DOMAIN-SUFFIX,bytetree.com
- DOMAIN-SUFFIX,coin.dance
- DOMAIN-SUFFIX,defieye.io
- DOMAIN-SUFFIX,duneanalytics.com
- DOMAIN-SUFFIX,tokenterminal.com
- DOMAIN-SUFFIX,dapp.review
- DOMAIN-SUFFIX,dappradar.com
- DOMAIN-SUFFIX,stateofthedapps.com
- DOMAIN-SUFFIX,thegraph.com
- DOMAIN-SUFFIX,debank.com
- DOMAIN-SUFFIX,vfat.tools
- DOMAIN-SUFFIX,loanscan.io
- DOMAIN-SUFFIX,defirate.com
- DOMAIN-SUFFIX,defipulse.com
- DOMAIN-SUFFIX,apy999.com
- DOMAIN-SUFFIX,defieye.io
- DOMAIN-SUFFIX,dextools.io
- DOMAIN-SUFFIX,tradingview.com
- DOMAIN-SUFFIX,dcabtc.com
- DOMAIN-SUFFIX,chainalysis.com
- DOMAIN-SUFFIX,cryptoquant.com
- DOMAIN-SUFFIX,viewbase.com
- DOMAIN-SUFFIX,bitcoinity.org
- DOMAIN-SUFFIX,cryptocompare.com
- DOMAIN-SUFFIX,coincodex.com
- DOMAIN-SUFFIX,cointrendz.com
- DOMAIN-SUFFIX,coincheckup.com
- DOMAIN-SUFFIX,thetie.io
- DOMAIN-SUFFIX,cryptorank.io
- DOMAIN-SUFFIX,tradeblock.com
- DOMAIN-SUFFIX,nyctale.io
- DOMAIN-SUFFIX,dovemetrics.com
- DOMAIN-SUFFIX,cryptorank.io
- DOMAIN-SUFFIX,icodrops.com
- DOMAIN-SUFFIX,chainbroker.io
- DOMAIN-SUFFIX,crunchbase.com
- DOMAIN-SUFFIX,defillama.com
- DOMAIN-SUFFIX,coinowo.com
- DOMAIN-SUFFIX,earni.fi
- DOMAIN-SUFFIX,dropsearn.com
- DOMAIN-SUFFIX,bitcoin.it
- DOMAIN-SUFFIX,bitcoinmagazine.com
- DOMAIN-SUFFIX,blockchain.com
- DOMAIN-SUFFIX,tronscan.org
# > POOL
- DOMAIN-SUFFIX,btc.com
- DOMAIN-SUFFIX,f2pool.com
- DOMAIN-SUFFIX,cbeci.org
- DOMAIN-SUFFIX,digiconomist.net
- DOMAIN-SUFFIX,1ml.com
- DOMAIN-SUFFIX,bitcoinvisuals.com
- DOMAIN-SUFFIX,crypto51.app
- DOMAIN-SUFFIX,masternodes.online
- DOMAIN-SUFFIX,bitnodes.earn.com
- DOMAIN-SUFFIX,poolin.com
- DOMAIN-SUFFIX,ethermine.org
- DOMAIN-SUFFIX,ewapool.net
# > FTX
- DOMAIN-SUFFIX,ftx.com
# > Metamask
- DOMAIN-KEYWORD,metamask
- DOMAIN,token-api.metaswap.codefi.network
- DOMAIN,min-api.cryptocompare.com
# > NFT
- DOMAIN-SUFFIX,opensea.io
- DOMAIN-SUFFIX,nftscan.com
- DOMAIN-SUFFIX,makersplace.com
- DOMAIN-SUFFIX,nonfungible.com
- DOMAIN-SUFFIX,cryptoslam.io
- DOMAIN-SUFFIX,cryptoart.io
- DOMAIN-SUFFIX,nftcalendar.io
- DOMAIN-SUFFIX,nftgo.io
# > IPFS
- DOMAIN-SUFFIX,filecoin.io
- DOMAIN-SUFFIX,docs.lotu.sh
- DOMAIN-SUFFIX,ipfs.io
- DOMAIN-SUFFIX,docs.ipfs.io
- DOMAIN-SUFFIX,discuss.ipfs.io
# > EOS
- DOMAIN-SUFFIX,eos.io
- DOMAIN-SUFFIX,developers.eos.io
- DOMAIN-SUFFIX,block.one
- DOMAIN-SUFFIX,eostracker.io
- DOMAIN-SUFFIX,eosflare.io
- DOMAIN-SUFFIX,eospark.com
- DOMAIN-SUFFIX,bloks.io
# > Lightning
- DOMAIN-SUFFIX,lightning.engineering
- DOMAIN-SUFFIX,lightning.community
- DOMAIN-SUFFIX,acinq.co
- DOMAIN-SUFFIX,1ml.com
# > Token
- DOMAIN-SUFFIX,tokenpocket.pro
- DOMAIN-SUFFIX,token.im
- DOMAIN-SUFFIX,phantom.app
- DOMAIN-SUFFIX,tronlink.org
- DOMAIN-SUFFIX,myetherwallet.com
- DOMAIN-SUFFIX,jaxx.io
- DOMAIN-SUFFIX,trustwalletapp.com
# > Gate
- DOMAIN-SUFFIX,gate.ac
- DOMAIN-SUFFIX,gate.io
# > Mexc
- DOMAIN-SUFFIX,mexc.com
# > Dapp
- DOMAIN-SUFFIX,sushi.com
- DOMAIN-SUFFIX,uniswap.org
- DOMAIN-SUFFIX,sunswap.com
- DOMAIN-SUFFIX,traderjoexyz.com
- DOMAIN-SUFFIX,raydium.io
- DOMAIN-SUFFIX,synthetix.io
- DOMAIN-SUFFIX,aave.com
- DOMAIN-SUFFIX,compound.finance
- DOMAIN-SUFFIX,makerdao.com
- DOMAIN-SUFFIX,wbtc.network
- DOMAIN-SUFFIX,pancakeswap.finance
- DOMAIN-SUFFIX,pancakeswap.com
- DOMAIN-SUFFIX,mdex.co
- DOMAIN-SUFFIX,mdex.one
- DOMAIN-SUFFIX,mdex.com
- DOMAIN-SUFFIX,mdex.me
- DOMAIN-SUFFIX,1inch.io

View File

@ -1,12 +1,25 @@
payload: payload:
# > DAZN # > DAZN
# - USER-AGENT,DAZN*
- PROCESS-NAME,com.dazn - PROCESS-NAME,com.dazn
# - USER-AGENT,DAZN*
- DOMAIN-KEYWORD,voddazn - DOMAIN-KEYWORD,voddazn
- DOMAIN-SUFFIX,dazn-api.com
- DOMAIN-SUFFIX,dazn.com - DOMAIN-SUFFIX,dazn.com
- DOMAIN-SUFFIX,dazn-api.com
- DOMAIN-SUFFIX,dazndn.com - DOMAIN-SUFFIX,dazndn.com
- DOMAIN-SUFFIX,daznedge.net
- DOMAIN-SUFFIX,daznfeeds.com
- DOMAIN-SUFFIX,daznservices.com
- DOMAIN-SUFFIX,indazn.com - DOMAIN-SUFFIX,indazn.com
- DOMAIN-SUFFIX,indaznlab.com - DOMAIN-SUFFIX,indaznlab.com
- DOMAIN,d151l6v8er5bdm.cloudfront.net
- DOMAIN,daznfeeds.com.edgekey.net
- DOMAIN,dca-lm-livedazn.secure.footprint.net
- DOMAIN,h-dazn.online-metrix.net
- DOMAIN,images-daznservices-com.cdn.ampproject.org
- DOMAIN,d151l6v8er5bdm.cloudfront.net
- IP-CIDR,185.42.236.0/24,no-resolve
- IP-CIDR,185.42.238.0/24,no-resolve

View File

@ -0,0 +1,8 @@
payload:
# > Discord
- DOMAIN-SUFFIX,discord.com
- DOMAIN-SUFFIX,discord.gg
- DOMAIN-SUFFIX,discord.media
- DOMAIN-SUFFIX,discordapp.com
- DOMAIN-SUFFIX,discordapp.net
- DOMAIN-SUFFIX,discordstatus.com

View File

@ -1,4 +1,4 @@
payload: payload:
# > Discovery Plus # > Discovery Plus
- PROCESS-NAME,com.discovery.discoveryplus.mobile - PROCESS-NAME,com.discovery.discoveryplus.mobile
- DOMAIN-SUFFIX,content-ause1-ur-discovery1.uplynk.com - DOMAIN-SUFFIX,content-ause1-ur-discovery1.uplynk.com

View File

@ -1,13 +1,14 @@
payload: payload:
# > Disney Plus # > Disney Plus
# - USER-AGENT,Disney*
- PROCESS-NAME,com.disney.disneyplus - PROCESS-NAME,com.disney.disneyplus
- DOMAIN-SUFFIX,adobedtm.com - DOMAIN-SUFFIX,adobedtm.com
- DOMAIN-SUFFIX,bam.nr-date.net - DOMAIN-SUFFIX,bam.nr-date.net
- DOMAIN-SUFFIX,bamgrid.com - DOMAIN-SUFFIX,bamgrid.com
- DOMAIN-SUFFIX,braze.com - DOMAIN-SUFFIX,braze.com
- DOMAIN-SUFFIX,cdn.optimizely.com - DOMAIN-SUFFIX,cdn.optimizely.com
- DOMAIN-SUFFIX,cdn.registerdisney.go.com
- DOMAIN-SUFFIX,cws.conviva.com
- DOMAIN-SUFFIX,d9.flashtalking.com - DOMAIN-SUFFIX,d9.flashtalking.com
- DOMAIN-SUFFIX,disney.demdex.net - DOMAIN-SUFFIX,disney.demdex.net
- DOMAIN-SUFFIX,disney.my.sentry.io - DOMAIN-SUFFIX,disney.my.sentry.io
@ -17,5 +18,4 @@ payload:
- DOMAIN-SUFFIX,disney-plus.net - DOMAIN-SUFFIX,disney-plus.net
- DOMAIN-SUFFIX,disney-portal.my.onetrust.com - DOMAIN-SUFFIX,disney-portal.my.onetrust.com
- DOMAIN-SUFFIX,dssott.com - DOMAIN-SUFFIX,dssott.com
- DOMAIN-SUFFIX,execute-api.us-east-1.amazonaws.com - DOMAIN-SUFFIX,registerdisney.go.com
- DOMAIN-SUFFIX,js-agent.newrelic.com

View File

@ -1,4 +1,40 @@
payload: payload:
# China Banks
# > Agricultural Bank of China
- DOMAIN-SUFFIX,abchina.com
- DOMAIN-SUFFIX,abchina.com.cn
# > Bank of China
- DOMAIN-SUFFIX,boc.cn
# > China Citic Bank
- DOMAIN-SUFFIX,citicbank.com
- DOMAIN-SUFFIX,ecitic.com
- DOMAIN-SUFFIX,ecitic.net
# > China Construction Bank
- DOMAIN-SUFFIX,ccb.com
- DOMAIN-SUFFIX,ccb.com.cn
# > China Everbright Bank
- DOMAIN-SUFFIX,cebbank.com
# > China Merchants Bank
# - USER-AGENT,cmb*
- DOMAIN-SUFFIX,cmbchina.com
- DOMAIN-SUFFIX,cmbimg.com
- DOMAIN-SUFFIX,cmbt.cn
- DOMAIN-SUFFIX,mbcloud.com
# > Industrial and Commercial Bank of China
# - USER-AGENT,%E4%B8%AD%E5%9B%BD%E5%B7%A5%E5%95%86%E9%93%B6%E8%A1%8C*
- DOMAIN-SUFFIX,icbc.com.cn
# > Ping An Bank
- DOMAIN-SUFFIX,pingan.com
- DOMAIN-SUFFIX,pingan.com.cn
# Type
# > Beplay # > Beplay
- DOMAIN-KEYWORD,beplay - DOMAIN-KEYWORD,beplay
@ -48,10 +84,13 @@ payload:
- IP-CIDR,183.128.0.0/11,DIRECT,no-resolve - IP-CIDR,183.128.0.0/11,DIRECT,no-resolve
- IP-CIDR,183.131.48.0/20,DIRECT,no-resolve - IP-CIDR,183.131.48.0/20,DIRECT,no-resolve
- DOMAIN-SUFFIX,10010.com
- DOMAIN-SUFFIX,10086.cn
- DOMAIN-SUFFIX,12306.cn - DOMAIN-SUFFIX,12306.cn
- DOMAIN-SUFFIX,12306.com - DOMAIN-SUFFIX,12306.com
- DOMAIN-SUFFIX,126.net - DOMAIN-SUFFIX,126.net
- DOMAIN-SUFFIX,163.com - DOMAIN-SUFFIX,163.com
- DOMAIN-SUFFIX,189.cn
- DOMAIN-SUFFIX,360.cn - DOMAIN-SUFFIX,360.cn
- DOMAIN-SUFFIX,360.com - DOMAIN-SUFFIX,360.com
- DOMAIN-SUFFIX,360buy.com - DOMAIN-SUFFIX,360buy.com
@ -60,6 +99,7 @@ payload:
- DOMAIN-SUFFIX,51ym.me - DOMAIN-SUFFIX,51ym.me
- DOMAIN-SUFFIX,58.com - DOMAIN-SUFFIX,58.com
- DOMAIN-SUFFIX,8686c.com - DOMAIN-SUFFIX,8686c.com
- DOMAIN-SUFFIX,95516.com
- DOMAIN-SUFFIX,abercrombie.com - DOMAIN-SUFFIX,abercrombie.com
- DOMAIN-SUFFIX,acfun.tv - DOMAIN-SUFFIX,acfun.tv
- DOMAIN-SUFFIX,adobesc.com - DOMAIN-SUFFIX,adobesc.com
@ -101,6 +141,7 @@ payload:
- DOMAIN-SUFFIX,cnbetacdn.com - DOMAIN-SUFFIX,cnbetacdn.com
- DOMAIN-SUFFIX,chdbits.co - DOMAIN-SUFFIX,chdbits.co
- DOMAIN-SUFFIX,cnlang.org - DOMAIN-SUFFIX,cnlang.org
- DOMAIN-SUFFIX,coolapk.com
- DOMAIN-SUFFIX,cn88.net - DOMAIN-SUFFIX,cn88.net
- DOMAIN-SUFFIX,dct-cloud.com - DOMAIN-SUFFIX,dct-cloud.com
- DOMAIN-SUFFIX,didialift.com - DOMAIN-SUFFIX,didialift.com
@ -115,8 +156,6 @@ payload:
- DOMAIN-SUFFIX,duoshuo.com - DOMAIN-SUFFIX,duoshuo.com
- DOMAIN-SUFFIX,dytt8.net - DOMAIN-SUFFIX,dytt8.net
- DOMAIN-SUFFIX,easou.com - DOMAIN-SUFFIX,easou.com
- DOMAIN-SUFFIX,ecitic.com
- DOMAIN-SUFFIX,ecitic.net
- DOMAIN-SUFFIX,eudic.net - DOMAIN-SUFFIX,eudic.net
- DOMAIN-SUFFIX,ewqcxz.com - DOMAIN-SUFFIX,ewqcxz.com
- DOMAIN-SUFFIX,feng.com - DOMAIN-SUFFIX,feng.com
@ -125,6 +164,7 @@ payload:
- DOMAIN-SUFFIX,frdic.com - DOMAIN-SUFFIX,frdic.com
- DOMAIN-SUFFIX,fresh-ideas.cc - DOMAIN-SUFFIX,fresh-ideas.cc
- DOMAIN-SUFFIX,gameloft.com - DOMAIN-SUFFIX,gameloft.com
- DOMAIN-SUFFIX,garmin.com
- DOMAIN-SUFFIX,geetest.com - DOMAIN-SUFFIX,geetest.com
- DOMAIN-SUFFIX,godic.net - DOMAIN-SUFFIX,godic.net
- DOMAIN-SUFFIX,goodread.com - DOMAIN-SUFFIX,goodread.com
@ -263,8 +303,6 @@ payload:
- DOMAIN-SUFFIX,xdrig.com - DOMAIN-SUFFIX,xdrig.com
- DOMAIN-SUFFIX,xhostfire.com - DOMAIN-SUFFIX,xhostfire.com
- DOMAIN-SUFFIX,xhscdn.com - DOMAIN-SUFFIX,xhscdn.com
- DOMAIN-SUFFIX,xiami.com
- DOMAIN-SUFFIX,xiami.net
- DOMAIN-SUFFIX,xiaohongshu.com - DOMAIN-SUFFIX,xiaohongshu.com
- DOMAIN-SUFFIX,xiaojukeji.com - DOMAIN-SUFFIX,xiaojukeji.com
- DOMAIN-SUFFIX,xiaomi.com - DOMAIN-SUFFIX,xiaomi.com
@ -293,4 +331,5 @@ payload:
- IP-CIDR,1.255.62.0/24,no-resolve - IP-CIDR,1.255.62.0/24,no-resolve
# > CN # > CN
- DOMAIN-SUFFIX,gov.cn
- DOMAIN-SUFFIX,cn - DOMAIN-SUFFIX,cn

View File

@ -1,8 +0,0 @@
payload:
# > Douyin
- DOMAIN-SUFFIX,amemv.com
- DOMAIN-SUFFIX,ixigua.com
- DOMAIN-SUFFIX,ixiguavideo.com
- DOMAIN-SUFFIX,pstatp.com
- DOMAIN-SUFFIX,snssdk.com
- DOMAIN-SUFFIX,toutiao.com

View File

@ -1,4 +1,4 @@
payload: payload:
# > F1 TV # > F1 TV
- DOMAIN,d2n9h2wits23hf.cloudfront.net - DOMAIN,d2n9h2wits23hf.cloudfront.net
- DOMAIN,f1prodlive.akamaized.net - DOMAIN,f1prodlive.akamaized.net
@ -7,4 +7,4 @@ payload:
- DOMAIN-SUFFIX,f1esports.com - DOMAIN-SUFFIX,f1esports.com
- DOMAIN-SUFFIX,f1manager.com - DOMAIN-SUFFIX,f1manager.com
- DOMAIN-SUFFIX,f1play.com - DOMAIN-SUFFIX,f1play.com
- DOMAIN-SUFFIX,formula1.com - DOMAIN-SUFFIX,formula1.com

View File

@ -1,4 +1,4 @@
payload: payload:
# > Fox+ (HK|TW|SG) # > Fox+ (HK|TW|SG)
# - USER-AGENT,FOXPlus* # - USER-AGENT,FOXPlus*
- DOMAIN-SUFFIX,akamaized.net - DOMAIN-SUFFIX,akamaized.net

View File

@ -1,4 +1,4 @@
payload: payload:
# > Fox Now # > Fox Now
# - USER-AGENT,FOX%20NOW* # - USER-AGENT,FOX%20NOW*
- DOMAIN-SUFFIX,fox.com - DOMAIN-SUFFIX,fox.com

View File

@ -1,10 +1,18 @@
payload: payload:
# > HBO Max # > HBO Max
# - USER-AGENT,HBO%20GO%20PROD* # - USER-AGENT,HBO%20GO%20PROD*
# - DOMAIN-KEYWORD,hboasia # - DOMAIN-KEYWORD,hboasia
- DOMAIN-KEYWORD,hbogoasia - DOMAIN-KEYWORD,hbogoasia
- DOMAIN-SUFFIX,hboasia.com - DOMAIN-SUFFIX,hboasia.com
- DOMAIN-SUFFIX,hbogo.co.th
- DOMAIN-SUFFIX,hbogo.com
- DOMAIN-SUFFIX,hbogo.eu
- DOMAIN-SUFFIX,hbogoasia.com - DOMAIN-SUFFIX,hbogoasia.com
- DOMAIN-SUFFIX,hbogoasia.id
- DOMAIN-SUFFIX,hbogoasia.ph
- DOMAIN,hbolb.onwardsmg.com - DOMAIN,hbolb.onwardsmg.com
- DOMAIN,hbounify-prod.evergent.com - DOMAIN,hbounify-prod.evergent.com
# - DOMAIN,bcbolthboa-a.akamaihd.net # - DOMAIN,bcbolthboa-a.akamaihd.net

View File

@ -1,9 +1,11 @@
payload: payload:
# > HBO Max # > HBO Max
# - USER-AGENT,HBOMAX* # - USER-AGENT,HBOMAX*
- DOMAIN-SUFFIX,hbo.com - DOMAIN-SUFFIX,hbo.com
# - DOMAIN-SUFFIX,hbogo.com
- DOMAIN-SUFFIX,hbonow.com
- DOMAIN-SUFFIX,hbomax.com - DOMAIN-SUFFIX,hbomax.com
- DOMAIN-SUFFIX,hbomaxcdn.com - DOMAIN-SUFFIX,hbomaxcdn.com
- DOMAIN-SUFFIX,hbonow.com
- DOMAIN-SUFFIX,hbomax.com
- DOMAIN,execute-api.ap-southeast-1.amazonaws.com - DOMAIN,execute-api.ap-southeast-1.amazonaws.com

View File

@ -1,10 +1,23 @@
payload: payload:
# > Hulu # > Hulu
- PROCESS-NAME,com.hulu.plus - PROCESS-NAME,com.hulu.plus
- DOMAIN-SUFFIX,cws-hulu.conviva.com
- DOMAIN-SUFFIX,hulu.com - DOMAIN-SUFFIX,hulu.com
- DOMAIN-SUFFIX,hulu.hb.omtrdc.net - DOMAIN-SUFFIX,hulu.hb.omtrdc.net
- DOMAIN-SUFFIX,hulu.sc.omtrdc.net - DOMAIN-SUFFIX,hulu.sc.omtrdc.net
- DOMAIN-SUFFIX,huluad.com - DOMAIN-SUFFIX,huluad.com
- DOMAIN-SUFFIX,huluim.com - DOMAIN-SUFFIX,huluim.com
- DOMAIN-SUFFIX,hulustream.com - DOMAIN-SUFFIX,hulumail.com
- DOMAIN-SUFFIX,huluqa.com
- DOMAIN-SUFFIX,hulustream.com
- DOMAIN,cs428.wpc.edgecastcdn.net
- DOMAIN,cws-hulu.conviva.com
- DOMAIN,hulu.com.c.footprint.net
- DOMAIN,hulu.map.fastly.net
- IP-CIDR,8.28.124.0/23
- IP-CIDR,199.60.116.0/24
- IP-CIDR,199.200.48.0/22
- IP-CIDR,208.91.156.0/22
- IP-CIDR6,2620:100:3000::/40

View File

@ -1,8 +1,8 @@
payload: payload:
# > Hulu(フールー) # > Hulu(フールー)
- PROCESS-NAME,jp.happyon.android - PROCESS-NAME,jp.happyon.android
- DOMAIN-SUFFIX,happyon.jp - DOMAIN-SUFFIX,happyon.jp
- DOMAIN-SUFFIX,hulu.jp - DOMAIN-SUFFIX,hulu.jp
- DOMAIN-SUFFIX,prod.hjholdings.tv - DOMAIN-SUFFIX,prod.hjholdings.tv
- DOMAIN-SUFFIX,streaks.jp - DOMAIN-SUFFIX,streaks.jp
- DOMAIN-SUFFIX,yb.uncn.jp - DOMAIN-SUFFIX,yb.uncn.jp

View File

@ -1,4 +1,4 @@
payload: payload:
# > iQIYI Intl # > iQIYI Intl
# - USER-AGENT,iQIYI* # - USER-AGENT,iQIYI*
# - USER-AGENT,QIYIVideo* # - USER-AGENT,QIYIVideo*
@ -28,4 +28,4 @@ payload:
- IP-CIDR,23.211.15.0/24,no-resolve - IP-CIDR,23.211.15.0/24,no-resolve
- IP-CIDR,23.219.172.0/24,no-resolve - IP-CIDR,23.219.172.0/24,no-resolve
- IP-CIDR,23.40.242.10/32,no-resolve - IP-CIDR,23.40.242.10/32,no-resolve
- IP-CIDR,23.59.252.0/24,no-resolve - IP-CIDR,23.59.252.0/24,no-resolve

View File

@ -1,4 +1,4 @@
payload: payload:
# > IQIYI # > IQIYI
# - USER-AGENT,*QIYI* # - USER-AGENT,*QIYI*
# - USER-AGENT,iQiYi* # - USER-AGENT,iQiYi*
@ -9,4 +9,4 @@ payload:
- DOMAIN-SUFFIX,gitv.tv - DOMAIN-SUFFIX,gitv.tv
- DOMAIN-SUFFIX,71.am - DOMAIN-SUFFIX,71.am
- DOMAIN-KEYWORD,qiyi - DOMAIN-KEYWORD,qiyi
- DOMAIN,cache.video.iqiyi.com - DOMAIN,cache.video.iqiyi.com

View File

@ -1,4 +1,4 @@
payload: payload:
# > JOOX # > JOOX
- PROCESS-NAME,com.tencent.ibg.joox - PROCESS-NAME,com.tencent.ibg.joox
- PROCESS-NAME,com.tencent.ibg.jooxtv - PROCESS-NAME,com.tencent.ibg.jooxtv

View File

@ -1,4 +1,4 @@
payload: payload:
# > Japonx # > Japonx
- DOMAIN-KEYWORD,japonx - DOMAIN-KEYWORD,japonx
- DOMAIN-KEYWORD,japronx - DOMAIN-KEYWORD,japronx
@ -9,4 +9,4 @@ payload:
- DOMAIN-SUFFIX,japronx.com - DOMAIN-SUFFIX,japronx.com
- DOMAIN-SUFFIX,japronx.tv - DOMAIN-SUFFIX,japronx.tv
- DOMAIN-SUFFIX,japronx.net - DOMAIN-SUFFIX,japronx.net
- DOMAIN-SUFFIX,japronx.vip - DOMAIN-SUFFIX,japronx.vip

View File

@ -1,5 +1,5 @@
payload: payload:
# > KKBOX # > KKBOX
- DOMAIN-SUFFIX,kkbox.com - DOMAIN-SUFFIX,kkbox.com
- DOMAIN-SUFFIX,kkbox.com.tw - DOMAIN-SUFFIX,kkbox.com.tw
- DOMAIN-SUFFIX,kfs.io - DOMAIN-SUFFIX,kfs.io

View File

@ -1,4 +1,4 @@
payload: payload:
# > KKTV # > KKTV
- PROCESS-NAME,com.kktv.kktv - PROCESS-NAME,com.kktv.kktv
- DOMAIN-SUFFIX,kktv.me - DOMAIN-SUFFIX,kktv.me

View File

@ -1,3 +1,3 @@
payload: payload:
# > letv # > letv
- DOMAIN-SUFFIX,api.mob.app.letv.com - DOMAIN-SUFFIX,api.mob.app.letv.com

View File

@ -1,4 +1,4 @@
payload: payload:
# > Line TV # > Line TV
# - USER-AGENT,LINE* # - USER-AGENT,LINE*
- DOMAIN-SUFFIX,d3c7rimkq79yfu.cloudfront.net - DOMAIN-SUFFIX,d3c7rimkq79yfu.cloudfront.net

View File

@ -1,4 +1,4 @@
payload: payload:
# > Microsoft # > Microsoft
- DOMAIN-SUFFIX,here.com - DOMAIN-SUFFIX,here.com
- DOMAIN-SUFFIX,here.net - DOMAIN-SUFFIX,here.net
@ -605,4 +605,4 @@ payload:
- DOMAIN-SUFFIX,mwf-service.akamaized.net - DOMAIN-SUFFIX,mwf-service.akamaized.net
- DOMAIN-SUFFIX,officecdn-microsoft-com.akamaized.net - DOMAIN-SUFFIX,officecdn-microsoft-com.akamaized.net
- DOMAIN-SUFFIX,statics-marketingsites-eus-ms-com.akamaized.net - DOMAIN-SUFFIX,statics-marketingsites-eus-ms-com.akamaized.net
- DOMAIN-SUFFIX,statics-marketingsites-wcus-ms-com.akamaized.net - DOMAIN-SUFFIX,statics-marketingsites-wcus-ms-com.akamaized.net

View File

@ -1,4 +1,4 @@
payload: payload:
# > Netease Music # > Netease Music
- DOMAIN-SUFFIX,163yun.com - DOMAIN-SUFFIX,163yun.com
- DOMAIN-SUFFIX,api.iplay.163.com - DOMAIN-SUFFIX,api.iplay.163.com

View File

@ -1,21 +1,34 @@
payload: payload:
# > Netflix # > Netflix
- DOMAIN-KEYWORD,netflixdnstest - DOMAIN-SUFFIX,flxvpn.net
- DOMAIN-KEYWORD,dualstack.apiproxy- - DOMAIN-SUFFIX,netflix.ca
- DOMAIN-KEYWORD,dualstack.ichnaea-web-
- DOMAIN-KEYWORD,apiproxy-device-prod-nlb-
- DOMAIN,api.fast.com
- DOMAIN,netflix.com.edgesuite.net
- DOMAIN-SUFFIX,netflix.com - DOMAIN-SUFFIX,netflix.com
- DOMAIN-SUFFIX,netflix.com.au
- DOMAIN-SUFFIX,netflixdnstest10.com
- DOMAIN-SUFFIX,netflixdnstest1.com
- DOMAIN-SUFFIX,netflixdnstest2.com
- DOMAIN-SUFFIX,netflixdnstest3.com
- DOMAIN-SUFFIX,netflixdnstest4.com
- DOMAIN-SUFFIX,netflixdnstest5.com
- DOMAIN-SUFFIX,netflixdnstest6.com
- DOMAIN-SUFFIX,netflixdnstest7.com
- DOMAIN-SUFFIX,netflixdnstest8.com
- DOMAIN-SUFFIX,netflixdnstest9.com
- DOMAIN-SUFFIX,netflixinvestor.com
- DOMAIN-SUFFIX,netflix.net - DOMAIN-SUFFIX,netflix.net
- DOMAIN-SUFFIX,netflixstudios.com
- DOMAIN-SUFFIX,netflixtechblog.com
- DOMAIN-SUFFIX,nflxext.com - DOMAIN-SUFFIX,nflxext.com
- DOMAIN-SUFFIX,nflximg.com - DOMAIN-SUFFIX,nflximg.com
- DOMAIN-SUFFIX,nflximg.net - DOMAIN-SUFFIX,nflximg.net
- DOMAIN-SUFFIX,nflxsearch
- DOMAIN-SUFFIX,nflxso.net - DOMAIN-SUFFIX,nflxso.net
- DOMAIN-SUFFIX,nflxvideo.net - DOMAIN-SUFFIX,nflxvideo.net
- DOMAIN-SUFFIX,e13252.dscg.akamaiedge.net
- DOMAIN-SUFFIX,h-netflix.online-metrix.net
- DOMAIN-SUFFIX,onetrust.com
- DOMAIN-SUFFIX,cookielaw.org
- IP-CIDR,23.246.0.0/18,no-resolve - IP-CIDR,23.246.0.0/18,no-resolve
- IP-CIDR,37.77.184.0/21,no-resolve - IP-CIDR,37.77.184.0/21,no-resolve
- IP-CIDR,38.72.126.0/24,no-resolve - IP-CIDR,38.72.126.0/24,no-resolve
@ -33,4 +46,4 @@ payload:
- IP-CIDR,208.75.76.0/22,no-resolve - IP-CIDR,208.75.76.0/22,no-resolve
- IP-CIDR,34.210.42.111/32,no-resolve - IP-CIDR,34.210.42.111/32,no-resolve
- IP-CIDR,52.89.124.203/32,no-resolve - IP-CIDR,52.89.124.203/32,no-resolve
- IP-CIDR,54.148.37.5/32,no-resolve - IP-CIDR,54.148.37.5/32,no-resolve

View File

@ -0,0 +1,11 @@
payload:
# > Niconico
- DOMAIN-SUFFIX,dmc.nico
- DOMAIN-SUFFIX,nicovideo.jp
- DOMAIN-SUFFIX,nicodic.jp
- DOMAIN-SUFFIX,nicomanga.jp
- DOMAIN-SUFFIX,niconico.com
- DOMAIN-SUFFIX,nicoseiga.jp
- DOMAIN-SUFFIX,nimg.jp
- DOMAIN-SUFFIX,simg.jp
- DOMAIN-SUFFIX,socdm.com

View File

@ -1,4 +1,4 @@
payload: payload:
# > PBS # > PBS
# - USER-AGENT,PBS* # - USER-AGENT,PBS*
- DOMAIN-SUFFIX,pbs.org - DOMAIN-SUFFIX,pbs.org

View File

@ -1,4 +1,4 @@
payload: payload:
# > Pandora # > Pandora
- PROCESS-NAME,com.pandora.android - PROCESS-NAME,com.pandora.android
- DOMAIN-SUFFIX,pandora.com - DOMAIN-SUFFIX,pandora.com

View File

@ -1,4 +1,4 @@
payload: payload:
# > PayPal # > PayPal
# - USER-AGENT,PayPal* # - USER-AGENT,PayPal*
- DOMAIN-KEYWORD,paypal - DOMAIN-KEYWORD,paypal

View File

@ -1,6 +1,6 @@
payload: payload:
# > Pornhub # > Pornhub
- DOMAIN-SUFFIX,phncdn.com - DOMAIN-SUFFIX,phncdn.com
- DOMAIN-SUFFIX,phprcdn.com - DOMAIN-SUFFIX,phprcdn.com
- DOMAIN-SUFFIX,pornhub.com - DOMAIN-SUFFIX,pornhub.com
- DOMAIN-SUFFIX,pornhubpremium.com - DOMAIN-SUFFIX,pornhubpremium.com

View File

@ -1,4 +1,10 @@
payload: payload:
# > Duolingo
# - USER-AGENT,Duolingo*
- DOMAIN-KEYWORD,duolingo
- DOMAIN-SUFFIX,duolingo.cn
- DOMAIN-SUFFIX,duolingo.com
# > Line # > Line
- DOMAIN-SUFFIX,lin.ee - DOMAIN-SUFFIX,lin.ee
- DOMAIN-SUFFIX,line.me - DOMAIN-SUFFIX,line.me
@ -67,7 +73,6 @@ payload:
- DOMAIN-SUFFIX,apkpure.com - DOMAIN-SUFFIX,apkpure.com
- DOMAIN-SUFFIX,appdownloader.net - DOMAIN-SUFFIX,appdownloader.net
- DOMAIN-SUFFIX,apple-dns.net - DOMAIN-SUFFIX,apple-dns.net
- DOMAIN-SUFFIX,app-measurement.com
- DOMAIN-SUFFIX,appshopper.com - DOMAIN-SUFFIX,appshopper.com
- DOMAIN-SUFFIX,arcgis.com - DOMAIN-SUFFIX,arcgis.com
- DOMAIN-SUFFIX,archive.is - DOMAIN-SUFFIX,archive.is
@ -683,6 +688,10 @@ payload:
- DOMAIN-KEYWORD,dlercloud - DOMAIN-KEYWORD,dlercloud
# > VikACG
- DOMAIN-SUFFIX,vikacg.com
- DOMAIN-SUFFIX,picjs.xyz
# > exception # > exception
- DOMAIN-SUFFIX,wheel-size.cn - DOMAIN-SUFFIX,wheel-size.cn
- DOMAIN-SUFFIX,chalungu.cn - DOMAIN-SUFFIX,chalungu.cn

View File

@ -36,8 +36,8 @@ payload:
- DOMAIN-SUFFIX,t7z.cupid.iqiyi.com - DOMAIN-SUFFIX,t7z.cupid.iqiyi.com
- DOMAIN-SUFFIX,tracker.sns.iqiyi.com - DOMAIN-SUFFIX,tracker.sns.iqiyi.com
- DOMAIN-SUFFIX,yuedu.iqiyi.com - DOMAIN-SUFFIX,yuedu.iqiyi.com
# - URL-REGEX,https?://.+/videos/other/.+ # - URL-REGEX,https?:\/\/.+\/videos\/other\/.+
# - URL-REGEX,https?://paopao\w?.qiyipic.com # - URL-REGEX,https?:\/\/paopao\w?\.qiyipic\.com
- IP-CIDR,101.227.97.240/32 - IP-CIDR,101.227.97.240/32
- IP-CIDR,101.227.200.11/32 - IP-CIDR,101.227.200.11/32
- IP-CIDR,101.227.200.28/32 - IP-CIDR,101.227.200.28/32
@ -102,7 +102,7 @@ payload:
- IP-CIDR,223.87.182.102/32 - IP-CIDR,223.87.182.102/32
- IP-CIDR,223.87.182.11/32 - IP-CIDR,223.87.182.11/32
- IP-CIDR,223.87.182.52/32 - IP-CIDR,223.87.182.52/32
# - URL-REGEX,https?:\/\/.+.atm.youku.com # - URL-REGEX,https?:\/\/\.+\.atm\.youku\.com
# > MGTV # > MGTV
- DOMAIN-SUFFIX,ads-api.videojj.com - DOMAIN-SUFFIX,ads-api.videojj.com
@ -196,7 +196,7 @@ payload:
- DOMAIN-SUFFIX,pp2.pptv.com - DOMAIN-SUFFIX,pp2.pptv.com
- DOMAIN-SUFFIX,stat.pptv.com - DOMAIN-SUFFIX,stat.pptv.com
- DOMAIN-SUFFIX,static.g.pptv.com - DOMAIN-SUFFIX,static.g.pptv.com
# - URL-REGEX,https?://img\w.g.pptv.com # - URL-REGEX,https?:\/\/img\w\.g\.pptv\.com
# > Site # > Site
- DOMAIN-SUFFIX,deliver.ifeng.com - DOMAIN-SUFFIX,deliver.ifeng.com
@ -204,7 +204,7 @@ payload:
- DOMAIN-SUFFIX,hxsame.hexun.com - DOMAIN-SUFFIX,hxsame.hexun.com
- DOMAIN-SUFFIX,itv.hexun.com - DOMAIN-SUFFIX,itv.hexun.com
- DOMAIN-SUFFIX,utrack.hexun.com - DOMAIN-SUFFIX,utrack.hexun.com
# - URL-REGEX,https?://h\w{2}.hxsame.hexun.com # - URL-REGEX,https?:\/\/h\w{2}\.hxsame\.hexun\.com
# > Vod # > Vod
- DOMAIN-SUFFIX,ad.cmvideo.cn - DOMAIN-SUFFIX,ad.cmvideo.cn
@ -8117,7 +8117,6 @@ payload:
- DOMAIN-SUFFIX,zhidian3g.cn - DOMAIN-SUFFIX,zhidian3g.cn
- DOMAIN-SUFFIX,zhifenjie.com - DOMAIN-SUFFIX,zhifenjie.com
- DOMAIN-SUFFIX,zhihei.com - DOMAIN-SUFFIX,zhihei.com
- DOMAIN-SUFFIX,zhihu.xmcimg.com
- DOMAIN-SUFFIX,zhiong.net - DOMAIN-SUFFIX,zhiong.net
- DOMAIN-SUFFIX,zhiyuanteam.com - DOMAIN-SUFFIX,zhiyuanteam.com
- DOMAIN-SUFFIX,zhiziyun.com - DOMAIN-SUFFIX,zhiziyun.com
@ -8195,6 +8194,8 @@ payload:
- DOMAIN-SUFFIX,zzy1.quyaoya.com - DOMAIN-SUFFIX,zzy1.quyaoya.com
- DOMAIN-SUFFIX,zzz7.52896368.com - DOMAIN-SUFFIX,zzz7.52896368.com
- DOMAIN-SUFFIX,zzzzz4.52896368.com - DOMAIN-SUFFIX,zzzzz4.52896368.com
- DOMAIN-SUFFIX,5534edee5a.com
- DOMAIN-SUFFIX,ea778a21c7.com
# > Baidu # > Baidu
- DOMAIN-SUFFIX,baidustatic.com - DOMAIN-SUFFIX,baidustatic.com
@ -8206,26 +8207,25 @@ payload:
- DOMAIN,nsclick.baidu.com - DOMAIN,nsclick.baidu.com
- DOMAIN,wn.pos.baidu.com - DOMAIN,wn.pos.baidu.com
- DOMAIN,ps.map.baidu.com - DOMAIN,ps.map.baidu.com
- DOMAIN,sv.map.baidu.com
- DOMAIN,offnavi.map.baidu.com - DOMAIN,offnavi.map.baidu.com
- DOMAIN,newvector.map.baidu.com - DOMAIN,newvector.map.baidu.com
- DOMAIN,ulog.imap.baidu.com - DOMAIN,ulog.imap.baidu.com
- DOMAIN,newloc.map.n.shifen.com - DOMAIN,newloc.map.n.shifen.com
# - URL-REGEX,^http:\/\/[\s\S]*baidu\.com/.*ad[xs]\.php # - URL-REGEX,http:\/\/[\s\S]*baidu\.com\/\.*ad[xs]\.php
# - URL-REGEX,^http:\/\/c\.tieba\.baidu\.com\/c\/s\/splashSchedule$ # - URL-REGEX,http:\/\/c\.tieba\.baidu\.com\/c\/s\/splashSchedule
# > Bilibili # > Bilibili
- DOMAIN,miniapp.bilibili.com - DOMAIN,miniapp.bilibili.com
- DOMAIN,thirdparty.biliapi.com - DOMAIN,thirdparty.biliapi.com
# - URL-REGEX,https://app.bilibili.com/x/v2/param # - URL-REGEX,https:\/\/app\.bilibili\.com\/x\/v2\/param
# - URL-REGEX,https://app.bilibili.com/x/resource/abtest # - URL-REGEX,https:\/\/app\.bilibili\.com\/x\/resource\/abtest
# - URL-REGEX,http://app.bilibili.com/x/v2/dataflow/report-TINYGIF # - URL-REGEX,http:\/\/app\.bilibili\.com\/x\/v2\/dataflow\/report-TINYGIF
# - URL-REGEX,https://app.bilibili.com/x/v2/search/(defaultword|hot|recommend|resource) # - URL-REGEX,https:\/\/app\.bilibili\.com\/x\/v2\/search\/(defaultword|hot|recommend|resource)
# - URL-REGEX,https://app.bilibili.com/x/v2/rank.*rid=(168|5) # - URL-REGEX,https:\/\/app\.bilibili\.com\/x\/v2\/rank\.*rid=(168|5)
# - URL-REGEX,https://api.bilibili.com/pgc/season/rank/cn # - URL-REGEX,https:\/\/api\.bilibili\.com\/pgc\/season\/rank\/cn
# > Didi # > Didi
# - URL-REGEX,^https:\/\/img-ys011\.didistatic\.com\/static\/ad_oss\/image-\d{4}-\d{4}\/ # - URL-REGEX,https:\/\/img-ys011\.didistatic\.com\/static\/ad_oss\/image-\d{4}-\d{4}\/
# > ele # > ele
- DOMAIN,log.star.ele.me - DOMAIN,log.star.ele.me
@ -8247,44 +8247,52 @@ payload:
- DOMAIN,rd.da.netease.com - DOMAIN,rd.da.netease.com
- DOMAIN,wr.da.netease.com - DOMAIN,wr.da.netease.com
- DOMAIN,yt-adp.nosdn.127.net - DOMAIN,yt-adp.nosdn.127.net
# - URL-REGEX,^http:\/\/p\d\.music\.126\.net\/\w+==\/\d+\.jpg$ # - URL-REGEX,http:\/\/p\d\.music\.126\.net\/\w+==\/\d+\.jpg
# - URL-REGEX,^http:\/\/iad.*mat\.[a-z]*\.12[67]\.net/\w+\.(jpg|mp4)$ # - URL-REGEX,http:\/\/iad\.*mat\.[a-z]*\.12[67]\.net\/\w+\.(jpg|mp4)
# > Zhihu # > Zhihu
- DOMAIN,appcloud2.in.zhihu.com
- DOMAIN,mqtt.zhihu.com - DOMAIN,mqtt.zhihu.com
- DOMAIN,sugar.zhihu.com - DOMAIN,sugar.zhihu.com
- DOMAIN,zhihu-analytics.zhihu.com
- DOMAIN,zhihu-web-analytics.zhihu.com
- DOMAIN,118.89.204.198
- DOMAIN-SUFFIX,xdrig.com - DOMAIN-SUFFIX,xdrig.com
# - URL-REGEX,https://api.zhihu.com/(fringe|zst|real_time|ad-style-service|banners|topstory/hot-lists|market/popover|mqtt|me|.*launch|.*featured-comment-ad|search/(top|tabs|preset)) - DOMAIN-SUFFIX,zhihu.xmcimg.com
# - URL-REGEX,https://api.zhihu.com.*(launch|recommendations)
# - URL-REGEX,https://api.zhihu.com/search/(top|tabs|preset)
# - URL-REGEX,https://api.zhihu.com/answers/.*/comments/featured-comment-ad
# - URL-REGEX,https?://(e|m).+/((uu|oo).php.+|\d+.x?html\?$) # - URL-REGEX,https:\/\/api\.zhihu\.com\/(fringe|zst|real_time|ad-style-service|banners|topstory/hot-lists|market/popover|mqtt|me|.*launch|.*featured-comment-ad|search/(top|tabs|preset))
# - URL-REGEX,https?://[^(apple|10010)]+.(com|cn)\/(a|A)d(s|v)?(/|.js) # - URL-REGEX,https:\/\/api\.zhihu\.com\.*(launch|recommendations)
# - URL-REGEX,https?://[^bbs].tianya\.cn # - URL-REGEX,https:\/\/api\.zhihu\.com\/search\/(top|tabs|preset)
# - URL-REGEX,https?://\w.?up.qingdaonews.com # - URL-REGEX,https:\/\/api\.zhihu\.com\/answers\/\.*\/comments\/featured-comment-ad
# - URL-REGEX,https?://\w{6}.com1.z0.glb.clouddn.com
# - URL-REGEX,https?://\w{8}.logic.cpm.cm.kankan.com # - URL-REGEX,https?:\/\/(e|m).+\/((uu|oo).php.+|\d+.x?html\?$)
# - URL-REGEX,https?://\w+.cloudfront.net/banner # - URL-REGEX,https?:\/\/[^(apple|10010)]+.(com|cn)\/(a|A)d(s|v)?(/|.js)
# - URL-REGEX,https?://\w+.gdt.qq.com # - URL-REGEX,https?:\/\/[^bbs]\.tianya\.cn
# - URL-REGEX,https?://\w+.kingsoft-office-service.com # - URL-REGEX,https?:\/\/\w.?up\.qingdaonews\.com
# - URL-REGEX,https?://9377\w{2}.com # - URL-REGEX,https?:\/\/\w{6}\.com1\.z0\.glb\.clouddn\.com
# - URL-REGEX,https?://a0b\w{2}.com # - URL-REGEX,https?:\/\/\w{8}\.logic\.cpm\.cm\.kankan\.com
# - URL-REGEX,https?://(a?d|sax)\d.sina.com # - URL-REGEX,https?:\/\/\w+\.cloudfront\.net\/banner
# - URL-REGEX,https?://d\d.sinaimg.cn # - URL-REGEX,https?:\/\/\w+\.gdt\.qq\.com
# - URL-REGEX,https?://dl.app.gtja.com/.+\d+.jpg$ # - URL-REGEX,https?:\/\/\w+\.kingsoft-office-service\.com
# - URL-REGEX,https?://impservice.+?youdao.com # - URL-REGEX,https?:\/\/9377\w{2}\.com
# - URL-REGEX,https?://mi.gdt.qq.com/gdt_mview.fcg # - URL-REGEX,https?:\/\/a0b\w{2}\.com
# - URL-REGEX,https?://notice.send-anywhere.com/banner # - URL-REGEX,https?:\/\/(a?d|sax)\d\.sina\.com
# - URL-REGEX,https?://sax\w?.sina.cn # - URL-REGEX,https?:\/\/d\d\.sinaimg\.cn
# - URL-REGEX,https?://sax\w?.sina.com.cn # - URL-REGEX,https?:\/\/dl\.app\.gtja\.com\/\.+\d+\.jpg
# - URL-REGEX,https?://server-\w+.imrworldwide.com # - URL-REGEX,https?:\/\/impservice\.+?youdao\.com
# - URL-REGEX,https?://www.bldimg.com/(background|splash)/.+.png$ # - URL-REGEX,https?:\/\/mi\.gdt\.qq\.com\/gdt_mview\.fcg
# - URL-REGEX,https?:\/\/notice\.send-anywhere\.com\/banner
# - URL-REGEX,https?:\/\/sax\w?\.sina\.cn
# - URL-REGEX,https?:\/\/sax\w?\.sina\.com\.cn
# - URL-REGEX,https?:\/\/server-\w+\.imrworldwide\.com
# - URL-REGEX,https?:\/\/www\.bldimg\.com\/(background|splash)\/\.+\.png
- IP-CIDR,39.107.15.115/32 - IP-CIDR,39.107.15.115/32
- IP-CIDR,47.89.59.182/32 - IP-CIDR,47.89.59.182/32
- IP-CIDR,103.49.209.27/32 - IP-CIDR,103.49.209.27/32
- IP-CIDR,118.89.204.198/32
- IP-CIDR,123.56.152.96/32 - IP-CIDR,123.56.152.96/32
- IP-CIDR6,2402:4e00:1200:ed00:0:9089:6dac:96b6/128
# > China Net # > China Net
- IP-CIDR,61.160.200.223/32 - IP-CIDR,61.160.200.223/32

View File

@ -1,5 +1,8 @@
payload: payload:
# > SoundCloud # > SoundCloud
# - USER-AGENT,SoundCloud* # - USER-AGENT,SoundCloud*
- DOMAIN-SUFFIX,sndcdn.com - DOMAIN-SUFFIX,sndcdn.com
- DOMAIN-SUFFIX,soundcloud.app.goo.gl
- DOMAIN-SUFFIX,soundcloud.com - DOMAIN-SUFFIX,soundcloud.com
- DOMAIN-SUFFIX,soundcloudmail.com

View File

@ -42,10 +42,11 @@ payload:
# > Steam # > Steam
# - USER-AGENT,Steam* # - USER-AGENT,Steam*
# - DOMAIN,store.steampowered.com
- DOMAIN,cm.steampowered.com - DOMAIN,cm.steampowered.com
- DOMAIN,ol.epicgames.com - DOMAIN,ol.epicgames.com
# - DOMAIN,store.steampowered.com
- DOMAIN-SUFFIX,steamcontent.com - DOMAIN-SUFFIX,steamcontent.com
- DOMAIN-SUFFIX,steamserver.net
- DOMAIN-SUFFIX,steamchina.com - DOMAIN-SUFFIX,steamchina.com
@ -86,6 +87,9 @@ payload:
# > UUBooster # > UUBooster
- PROCESS-NAME,UUBooster - PROCESS-NAME,UUBooster
# > WiFiman
- DOMAIN-SUFFIX,app-measurement.com
# > Xunlei # > Xunlei
# - USER-AGENT,%E8%BF%85%E9%9B%B7 # - USER-AGENT,%E8%BF%85%E9%9B%B7
@ -119,6 +123,7 @@ payload:
- DOMAIN-SUFFIX,broadcasthe.net - DOMAIN-SUFFIX,broadcasthe.net
- DOMAIN-SUFFIX,chdbits.co - DOMAIN-SUFFIX,chdbits.co
- DOMAIN-SUFFIX,classix-unlimited.co.uk - DOMAIN-SUFFIX,classix-unlimited.co.uk
- DOMAIN-SUFFIX,dmhy.best
- DOMAIN-SUFFIX,empornium.me - DOMAIN-SUFFIX,empornium.me
- DOMAIN-SUFFIX,gazellegames.net - DOMAIN-SUFFIX,gazellegames.net
- DOMAIN-SUFFIX,hdchina.org - DOMAIN-SUFFIX,hdchina.org

View File

@ -1,8 +1,18 @@
payload: payload:
# > Spotify # > Spotify
# - USER-AGENT,Spotify*
- PROCESS-NAME,com.spotify.music - PROCESS-NAME,com.spotify.music
- DOMAIN-SUFFIX,pscdn.co - DOMAIN-SUFFIX,pscdn.co
- DOMAIN-SUFFIX,scdn.co - DOMAIN-SUFFIX,scdn.co
- DOMAIN-SUFFIX,spoti.fi - DOMAIN-SUFFIX,spoti.fi
- DOMAIN-SUFFIX,spotify.com - DOMAIN-SUFFIX,spotify.com
- DOMAIN-SUFFIX,spotifycdn.com
- DOMAIN-SUFFIX,spotifycdn.net - DOMAIN-SUFFIX,spotifycdn.net
- DOMAIN-SUFFIX,spotifycharts.com
- DOMAIN-SUFFIX,spotifycodes.com
- DOMAIN-SUFFIX,spotifyjobs.com
- DOMAIN-SUFFIX,spotifynewsroom.jp
- DOMAIN-SUFFIX,spotilocal.com
- DOMAIN-SUFFIX,tospotify.com

View File

@ -1,33 +1,41 @@
payload: payload:
# Streaming Media # Streaming Media
# (Podcast)
# > Himalaya # (Live)
# USER-AGENT,Himalaya* # > Twitch
- DOMAIN-SUFFIX,himalaya.com - PROCESS-NAME,tv.twitch.android.app
- DOMAIN-SUFFIX,ext-twitch.tv
- DOMAIN-SUFFIX,jtvnw.net
- DOMAIN-SUFFIX,ttvnw.net
- DOMAIN-SUFFIX,twitch.tv
- DOMAIN-SUFFIX,twitchcdn.net
- DOMAIN-SUFFIX,twitch-ext.rootonline.de
# (Music) # (Music)
# > Deezer # > Deezer
# USER-AGENT,Deezer* - PROCESS-NAME,deezer.android.app
- DOMAIN-SUFFIX,deezer.com - DOMAIN-SUFFIX,deezer.com
- DOMAIN-SUFFIX,dzcdn.net - DOMAIN-SUFFIX,dzcdn.net
# > JOOX # > JOOX
# USER-AGENT,JOOX* - PROCESS-NAME,com.tencent.ibg.joox
# USER-AGENT,WeMusic* - PROCESS-NAME,com.tencent.ibg.jooxtv
- DOMAIN-SUFFIX,joox.com - DOMAIN-SUFFIX,joox.com
- DOMAIN-KEYWORD,jooxweb-api - DOMAIN-KEYWORD,jooxweb-api
# > KKBOX # > KKBOX
- PROCESS-NAME,com.skysoft.kkbox.android
- DOMAIN-SUFFIX,kkbox.com - DOMAIN-SUFFIX,kkbox.com
- DOMAIN-SUFFIX,kkbox.com.tw - DOMAIN-SUFFIX,kkbox.com.tw
- DOMAIN-SUFFIX,kfs.io - DOMAIN-SUFFIX,kfs.io
# > Pandora # > Pandora
# USER-AGENT,Pandora* - PROCESS-NAME,com.pandora.android
- DOMAIN-SUFFIX,pandora.com - DOMAIN-SUFFIX,pandora.com
# > SoundCloud # > SoundCloud
# USER-AGENT,SoundCloud* - PROCESS-NAME,com.soundcloud.android
- DOMAIN-SUFFIX,p-cdn.us - DOMAIN-SUFFIX,p-cdn.us
- DOMAIN-SUFFIX,sndcdn.com - DOMAIN-SUFFIX,sndcdn.com
- DOMAIN-SUFFIX,soundcloud.com - DOMAIN-SUFFIX,soundcloud.com
# > Spotify # > Spotify
# USER-AGENT,Spotify* - PROCESS-NAME,com.spotify.music
- DOMAIN-SUFFIX,pscdn.co - DOMAIN-SUFFIX,pscdn.co
- DOMAIN-SUFFIX,scdn.co - DOMAIN-SUFFIX,scdn.co
- DOMAIN-SUFFIX,spotify.com - DOMAIN-SUFFIX,spotify.com
@ -35,154 +43,204 @@ payload:
- DOMAIN-KEYWORD,spotify.com - DOMAIN-KEYWORD,spotify.com
- DOMAIN-KEYWORD,-spotify-com - DOMAIN-KEYWORD,-spotify-com
# > TIDAL # > TIDAL
# USER-AGENT,TIDAL* - PROCESS-NAME,com.aspiro.tidal
- DOMAIN-SUFFIX,tidal.com - DOMAIN-SUFFIX,tidal.com
# > YouTubeMusic # > YouTubeMusic
# USER-AGENT,com.google.ios.youtubemusic* - PROCESS-NAME,com.google.android.apps.youtube.music
# USER-AGENT,YouTubeMusic* - PROCESS-NAME,com.google.android.youtube.tvmusic
# (Podcast)
# > Himalaya
- PROCESS-NAME,com.ximalaya.ting.himalaya
- DOMAIN-SUFFIX,himalaya.com
# (Video) # (Video)
# > AbemaTV # > AbemaTV
# USER-AGENT,AbemaTV* - PROCESS-NAME,tv.abema
- DOMAIN-SUFFIX,abema.io - DOMAIN-SUFFIX,abema.io
- DOMAIN-SUFFIX,abema.tv - DOMAIN-SUFFIX,abema.tv
- DOMAIN-SUFFIX,ameba.jp - DOMAIN-SUFFIX,ameba.jp
- DOMAIN-SUFFIX,hayabusa.io - DOMAIN-SUFFIX,hayabusa.io
- DOMAIN-KEYWORD,abematv.akamaized.net - DOMAIN-KEYWORD,abematv.akamaized.net
# > All 4 # > All 4
# USER-AGENT,All4* - PROCESS-NAME,com.channel4.ondemand
- DOMAIN-SUFFIX,c4assets.com - DOMAIN-SUFFIX,c4assets.com
- DOMAIN-SUFFIX,channel4.com - DOMAIN-SUFFIX,channel4.com
# > Amazon Prime Video # > Amazon Prime Video
# USER-AGENT,InstantVideo.US* - PROCESS-NAME,com.amazon.avod.thirdp
# USER-AGENT,Prime%20Video*
- DOMAIN-SUFFIX,aiv-cdn.net - DOMAIN-SUFFIX,aiv-cdn.net
- DOMAIN-SUFFIX,aiv-delivery.net - DOMAIN-SUFFIX,aiv-delivery.net
- DOMAIN-SUFFIX,amazonvideo.com - DOMAIN-SUFFIX,amazonvideo.com
- DOMAIN-SUFFIX,media-amazon.com
- DOMAIN-SUFFIX,primevideo.com - DOMAIN-SUFFIX,primevideo.com
- DOMAIN-SUFFIX,pv-cdn.net
- DOMAIN,atv-ps.amazon.com
- DOMAIN,fls-na.amazon.com
- DOMAIN,avodmp4s3ww-a.akamaihd.net - DOMAIN,avodmp4s3ww-a.akamaihd.net
- DOMAIN,d25xi40x97liuc.cloudfront.net - DOMAIN,d25xi40x97liuc.cloudfront.net
- DOMAIN,dmqdd6hw24ucf.cloudfront.net - DOMAIN,dmqdd6hw24ucf.cloudfront.net
- DOMAIN,dmqdd6hw24ucf.cloudfront.net - DOMAIN,dmqdd6hw24ucf.cloudfront.net
- DOMAIN,d22qjgkvxw22r6.cloudfront.net - DOMAIN,d22qjgkvxw22r6.cloudfront.net
- DOMAIN,d1v5ir2lpwr8os.cloudfront.net - DOMAIN,d1v5ir2lpwr8os.cloudfront.net
- DOMAIN,d27xxe7juh1us6.cloudfront.net
# - DOMAIN,www.amazon.com
- DOMAIN-KEYWORD,avoddashs - DOMAIN-KEYWORD,avoddashs
# > Apple Music TV
- DOMAIN,tv.applemusic.com
# > Apple TV # > Apple TV
- DOMAIN-SUFFIX,tv.apple.com - DOMAIN,linear.tv.apple.com
- DOMAIN,hls.itunes.apple.com
- DOMAIN,hls-amt.itunes.apple.com
- DOMAIN,play-edge.itunes.apple.com - DOMAIN,play-edge.itunes.apple.com
- DOMAIN,uts-api.itunes.apple.com
# > Bahamut # > Bahamut
# USER-AGENT,Anime* - PROCESS-NAME,tw.com.gamer.android.animad
- DOMAIN-SUFFIX,bahamut.com.tw - DOMAIN-SUFFIX,bahamut.com.tw
- DOMAIN-SUFFIX,gamer.com.tw - DOMAIN-SUFFIX,gamer.com.tw
- DOMAIN,bahamut.akamaized.net
- DOMAIN,gamer-cds.cdn.hinet.net - DOMAIN,gamer-cds.cdn.hinet.net
- DOMAIN,gamer2-cds.cdn.hinet.net - DOMAIN,gamer2-cds.cdn.hinet.net
# > BBC iPlayer # > BBC iPlayer
# USER-AGENT,BBCiPlayer* - PROCESS-NAME,bbc.iplayer.android
- DOMAIN-SUFFIX,bbc.co.uk - DOMAIN-SUFFIX,bbc.co.uk
- DOMAIN-SUFFIX,bbci.co.uk - DOMAIN-SUFFIX,bbci.co.uk
- DOMAIN-KEYWORD,bbcfmt - DOMAIN-KEYWORD,bbcfmt
- DOMAIN-KEYWORD,uk-live - DOMAIN-KEYWORD,uk-live
# > bilibili Intl
- PROCESS-NAME,com.bstar.intl
- DOMAIN-SUFFIX,biliintl.com
- DOMAIN,apm-misaka.biliapi.net
- DOMAIN,p.bstarstatic.com
- DOMAIN,p-bstarstatic.akamaized.net
- DOMAIN,upos-bstar-mirrorakam.akamaized.net
- DOMAIN,upos-bstar1-mirrorakam.akamaized.net
# > DAZN # > DAZN
# USER-AGENT,DAZN* - PROCESS-NAME,com.dazn
- DOMAIN-SUFFIX,dazn.com - DOMAIN-SUFFIX,dazn.com
- DOMAIN-SUFFIX,dazn-api.com - DOMAIN-SUFFIX,dazn-api.com
- DOMAIN-SUFFIX,dazndn.com
- DOMAIN-SUFFIX,indazn.com
- DOMAIN,d151l6v8er5bdm.cloudfront.net - DOMAIN,d151l6v8er5bdm.cloudfront.net
- DOMAIN-KEYWORD,voddazn - DOMAIN-KEYWORD,voddazn
# > discovery+
- PROCESS-NAME,com.discovery.discoveryplus.mobile
- DOMAIN-SUFFIX,disco-api.com
- DOMAIN-SUFFIX,discoveryplus.co.uk
- DOMAIN-SUFFIX,discoveryplus.com
- DOMAIN-SUFFIX,discoveryplus.in
- DOMAIN-SUFFIX,dnitv.com
# - DOMAIN,go-prod-vz.akamaized.net
- DOMAIN,x-default-stgec.uplynk.com
- DOMAIN-KEYWORD,discovery.uplynk.com
# > Disney+ # > Disney+
# USER-AGENT,Disney+* - PROCESS-NAME,com.disney.disneyplus
- DOMAIN-SUFFIX,disney-plus.net - DOMAIN-SUFFIX,bamgrid.com
- DOMAIN-SUFFIX,disneyplus.com - DOMAIN-SUFFIX,disneyplus.com
- DOMAIN-SUFFIX,disney-plus.net
- DOMAIN-SUFFIX,disneystreaming.com
- DOMAIN-SUFFIX,dssott.com - DOMAIN-SUFFIX,dssott.com
- DOMAIN,cdn.registerdisney.go.com - DOMAIN,cdn.registerdisney.go.com
- DOMAIN,global.edge.bamgrid.com
# > DMM # > DMM
- PROCESS-NAME,com.dmm.app.movieplayer
- DOMAIN-SUFFIX,dmm.co.jp - DOMAIN-SUFFIX,dmm.co.jp
- DOMAIN-SUFFIX,dmm.com - DOMAIN-SUFFIX,dmm.com
- DOMAIN-SUFFIX,dmm-extension.com - DOMAIN-SUFFIX,dmm-extension.com
# > encoreTVB # > encoreTVB
# USER-AGENT,encoreTVB* - PROCESS-NAME,com.tvbusa.encore
- DOMAIN-SUFFIX,encoretvb.com - DOMAIN-SUFFIX,encoretvb.com
- DOMAIN,edge.api.brightcove.com - DOMAIN,edge.api.brightcove.com
- DOMAIN,bcbolt446c5271-a.akamaihd.net - DOMAIN,bcbolt446c5271-a.akamaihd.net
# > FOX NOW
# USER-AGENT,FOX%20NOW*
- DOMAIN-SUFFIX,fox.com
- DOMAIN-SUFFIX,foxdcg.com
- DOMAIN-SUFFIX,theplatform.com
- DOMAIN-SUFFIX,uplynk.com
# > FOX+
- DOMAIN-SUFFIX,foxplus.com
# - DOMAIN-SUFFIX,theplatform.com
- DOMAIN,cdn-fox-networks-group-green.akamaized.net
- DOMAIN,d3cv4a9a9wh0bt.cloudfront.net
- DOMAIN,foxsports01-i.akamaihd.net
- DOMAIN,foxsports02-i.akamaihd.net
- DOMAIN,foxsports03-i.akamaihd.net
- DOMAIN,staticasiafox.akamaized.net
# > HBO NOW & Max # > HBO NOW & Max
# USER-AGENT,HBO%20NOW* - PROCESS-NAME,com.hbo.hbonow
- DOMAIN-SUFFIX,hbo.com - DOMAIN-SUFFIX,hbo.com
- DOMAIN-SUFFIX,hbogo.com - DOMAIN-SUFFIX,hbogo.com
- DOMAIN-SUFFIX,hbonow.com - DOMAIN-SUFFIX,hbonow.com
# USER-AGENT,HBOMAX*
- DOMAIN-SUFFIX,hbomax.com - DOMAIN-SUFFIX,hbomax.com
# > HBO GO HKG - DOMAIN-SUFFIX,hbomaxcdn.com
# USER-AGENT,HBO%20GO%20PROD%20HKG* # > HBO Asia
- PROCESS-NAME,hk.hbo.hbogo
- DOMAIN-SUFFIX,hbogoasia.com - DOMAIN-SUFFIX,hbogoasia.com
- DOMAIN-SUFFIX,hbogoasia.hk - DOMAIN-SUFFIX,hbogoasia.hk
- DOMAIN,bcbolthboa-a.akamaihd.net - DOMAIN-KEYWORD,.hbogoasia.
- DOMAIN,players.brightcove.net
- DOMAIN,s3-ap-southeast-1.amazonaws.com
- DOMAIN,dai3fd1oh325y.cloudfront.net
- DOMAIN,44wilhpljf.execute-api.ap-southeast-1.amazonaws.com - DOMAIN,44wilhpljf.execute-api.ap-southeast-1.amazonaws.com
- DOMAIN,bcbolthboa-a.akamaihd.net
- DOMAIN,cf-images.ap-southeast-1.prod.boltdns.net
- DOMAIN,dai3fd1oh325y.cloudfront.net
- DOMAIN,hboasia1-i.akamaihd.net - DOMAIN,hboasia1-i.akamaihd.net
- DOMAIN,hboasia2-i.akamaihd.net - DOMAIN,hboasia2-i.akamaihd.net
- DOMAIN,hboasia3-i.akamaihd.net - DOMAIN,hboasia3-i.akamaihd.net
- DOMAIN,hboasia4-i.akamaihd.net - DOMAIN,hboasia4-i.akamaihd.net
- DOMAIN,hboasia5-i.akamaihd.net - DOMAIN,hboasia5-i.akamaihd.net
- DOMAIN,cf-images.ap-southeast-1.prod.boltdns.net - DOMAIN,hboasialive.akamaized.net
- DOMAIN,hbogoprod-vod.akamaized.net
- DOMAIN,hbolb.onwardsmg.com
- DOMAIN,hbounify-prod.evergent.com
- DOMAIN,players.brightcove.net
- DOMAIN,s3-ap-southeast-1.amazonaws.com
# > 华文电视 # > 华文电视
# USER-AGENT,HWTVMobile*
- DOMAIN-SUFFIX,5itv.tv - DOMAIN-SUFFIX,5itv.tv
- DOMAIN-SUFFIX,ocnttv.com - DOMAIN-SUFFIX,ocnttv.com
# > Hulu # > Hulu
- PROCESS-NAME,com.hulu.plus
- DOMAIN-SUFFIX,hulu.com - DOMAIN-SUFFIX,hulu.com
- DOMAIN-SUFFIX,huluim.com - DOMAIN-SUFFIX,huluim.com
- DOMAIN-SUFFIX,hulustream.com - DOMAIN-SUFFIX,hulustream.com
# > Hulu / フールー # > Hulu / フールー
- PROCESS-NAME,jp.happyon.android
- DOMAIN-SUFFIX,happyon.jp - DOMAIN-SUFFIX,happyon.jp
- DOMAIN-SUFFIX,hjholdings.jp - DOMAIN-SUFFIX,hjholdings.jp
- DOMAIN-SUFFIX,hulu.jp - DOMAIN-SUFFIX,hulu.jp
# > ITV # > ITV
# USER-AGENT,ITV_Player* - PROCESS-NAME,air.ITVMobilePlayer
- DOMAIN-SUFFIX,itv.com - DOMAIN-SUFFIX,itv.com
- DOMAIN-SUFFIX,itvstatic.com - DOMAIN-SUFFIX,itvstatic.com
- DOMAIN,itvpnpmobile-a.akamaihd.net - DOMAIN,itvpnpmobile-a.akamaihd.net
# > iQIYI
- DOMAIN-SUFFIX,iq.com
- DOMAIN,intl.iqiyi.com
- DOMAIN,intl-rcd.iqiyi.com
- DOMAIN,intl-subscription.iqiyi.com
- IP-CIDR,23.53.32.88/32,no-resolve
- IP-CIDR,23.211.15.99/32,no-resolve
- IP-CIDR,103.5.34.153/32,no-resolve
- IP-CIDR,104.109.129.153/32,no-resolve
- IP-CIDR,110.238.107.47/32,no-resolve
- IP-CIDR,118.26.32.178/32,no-resolve
- IP-CIDR,203.74.95.131/32,no-resolve
- IP-CIDR,203.74.95.139/32,no-resolve
- IP-CIDR,203.74.95.153/32,no-resolve
- IP-CIDR,203.211.4.169/32,no-resolve
- IP-CIDR,203.211.4.193/32,no-resolve
- IP-CIDR,210.71.227.200/32,no-resolve
- IP-CIDR,210.71.227.202/32,no-resolve
- IP-CIDR,210.201.32.8/32,no-resolve
- IP-CIDR,210.201.32.11/32,no-resolve
# > KKTV # > KKTV
# USER-AGENT,KKTV* - PROCESS-NAME,com.kktv.kktv
# USER-AGENT,com.kktv.ios.kktv*
- DOMAIN-SUFFIX,kktv.com.tw - DOMAIN-SUFFIX,kktv.com.tw
- DOMAIN-SUFFIX,kktv.me - DOMAIN-SUFFIX,kktv.me
- DOMAIN,kktv-theater.kk.stream - DOMAIN,kktv-theater.kk.stream
# > LINE TV # > LINE TV
# USER-AGENT,LINE%20TV* - PROCESS-NAME,com.linecorp.linetv
- DOMAIN-SUFFIX,linetv.tw - DOMAIN-SUFFIX,linetv.tw
- DOMAIN,d3c7rimkq79yfu.cloudfront.net - DOMAIN,d3c7rimkq79yfu.cloudfront.net
# > LiTV # > LiTV
- PROCESS-NAME,com.litv.mobile.gp.litv
- DOMAIN-SUFFIX,litv.tv - DOMAIN-SUFFIX,litv.tv
- DOMAIN,litvfreemobile-hichannel.cdn.hinet.net - DOMAIN,litvfreemobile-hichannel.cdn.hinet.net
# > My5 # > My5
# USER-AGENT,My5* - PROCESS-NAME,com.mobileiq.demand5
- DOMAIN-SUFFIX,channel5.com - DOMAIN-SUFFIX,channel5.com
- DOMAIN-SUFFIX,my5.tv - DOMAIN-SUFFIX,my5.tv
- DOMAIN,d349g9zuie06uo.cloudfront.net - DOMAIN,d349g9zuie06uo.cloudfront.net
# > myTV SUPER # > myTV SUPER
# USER-AGENT,mytv* - PROCESS-NAME,com.tvb.mytvsuper
- DOMAIN-SUFFIX,mytvsuper.com - DOMAIN-SUFFIX,mytvsuper.com
- DOMAIN-SUFFIX,tvb.com - DOMAIN-SUFFIX,tvb.com
# > Naver TV
- PROCESS-NAME,com.nhn.android.naverplayer
- DOMAIN-SUFFIX,naver.com
- DOMAIN-SUFFIX,smartmediarep.com
# > Netflix # > Netflix
# USER-AGENT,Argo* - PROCESS-NAME,com.netflix.mediaclient
- DOMAIN-SUFFIX,netflix.com - DOMAIN-SUFFIX,netflix.com
- DOMAIN-SUFFIX,netflix.net - DOMAIN-SUFFIX,netflix.net
- DOMAIN-SUFFIX,nflxext.com - DOMAIN-SUFFIX,nflxext.com
@ -190,73 +248,85 @@ payload:
- DOMAIN-SUFFIX,nflximg.net - DOMAIN-SUFFIX,nflximg.net
- DOMAIN-SUFFIX,nflxso.net - DOMAIN-SUFFIX,nflxso.net
- DOMAIN-SUFFIX,nflxvideo.net - DOMAIN-SUFFIX,nflxvideo.net
- DOMAIN-SUFFIX,netflixdnstest0.com - DOMAIN-KEYWORD,netflixdnstest
- DOMAIN-SUFFIX,netflixdnstest1.com - DOMAIN-KEYWORD,apiproxy-device-prod-nlb-
- DOMAIN-SUFFIX,netflixdnstest2.com - DOMAIN-KEYWORD,dualstack.apiproxy-
- DOMAIN-SUFFIX,netflixdnstest3.com - GEOIP,NETFLIX,no-resolve
- DOMAIN-SUFFIX,netflixdnstest4.com
- DOMAIN-SUFFIX,netflixdnstest5.com
- DOMAIN-SUFFIX,netflixdnstest6.com
- DOMAIN-SUFFIX,netflixdnstest7.com
- DOMAIN-SUFFIX,netflixdnstest8.com
- DOMAIN-SUFFIX,netflixdnstest9.com
- IP-CIDR,23.246.0.0/18,no-resolve
- IP-CIDR,37.77.184.0/21,no-resolve
- IP-CIDR,45.57.0.0/17,no-resolve
- IP-CIDR,64.120.128.0/17,no-resolve
- IP-CIDR,66.197.128.0/17,no-resolve
- IP-CIDR,108.175.32.0/20,no-resolve
- IP-CIDR,192.173.64.0/18,no-resolve
- IP-CIDR,198.38.96.0/19,no-resolve
- IP-CIDR,198.45.48.0/20,no-resolve
# > niconico # > niconico
# USER-AGENT,Niconico* - PROCESS-NAME,jp.nicovideo.android
- DOMAIN-SUFFIX,dmc.nico - DOMAIN-SUFFIX,dmc.nico
- DOMAIN-SUFFIX,nicovideo.jp - DOMAIN-SUFFIX,nicovideo.jp
- DOMAIN-SUFFIX,nimg.jp - DOMAIN-SUFFIX,nimg.jp
- DOMAIN-SUFFIX,socdm.com
# > Now E # > Now E
- PROCESS-NAME,com.pccw.nowemobile
- DOMAIN-SUFFIX,nowe.com - DOMAIN-SUFFIX,nowe.com
- DOMAIN-SUFFIX,nowestatic.com - DOMAIN-SUFFIX,nowestatic.com
# > Paramount+
- PROCESS-NAME,com.cbs.app
- DOMAIN-SUFFIX,cbsi.com
- DOMAIN-SUFFIX,cbsaavideo.com
- DOMAIN-SUFFIX,cbsivideo.com
- DOMAIN-SUFFIX,paramountplus.com
- DOMAIN-SUFFIX,pplusstatic.com
- DOMAIN,cbsi.live.ott.irdeto.com
- DOMAIN,cbsplaylistserver.aws.syncbak.com
- DOMAIN,cbsservice.aws.syncbak.com
- DOMAIN,link.theplatform.com
# > PBS # > PBS
# USER-AGENT,PBS* - PROCESS-NAME,com.pbs.video
- DOMAIN-SUFFIX,pbs.org - DOMAIN-SUFFIX,pbs.org
# > Peacock
- PROCESS-NAME,com.peacocktv.peacockandroid
- DOMAIN-SUFFIX,peacocktv.com
# > Pornhub # > Pornhub
- DOMAIN-SUFFIX,phncdn.com - DOMAIN-SUFFIX,phncdn.com
- DOMAIN-SUFFIX,phprcdn.com - DOMAIN-SUFFIX,phprcdn.com
- DOMAIN-SUFFIX,pornhub.com - DOMAIN-SUFFIX,pornhub.com
- DOMAIN-SUFFIX,pornhubpremium.com - DOMAIN-SUFFIX,pornhubpremium.com
# > 台湾好 # > 台湾好
# USER-AGENT,TaiwanGood* - PROCESS-NAME,com.twgood.android
- DOMAIN-SUFFIX,skyking.com.tw - DOMAIN-SUFFIX,skyking.com.tw
- DOMAIN,hamifans.emome.net - DOMAIN,hamifans.emome.net
# > TikTok # > TikTok
# USER-AGENT,TikTok* - PROCESS-NAME,com.ss.android.ugc.trill
- DOMAIN-SUFFIX,byteoversea.com - DOMAIN-SUFFIX,byteoversea.com
- DOMAIN-SUFFIX,ibytedtos.com - DOMAIN-SUFFIX,ibytedtos.com
- DOMAIN-SUFFIX,ipstatp.com
- DOMAIN-SUFFIX,muscdn.com - DOMAIN-SUFFIX,muscdn.com
- DOMAIN-SUFFIX,musical.ly - DOMAIN-SUFFIX,musical.ly
- DOMAIN-SUFFIX,tiktok.com - DOMAIN-SUFFIX,tiktok.com
- DOMAIN-SUFFIX,tik-tokapi.com
- DOMAIN-SUFFIX,tiktokcdn.com - DOMAIN-SUFFIX,tiktokcdn.com
- DOMAIN-SUFFIX,tiktokv.com - DOMAIN-SUFFIX,tiktokv.com
- DOMAIN-KEYWORD,-tiktokcdn-com - DOMAIN-KEYWORD,tiktokcdn-
# > Twitch # > TVer
- DOMAIN-SUFFIX,jtvnw.net - PROCESS-NAME,jp.hamitv.hamiand1
- DOMAIN-SUFFIX,ttvnw.net - DOMAIN-SUFFIX,tver.jp
- DOMAIN-SUFFIX,twitch.tv - DOMAIN,edge.api.brightcove.com
- DOMAIN-SUFFIX,twitchcdn.net
# > ViuTV # > ViuTV
# USER-AGENT,Viu* - PROCESS-NAME,com.hktve.viutv
- DOMAIN-SUFFIX,viu.com - DOMAIN-SUFFIX,viu.com
- DOMAIN-SUFFIX,viu.tv - DOMAIN-SUFFIX,viu.tv
- DOMAIN,api.viu.now.com - DOMAIN,api.viu.now.com
- DOMAIN,d1k2us671qcoau.cloudfront.net - DOMAIN,d1k2us671qcoau.cloudfront.net
- DOMAIN,d2anahhhmp1ffz.cloudfront.net - DOMAIN,d2anahhhmp1ffz.cloudfront.net
- DOMAIN,dfp6rglgjqszk.cloudfront.net - DOMAIN,dfp6rglgjqszk.cloudfront.net
# > WeTV
- PROCESS-NAME,com.tencent.qqlivei18n
- DOMAIN-SUFFIX,wetv.vip
- DOMAIN-SUFFIX,wetvinfo.com
- IP-CIDR,150.109.28.51/32,no-resolve
# > YouTube # > YouTube
# USER-AGENT,com.google.ios.youtube* - PROCESS-NAME,com.google.android.youtube
# USER-AGENT,YouTube* - PROCESS-NAME,com.google.android.youtube.tv
- DOMAIN-SUFFIX,googlevideo.com - DOMAIN-SUFFIX,googlevideo.com
- DOMAIN-SUFFIX,withyoutube.com
- DOMAIN-SUFFIX,youtu.be
- DOMAIN-SUFFIX,youtube.com - DOMAIN-SUFFIX,youtube.com
- DOMAIN,youtubei.googleapis.com - DOMAIN-SUFFIX,youtubeeducation.com
- DOMAIN-SUFFIX,youtubegaming.com
- DOMAIN-SUFFIX,youtubekids.com
- DOMAIN-SUFFIX,youtube-nocookie.com
- DOMAIN-SUFFIX,yt.be
- DOMAIN-SUFFIX,ytimg.com
- DOMAIN,youtubei.googleapis.com
- DOMAIN,yt3.ggpht.com

View File

@ -1,10 +1,20 @@
payload: payload:
# > bilibili # > bilibili
- DOMAIN-SUFFIX,biliapi.net - DOMAIN,api.biliapi.com
- DOMAIN-SUFFIX,bilibili.com - DOMAIN,api.biliapi.net
- DOMAIN-KEYWORD,cn-hk-eq-bcache- - DOMAIN,api.bilibili.com
- DOMAIN,app.biliapi.com
- DOMAIN,app.biliapi.net
- DOMAIN,app.bilibili.com
- DOMAIN,grpc.biliapi.net
- DOMAIN,m.bilibili.com
- DOMAIN,upos-hz-mirrorakam.akamaized.net - DOMAIN,upos-hz-mirrorakam.akamaized.net
- DOMAIN,www.bilibili.com
- DOMAIN-KEYWORD,cn-hk-eq-bcache-
# > 愛奇藝台灣站 # > 愛奇藝台灣站
- DOMAIN,cache.video.iqiyi.com - DOMAIN,cache.video.iqiyi.com
- IP-CIDR,116.211.202.206/32,no-resolve - IP-CIDR,116.211.202.206/32,no-resolve
- IP-CIDR,116.211.202.216/32,no-resolve - IP-CIDR,116.211.202.216/32,no-resolve
# > MangoTV(芒果TV国际)
- DOMAIN-SUFFIX,api.mgtv.com
- DOMAIN,mobileso.bz.mgtv.com

View File

@ -7,6 +7,7 @@ payload:
- DOMAIN-SUFFIX,telegram.me - DOMAIN-SUFFIX,telegram.me
- DOMAIN-SUFFIX,telegram.org - DOMAIN-SUFFIX,telegram.org
- DOMAIN-SUFFIX,telegram-cdn.org - DOMAIN-SUFFIX,telegram-cdn.org
- DOMAIN-SUFFIX,telesco.pe
- IP-CIDR,91.105.192.0/23,no-resolve - IP-CIDR,91.105.192.0/23,no-resolve
- IP-CIDR,91.108.56.0/22,no-resolve - IP-CIDR,91.108.56.0/22,no-resolve

View File

@ -1,4 +1,4 @@
payload: payload:
# > Tencent Video # > Tencent Video
- DOMAIN-SUFFIX,v.smtcdns.com - DOMAIN-SUFFIX,v.smtcdns.com
- DOMAIN-SUFFIX,vv.video.qq.com - DOMAIN-SUFFIX,vv.video.qq.com

View File

@ -1,15 +1,5 @@
payload: payload:
# Unbreak # Unbreak
# > General
# USER-AGENT,archero*
# USER-AGENT,coffeecorp*
# USER-AGENT,Coffee%20Corp*
# USER-AGENT,restaurant-mobile*
- DOMAIN,app.adjust.com
- DOMAIN,bdtj.tagtic.cn
# > Alibaba
- DOMAIN,log.mmstat.com
- DOMAIN,sycm.mmstat.com
# > Google # > Google
- DOMAIN-SUFFIX,blog.google - DOMAIN-SUFFIX,blog.google
- DOMAIN-SUFFIX,googletraveladservices.com - DOMAIN-SUFFIX,googletraveladservices.com
@ -18,9 +8,6 @@ payload:
- DOMAIN,dl.l.google.com - DOMAIN,dl.l.google.com
- DOMAIN,update.googleapis.com - DOMAIN,update.googleapis.com
- DOMAIN,translate.googleapis.com - DOMAIN,translate.googleapis.com
# >> Google Fonts API
- DOMAIN,fonts.googleapis.com
- DOMAIN,fonts.gstatic.com
# >> Firebase Cloud Messaging # >> Firebase Cloud Messaging
- DOMAIN,mtalk.google.com - DOMAIN,mtalk.google.com
- DOMAIN,alt1-mtalk.google.com - DOMAIN,alt1-mtalk.google.com
@ -30,15 +17,4 @@ payload:
- DOMAIN,alt5-mtalk.google.com - DOMAIN,alt5-mtalk.google.com
- DOMAIN,alt6-mtalk.google.com - DOMAIN,alt6-mtalk.google.com
- DOMAIN,alt7-mtalk.google.com - DOMAIN,alt7-mtalk.google.com
- DOMAIN,alt8-mtalk.google.com - DOMAIN,alt8-mtalk.google.com
# >> Paramount+
- DOMAIN,pubads.g.doubleclick.net
# > Tencent
- DOMAIN,fairplay.l.qq.com
- DOMAIN,livew.l.qq.com
- DOMAIN,vd.l.qq.com
# > Strava
- DOMAIN,analytics.strava.com
# > Umeng
- DOMAIN,msg.umeng.com
- DOMAIN,msg.umengcloud.com

View File

@ -1,4 +1,4 @@
payload: payload:
# > ViuTV # > ViuTV
- PROCESS-NAME,com.hktve.viutv - PROCESS-NAME,com.hktve.viutv

View File

@ -1,5 +1,5 @@
payload: payload:
# > WeTV # > WeTV
- PROCESS-NAME,com.tencent.qqlivei18n - PROCESS-NAME,com.tencent.qqlivei18n
- DOMAIN-SUFFIX,wetv.vip - DOMAIN-SUFFIX,wetv.vip
- DOMAIN-SUFFIX,wetvinfo.com - DOMAIN-SUFFIX,wetvinfo.com

View File

@ -1,15 +1,11 @@
payload: payload:
# > Youtube # > Youtube
- PROCESS-NAME,com.google.android.youtube - PROCESS-NAME,com.google.android.youtube
- PROCESS-NAME,com.google.android.youtube.tv - PROCESS-NAME,com.google.android.youtube.tv
- DOMAIN-SUFFIX,ggpht.cn
- DOMAIN-SUFFIX,ggpht.com
- DOMAIN-SUFFIX,googlevideo.com - DOMAIN-SUFFIX,googlevideo.com
- DOMAIN-SUFFIX,withyoutube.com - DOMAIN-SUFFIX,gvt1.com
- DOMAIN-SUFFIX,video.google.com
- DOMAIN-SUFFIX,youtu.be - DOMAIN-SUFFIX,youtu.be
- DOMAIN-SUFFIX,youtube
- DOMAIN-SUFFIX,youtube-nocookie.com
- DOMAIN-SUFFIX,youtube-ui.l.google.com
- DOMAIN-SUFFIX,youtube.ae - DOMAIN-SUFFIX,youtube.ae
- DOMAIN-SUFFIX,youtube.al - DOMAIN-SUFFIX,youtube.al
- DOMAIN-SUFFIX,youtube.am - DOMAIN-SUFFIX,youtube.am
@ -164,16 +160,10 @@ payload:
- DOMAIN-SUFFIX,youtube.vn - DOMAIN-SUFFIX,youtube.vn
- DOMAIN-SUFFIX,youtubeeducation.com - DOMAIN-SUFFIX,youtubeeducation.com
- DOMAIN-SUFFIX,youtubeembeddedplayer.googleapis.com - DOMAIN-SUFFIX,youtubeembeddedplayer.googleapis.com
- DOMAIN-SUFFIX,youtubefanfest.com
- DOMAIN-SUFFIX,youtubegaming.com
- DOMAIN-SUFFIX,youtubego.co.id
- DOMAIN-SUFFIX,youtubego.co.in
- DOMAIN-SUFFIX,youtubego.com
- DOMAIN-SUFFIX,youtubego.com.br
- DOMAIN-SUFFIX,youtubego.id
- DOMAIN-SUFFIX,youtubego.in
- DOMAIN-SUFFIX,youtubei.googleapis.com - DOMAIN-SUFFIX,youtubei.googleapis.com
- DOMAIN-SUFFIX,youtubekids.com - DOMAIN-SUFFIX,youtubekids.com
- DOMAIN-SUFFIX,youtubemobilesupport.com - DOMAIN-SUFFIX,youtube-nocookie.com
- DOMAIN-SUFFIX,youtube-ui.l.google.com
- DOMAIN-SUFFIX,yt.be - DOMAIN-SUFFIX,yt.be
- DOMAIN-SUFFIX,ytimg.com - DOMAIN-SUFFIX,yt3.ggpht.com
- DOMAIN-SUFFIX,ytimg.com

View File

@ -1,4 +1,4 @@
payload: payload:
# > Youku # > Youku
- DOMAIN-SUFFIX,youku.com - DOMAIN-SUFFIX,youku.com
- IP-CIDR,106.11.0.0/16,no-resolve - IP-CIDR,106.11.0.0/16,no-resolve

View File

@ -1,4 +1,4 @@
payload: payload:
# > encoreTVB # > encoreTVB
- PROCESS-NAME,com.tvbusa.encore - PROCESS-NAME,com.tvbusa.encore
- DOMAIN-SUFFIX,encoretvb.com - DOMAIN-SUFFIX,encoretvb.com

View File

@ -1,4 +1,4 @@
payload: payload:
# > myTV_SUPER # > myTV_SUPER
# - USER-AGENT,mytv* # - USER-AGENT,mytv*
- DOMAIN-KEYWORD,nowtv100 - DOMAIN-KEYWORD,nowtv100

View File

@ -44,7 +44,7 @@ EOF
source "/etc/openwrt_release" source "/etc/openwrt_release"
case "${DISTRIB_ARCH}" in case "${DISTRIB_ARCH}" in
aarch64_*) aarch64_*)
CORE_ARCH="linux-armv8" CORE_ARCH="linux-arm64"
;; ;;
arm_*_neon-vfp*) arm_*_neon-vfp*)
CORE_ARCH="linux-armv7" CORE_ARCH="linux-armv7"
@ -166,21 +166,11 @@ EOF
fi fi
#Set authentication #Set authentication
if [ -n "$(uci -q get openclash.@authentication[0].enabled)" ]; then
auth_info_get() auth_cfg=false
{ else
local section="$1" auth_cfg=true
config_get_bool "enabled" "$section" "enabled" "1" fi
if [ "$enabled" == "1" ]; then
auth_cfg=false
fi
return
}
auth_cfg=true
config_load "openclash"
config_foreach auth_info_get "authentication"
if $auth_cfg; then if $auth_cfg; then
uci_name_tmp=$(uci add openclash authentication) uci_name_tmp=$(uci add openclash authentication)

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
START_LOG="/tmp/openclash_start.log" START_LOG="/tmp/openclash_start.log"
en_mode=$(uci get openclash.config.en_mode 2>/dev/null) en_mode=$(uci -q get openclash.config.en_mode)
if pidof clash >/dev/null && [ -z "$(echo "$en_mode" |grep "redir-host")" ]; then if pidof clash >/dev/null && [ -z "$(echo "$en_mode" |grep "redir-host")" ]; then
rm -rf /tmp/dnsmasq.d/dnsmasq_openclash.conf >/dev/null 2>&1 rm -rf /tmp/dnsmasq.d/dnsmasq_openclash.conf >/dev/null 2>&1

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
set_lock() { set_lock() {
exec 884>"/tmp/lock/openclash_clash_version.lock" 2>/dev/null exec 884>"/tmp/lock/openclash_clash_version.lock" 2>/dev/null
@ -14,28 +14,30 @@ CKTIME=$(date "+%Y-%m-%d-%H")
LAST_OPVER="/tmp/clash_last_version" LAST_OPVER="/tmp/clash_last_version"
RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master") RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master")
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0) github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
LOG_FILE="/tmp/openclash.log"
set_lock set_lock
if [ "$CKTIME" != "$(grep "CheckTime" $LAST_OPVER 2>/dev/null |awk -F ':' '{print $2}')" ]; then if [ "$CKTIME" != "$(grep "CheckTime" $LAST_OPVER 2>/dev/null |awk -F ':' '{print $2}')" ]; then
if [ "$github_address_mod" != "0" ]; then if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -sL -m 10 https://cdn.jsdelivr.net/gh/vernesong/OpenClash@"$RELEASE_BRANCH"/core_version -o $LAST_OPVER >/dev/null 2>&1 curl -SsL -m 10 "$github_address_mod"gh/vernesong/OpenClash@"$RELEASE_BRANCH"/core_version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ]; then
curl -sL -m 10 https://fastly.jsdelivr.net/gh/vernesong/OpenClash@"$RELEASE_BRANCH"/core_version -o $LAST_OPVER >/dev/null 2>&1
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -sL -m 10 https://raw.fastgit.org/vernesong/OpenClash/"$RELEASE_BRANCH"/core_version -o $LAST_OPVER >/dev/null 2>&1 curl -SsL -m 10 https://raw.fastgit.org/vernesong/OpenClash/"$RELEASE_BRANCH"/core_version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else else
curl -sL -m 10 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core_version -o $LAST_OPVER >/dev/null 2>&1 curl -SsL -m 10 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core_version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
else else
curl -sL -m 10 https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core_version -o $LAST_OPVER >/dev/null 2>&1 curl -SsL -m 10 https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core_version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
if [ "$?" != "0" ] || [ -n "$(cat $LAST_OPVER |grep '<html>')" ]; then if [ "${PIPESTATUS[0]}" -ne 0 ] || [ -n "$(cat $LAST_OPVER |grep '<html>')" ]; then
curl -sL -m 10 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/core_version -o $LAST_OPVER >/dev/null 2>&1 curl -SsL -m 10 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/core_version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
curl_status=${PIPESTATUS[0]}
else
curl_status=0
fi fi
if [ "$?" == "0" ] && [ -z "$(cat $LAST_OPVER |grep '<html>')" ]; then if [ "$curl_status" -eq 0 ] && [ -z "$(cat $LAST_OPVER |grep '<html>')" ]; then
echo "CheckTime:$CKTIME" >>$LAST_OPVER echo "CheckTime:$CKTIME" >>$LAST_OPVER
else else
rm -rf $LAST_OPVER rm -rf $LAST_OPVER

View File

@ -24,8 +24,15 @@ dns_port=$(uci -q get openclash.config.dns_port)
enable_redirect_dns=$(uci -q get openclash.config.enable_redirect_dns) enable_redirect_dns=$(uci -q get openclash.config.enable_redirect_dns)
disable_masq_cache=$(uci -q get openclash.config.disable_masq_cache) disable_masq_cache=$(uci -q get openclash.config.disable_masq_cache)
default_resolvfile=$(uci -q get openclash.config.default_resolvfile) default_resolvfile=$(uci -q get openclash.config.default_resolvfile)
en_mode=$(uci -q get openclash.config.en_mode)
china_ip_route=$(uci -q get openclash.config.china_ip_route)
ipv6_enable=$(uci -q get openclash.config.ipv6_enable)
FW4="$(command -v fw4)" FW4="$(command -v fw4)"
if_restart=0 DNSPORT=$(uci -q get dhcp.@dnsmasq[0].port)
if [ -z "$DNSPORT" ]; then
DNSPORT=$(netstat -nlp |grep -E '127.0.0.1:.*dnsmasq' |awk -F '127.0.0.1:' '{print $2}' |awk '{print $1}' |head -1 || echo 53)
fi
restart=0
only_download=0 only_download=0
set_lock set_lock
@ -55,15 +62,15 @@ config_download()
{ {
if [ -n "$subscribe_url_param" ]; then if [ -n "$subscribe_url_param" ]; then
if [ -n "$c_address" ]; then if [ -n "$c_address" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 -H 'User-Agent: Clash' "$c_address""$subscribe_url_param" -o "$CFG_FILE" >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 -H 'User-Agent: Clash' "$c_address""$subscribe_url_param" -o "$CFG_FILE" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$CFG_FILE" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 -H 'User-Agent: Clash' https://api.dler.io/sub"$subscribe_url_param" -o "$CFG_FILE" >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 -H 'User-Agent: Clash' https://api.dler.io/sub"$subscribe_url_param" -o "$CFG_FILE" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$CFG_FILE" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
if [ "$?" -ne 0 ]; then if [ "$?" -ne 0 ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 -H 'User-Agent: Clash' https://subconverter.herokuapp.com/sub"$subscribe_url_param" -o "$CFG_FILE" >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 -H 'User-Agent: Clash' https://subconverter.herokuapp.com/sub"$subscribe_url_param" -o "$CFG_FILE" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$CFG_FILE" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
fi fi
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 -H 'User-Agent: Clash' "$subscribe_url" -o "$CFG_FILE" >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 -H 'User-Agent: Clash' "$subscribe_url" -o "$CFG_FILE" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$CFG_FILE" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
} }
@ -131,15 +138,13 @@ config_cus_up()
uci commit openclash uci commit openclash
/usr/share/openclash/yml_groups_set.sh /usr/share/openclash/yml_groups_set.sh
if [ "$CONFIG_FILE" == "$CONFIG_PATH" ]; then if [ "$CONFIG_FILE" == "$CONFIG_PATH" ]; then
if_restart=1 restart=1
fi fi
LOG_OUT "Config File【$name】Update Successful!" LOG_OUT "Config File【$name】Update Successful!"
sleep 3
SLOG_CLEAN SLOG_CLEAN
elif [ "$CONFIG_FILE" == "$CONFIG_PATH" ]; then elif [ "$CONFIG_FILE" == "$CONFIG_PATH" ]; then
LOG_OUT "Config File【$name】Update Successful!" LOG_OUT "Config File【$name】Update Successful!"
sleep 3 restart=1
if_restart=1
else else
LOG_OUT "Config File【$name】Update Successful!" LOG_OUT "Config File【$name】Update Successful!"
sleep 3 sleep 3
@ -148,8 +153,7 @@ config_cus_up()
else else
if [ "$CONFIG_FILE" == "$CONFIG_PATH" ]; then if [ "$CONFIG_FILE" == "$CONFIG_PATH" ]; then
LOG_OUT "Config File【$name】Update Successful!" LOG_OUT "Config File【$name】Update Successful!"
sleep 3 restart=1
if_restart=1
else else
LOG_OUT "Config File【$name】Update Successful!" LOG_OUT "Config File【$name】Update Successful!"
sleep 3 sleep 3
@ -241,7 +245,7 @@ change_dns()
if [ -n "$FW4" ]; then if [ -n "$FW4" ]; then
for nft in "nat_output" "mangle_output"; do for nft in "nat_output" "mangle_output"; do
local handles=$(nft -a list chain inet fw4 ${nft} |grep -E "openclash|OpenClash" |awk -F '# handle ' '{print$2}') local handles=$(nft -a list chain inet fw4 ${nft} |grep -E "openclash|OpenClash" |grep -v "OpenClash DNS Hijack" |awk -F '# handle ' '{print$2}')
for handle in $handles; do for handle in $handles; do
nft delete rule inet fw4 ${nft} handle ${handle} nft delete rule inet fw4 ${nft} handle ${handle}
done done
@ -257,8 +261,10 @@ change_dns()
else else
iptables -t nat -D OUTPUT -j openclash_output >/dev/null 2>&1 iptables -t nat -D OUTPUT -j openclash_output >/dev/null 2>&1
iptables -t mangle -D OUTPUT -j openclash_output >/dev/null 2>&1 iptables -t mangle -D OUTPUT -j openclash_output >/dev/null 2>&1
ip6tables -t mangle -D OUTPUT -j openclash_output >/dev/null 2>&1
iptables -t nat -A OUTPUT -j openclash_output >/dev/null 2>&1 iptables -t nat -A OUTPUT -j openclash_output >/dev/null 2>&1
iptables -t mangle -A OUTPUT -j openclash_output >/dev/null 2>&1 iptables -t mangle -A OUTPUT -j openclash_output >/dev/null 2>&1
ip6tables -t mangle -A OUTPUT -j openclash_output >/dev/null 2>&1
fi fi
[ "$(unify_ps_status "openclash_watchdog.sh")" -eq 0 ] && [ "$(unify_ps_prevent)" -eq 0 ] && nohup /usr/share/openclash/openclash_watchdog.sh & [ "$(unify_ps_status "openclash_watchdog.sh")" -eq 0 ] && [ "$(unify_ps_prevent)" -eq 0 ] && nohup /usr/share/openclash/openclash_watchdog.sh &
fi fi
@ -332,15 +338,66 @@ EOF
nft delete rule inet fw4 ${nft} handle ${handle} nft delete rule inet fw4 ${nft} handle ${handle}
done done
done >/dev/null 2>&1 done >/dev/null 2>&1
if [ -z "$(echo "$en_mode" |grep "redir-host")" ] && [ "$china_ip_route" -eq 1 ]; then
LOG_OUT "Tip: Bypass the China IP May Cause the Dnsmasq Load For a Long Time After Restart in FAKE-IP Mode, Hijack the DNS to Core Untill the Dnsmasq Works Well..."
handles=$(nft -a list chain inet fw4 dstnat |grep "OpenClash DNS Hijack" |awk -F '# handle ' '{print$2}')
for handle in $handles; do
nft delete rule inet fw4 dstnat handle ${handle}
done >/dev/null 2>&1
position=$(nft list chain inet fw4 dstnat |grep "OpenClash" |grep "DNS" |awk -F '# handle ' '{print$2}' |sort -rn |head -1 || ehco 0)
nft add rule inet fw4 dstnat position "$position" tcp dport 53 redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 dstnat position "$position" udp dport 53 redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft 'add chain inet fw4 nat_output { type nat hook output priority -1; }' 2>/dev/null
nft add rule inet fw4 nat_output position 0 tcp dport 53 meta skuid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 nat_output position 0 udp dport 53 meta skuid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 nat_output position 0 tcp dport 5353 meta skuid != 65534 counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 nat_output position 0 udp dport 5353 meta skuid != 65534 counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
if [ "$ipv6_enable" -eq 1 ]; then
nft add rule inet fw4 dstnat position "$position" meta nfproto {ipv6} tcp dport 53 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 dstnat position "$position" meta nfproto {ipv6} udp dport 53 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 nat_output position 0 meta nfproto {ipv6} tcp dport 53 meta skuid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 nat_output position 0 meta nfproto {ipv6} udp dport 53 meta skuid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
fi
fi
else else
iptables -t nat -D OUTPUT -j openclash_output >/dev/null 2>&1 iptables -t nat -D OUTPUT -j openclash_output >/dev/null 2>&1
iptables -t mangle -D OUTPUT -j openclash_output >/dev/null 2>&1 iptables -t mangle -D OUTPUT -j openclash_output >/dev/null 2>&1
ip6tables -t mangle -D OUTPUT -j openclash_output >/dev/null 2>&1
if [ -z "$(echo "$en_mode" |grep "redir-host")" ] && [ "$china_ip_route" -eq 1 ]; then
LOG_OUT "Tip: Bypass the China IP May Cause the Dnsmasq Load For a Long Time After Restart in FAKE-IP Mode, Hijack the DNS to Core Untill the Dnsmasq Works Well..."
for ipt in "iptables -nvL OUTPUT -t nat" "iptables -nvL PREROUTING -t nat" "ip6tables -nvL PREROUTING -t nat" "ip6tables -nvL OUTPUT -t nat"; do
for comment in "OpenClash DNS Hijack"; do
local lines=$($ipt |sed 1,2d |sed -n "/${comment}/=" 2>/dev/null |sort -rn)
if [ -n "$lines" ]; then
for line in $lines; do
$(echo "$ipt" |awk -v OFS=" " '{print $1,$4,$5}' |sed 's/[ ]*$//g') -D $(echo "$ipt" |awk '{print $3}') $line
done
fi
done
done >/dev/null 2>&1
position=$(iptables -nvL PREROUTING -t nat |sed 1,2d |grep "OpenClash" |sed -n "/DNS/=" 2>/dev/null |sort -rn |head -1 || ehco 0)
[ "$position" -ne 0 ] && let position++
iptables -t nat -I PREROUTING "$position" -p udp --dport 53 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
iptables -t nat -I PREROUTING "$position" -p tcp --dport 53 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
iptables -t nat -I OUTPUT -p udp --dport 53 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
iptables -t nat -I OUTPUT -p tcp --dport 53 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
iptables -t nat -I OUTPUT -p udp --dport 5353 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
iptables -t nat -I OUTPUT -p tcp --dport 5353 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
if [ "$ipv6_enable" -eq 1 ]; then
position=$(ip6tables -nvL PREROUTING -t nat |sed 1,2d |grep "OpenClash" |sed -n "/DNS/=" 2>/dev/null |sort -rn |head -1 || ehco 0)
[ "$position" -ne 0 ] && let position++
ip6tables -t nat -I PREROUTING "$position" -p udp --dport 53 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
ip6tables -t nat -I PREROUTING "$position" -p tcp --dport 53 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
ip6tables -t nat -I OUTPUT -p udp --dport 53 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
ip6tables -t nat -I OUTPUT -p tcp --dport 53 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
fi
fi
fi fi
sleep 3 sleep 3
config_download config_download
if [ "$?" -eq 0 ] && [ -s "$CFG_FILE" ]; then if [ "${PIPESTATUS[0]}" -eq 0 ] && [ -s "$CFG_FILE" ]; then
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e " ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
begin begin
YAML.load_file('$CFG_FILE'); YAML.load_file('$CFG_FILE');
@ -518,7 +575,7 @@ sub_info_get()
config_download config_download
if [ "$?" -eq 0 ] && [ -s "$CFG_FILE" ]; then if [ "${PIPESTATUS[0]}" -eq 0 ] && [ -s "$CFG_FILE" ]; then
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e " ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
begin begin
YAML.load_file('$CFG_FILE'); YAML.load_file('$CFG_FILE');
@ -560,8 +617,15 @@ config_foreach sub_info_get "config_subscribe"
uci -q delete openclash.config.config_update_path uci -q delete openclash.config.config_update_path
uci commit openclash uci commit openclash
if [ "$if_restart" -eq 1 ]; then if [ "$restart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 & /etc/init.d/openclash restart >/dev/null 2>&1 &
elif [ "$restart" -eq 0 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ] && [ "$(uci -q get openclash.config.restart)" -eq 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
uci -q set openclash.config.restart=0
uci -q commit openclash
elif [ "$restart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -gt 1 ]; then
uci -q set openclash.config.restart=1
uci -q commit openclash
else else
sed -i '/openclash.sh/d' $CRON_FILE 2>/dev/null sed -i '/openclash.sh/d' $CRON_FILE 2>/dev/null
[ "$(uci -q get openclash.config.auto_update)" -eq 1 ] && [ "$(uci -q get openclash.config.config_auto_update_mode)" -ne 1 ] && echo "0 $(uci -q get openclash.config.auto_update_time) * * $(uci -q get openclash.config.config_update_week_time) /usr/share/openclash/openclash.sh" >> $CRON_FILE [ "$(uci -q get openclash.config.auto_update)" -eq 1 ] && [ "$(uci -q get openclash.config.config_auto_update_mode)" -ne 1 ] && echo "0 $(uci -q get openclash.config.auto_update_time) * * $(uci -q get openclash.config.config_update_week_time) /usr/share/openclash/openclash.sh" >> $CRON_FILE

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
. /usr/share/openclash/openclash_ps.sh . /usr/share/openclash/openclash_ps.sh
. /usr/share/openclash/log.sh . /usr/share/openclash/log.sh
@ -14,36 +14,43 @@
rm -rf "/tmp/lock/openclash_chn.lock" rm -rf "/tmp/lock/openclash_chn.lock"
} }
china_ip_route=$(uci get openclash.config.china_ip_route 2>/dev/null) china_ip_route=$(uci -q get openclash.config.china_ip_route)
china_ip6_route=$(uci get openclash.config.china_ip6_route 2>/dev/null) china_ip6_route=$(uci -q get openclash.config.china_ip6_route)
CHNR_CUSTOM_URL=$(uci get openclash.config.chnr_custom_url 2>/dev/null) CHNR_CUSTOM_URL=$(uci -q get openclash.config.chnr_custom_url)
CHNR6_CUSTOM_URL=$(uci get openclash.config.chnr6_custom_url 2>/dev/null) CHNR6_CUSTOM_URL=$(uci -q get openclash.config.chnr6_custom_url)
disable_udp_quic=$(uci get openclash.config.disable_udp_quic 2>/dev/null) CNDOMAIN_CUSTOM_URL=$(uci -q get openclash.config.cndomain_custom_url)
small_flash_memory=$(uci get openclash.config.small_flash_memory 2>/dev/null) disable_udp_quic=$(uci -q get openclash.config.disable_udp_quic)
small_flash_memory=$(uci -q get openclash.config.small_flash_memory)
en_mode=$(uci -q get openclash.config.en_mode)
LOG_FILE="/tmp/openclash.log"
restart=0
set_lock set_lock
if [ "$small_flash_memory" != "1" ]; then if [ "$small_flash_memory" != "1" ]; then
chnr_path="/etc/openclash/china_ip_route.ipset" chnr_path="/etc/openclash/china_ip_route.ipset"
chnr6_path="/etc/openclash/china_ip6_route.ipset" chnr6_path="/etc/openclash/china_ip6_route.ipset"
mkdir -p /etc/openclash cndomain_path="/etc/openclash/accelerated-domains.china.conf"
mkdir -p /etc/openclash
else else
chnr_path="/tmp/etc/openclash/china_ip_route.ipset" chnr_path="/tmp/etc/openclash/china_ip_route.ipset"
chnr6_path="/tmp/etc/openclash/china_ip6_route.ipset" chnr6_path="/tmp/etc/openclash/china_ip6_route.ipset"
mkdir -p /tmp/etc/openclash cndomain_path="/tmp/etc/openclash/accelerated-domains.china.conf"
mkdir -p /tmp/etc/openclash
fi fi
LOG_OUT "Start Downloading The Chnroute Cidr List..." LOG_OUT "Start Downloading The Chnroute Cidr List..."
if [ -z "$CHNR_CUSTOM_URL" ]; then if [ -z "$CHNR_CUSTOM_URL" ]; then
if pidof clash >/dev/null; then if pidof clash >/dev/null; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://ispip.clang.cn/all_cn.txt -o /tmp/china_ip_route.txt >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://ispip.clang.cn/all_cn.txt -o /tmp/china_ip_route.txt 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/china_ip_route.txt" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
if [ "$?" -ne "0" ] || ! pidof clash >/dev/null; then if [ "${PIPESTATUS[0]}" != "0" ] || ! pidof clash >/dev/null; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://ispip.clang.cn/all_cn_cidr.txt -o /tmp/china_ip_route.txt >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://ispip.clang.cn/all_cn_cidr.txt -o /tmp/china_ip_route.txt 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/china_ip_route.txt" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$CHNR_CUSTOM_URL" -o /tmp/china_ip_route.txt >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$CHNR_CUSTOM_URL" -o /tmp/china_ip_route.txt 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/china_ip_route.txt" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
if [ "$?" -eq "0" ] && [ -s "/tmp/china_ip_route.txt" ]; then
if [ "${PIPESTATUS[0]}" -eq 0 ] && [ -s "/tmp/china_ip_route.txt" ]; then
LOG_OUT "Chnroute Cidr List Download Success, Check Updated..." LOG_OUT "Chnroute Cidr List Download Success, Check Updated..."
#预处理 #预处理
if [ -n "$FW4" ]; then if [ -n "$FW4" ]; then
@ -61,10 +68,9 @@
LOG_OUT "Chnroute Cidr List Has Been Updated, Starting To Replace The Old Version..." LOG_OUT "Chnroute Cidr List Has Been Updated, Starting To Replace The Old Version..."
mv /tmp/china_ip_route.list "$chnr_path" >/dev/null 2>&1 mv /tmp/china_ip_route.list "$chnr_path" >/dev/null 2>&1
if [ "$china_ip_route" -eq 1 ] || [ "$disable_udp_quic" -eq 1 ]; then if [ "$china_ip_route" -eq 1 ] || [ "$disable_udp_quic" -eq 1 ]; then
[ "$(unify_ps_prevent)" -eq 0 ] && /etc/init.d/openclash restart >/dev/null 2>&1 & restart=1
fi fi
LOG_OUT "Chnroute Cidr List Update Successful!" LOG_OUT "Chnroute Cidr List Update Successful!"
sleep 3
else else
LOG_OUT "Updated Chnroute Cidr List No Change, Do Nothing..." LOG_OUT "Updated Chnroute Cidr List No Change, Do Nothing..."
sleep 3 sleep 3
@ -77,11 +83,11 @@
#ipv6 #ipv6
LOG_OUT "Start Downloading The Chnroute6 Cidr List..." LOG_OUT "Start Downloading The Chnroute6 Cidr List..."
if [ -z "$CHNR6_CUSTOM_URL" ]; then if [ -z "$CHNR6_CUSTOM_URL" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://ispip.clang.cn/all_cn_ipv6.txt -o /tmp/china_ip6_route.txt >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://ispip.clang.cn/all_cn_ipv6.txt -o /tmp/china_ip6_route.txt 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/china_ip6_route.txt" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$CHNR6_CUSTOM_URL" -o /tmp/china_ip6_route.txt >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$CHNR6_CUSTOM_URL" -o /tmp/china_ip6_route.txt 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/china_ip6_route.txt" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
if [ "$?" -eq "0" ] && [ -s "/tmp/china_ip6_route.txt" ]; then if [ "${PIPESTATUS[0]}" -eq "0" ] && [ -s "/tmp/china_ip6_route.txt" ]; then
LOG_OUT "Chnroute6 Cidr List Download Success, Check Updated..." LOG_OUT "Chnroute6 Cidr List Download Success, Check Updated..."
#预处理 #预处理
if [ -n "$FW4" ]; then if [ -n "$FW4" ]; then
@ -99,10 +105,9 @@
LOG_OUT "Chnroute6 Cidr List Has Been Updated, Starting To Replace The Old Version..." LOG_OUT "Chnroute6 Cidr List Has Been Updated, Starting To Replace The Old Version..."
mv /tmp/china_ip6_route.list "$chnr6_path" >/dev/null 2>&1 mv /tmp/china_ip6_route.list "$chnr6_path" >/dev/null 2>&1
if [ "$china_ip6_route" -eq 1 ] || [ "$disable_udp_quic" -eq 1 ]; then if [ "$china_ip6_route" -eq 1 ] || [ "$disable_udp_quic" -eq 1 ]; then
[ "$(unify_ps_prevent)" -eq 0 ] && /etc/init.d/openclash restart >/dev/null 2>&1 & restart=1
fi fi
LOG_OUT "Chnroute6 Cidr List Update Successful!" LOG_OUT "Chnroute6 Cidr List Update Successful!"
sleep 3
else else
LOG_OUT "Updated Chnroute6 Cidr List No Change, Do Nothing..." LOG_OUT "Updated Chnroute6 Cidr List No Change, Do Nothing..."
sleep 3 sleep 3
@ -111,6 +116,56 @@
LOG_OUT "Chnroute6 Cidr List Update Error, Please Try Again Later..." LOG_OUT "Chnroute6 Cidr List Update Error, Please Try Again Later..."
sleep 3 sleep 3
fi fi
#CN DOMAIN
LOG_OUT "Start Downloading The CN Domains List..."
if [ -n "$CNDOMAIN_CUSTOM_URL" ]; then
curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$CNDOMAIN_CUSTOM_URL" -o "/tmp/china_domains.list" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/china_domains.list" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"gh/felixonmars/dnsmasq-china-list@master/accelerated-domains.china.conf -o "/tmp/china_domains.list" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/china_domains.list" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.fastgit.org/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf -o "/tmp/china_domains.list" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/china_domains.list" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else
curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf -o "/tmp/china_domains.list" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/china_domains.list" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
else
curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf -o "/tmp/china_domains.list" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/china_domains.list" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
fi
if [ "${PIPESTATUS[0]}" -eq "0" ] && [ -s "/tmp/china_domains.list" ] && [ -n "$(cat "/tmp/china_domains.list" |head -1 |grep "server=")" ]; then
LOG_OUT "CN Domains List Download Success, Check Updated..."
cmp -s /tmp/china_domains.list "$cndomain_path"
if [ "$?" -ne "0" ]; then
LOG_OUT "CN Domains List Has Been Updated, Starting To Replace The Old Version..."
mv /tmp/china_domains.list "$cndomain_path" >/dev/null 2>&1
if [ "$china_ip_route" -eq 1 ] && [ -z "$(echo "$en_mode" |grep "redir-host")" ]; then
restart=1
fi
LOG_OUT "CN Domains List Update Successful!"
else
LOG_OUT "Updated CN Domains List No Change, Do Nothing..."
sleep 3
fi
else
LOG_OUT "CN Domains List Update Error, Please Try Again Later..."
sleep 3
fi
if [ "$restart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
elif [ "$restart" -eq 0 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ] && [ "$(uci -q get openclash.config.restart)" -eq 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
uci -q set openclash.config.restart=0
uci -q commit openclash
elif [ "$restart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ]; then
uci -q set openclash.config.restart=1
uci -q commit openclash
fi
rm -rf /tmp/china_ip*_route* >/dev/null 2>&1 rm -rf /tmp/china_ip*_route* >/dev/null 2>&1
rm -rf /tmp/china_domains.list >/dev/null 2>&1
SLOG_CLEAN SLOG_CLEAN
del_lock del_lock

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
. /lib/functions.sh . /lib/functions.sh
. /usr/share/openclash/openclash_ps.sh . /usr/share/openclash/openclash_ps.sh
. /usr/share/openclash/log.sh . /usr/share/openclash/log.sh
@ -10,6 +10,7 @@ small_flash_memory=$(uci -q get openclash.config.small_flash_memory)
CPU_MODEL=$(uci -q get openclash.config.core_version) CPU_MODEL=$(uci -q get openclash.config.core_version)
RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master") RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master")
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0) github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
LOG_FILE="/tmp/openclash.log"
[ ! -f "/tmp/clash_last_version" ] && /usr/share/openclash/clash_version.sh 2>/dev/null [ ! -f "/tmp/clash_last_version" ] && /usr/share/openclash/clash_version.sh 2>/dev/null
if [ ! -f "/tmp/clash_last_version" ]; then if [ ! -f "/tmp/clash_last_version" ]; then
@ -59,66 +60,69 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
"TUN") "TUN")
LOG_OUT "【TUN】Core Downloading, Please Try to Download and Upload Manually If Fails" LOG_OUT "【TUN】Core Downloading, Please Try to Download and Upload Manually If Fails"
if [ "$github_address_mod" != "0" ]; then if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -sL -m 30 --speed-time 15 --speed-limit 1 https://cdn.jsdelivr.net/gh/vernesong/OpenClash@"$RELEASE_BRANCH"/core-lateset/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz >/dev/null 2>&1 curl -SsL -m 30 --speed-time 15 --speed-limit 1 "$github_address_mod"gh/vernesong/OpenClash@"$RELEASE_BRANCH"/core-lateset/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_tun.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ]; then
curl -sL -m 30 --speed-time 15 --speed-limit 1 https://fastly.jsdelivr.net/gh/vernesong/OpenClash@"$RELEASE_BRANCH"/core-lateset/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz >/dev/null 2>&1
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -sL -m 30 --speed-time 15 --speed-limit 1 https://raw.fastgit.org/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz >/dev/null 2>&1 curl -SsL -m 30 --speed-time 15 --speed-limit 1 https://raw.fastgit.org/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_tun.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else else
curl -sL -m 30 --speed-time 15 --speed-limit 1 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz >/dev/null 2>&1 curl -SsL -m 30 --speed-time 15 --speed-limit 1 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_tun.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
else else
curl -sL -m 30 --speed-time 15 --speed-limit 1 https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz >/dev/null 2>&1 curl -SsL -m 30 --speed-time 15 --speed-limit 1 https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_tun.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
if [ "$?" != "0" ]; then if [ "${PIPESTATUS[0]}" -ne 0 ]; then
curl -sL -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/core-lateset/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz >/dev/null 2>&1 curl -SsL -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/core-lateset/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_tun.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
curl_status=${PIPESTATUS[0]}
else
curl_status=0
fi fi
if [ "$?" == "0" ]; then if [ "$curl_status" -eq 0 ]; then
gzip -t /tmp/clash_tun.gz >/dev/null 2>&1 gzip -t /tmp/clash_tun.gz >/dev/null 2>&1
fi fi
;; ;;
"Meta") "Meta")
LOG_OUT "【Meta】Core Downloading, Please Try to Download and Upload Manually If Fails" LOG_OUT "【Meta】Core Downloading, Please Try to Download and Upload Manually If Fails"
if [ "$github_address_mod" != "0" ]; then if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -sL -m 30 --speed-time 15 --speed-limit 1 https://cdn.jsdelivr.net/gh/vernesong/OpenClash@"$RELEASE_BRANCH"/core-lateset/meta/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_meta.tar.gz >/dev/null 2>&1 curl -SsL -m 30 --speed-time 15 --speed-limit 1 "$github_address_mod"gh/vernesong/OpenClash@"$RELEASE_BRANCH"/core-lateset/meta/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_meta.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_meta.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ]; then
curl -sL -m 30 --speed-time 15 --speed-limit 1 https://fastly.jsdelivr.net/gh/vernesong/OpenClash@"$RELEASE_BRANCH"/core-lateset/meta/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_meta.tar.gz >/dev/null 2>&1
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -sL -m 30 --speed-time 15 --speed-limit 1 https://raw.fastgit.org/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/meta/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_meta.tar.gz >/dev/null 2>&1 curl -SsL -m 30 --speed-time 15 --speed-limit 1 https://raw.fastgit.org/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/meta/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_meta.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_meta.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else else
curl -sL -m 30 --speed-time 15 --speed-limit 1 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/meta/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_meta.tar.gz >/dev/null 2>&1 curl -SsL -m 30 --speed-time 15 --speed-limit 1 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/meta/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_meta.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_meta.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
else else
curl -sL -m 30 --speed-time 15 --speed-limit 1 https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/meta/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_meta.tar.gz >/dev/null 2>&1 curl -SsL -m 30 --speed-time 15 --speed-limit 1 https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/meta/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_meta.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_meta.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
if [ "$?" != "0" ]; then if [ "${PIPESTATUS[0]}" -ne 0 ]; then
curl -sL -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/core-lateset/meta/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_meta.tar.gz >/dev/null 2>&1 curl -SsL -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/core-lateset/meta/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_meta.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_meta.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
curl_status=${PIPESTATUS[0]}
else
curl_status=0
fi fi
if [ "$?" == "0" ]; then if [ "$curl_status" -eq 0 ]; then
gzip -t /tmp/clash_meta.tar.gz >/dev/null 2>&1 gzip -t /tmp/clash_meta.tar.gz >/dev/null 2>&1
fi fi
;; ;;
*) *)
LOG_OUT "【Dev】Core Downloading, Please Try to Download and Upload Manually If Fails" LOG_OUT "【Dev】Core Downloading, Please Try to Download and Upload Manually If Fails"
if [ "$github_address_mod" != "0" ]; then if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -sL -m 30 --speed-time 15 --speed-limit 1 https://cdn.jsdelivr.net/gh/vernesong/OpenClash@"$RELEASE_BRANCH"/core-lateset/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz >/dev/null 2>&1 curl -SsL -m 30 --speed-time 15 --speed-limit 1 "$github_address_mod"gh/vernesong/OpenClash@"$RELEASE_BRANCH"/core-lateset/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ]; then
curl -sL -m 30 --speed-time 15 --speed-limit 1 https://fastly.jsdelivr.net/gh/vernesong/OpenClash@"$RELEASE_BRANCH"/core-lateset/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz >/dev/null 2>&1
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -sL -m 30 --speed-time 15 --speed-limit 1 https://raw.fastgit.org/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz >/dev/null 2>&1 curl -SsL -m 30 --speed-time 15 --speed-limit 1 https://raw.fastgit.org/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else else
curl -sL -m 30 --speed-time 15 --speed-limit 1 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz >/dev/null 2>&1 curl -SsL -m 30 --speed-time 15 --speed-limit 1 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
else else
curl -sL -m 30 --speed-time 15 --speed-limit 1 https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz >/dev/null 2>&1 curl -SsL -m 30 --speed-time 15 --speed-limit 1 https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
if [ "$?" != "0" ]; then if [ "${PIPESTATUS[0]}" -ne 0 ]; then
curl -sL -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/core-lateset/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz >/dev/null 2>&1 curl -SsL -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/core-lateset/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi curl_status=${PIPESTATUS[0]}
if [ "$?" == "0" ]; then else
curl_status=0
fi
if [ "$curl_status" -eq 0 ]; then
gzip -t /tmp/clash.tar.gz >/dev/null 2>&1 gzip -t /tmp/clash.tar.gz >/dev/null 2>&1
fi fi
esac esac
@ -184,7 +188,7 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
if [ "$if_restart" -eq 1 ]; then if [ "$if_restart" -eq 1 ]; then
uci -q set openclash.config.config_reload=0 uci -q set openclash.config.config_reload=0
uci -q commit openclash uci -q commit openclash
if [ -z "$2" ] && [ "$1" != "one_key_update" ] && [ "$(unify_ps_prevent)" -eq 0 ]; then if [ -z "$2" ] && [ "$1" != "one_key_update" ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ] && [ "$(unify_ps_prevent)" -eq 0 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 & /etc/init.d/openclash restart >/dev/null 2>&1 &
fi fi
else else

View File

@ -345,7 +345,7 @@ cat >> "$DEBUG_LOG" <<-EOF
EOF EOF
for nft in "input" "forward" "dstnat" "srcnat" "nat_output" "mangle_prerouting" "mangle_output"; do for nft in "input" "forward" "dstnat" "srcnat" "nat_output" "mangle_prerouting" "mangle_output"; do
nft list chain inet fw4 dstnat >> "$DEBUG_LOG" 2>/dev/null nft list chain inet fw4 "$nft" >> "$DEBUG_LOG" 2>/dev/null
done >/dev/null 2>&1 done >/dev/null 2>&1
fi fi
@ -414,7 +414,7 @@ cat >> "$DEBUG_LOG" <<-EOF
#===================== 测试本机网络连接 =====================# #===================== 测试本机网络连接 =====================#
EOF EOF
curl -I -m 5 www.baidu.com >> "$DEBUG_LOG" 2>/dev/null curl -SsI -m 5 www.baidu.com >> "$DEBUG_LOG" 2>/dev/null
cat >> "$DEBUG_LOG" <<-EOF cat >> "$DEBUG_LOG" <<-EOF
@ -423,9 +423,9 @@ cat >> "$DEBUG_LOG" <<-EOF
EOF EOF
VERSION_URL="https://raw.githubusercontent.com/vernesong/OpenClash/master/version" VERSION_URL="https://raw.githubusercontent.com/vernesong/OpenClash/master/version"
if pidof clash >/dev/null; then if pidof clash >/dev/null; then
curl -IL -m 3 --retry 2 "$VERSION_URL" >> "$DEBUG_LOG" 2>/dev/null curl -SsIL -m 3 --retry 2 "$VERSION_URL" >> "$DEBUG_LOG" 2>/dev/null
else else
curl -IL -m 3 --retry 2 "$VERSION_URL" >> "$DEBUG_LOG" 2>/dev/null curl -SsIL -m 3 --retry 2 "$VERSION_URL" >> "$DEBUG_LOG" 2>/dev/null
fi fi
cat >> "$DEBUG_LOG" <<-EOF cat >> "$DEBUG_LOG" <<-EOF

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
. /usr/share/openclash/log.sh . /usr/share/openclash/log.sh
. /lib/functions.sh . /lib/functions.sh
@ -6,6 +6,7 @@
DASH_TYPE="$2" DASH_TYPE="$2"
DASH_FILE_DIR="/tmp/dash.zip" DASH_FILE_DIR="/tmp/dash.zip"
DASH_FILE_TMP="/tmp/dash/" DASH_FILE_TMP="/tmp/dash/"
LOG_FILE="/tmp/openclash.log"
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0) github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
if [ "$DASH_NAME" == "Dashboard" ]; then if [ "$DASH_NAME" == "Dashboard" ]; then
UNPACK_FILE_DIR="/usr/share/openclash/ui/dashboard/" UNPACK_FILE_DIR="/usr/share/openclash/ui/dashboard/"
@ -29,9 +30,9 @@
fi fi
fi fi
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$DOWNLOAD_PATH" -o "$DASH_FILE_DIR" >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$DOWNLOAD_PATH" -o "$DASH_FILE_DIR" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$DASH_FILE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
if [ "$?" -eq "0" ] && [ -s "$DASH_FILE_DIR" ] && [ -z "$(grep "404: Not Found" "$DASH_FILE_DIR")" ] && [ -z "$(grep "Package size exceeded the configured limit" "$DASH_FILE_DIR")" ]; then if [ "${PIPESTATUS[0]}" -eq 0 ] && [ -s "$DASH_FILE_DIR" ] && [ -z "$(grep "404: Not Found" "$DASH_FILE_DIR")" ] && [ -z "$(grep "Package size exceeded the configured limit" "$DASH_FILE_DIR")" ]; then
unzip -qt "$DASH_FILE_DIR" >/dev/null 2>&1 unzip -qt "$DASH_FILE_DIR" >/dev/null 2>&1
if [ "$?" -eq "0" ]; then if [ "$?" -eq "0" ]; then
cp -rf "$UNPACK_FILE_DIR". "$BACKUP_FILE_DIR" >/dev/null 2>&1 cp -rf "$UNPACK_FILE_DIR". "$BACKUP_FILE_DIR" >/dev/null 2>&1
@ -43,14 +44,14 @@
rm -rf "$BACKUP_FILE_DIR" >/dev/null 2>&1 rm -rf "$BACKUP_FILE_DIR" >/dev/null 2>&1
rm -rf "$DASH_FILE_TMP" >/dev/null 2>&1 rm -rf "$DASH_FILE_TMP" >/dev/null 2>&1
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Download Successful!" && SLOG_CLEAN LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Download Successful!" && SLOG_CLEAN
return 1 exit 1
else else
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Unzip Error!" && SLOG_CLEAN LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Unzip Error!" && SLOG_CLEAN
cp -rf "$BACKUP_FILE_DIR". "$UNPACK_FILE_DIR" >/dev/null 2>&1 cp -rf "$BACKUP_FILE_DIR". "$UNPACK_FILE_DIR" >/dev/null 2>&1
rm -rf "$DASH_FILE_DIR" >/dev/null 2>&1 rm -rf "$DASH_FILE_DIR" >/dev/null 2>&1
rm -rf "$BACKUP_FILE_DIR" >/dev/null 2>&1 rm -rf "$BACKUP_FILE_DIR" >/dev/null 2>&1
rm -rf "$DASH_FILE_TMP" >/dev/null 2>&1 rm -rf "$DASH_FILE_TMP" >/dev/null 2>&1
return 2 exit 2
fi fi
else else
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Unzip Error!" && SLOG_CLEAN LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Unzip Error!" && SLOG_CLEAN
@ -58,7 +59,7 @@
rm -rf "$DASH_FILE_DIR" >/dev/null 2>&1 rm -rf "$DASH_FILE_DIR" >/dev/null 2>&1
rm -rf "$BACKUP_FILE_DIR" >/dev/null 2>&1 rm -rf "$BACKUP_FILE_DIR" >/dev/null 2>&1
rm -rf "$DASH_FILE_TMP" >/dev/null 2>&1 rm -rf "$DASH_FILE_TMP" >/dev/null 2>&1
return 2 exit 2
fi fi
else else
cp -rf "$BACKUP_FILE_DIR". "$UNPACK_FILE_DIR" >/dev/null 2>&1 cp -rf "$BACKUP_FILE_DIR". "$UNPACK_FILE_DIR" >/dev/null 2>&1
@ -66,5 +67,5 @@
rm -rf "$DASH_FILE_DIR" >/dev/null 2>&1 rm -rf "$DASH_FILE_DIR" >/dev/null 2>&1
rm -rf "$DASH_FILE_TMP" >/dev/null 2>&1 rm -rf "$DASH_FILE_TMP" >/dev/null 2>&1
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Download Error!" && SLOG_CLEAN LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Download Error!" && SLOG_CLEAN
return 0 exit 0
fi fi

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
. /usr/share/openclash/log.sh . /usr/share/openclash/log.sh
. /lib/functions.sh . /lib/functions.sh
@ -13,14 +13,13 @@ urlencode() {
} }
RULE_FILE_NAME="$1" RULE_FILE_NAME="$1"
LOG_FILE="/tmp/openclash.log"
RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master") RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master")
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0) github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
if [ "$1" == "netflix_domains" ]; then if [ "$1" == "netflix_domains" ]; then
if [ "$github_address_mod" != "0" ]; then if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
DOWNLOAD_PATH="https://cdn.jsdelivr.net/gh/vernesong/OpenClash@$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Netflix_Domains.list" DOWNLOAD_PATH="${github_address_mod}gh/vernesong/OpenClash@$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Netflix_Domains.list"
elif [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ]; then
DOWNLOAD_PATH="https://fastly.jsdelivr.net/gh/vernesong/OpenClash@$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Netflix_Domains.list"
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
DOWNLOAD_PATH="https://raw.fastgit.org/vernesong/OpenClash/$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Netflix_Domains.list" DOWNLOAD_PATH="https://raw.fastgit.org/vernesong/OpenClash/$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Netflix_Domains.list"
else else
@ -34,10 +33,8 @@ urlencode() {
RULE_TYPE="netflix" RULE_TYPE="netflix"
elif [ "$1" == "disney_domains" ]; then elif [ "$1" == "disney_domains" ]; then
if [ "$github_address_mod" != "0" ]; then if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
DOWNLOAD_PATH="https://cdn.jsdelivr.net/gh/vernesong/OpenClash@$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Disney_Plus_Domains.list" DOWNLOAD_PATH="${github_address_mod}gh/vernesong/OpenClash@$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Disney_Plus_Domains.list"
elif [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ]; then
DOWNLOAD_PATH="https://fastly.jsdelivr.net/gh/vernesong/OpenClash@$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Disney_Plus_Domains.list"
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
DOWNLOAD_PATH="https://raw.fastgit.org/vernesong/OpenClash/$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Disney_Plus_Domains.list" DOWNLOAD_PATH="https://raw.fastgit.org/vernesong/OpenClash/$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Disney_Plus_Domains.list"
else else
@ -62,7 +59,7 @@ urlencode() {
if [ -z "$DOWNLOAD_PATH" ]; then if [ -z "$DOWNLOAD_PATH" ]; then
LOG_OUT "Rule File【$RULE_FILE_NAME】Download Error!" && SLOG_CLEAN LOG_OUT "Rule File【$RULE_FILE_NAME】Download Error!" && SLOG_CLEAN
return 0 exit 0
fi fi
TMP_RULE_DIR="/tmp/$RULE_FILE_NAME" TMP_RULE_DIR="/tmp/$RULE_FILE_NAME"
@ -70,36 +67,36 @@ urlencode() {
[ "$RULE_TYPE" != "netflix" ] && [ "$RULE_TYPE" != "disney" ] && DOWNLOAD_PATH=$(urlencode "$DOWNLOAD_PATH") [ "$RULE_TYPE" != "netflix" ] && [ "$RULE_TYPE" != "disney" ] && DOWNLOAD_PATH=$(urlencode "$DOWNLOAD_PATH")
if [ "$RULE_TYPE" = "netflix" ]; then if [ "$RULE_TYPE" = "netflix" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$RULE_TYPE" = "disney" ]; then elif [ "$RULE_TYPE" = "disney" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$RULE_TYPE" = "game" ]; then elif [ "$RULE_TYPE" = "game" ]; then
if [ "$github_address_mod" != "0" ]; then if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://cdn.jsdelivr.net/gh/FQrabbit/SSTap-Rule@master/rules/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"gh/FQrabbit/SSTap-Rule@master/rules/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ]; then elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://fastly.jsdelivr.net/gh/FQrabbit/SSTap-Rule@master/rules/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"FQrabbit/SSTap-Rule/master/rules/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/FQrabbit/SSTap-Rule/master/rules/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/FQrabbit/SSTap-Rule/master/rules/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/FQrabbit/SSTap-Rule/master/rules/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/FQrabbit/SSTap-Rule/master/rules/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
elif [ "$RULE_TYPE" = "provider" ]; then elif [ "$RULE_TYPE" = "provider" ]; then
if [ "$github_address_mod" != "0" ]; then if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://cdn.jsdelivr.net/gh/"$(echo "$DOWNLOAD_PATH" |awk -F '/master' '{print $1}' 2>/dev/null)"@master"$(echo "$DOWNLOAD_PATH" |awk -F 'master' '{print $2}')" -o "$TMP_RULE_DIR" >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"gh/"$(echo "$DOWNLOAD_PATH" |awk -F '/master' '{print $1}' 2>/dev/null)"@master"$(echo "$DOWNLOAD_PATH" |awk -F 'master' '{print $2}')" -o "$TMP_RULE_DIR" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ]; then elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://fastly.jsdelivr.net/gh/"$(echo "$DOWNLOAD_PATH" |awk -F '/master' '{print $1}' 2>/dev/null)"@master"$(echo "$DOWNLOAD_PATH" |awk -F 'master' '{print $2}')" -o "$TMP_RULE_DIR" >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod""$(echo "$DOWNLOAD_PATH" |awk -F '/master' '{print $1}' 2>/dev/null)"/master"$(echo "$DOWNLOAD_PATH" |awk -F 'master' '{print $2}')" -o "$TMP_RULE_DIR" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
fi fi
if [ "$?" -eq "0" ] && [ -s "$TMP_RULE_DIR" ] && [ -z "$(grep "404: Not Found" "$TMP_RULE_DIR")" ] && [ -z "$(grep "Package size exceeded the configured limit" "$TMP_RULE_DIR")" ]; then if [ "${PIPESTATUS[0]}" -eq 0 ] && [ -s "$TMP_RULE_DIR" ] && [ -z "$(grep "404: Not Found" "$TMP_RULE_DIR")" ] && [ -z "$(grep "Package size exceeded the configured limit" "$TMP_RULE_DIR")" ]; then
if [ "$RULE_TYPE" = "game" ]; then if [ "$RULE_TYPE" = "game" ]; then
cat "$TMP_RULE_DIR" |sed '/^#/d' 2>/dev/null |sed '/^ *$/d' 2>/dev/null |awk '{print " - "$0}' > "$TMP_RULE_DIR_TMP" 2>/dev/null cat "$TMP_RULE_DIR" |sed '/^#/d' 2>/dev/null |sed '/^ *$/d' 2>/dev/null |awk '{print " - "$0}' > "$TMP_RULE_DIR_TMP" 2>/dev/null
sed -i '1i\payload:' "$TMP_RULE_DIR_TMP" 2>/dev/null sed -i '1i\payload:' "$TMP_RULE_DIR_TMP" 2>/dev/null
@ -115,15 +112,15 @@ urlencode() {
fi fi
rm -rf "$TMP_RULE_DIR" >/dev/null 2>&1 rm -rf "$TMP_RULE_DIR" >/dev/null 2>&1
LOG_OUT "Rule File【$RULE_FILE_NAME】Download Successful!" && SLOG_CLEAN LOG_OUT "Rule File【$RULE_FILE_NAME】Download Successful!" && SLOG_CLEAN
return 1 exit 1
else else
LOG_OUT "Rule File【$RULE_FILE_NAME】No Change, Do Nothing!" && SLOG_CLEAN LOG_OUT "Rule File【$RULE_FILE_NAME】No Change, Do Nothing!" && SLOG_CLEAN
rm -rf "$TMP_RULE_DIR" >/dev/null 2>&1 rm -rf "$TMP_RULE_DIR" >/dev/null 2>&1
rm -rf "$TMP_RULE_DIR_TMP" >/dev/null 2>&1 rm -rf "$TMP_RULE_DIR_TMP" >/dev/null 2>&1
return 2 exit 2
fi fi
else else
rm -rf "$TMP_RULE_DIR" >/dev/null 2>&1 rm -rf "$TMP_RULE_DIR" >/dev/null 2>&1
LOG_OUT "Rule File【$RULE_FILE_NAME】Download Error!" && SLOG_CLEAN LOG_OUT "Rule File【$RULE_FILE_NAME】Download Error!" && SLOG_CLEAN
return 0 exit 0
fi fi

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
. /usr/share/openclash/openclash_ps.sh . /usr/share/openclash/openclash_ps.sh
. /usr/share/openclash/log.sh . /usr/share/openclash/log.sh
@ -15,6 +15,8 @@
small_flash_memory=$(uci get openclash.config.small_flash_memory 2>/dev/null) small_flash_memory=$(uci get openclash.config.small_flash_memory 2>/dev/null)
GEOIP_CUSTOM_URL=$(uci get openclash.config.geoip_custom_url 2>/dev/null) GEOIP_CUSTOM_URL=$(uci get openclash.config.geoip_custom_url 2>/dev/null)
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0) github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
LOG_FILE="/tmp/openclash.log"
restart=0
set_lock set_lock
if [ "$small_flash_memory" != "1" ]; then if [ "$small_flash_memory" != "1" ]; then
@ -27,25 +29,23 @@
LOG_OUT "Start Downloading GeoIP Dat..." LOG_OUT "Start Downloading GeoIP Dat..."
if [ -z "$GEOIP_CUSTOM_URL" ]; then if [ -z "$GEOIP_CUSTOM_URL" ]; then
if [ "$github_address_mod" != "0" ]; then if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat" -o /tmp/GeoIP.dat >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "${github_address_mod}gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat" -o /tmp/GeoIP.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoIP.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat" -o /tmp/GeoIP.dat >/dev/null 2>&1
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "https://raw.fastgit.org/Loyalsoldier/v2ray-rules-dat/release/geoip.dat" -o /tmp/GeoIP.dat >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "https://raw.fastgit.org/Loyalsoldier/v2ray-rules-dat/release/geoip.dat" -o /tmp/GeoIP.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoIP.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat -o /tmp/GeoIP.dat >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat -o /tmp/GeoIP.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoIP.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat" -o /tmp/GeoIP.dat >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat" -o /tmp/GeoIP.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoIP.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
if [ "$?" -ne "0" ]; then if [ "$?" -ne "0" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/v/v2/v2raya/dists/v2ray-rules-dat/geoip.dat" -o /tmp/GeoIP.dat >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/v/v2/v2raya/dists/v2ray-rules-dat/geoip.dat" -o /tmp/GeoIP.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoIP.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$GEOIP_CUSTOM_URL" -o /tmp/GeoIP.dat >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$GEOIP_CUSTOM_URL" -o /tmp/GeoIP.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoIP.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
if [ "$?" -eq "0" ] && [ -s "/tmp/GeoIP.dat" ]; then if [ "${PIPESTATUS[0]}" -eq 0 ] && [ -s "/tmp/GeoIP.dat" ]; then
LOG_OUT "GeoIP Dat Download Success, Check Updated..." LOG_OUT "GeoIP Dat Download Success, Check Updated..."
cmp -s /tmp/GeoIP.dat "$geoip_path" cmp -s /tmp/GeoIP.dat "$geoip_path"
if [ "$?" -ne "0" ]; then if [ "$?" -ne "0" ]; then
@ -53,8 +53,7 @@
rm -rf "/etc/openclash/geoip.dat" rm -rf "/etc/openclash/geoip.dat"
mv /tmp/GeoIP.dat "$geoip_path" >/dev/null 2>&1 mv /tmp/GeoIP.dat "$geoip_path" >/dev/null 2>&1
LOG_OUT "GeoIP Dat Update Successful!" LOG_OUT "GeoIP Dat Update Successful!"
sleep 3 restart=1
[ "$(unify_ps_prevent)" -eq 0 ] && /etc/init.d/openclash restart >/dev/null 2>&1 &
else else
LOG_OUT "Updated GeoIP Dat No Change, Do Nothing..." LOG_OUT "Updated GeoIP Dat No Change, Do Nothing..."
sleep 3 sleep 3
@ -63,6 +62,18 @@
LOG_OUT "GeoIP Dat Update Error, Please Try Again Later..." LOG_OUT "GeoIP Dat Update Error, Please Try Again Later..."
sleep 3 sleep 3
fi fi
if [ "$restart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
elif [ "$restart" -eq 0 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ] && [ "$(uci -q get openclash.config.restart)" -eq 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
uci -q set openclash.config.restart=0
uci -q commit openclash
elif [ "$restart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ]; then
uci -q set openclash.config.restart=1
uci -q commit openclash
fi
rm -rf /tmp/GeoIP.dat >/dev/null 2>&1 rm -rf /tmp/GeoIP.dat >/dev/null 2>&1
SLOG_CLEAN SLOG_CLEAN
del_lock del_lock

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
. /usr/share/openclash/openclash_ps.sh . /usr/share/openclash/openclash_ps.sh
. /usr/share/openclash/log.sh . /usr/share/openclash/log.sh
@ -15,6 +15,8 @@
small_flash_memory=$(uci get openclash.config.small_flash_memory 2>/dev/null) small_flash_memory=$(uci get openclash.config.small_flash_memory 2>/dev/null)
GEOSITE_CUSTOM_URL=$(uci get openclash.config.geosite_custom_url 2>/dev/null) GEOSITE_CUSTOM_URL=$(uci get openclash.config.geosite_custom_url 2>/dev/null)
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0) github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
LOG_FILE="/tmp/openclash.log"
restart=0
set_lock set_lock
if [ "$small_flash_memory" != "1" ]; then if [ "$small_flash_memory" != "1" ]; then
@ -27,25 +29,23 @@
LOG_OUT "Start Downloading GeoSite Database..." LOG_OUT "Start Downloading GeoSite Database..."
if [ -z "$GEOSITE_CUSTOM_URL" ]; then if [ -z "$GEOSITE_CUSTOM_URL" ]; then
if [ "$github_address_mod" != "0" ]; then if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat -o /tmp/GeoSite.dat >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat -o /tmp/GeoSite.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoSite.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat -o /tmp/GeoSite.dat >/dev/null 2>&1
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.fastgit.org/Loyalsoldier/v2ray-rules-dat/release/geosite.dat -o /tmp/GeoSite.dat >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.fastgit.org/Loyalsoldier/v2ray-rules-dat/release/geosite.dat -o /tmp/GeoSite.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoSite.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat -o /tmp/GeoSite.dat >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat -o /tmp/GeoSite.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoSite.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat -o /tmp/GeoSite.dat >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat -o /tmp/GeoSite.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoSite.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
if [ "$?" -ne "0" ]; then if [ "$?" -ne "0" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/v/v2/v2raya/dists/v2ray-rules-dat/geosite.dat" -o /tmp/GeoSite.dat >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/v/v2/v2raya/dists/v2ray-rules-dat/geosite.dat" -o /tmp/GeoSite.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoSite.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$GEOSITE_CUSTOM_URL" -o /tmp/GeoSite.dat >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$GEOSITE_CUSTOM_URL" -o /tmp/GeoSite.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoSite.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
if [ "$?" -eq "0" ] && [ -s "/tmp/GeoSite.dat" ]; then if [ "${PIPESTATUS[0]}" -eq 0 ] && [ -s "/tmp/GeoSite.dat" ]; then
LOG_OUT "GeoSite Database Download Success, Check Updated..." LOG_OUT "GeoSite Database Download Success, Check Updated..."
cmp -s /tmp/GeoSite.dat "$geosite_path" cmp -s /tmp/GeoSite.dat "$geosite_path"
if [ "$?" -ne "0" ]; then if [ "$?" -ne "0" ]; then
@ -53,8 +53,7 @@
rm -rf "/etc/openclash/geosite.dat" rm -rf "/etc/openclash/geosite.dat"
mv /tmp/GeoSite.dat "$geosite_path" >/dev/null 2>&1 mv /tmp/GeoSite.dat "$geosite_path" >/dev/null 2>&1
LOG_OUT "GeoSite Database Update Successful!" LOG_OUT "GeoSite Database Update Successful!"
sleep 3 restart=1
[ "$(unify_ps_prevent)" -eq 0 ] && /etc/init.d/openclash restart >/dev/null 2>&1 &
else else
LOG_OUT "Updated GeoSite Database No Change, Do Nothing..." LOG_OUT "Updated GeoSite Database No Change, Do Nothing..."
sleep 3 sleep 3
@ -63,6 +62,18 @@
LOG_OUT "GeoSite Database Update Error, Please Try Again Later..." LOG_OUT "GeoSite Database Update Error, Please Try Again Later..."
sleep 3 sleep 3
fi fi
if [ "$restart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
elif [ "$restart" -eq 0 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ] && [ "$(uci -q get openclash.config.restart)" -eq 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
uci -q set openclash.config.restart=0
uci -q commit openclash
elif [ "$restart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ]; then
uci -q set openclash.config.restart=1
uci -q commit openclash
fi
rm -rf /tmp/GeoSite.dat >/dev/null 2>&1 rm -rf /tmp/GeoSite.dat >/dev/null 2>&1
SLOG_CLEAN SLOG_CLEAN
del_lock del_lock

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
. /usr/share/openclash/openclash_ps.sh . /usr/share/openclash/openclash_ps.sh
. /usr/share/openclash/log.sh . /usr/share/openclash/log.sh
@ -11,10 +11,12 @@
flock -u 880 2>/dev/null flock -u 880 2>/dev/null
rm -rf "/tmp/lock/openclash_ipdb.lock" rm -rf "/tmp/lock/openclash_ipdb.lock"
} }
small_flash_memory=$(uci get openclash.config.small_flash_memory 2>/dev/null) small_flash_memory=$(uci get openclash.config.small_flash_memory 2>/dev/null)
GEOIP_CUSTOM_URL=$(uci get openclash.config.geo_custom_url 2>/dev/null) GEOIP_CUSTOM_URL=$(uci get openclash.config.geo_custom_url 2>/dev/null)
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0) github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
LOG_FILE="/tmp/openclash.log"
restart=0
set_lock set_lock
if [ "$small_flash_memory" != "1" ]; then if [ "$small_flash_memory" != "1" ]; then
@ -27,30 +29,27 @@
LOG_OUT "Start Downloading Geoip Database..." LOG_OUT "Start Downloading Geoip Database..."
if [ -z "$GEOIP_CUSTOM_URL" ]; then if [ -z "$GEOIP_CUSTOM_URL" ]; then
if [ "$github_address_mod" != "0" ]; then if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://cdn.jsdelivr.net/gh/alecthw/mmdb_china_ip_list@release/lite/Country.mmdb -o /tmp/Country.mmdb >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"gh/alecthw/mmdb_china_ip_list@release/lite/Country.mmdb -o /tmp/Country.mmdb 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/Country.mmdb" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://fastly.jsdelivr.net/gh/alecthw/mmdb_china_ip_list@release/lite/Country.mmdb -o /tmp/Country.mmdb >/dev/null 2>&1
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.fastgit.org/alecthw/mmdb_china_ip_list/release/lite/Country.mmdb -o /tmp/Country.mmdb >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.fastgit.org/alecthw/mmdb_china_ip_list/release/lite/Country.mmdb -o /tmp/Country.mmdb 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/Country.mmdb" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/alecthw/mmdb_china_ip_list/release/lite/Country.mmdb -o /tmp/Country.mmdb >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/alecthw/mmdb_china_ip_list/release/lite/Country.mmdb -o /tmp/Country.mmdb 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/Country.mmdb" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/alecthw/mmdb_china_ip_list/release/lite/Country.mmdb -o /tmp/Country.mmdb >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/alecthw/mmdb_china_ip_list/release/lite/Country.mmdb -o /tmp/Country.mmdb 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/Country.mmdb" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$GEOIP_CUSTOM_URL" -o /tmp/Country.mmdb >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$GEOIP_CUSTOM_URL" -o /tmp/Country.mmdb 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/Country.mmdb" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
if [ "$?" -eq "0" ] && [ -s "/tmp/Country.mmdb" ]; then if [ "${PIPESTATUS[0]}" -eq 0 ] && [ -s "/tmp/Country.mmdb" ]; then
LOG_OUT "Geoip Database Download Success, Check Updated..." LOG_OUT "Geoip Database Download Success, Check Updated..."
cmp -s /tmp/Country.mmdb "$geoip_path" cmp -s /tmp/Country.mmdb "$geoip_path"
if [ "$?" -ne "0" ]; then if [ "$?" -ne "0" ]; then
LOG_OUT "Geoip Database Has Been Updated, Starting To Replace The Old Version..." LOG_OUT "Geoip Database Has Been Updated, Starting To Replace The Old Version..."
mv /tmp/Country.mmdb "$geoip_path" >/dev/null 2>&1 mv /tmp/Country.mmdb "$geoip_path" >/dev/null 2>&1
LOG_OUT "Geoip Database Update Successful!" LOG_OUT "Geoip Database Update Successful!"
sleep 3 restart=1
[ "$(unify_ps_prevent)" -eq 0 ] && /etc/init.d/openclash restart >/dev/null 2>&1 &
else else
LOG_OUT "Updated Geoip Database No Change, Do Nothing..." LOG_OUT "Updated Geoip Database No Change, Do Nothing..."
sleep 3 sleep 3
@ -59,6 +58,18 @@
LOG_OUT "Geoip Database Update Error, Please Try Again Later..." LOG_OUT "Geoip Database Update Error, Please Try Again Later..."
sleep 3 sleep 3
fi fi
if [ "$restart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
elif [ "$restart" -eq 0 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ] && [ "$(uci -q get openclash.config.restart)" -eq 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
uci -q set openclash.config.restart=0
uci -q commit openclash
elif [ "$restart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ]; then
uci -q set openclash.config.restart=1
uci -q commit openclash
fi
rm -rf /tmp/Country.mmdb >/dev/null 2>&1 rm -rf /tmp/Country.mmdb >/dev/null 2>&1
SLOG_CLEAN SLOG_CLEAN
del_lock del_lock

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
unify_ps_status() { unify_ps_status() {
if [ "$(ps --version 2>&1 |grep -c procps-ng)" -eq 1 ];then if [ "$(ps --version 2>&1 |grep -c procps-ng)" -eq 1 ]; then
echo "$(ps -efw |grep -v grep |grep -c "$1")" echo "$(ps -efw |grep -v grep |grep -c "$1")"
else else
echo "$(ps -w |grep -v grep |grep -c "$1")" echo "$(ps -w |grep -v grep |grep -c "$1")"
@ -9,7 +9,7 @@ unify_ps_status() {
} }
unify_ps_pids() { unify_ps_pids() {
if [ "$(ps --version 2>&1 |grep -c procps-ng)" -eq 1 ];then if [ "$(ps --version 2>&1 |grep -c procps-ng)" -eq 1 ]; then
echo "$(ps -efw |grep "$1" |grep -v grep |awk '{print $2}' 2>/dev/null)" echo "$(ps -efw |grep "$1" |grep -v grep |awk '{print $2}' 2>/dev/null)"
else else
echo "$(ps -w |grep "$1" |grep -v grep |awk '{print $1}' 2>/dev/null)" echo "$(ps -w |grep "$1" |grep -v grep |awk '{print $1}' 2>/dev/null)"
@ -17,7 +17,7 @@ unify_ps_pids() {
} }
unify_ps_prevent() { unify_ps_prevent() {
if [ "$(ps --version 2>&1 |grep -c procps-ng)" -eq 1 ];then if [ "$(ps --version 2>&1 |grep -c procps-ng)" -eq 1 ]; then
echo "$(ps -efw |grep -v grep |grep -c "/etc/init.d/openclash")" echo "$(ps -efw |grep -v grep |grep -c "/etc/init.d/openclash")"
else else
echo "$(ps -w |grep -v grep |grep -c "/etc/init.d/openclash")" echo "$(ps -w |grep -v grep |grep -c "/etc/init.d/openclash")"
@ -25,7 +25,7 @@ unify_ps_prevent() {
} }
unify_ps_cfgname() { unify_ps_cfgname() {
if [ "$(ps --version 2>&1 |grep -c procps-ng)" -eq 1 ];then if [ "$(ps --version 2>&1 |grep -c procps-ng)" -eq 1 ]; then
echo "$(ps -efw |grep /etc/openclash/clash 2>/dev/null |grep -v grep |awk -F '-f ' '{print $2}' 2>/dev/null)" echo "$(ps -efw |grep /etc/openclash/clash 2>/dev/null |grep -v grep |awk -F '-f ' '{print $2}' 2>/dev/null)"
else else
echo "$(ps -w |grep /etc/openclash/clash 2>/dev/null |grep -v grep |awk -F '-f ' '{print $2}' 2>/dev/null)" echo "$(ps -w |grep /etc/openclash/clash 2>/dev/null |grep -v grep |awk -F '-f ' '{print $2}' 2>/dev/null)"

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
. /usr/share/openclash/openclash_ps.sh . /usr/share/openclash/openclash_ps.sh
. /lib/functions.sh . /lib/functions.sh
. /usr/share/openclash/ruby.sh . /usr/share/openclash/ruby.sh
@ -35,51 +35,45 @@
LOG_OUT "Start Downloading Third Party Rules in Use..." LOG_OUT "Start Downloading Third Party Rules in Use..."
if [ "$rule_name" = "lhie1" ]; then if [ "$rule_name" = "lhie1" ]; then
if [ "$github_address_mod" != "0" ]; then if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://cdn.jsdelivr.net/gh/dler-io/Rules@master/Clash/Rule.yaml -o /tmp/rules.yaml >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"gh/dler-io/Rules@master/Clash/Rule.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://fastly.jsdelivr.net/gh/dler-io/Rules@master/Clash/Rule.yaml -o /tmp/rules.yaml >/dev/null 2>&1
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.fastgit.org/dler-io/Rules/master/Clash/Rule.yaml -o /tmp/rules.yaml >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.fastgit.org/dler-io/Rules/master/Clash/Rule.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/dler-io/Rules/master/Clash/Rule.yaml -o /tmp/rules.yaml >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/dler-io/Rules/master/Clash/Rule.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/dler-io/Rules/master/Clash/Rule.yaml -o /tmp/rules.yaml >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/dler-io/Rules/master/Clash/Rule.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
sed -i '1i rules:' /tmp/rules.yaml sed -i '1i rules:' /tmp/rules.yaml
elif [ "$rule_name" = "ConnersHua" ]; then elif [ "$rule_name" = "ConnersHua" ]; then
if [ "$github_address_mod" != "0" ]; then if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://cdn.jsdelivr.net/gh/DivineEngine/Profiles@master/Clash/Outbound.yaml -o /tmp/rules.yaml >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"gh/DivineEngine/Profiles@master/Clash/Outbound.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://fastly.jsdelivr.net/gh/DivineEngine/Profiles@master/Clash/Outbound.yaml -o /tmp/rules.yaml >/dev/null 2>&1
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.fastgit.org/DivineEngine/Profiles/master/Clash/Outbound.yaml -o /tmp/rules.yaml >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.fastgit.org/DivineEngine/Profiles/master/Clash/Outbound.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/Outbound.yaml -o /tmp/rules.yaml >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/Outbound.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/Outbound.yaml -o /tmp/rules.yaml >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/Outbound.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
sed -i "s/# - RULE-SET,ChinaIP,DIRECT/- RULE-SET,ChinaIP,DIRECT/g" /tmp/rules.yaml 2>/dev/null sed -i "s/# - RULE-SET,ChinaIP,DIRECT/- RULE-SET,ChinaIP,DIRECT/g" /tmp/rules.yaml 2>/dev/null
sed -i "s/- GEOIP,/#- GEOIP,/g" /tmp/rules.yaml 2>/dev/null sed -i "s/- GEOIP,/#- GEOIP,/g" /tmp/rules.yaml 2>/dev/null
elif [ "$rule_name" = "ConnersHua_return" ]; then elif [ "$rule_name" = "ConnersHua_return" ]; then
if [ "$github_address_mod" != "0" ]; then if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://cdn.jsdelivr.net/gh/DivineEngine/Profiles@master/Clash/Inbound.yaml -o /tmp/rules.yaml >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"gh/DivineEngine/Profiles@master/Clash/Inbound.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://fastly.jsdelivr.net/gh/DivineEngine/Profiles@master/Clash/Inbound.yaml -o /tmp/rules.yaml >/dev/null 2>&1
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.fastgit.org/DivineEngine/Profiles/master/Clash/Inbound.yaml -o /tmp/rules.yaml >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.fastgit.org/DivineEngine/Profiles/master/Clash/Inbound.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/Inbound.yaml -o /tmp/rules.yaml >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/Inbound.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
else else
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/Inbound.yaml -o /tmp/rules.yaml >/dev/null 2>&1 curl -SsL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/Inbound.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
fi fi
if [ "$?" -eq "0" ] && [ -s "/tmp/rules.yaml" ]; then if [ -s "/tmp/rules.yaml" ]; then
LOG_OUT "Download Successful, Start Preprocessing Rule File..." LOG_OUT "Download Successful, Start Preprocessing Rule File..."
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e " ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
begin begin
@ -117,7 +111,7 @@
OLD_GROUP = Value['rules'].collect{|x| x.split(',')[2] or x.split(',')[1]}.uniq; OLD_GROUP = Value['rules'].collect{|x| x.split(',')[2] or x.split(',')[1]}.uniq;
NEW_GROUP = Value_1['rules'].collect{|x| x.split(',')[2] or x.split(',')[1]}.uniq; NEW_GROUP = Value_1['rules'].collect{|x| x.split(',')[2] or x.split(',')[1]}.uniq;
puts (OLD_GROUP | NEW_GROUP).eql?(OLD_GROUP) puts (OLD_GROUP | NEW_GROUP).eql?(OLD_GROUP)
")" ; then ")" && [ -f "/usr/share/openclash/res/${rule_name}.yaml" ]; then
LOG_OUT "Error: Updated Others Rules【$rule_name】Has Incompatible Proxy-Group, Update Exit, Please Wait For OpenClash Update To Adapt..." LOG_OUT "Error: Updated Others Rules【$rule_name】Has Incompatible Proxy-Group, Update Exit, Please Wait For OpenClash Update To Adapt..."
rm -rf /tmp/rules.yaml >/dev/null 2>&1 rm -rf /tmp/rules.yaml >/dev/null 2>&1
sleep 3 sleep 3
@ -166,7 +160,7 @@
if [ -z "$CONFIG_FILE" ]; then if [ -z "$CONFIG_FILE" ]; then
CONFIG_FILE="/etc/openclash/config/$(ls -lt /etc/openclash/config/ | grep -E '.yaml|.yml' | head -n 1 |awk '{print $9}')" CONFIG_FILE="/etc/openclash/config/$(ls -lt /etc/openclash/config/ | grep -E '.yaml|.yml' | head -n 1 |awk '{print $9}')"
CONFIG_NAME=$(echo "$CONFIG_FILE" |awk -F '/' '{print $5}' 2>/dev/null) CONFIG_NAME=$(echo "$CONFIG_FILE" |awk -F '/' '{print $5}' 2>/dev/null)
fi fi
if [ -z "$CONFIG_NAME" ]; then if [ -z "$CONFIG_NAME" ]; then
@ -180,7 +174,7 @@
LOG_OUT "Get Other Rules Settings Faild, Update Stop!" LOG_OUT "Get Other Rules Settings Faild, Update Stop!"
sleep 3 sleep 3
fi fi
if [ "$ifrestart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ]; then if [ "$ifrestart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 & /etc/init.d/openclash restart >/dev/null 2>&1 &
fi fi
fi fi

View File

@ -8,7 +8,6 @@ local uci = require("luci.model.uci").cursor()
local fs = require "luci.openclash" local fs = require "luci.openclash"
local json = require "luci.jsonc" local json = require "luci.jsonc"
local UA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36" local UA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36"
local filmId = 70143836
local class_type = type local class_type = type
local type = arg[1] local type = arg[1]
local all_test local all_test
@ -16,6 +15,7 @@ local router_self_proxy = tonumber(uci:get("openclash", "config", "router_self_p
local now_name, group_name, group_type, group_show, status, ip, port, passwd, group_match_name local now_name, group_name, group_type, group_show, status, ip, port, passwd, group_match_name
local groups = {} local groups = {}
local proxies = {} local proxies = {}
local tested_proxy = {}
local self_status = luci.sys.exec(string.format('ps -w |grep -v grep |grep -c "openclash_streaming_unlock.lua %s"', type)) local self_status = luci.sys.exec(string.format('ps -w |grep -v grep |grep -c "openclash_streaming_unlock.lua %s"', type))
local select_logic = uci:get("openclash", "config", "stream_auto_select_logic") or "urltest" local select_logic = uci:get("openclash", "config", "stream_auto_select_logic") or "urltest"
@ -33,16 +33,15 @@ end
if arg[2] == "all" then all_test = true else all_test = false end if arg[2] == "all" then all_test = true else all_test = false end
function unlock_auto_select() function unlock_auto_select()
local key_group, region, now, proxy, group_match, proxy_default, auto_get_group, info, group_now local key_group, region, old_region, now, proxy, group_match, proxy_default, auto_get_group, info, group_now
local original = {} local original = {}
local other_region_unlock = {} local other_region_unlock = {}
local no_old_region_unlock = {} local no_old_region_unlock = {}
local full_support_list = {} local full_support_list = {}
local tested_proxy = {}
local fallback_select = {} local fallback_select = {}
local gorup_i18 = "Group:" local gorup_i18 = "Group:"
local no_group_find = "failed to search based on keywords and automatically obtain the group, please confirm the validity of the regex!" local no_group_find = "failed to search based on keywords and automatically obtain the group, please confirm the validity of the regex!"
local full_support_no_area = "full support." local full_support_no_area = "full support"
local full_support = "full support, area:" local full_support = "full support, area:"
local only_original = "only support homemade!" local only_original = "only support homemade!"
local no_unlock = "not support unlock!" local no_unlock = "not support unlock!"
@ -58,15 +57,17 @@ function unlock_auto_select()
local faild_test_start = "unlock test faild! start auto select unlock proxy..." local faild_test_start = "unlock test faild! start auto select unlock proxy..."
local area_i18 = ", area:" local area_i18 = ", area:"
local select_faild_other_region = "unlock node auto selected failed, no node match the regex, rolled back to other full support node" local select_faild_other_region = "unlock node auto selected failed, no node match the regex, rolled back to other full support node"
local other_region_unlock_test = "full support but not match the regex!" local other_region_unlock_test = ", but not match the regex!"
local other_region_unlock_no_select = "but not match the regex! the type of group is not select, auto select could not work!" local other_region_unlock_no_select = ", but not match the regex! the type of group is not select, auto select could not work!"
local other_region_unlock_test_start = "full support but not match the regex! start auto select unlock proxy..." local other_region_unlock_test_start = ", but not match the regex! start auto select unlock proxy..."
local select_all_full_support = "unlock node test finished, rolled back to the full support node" local select_all_full_support = "unlock node test finished, rolled back to the full support node"
local select_all_other_region = "unlock node test finished, no node match the regex, rolled back to other full support node" local select_all_other_region = "unlock node test finished, no node match the regex, rolled back to other full support node"
local select_all_faild = "unlock node test finished, no node available, rolled back to the" local select_all_faild = "unlock node test finished, no node available, rolled back to the"
local no_nodes_filter = "no nodes name match the regex!" local no_nodes_filter = "no nodes name match the regex!"
local select_success_no_old_region = "unlock node auto selected successfully, no node match the old region, rolled back to other full support node" local select_success_no_old_region = "unlock node auto selected successfully, no node match the old region, rolled back to other full support node"
local no_old_region_unlock_test = "full support but not match the old region!" local no_old_region_unlock_test = "full support but not match the old region!"
local no_old_region_unlock_old_region = ", but not match the old region:"
local no_old_region_unlock_old_region_no_select = ", the type of group is not select, auto select could not work!"
local no_old_region_unlock_no_select = "but not match the old region! the type of group is not select, auto select could not work!" local no_old_region_unlock_no_select = "but not match the old region! the type of group is not select, auto select could not work!"
local select_all_no_old_region = "unlock node test finished, no node match the old region, rolled back to other full support node" local select_all_no_old_region = "unlock node test finished, no node match the old region, rolled back to other full support node"
@ -140,7 +141,7 @@ function unlock_auto_select()
table.insert(tested_proxy, now_name) table.insert(tested_proxy, now_name)
group_match = true group_match = true
--test now proxy --test now proxy
region = proxy_unlock_test() region, old_region = proxy_unlock_test()
if table_include(groups, now_name) then if table_include(groups, now_name) then
now = os.date("%Y-%m-%d %H:%M:%S").." "..type.." "..gorup_i18..""..group_show.."" now = os.date("%Y-%m-%d %H:%M:%S").." "..type.." "..gorup_i18..""..group_show..""
else else
@ -148,7 +149,7 @@ function unlock_auto_select()
end end
if status ~= 2 and status ~= 4 then if status ~= 2 and status ~= 4 then
os.execute("sleep 3") os.execute("sleep 3")
region = proxy_unlock_test() region, old_region = proxy_unlock_test()
end end
if status == 2 or status == 4 then if status == 2 or status == 4 then
if region and region ~= "" then if region and region ~= "" then
@ -165,6 +166,9 @@ function unlock_auto_select()
fs.writefile(string.format("/tmp/openclash_%s_region", type), region) fs.writefile(string.format("/tmp/openclash_%s_region", type), region)
end end
end end
if status == 2 and type == "Google" then
fs.writefile(string.format("/tmp/openclash_%s_region", type), now_name)
end
break break
else else
status = 0 status = 0
@ -176,9 +180,17 @@ function unlock_auto_select()
table.insert(other_region_unlock, {value.now, value.now, get_group_now(info, value.now)}) table.insert(other_region_unlock, {value.now, value.now, get_group_now(info, value.now)})
end end
if not all_test then if not all_test then
print(now..other_region_unlock_test_start) if region and region ~= "" then
print(now..full_support..""..region..""..other_region_unlock_test_start)
else
print(now..full_support_no_area..other_region_unlock_test_start)
end
else else
print(now..other_region_unlock_test) if region and region ~= "" then
print(now..full_support..""..region..""..other_region_unlock_test)
else
print(now..full_support_no_area..other_region_unlock_test)
end
end end
elseif status == 1 then elseif status == 1 then
table.insert(original, {value.now, value.now, get_group_now(info, value.now)}) table.insert(original, {value.now, value.now, get_group_now(info, value.now)})
@ -268,7 +280,7 @@ function unlock_auto_select()
break break
else else
luci.sys.exec(string.format("curl -sL -m 3 --retry 2 -w %%{http_code} -o /dev/null -H 'Authorization: Bearer %s' -H 'Content-Type:application/json' -X PUT -d '{\"name\":\"%s\"}' http://%s:%s/proxies/%s", passwd, proxy, ip, port, urlencode(group_name))) luci.sys.exec(string.format("curl -sL -m 3 --retry 2 -w %%{http_code} -o /dev/null -H 'Authorization: Bearer %s' -H 'Content-Type:application/json' -X PUT -d '{\"name\":\"%s\"}' http://%s:%s/proxies/%s", passwd, proxy, ip, port, urlencode(group_name)))
region = proxy_unlock_test() region, old_region = proxy_unlock_test()
if status == 2 then if status == 2 then
if region and region ~= "" then if region and region ~= "" then
table.insert(full_support_list, {value.all[i], group_name, proxy, region}) table.insert(full_support_list, {value.all[i], group_name, proxy, region})
@ -290,17 +302,20 @@ function unlock_auto_select()
elseif status == 3 then elseif status == 3 then
if region and region ~= "" then if region and region ~= "" then
table.insert(other_region_unlock, {value.all[i], group_name, proxy, region}) table.insert(other_region_unlock, {value.all[i], group_name, proxy, region})
print(now..full_support..""..region..""..other_region_unlock_test)
else else
table.insert(other_region_unlock, {value.all[i], group_name, proxy}) table.insert(other_region_unlock, {value.all[i], group_name, proxy})
print(now..full_support_no_area..other_region_unlock_test)
end end
print(now..other_region_unlock_test)
elseif status == 4 then elseif status == 4 then
if region and region ~= "" then if region and region ~= "" then
table.insert(no_old_region_unlock, {value.all[i], group_name, proxy, region}) table.insert(no_old_region_unlock, {value.all[i], group_name, proxy, region})
print(now..full_support..""..region..""..no_old_region_unlock_old_region..""..old_region.."")
else else
table.insert(no_old_region_unlock, {value.all[i], group_name, proxy}) table.insert(no_old_region_unlock, {value.all[i], group_name, proxy})
print(now..no_old_region_unlock_test)
end end
print(now..no_old_region_unlock_test)
elseif status == 1 then elseif status == 1 then
table.insert(original, {value.all[i], group_name, proxy}) table.insert(original, {value.all[i], group_name, proxy})
if type == "Netflix" then if type == "Netflix" then
@ -332,7 +347,7 @@ function unlock_auto_select()
else else
table.insert(tested_proxy, now_name) table.insert(tested_proxy, now_name)
end end
region = proxy_unlock_test() region, old_region = proxy_unlock_test()
if table_include(groups, now_name) then if table_include(groups, now_name) then
now = os.date("%Y-%m-%d %H:%M:%S").." "..type.." "..gorup_i18..""..group_show.."" now = os.date("%Y-%m-%d %H:%M:%S").." "..type.." "..gorup_i18..""..group_show..""
else else
@ -359,17 +374,20 @@ function unlock_auto_select()
elseif status == 3 then elseif status == 3 then
if region and region ~= "" then if region and region ~= "" then
table.insert(other_region_unlock, {value.all[i], group_name, value.all[i], region}) table.insert(other_region_unlock, {value.all[i], group_name, value.all[i], region})
print(now..full_support..""..region..""..other_region_unlock_no_select)
else else
table.insert(other_region_unlock, {value.all[i], group_name, value.all[i]}) table.insert(other_region_unlock, {value.all[i], group_name, value.all[i]})
print(now..full_support_no_area..other_region_unlock_no_select)
end end
print(now..full_support..""..region..""..other_region_unlock_no_select)
elseif status == 4 then elseif status == 4 then
if region and region ~= "" then if region and region ~= "" then
table.insert(no_old_region_unlock, {value.all[i], group_name, value.all[i], region}) table.insert(no_old_region_unlock, {value.all[i], group_name, value.all[i], region})
print(now..full_support..""..region..""..no_old_region_unlock_old_region..""..old_region..""..no_old_region_unlock_old_region_no_select)
else else
table.insert(no_old_region_unlock, {value.all[i], group_name, value.all[i]}) table.insert(no_old_region_unlock, {value.all[i], group_name, value.all[i]})
print(now..full_support_no_area..no_old_region_unlock_no_select)
end end
print(now..full_support..""..region..""..no_old_region_unlock_no_select)
elseif status == 1 then elseif status == 1 then
table.insert(original, {value.all[i], group_name, value.all[i]}) table.insert(original, {value.all[i], group_name, value.all[i]})
if type == "Netflix" then if type == "Netflix" then
@ -458,7 +476,7 @@ function unlock_auto_select()
end end
end end
elseif #nodes_filter(get_group_now(info, value.name), info) ~= 0 then elseif #nodes_filter(get_group_now(info, value.name), info) ~= 0 then
region = proxy_unlock_test() region, old_region = proxy_unlock_test()
if status == 2 then if status == 2 then
if region and region ~= "" then if region and region ~= "" then
if not all_test then if not all_test then
@ -475,9 +493,17 @@ function unlock_auto_select()
break break
end end
elseif status == 3 then elseif status == 3 then
print(now..full_support..""..region..""..other_region_unlock_no_select) if region and region ~= "" then
print(now..full_support..""..region..""..other_region_unlock_no_select)
else
print(now..full_support_no_area..other_region_unlock_no_select)
end
elseif status == 4 then elseif status == 4 then
print(now..full_support..""..region..""..no_old_region_unlock_no_select) if region and region ~= "" then
print(now..full_support..""..region..""..no_old_region_unlock_old_region..""..old_region..""..no_old_region_unlock_old_region_no_select)
else
print(now..full_support_no_area..no_old_region_unlock_no_select)
end
elseif status == 1 then elseif status == 1 then
if type == "Netflix" then if type == "Netflix" then
print(now..original_no_select) print(now..original_no_select)
@ -518,7 +544,9 @@ function table_rand(t, d)
while #t ~= 0 do while #t ~= 0 do
local n = math.random(0, #t) local n = math.random(0, #t)
if t[n] ~= nil then if t[n] ~= nil then
if d ~= nil and table_include(groups, d) and d == t[n] then if type == "YouTube Premium" and fs.isfile("/tmp/openclash_Google_region") and fs.readfile("/tmp/openclash_Google_region") == t[n] then
table.insert(tab, 1, t[n])
elseif d ~= nil and table_include(groups, d) and d == t[n] then
table.insert(tab, 1, t[n]) table.insert(tab, 1, t[n])
else else
table.insert(tab, t[n]) table.insert(tab, t[n])
@ -566,7 +594,7 @@ function table_sort_by_urltest(t, d)
if group_delay then if group_delay then
group_delay = json.parse(group_delay) group_delay = json.parse(group_delay)
end end
if group_delay.delay and group_delay.delay ~= 0 then if group_delay and group_delay.delay and group_delay.delay ~= 0 then
table.insert(tab, {t[n], group_delay.delay}) table.insert(tab, {t[n], group_delay.delay})
else else
table.insert(tab, {t[n], 123456}) table.insert(tab, {t[n], 123456})
@ -582,7 +610,9 @@ function table_sort_by_urltest(t, d)
end) end)
for _, value in pairs(tab) do for _, value in pairs(tab) do
if d ~= nil and table_include(groups, d) and d == value[1] then if type == "YouTube Premium" and fs.isfile("/tmp/openclash_Google_region") and fs.readfile("/tmp/openclash_Google_region") == value[1] then
table.insert(result, 1, value[1])
elseif d ~= nil and table_include(groups, d) and d == value[1] then
table.insert(result, 1, value[1]) table.insert(result, 1, value[1])
else else
table.insert(result, value[1]) table.insert(result, value[1])
@ -712,34 +742,35 @@ function nodes_filter(t, info)
end end
function proxy_unlock_test() function proxy_unlock_test()
local region, old_region
if type == "Netflix" then if type == "Netflix" then
region = netflix_unlock_test() region, old_region = netflix_unlock_test()
elseif type == "Disney Plus" then elseif type == "Disney Plus" then
region = disney_unlock_test() region, old_region = disney_unlock_test()
elseif type == "HBO Now" then elseif type == "HBO Now" then
region = hbo_now_unlock_test() region, old_region = hbo_now_unlock_test()
elseif type == "HBO Max" then elseif type == "HBO Max" then
region = hbo_max_unlock_test() region, old_region = hbo_max_unlock_test()
elseif type == "HBO GO Asia" then elseif type == "HBO GO Asia" then
region = hbo_go_asia_unlock_test() region, old_region = hbo_go_asia_unlock_test()
elseif type == "YouTube Premium" then elseif type == "YouTube Premium" then
region = ytb_unlock_test() region, old_region = ytb_unlock_test()
elseif type == "TVB Anywhere+" then elseif type == "TVB Anywhere+" then
region = tvb_anywhere_unlock_test() region, old_region = tvb_anywhere_unlock_test()
elseif type == "Amazon Prime Video" then elseif type == "Amazon Prime Video" then
region = prime_video_unlock_test() region, old_region = prime_video_unlock_test()
elseif type == "DAZN" then elseif type == "DAZN" then
region = dazn_unlock_test() region, old_region = dazn_unlock_test()
elseif type == "Paramount Plus" then elseif type == "Paramount Plus" then
region = paramount_plus_unlock_test() region, old_region = paramount_plus_unlock_test()
elseif type == "Discovery Plus" then elseif type == "Discovery Plus" then
region = discovery_plus_unlock_test() region, old_region = discovery_plus_unlock_test()
elseif type == "Bilibili" then elseif type == "Bilibili" then
region = bilibili_unlock_test() region, old_region = bilibili_unlock_test()
elseif type == "Google" then elseif type == "Google" then
region = google_not_cn_test() region, old_region = google_not_cn_test()
end end
return region return region, old_region
end end
function auto_get_policy_group(passwd, ip, port) function auto_get_policy_group(passwd, ip, port)
@ -965,11 +996,13 @@ end
function netflix_unlock_test() function netflix_unlock_test()
status = 0 status = 0
local filmId = 70143836
local url = "https://www.netflix.com/title/"..filmId local url = "https://www.netflix.com/title/"..filmId
local headers = "User-Agent: "..UA local headers = "User-Agent: "..UA
local info = luci.sys.exec(string.format('curl -sLI --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{json} -H "Content-Type: application/json" -H "%s" -XGET %s', headers, url)) local info = luci.sys.exec(string.format('curl -sLI --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{json} -H "Content-Type: application/json" -H "%s" -XGET %s', headers, url))
local result = {} local result = {}
local region, old_region local region
local old_region = ""
local regex = uci:get("openclash", "config", "stream_auto_select_region_key_netflix") or "" local regex = uci:get("openclash", "config", "stream_auto_select_region_key_netflix") or ""
if info then if info then
info = json.parse(info) info = json.parse(info)
@ -980,18 +1013,20 @@ function netflix_unlock_test()
string.gsub(info.url_effective, '[^/]+', function(w) table.insert(result, w) end) string.gsub(info.url_effective, '[^/]+', function(w) table.insert(result, w) end)
region = string.upper(string.match(result[3], "^%a+")) region = string.upper(string.match(result[3], "^%a+"))
if region == "TITLE" then region = "US" end if region == "TITLE" then region = "US" end
if fs.isfile(string.format("/tmp/openclash_%s_region", type)) then if region then
old_region = fs.readfile(string.format("/tmp/openclash_%s_region", type)) if fs.isfile(string.format("/tmp/openclash_%s_region", type)) then
old_region = fs.readfile(string.format("/tmp/openclash_%s_region", type))
end
if not datamatch(region, regex) then
status = 3
elseif old_region ~= "" and region ~= old_region and not all_test then
status = 4
end
if status == 2 and not all_test and ((old_region ~= "" and region ~= old_region) or (old_region == "")) then
fs.writefile(string.format("/tmp/openclash_%s_region", type), region)
end
end end
if not datamatch(region, regex) then return region, old_region
status = 3
elseif old_region and region ~= old_region and not all_test then
status = 4
end
if status == 2 and region ~= old_region and not all_test then
fs.writefile(string.format("/tmp/openclash_%s_region", type), region)
end
return region
elseif info.http_code == 404 or info.http_code == 403 then elseif info.http_code == 404 or info.http_code == 403 then
status = 1 status = 1
end end
@ -1001,14 +1036,15 @@ end
function disney_unlock_test() function disney_unlock_test()
status = 0 status = 0
local url = "https://global.edge.bamgrid.com/devices" local url = "https://disney.api.edge.bamgrid.com/devices"
local url2 = "https://global.edge.bamgrid.com/token" local url2 = "https://disney.api.edge.bamgrid.com/token"
local url3 = "https://disney.api.edge.bamgrid.com/graph/v1/device/graphql" local url3 = "https://disney.api.edge.bamgrid.com/graph/v1/device/graphql"
local headers = '-H "Accept-Language: en" -H "Content-Type: application/json" -H "authorization: ZGlzbmV5JmJyb3dzZXImMS4wLjA.Cu56AgSfBTDag5NiRA81oLHkDZfu5L3CKadnefEAY84"' local headers = '-H "Accept-Language: en" -H "Content-Type: application/json" -H "authorization: ZGlzbmV5JmJyb3dzZXImMS4wLjA.Cu56AgSfBTDag5NiRA81oLHkDZfu5L3CKadnefEAY84"'
local auth = '-H "authorization: Bearer ZGlzbmV5JmJyb3dzZXImMS4wLjA.Cu56AgSfBTDag5NiRA81oLHkDZfu5L3CKadnefEAY84"' local auth = '-H "authorization: Bearer ZGlzbmV5JmJyb3dzZXImMS4wLjA.Cu56AgSfBTDag5NiRA81oLHkDZfu5L3CKadnefEAY84"'
local body = '{"query":"mutation registerDevice($input: RegisterDeviceInput!) { registerDevice(registerDevice: $input) { grant { grantType assertion } } }","variables":{"input":{"deviceFamily":"browser","applicationRuntime":"chrome","deviceProfile":"windows","deviceLanguage":"en","attributes":{"osDeviceIds":[],"manufacturer":"microsoft","model":null,"operatingSystem":"windows","operatingSystemVersion":"10.0","browserName":"chrome","browserVersion":"96.0.4606"}}}}' local body = '{"query":"mutation registerDevice($input: RegisterDeviceInput!) { registerDevice(registerDevice: $input) { grant { grantType assertion } } }","variables":{"input":{"deviceFamily":"browser","applicationRuntime":"chrome","deviceProfile":"windows","deviceLanguage":"en","attributes":{"osDeviceIds":[],"manufacturer":"microsoft","model":null,"operatingSystem":"windows","operatingSystemVersion":"10.0","browserName":"chrome","browserVersion":"96.0.4606"}}}}'
local region, old_region, assertion, data, preassertion, disneycookie, tokencontent local region, assertion, data, preassertion, disneycookie, tokencontent
local regex = uci:get("openclash", "config", "stream_auto_select_region_key_disney") or "" local regex = uci:get("openclash", "config", "stream_auto_select_region_key_disney") or ""
local old_region = ""
preassertion = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 %s -H 'User-Agent: %s' -H 'content-type: application/json; charset=UTF-8' -d '{\"deviceFamily\":\"browser\",\"applicationRuntime\":\"chrome\",\"deviceProfile\":\"windows\",\"attributes\":{}}' -XPOST %s", auth, UA, url)) preassertion = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 %s -H 'User-Agent: %s' -H 'content-type: application/json; charset=UTF-8' -d '{\"deviceFamily\":\"browser\",\"applicationRuntime\":\"chrome\",\"deviceProfile\":\"windows\",\"attributes\":{}}' -XPOST %s", auth, UA, url))
@ -1042,13 +1078,13 @@ function disney_unlock_test()
end end
if not datamatch(region, regex) then if not datamatch(region, regex) then
status = 3 status = 3
elseif old_region and not datamatch(region, old_region) and not all_test then elseif old_region ~= "" and not datamatch(region, old_region) and not all_test then
status = 3 status = 4
end end
if status == 2 and not all_test then if status == 2 and not all_test and ((old_region ~= "" and not datamatch(region, old_region)) or (old_region == "")) then
fs.writefile(string.format("/tmp/openclash_%s_region", type), region) fs.writefile(string.format("/tmp/openclash_%s_region", type), region)
end end
return region return region, old_region
end end
if region and region ~= "" and inSupportedLocation then if region and region ~= "" and inSupportedLocation then
@ -1058,13 +1094,13 @@ function disney_unlock_test()
end end
if not datamatch(region, regex) then if not datamatch(region, regex) then
status = 3 status = 3
elseif old_region and region ~= old_region and not all_test then elseif old_region ~= "" and not datamatch(region, old_region) and not all_test then
status = 4 status = 4
end end
if status == 2 and region ~= old_region and not all_test then if status == 2 and not all_test and ((old_region ~= "" and not datamatch(region, old_region)) or (old_region == "")) then
fs.writefile(string.format("/tmp/openclash_%s_region", type), region) fs.writefile(string.format("/tmp/openclash_%s_region", type), region)
end end
return region return region, old_region
end end
end end
end end
@ -1109,18 +1145,20 @@ function hbo_max_unlock_test()
if result[3] then if result[3] then
region = string.upper(string.match(result[3], "^%a+")) region = string.upper(string.match(result[3], "^%a+"))
end end
if fs.isfile(string.format("/tmp/openclash_%s_region", type)) then if region then
old_region = fs.readfile(string.format("/tmp/openclash_%s_region", type)) if fs.isfile(string.format("/tmp/openclash_%s_region", type)) then
old_region = fs.readfile(string.format("/tmp/openclash_%s_region", type))
end
if not datamatch(region, regex) then
status = 3
elseif old_region ~= "" and region ~= old_region and not all_test then
status = 4
end
if status == 2 and not all_test and ((old_region ~= "" and region ~= old_region) or (old_region == "")) then
fs.writefile(string.format("/tmp/openclash_%s_region", type), region)
end
end end
if not datamatch(region, regex) then return region, old_region
status = 3
elseif region ~= old_region and not all_test then
status = 4
end
if status == 2 and not all_test and region ~= old_region then
fs.writefile(string.format("/tmp/openclash_%s_region", type), region)
end
return region
end end
end end
end end
@ -1146,18 +1184,20 @@ function hbo_go_asia_unlock_test()
if data.country then if data.country then
region = string.upper(data.country) region = string.upper(data.country)
end end
if fs.isfile(string.format("/tmp/openclash_%s_region", type)) then if region then
old_region = fs.readfile(string.format("/tmp/openclash_%s_region", type)) if fs.isfile(string.format("/tmp/openclash_%s_region", type)) then
old_region = fs.readfile(string.format("/tmp/openclash_%s_region", type))
end
if not datamatch(region, regex) then
status = 3
elseif old_region ~= "" and region ~= old_region and not all_test then
status = 4
end
if status == 2 and not all_test and ((old_region ~= "" and region ~= old_region) or (old_region == "")) then
fs.writefile(string.format("/tmp/openclash_%s_region", type), region)
end
end end
if not datamatch(region, regex) then return region, old_region
status = 3
elseif region ~= old_region and not all_test then
status = 4
end
if status == 2 and not all_test and region ~= old_region then
fs.writefile(string.format("/tmp/openclash_%s_region", type), region)
end
return region
end end
end end
end end
@ -1195,14 +1235,14 @@ function ytb_unlock_test()
end end
if not datamatch(region, regex) then if not datamatch(region, regex) then
status = 3 status = 3
elseif region ~= old_region and not all_test then elseif old_region ~= "" and region ~= old_region and not all_test then
status = 4 status = 4
end end
if status == 2 and not all_test and region ~= old_region then if status == 2 and not all_test and ((old_region ~= "" and region ~= old_region) or (old_region == "")) then
fs.writefile(string.format("/tmp/openclash_%s_region", type), region) fs.writefile(string.format("/tmp/openclash_%s_region", type), region)
end end
end end
return region return region, old_region
end end
function tvb_anywhere_unlock_test() function tvb_anywhere_unlock_test()
@ -1223,20 +1263,22 @@ function tvb_anywhere_unlock_test()
if data.country then if data.country then
region = string.upper(data.country) region = string.upper(data.country)
end end
if fs.isfile(string.format("/tmp/openclash_%s_region", type)) then if region then
old_region = fs.readfile(string.format("/tmp/openclash_%s_region", type)) if fs.isfile(string.format("/tmp/openclash_%s_region", type)) then
end old_region = fs.readfile(string.format("/tmp/openclash_%s_region", type))
if not datamatch(region, regex) then end
status = 3 if not datamatch(region, regex) then
elseif region ~= old_region and not all_test then status = 3
status = 4 elseif old_region ~= "" and region ~= old_region and not all_test then
end status = 4
if status == 2 and not all_test and region ~= old_region then end
fs.writefile(string.format("/tmp/openclash_%s_region", type), region) if status == 2 and not all_test and ((old_region ~= "" and region ~= old_region) or (old_region == "")) then
fs.writefile(string.format("/tmp/openclash_%s_region", type), region)
end
end end
end end
end end
return region return region, old_region
end end
function prime_video_unlock_test() function prime_video_unlock_test()
@ -1244,13 +1286,13 @@ function prime_video_unlock_test()
local url = "https://www.primevideo.com" local url = "https://www.primevideo.com"
local httpcode = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{http_code} -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url)) local httpcode = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{http_code} -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
local region local region
local old_region local old_region = ""
local regex = uci:get("openclash", "config", "stream_auto_select_region_key_prime_video") or "" local regex = uci:get("openclash", "config", "stream_auto_select_region_key_prime_video") or ""
if tonumber(httpcode) == 200 then if tonumber(httpcode) == 200 then
status = 1 status = 1
local data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url)) local data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
if data then if data then
region = string.sub(string.match(data, "\"currentTerritory\":\"%a+\""), 21, -2) region = string.sub(string.match(data, "\"currentTerritory\":\"%a+\""), 21, -2)
if region then if region then
status = 2 status = 2
if fs.isfile(string.format("/tmp/openclash_%s_region", type)) then if fs.isfile(string.format("/tmp/openclash_%s_region", type)) then
@ -1258,13 +1300,13 @@ function prime_video_unlock_test()
end end
if not datamatch(region, regex) then if not datamatch(region, regex) then
status = 3 status = 3
elseif old_region and region ~= old_region and not all_test then elseif old_region ~= "" and region ~= old_region and not all_test then
status = 4 status = 4
end end
if status == 2 and not all_test and region ~= old_region then if status == 2 and not all_test and ((old_region ~= "" and region ~= old_region) or (old_region == "")) then
fs.writefile(string.format("/tmp/openclash_%s_region", type), region) fs.writefile(string.format("/tmp/openclash_%s_region", type), region)
end end
return region return region, old_region
end end
end end
end end
@ -1277,7 +1319,7 @@ function dazn_unlock_test()
local url2 = "https://startup.core.indazn.com/misl/v5/Startup" local url2 = "https://startup.core.indazn.com/misl/v5/Startup"
local httpcode = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{http_code} -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url)) local httpcode = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{http_code} -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
local region local region
local old_region local old_region = ""
local regex = uci:get("openclash", "config", "stream_auto_select_region_key_dazn") or "" local regex = uci:get("openclash", "config", "stream_auto_select_region_key_dazn") or ""
if tonumber(httpcode) == 200 then if tonumber(httpcode) == 200 then
status = 1 status = 1
@ -1290,27 +1332,29 @@ function dazn_unlock_test()
if data.Region.GeolocatedCountry then if data.Region.GeolocatedCountry then
region = string.upper(data.Region.GeolocatedCountry) region = string.upper(data.Region.GeolocatedCountry)
end end
if fs.isfile(string.format("/tmp/openclash_%s_region", type)) then if region then
old_region = fs.readfile(string.format("/tmp/openclash_%s_region", type)) if fs.isfile(string.format("/tmp/openclash_%s_region", type)) then
end old_region = fs.readfile(string.format("/tmp/openclash_%s_region", type))
if not datamatch(region, regex) then end
status = 3 if not datamatch(region, regex) then
elseif old_region and region ~= old_region and not all_test then status = 3
status = 4 elseif old_region ~= "" and region ~= old_region and not all_test then
end status = 4
if status == 2 and not all_test and region ~= old_region then end
fs.writefile(string.format("/tmp/openclash_%s_region", type), region) if status == 2 and not all_test and ((old_region ~= "" and region ~= old_region) or (old_region == "")) then
fs.writefile(string.format("/tmp/openclash_%s_region", type), region)
end
end end
end end
end end
return region return region, old_region
end end
function paramount_plus_unlock_test() function paramount_plus_unlock_test()
status = 0 status = 0
local url = "https://www.paramountplus.com/" local url = "https://www.paramountplus.com/"
local region local region
local old_region local old_region = ""
local regex = uci:get("openclash", "config", "stream_auto_select_region_key_paramount_plus") or "" local regex = uci:get("openclash", "config", "stream_auto_select_region_key_paramount_plus") or ""
local data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{json} -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url)) local data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{json} -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
data = json.parse(data) data = json.parse(data)
@ -1326,13 +1370,13 @@ function paramount_plus_unlock_test()
end end
if not datamatch(region, regex) then if not datamatch(region, regex) then
status = 3 status = 3
elseif old_region and region ~= old_region and not all_test then elseif old_region ~= "" and region ~= old_region and not all_test then
status = 4 status = 4
end end
if status == 2 and not all_test and region ~= old_region then if status == 2 and not all_test and ((old_region ~= "" and region ~= old_region) or (old_region == "")) then
fs.writefile(string.format("/tmp/openclash_%s_region", type), region) fs.writefile(string.format("/tmp/openclash_%s_region", type), region)
end end
return region return region, old_region
end end
end end
end end
@ -1343,6 +1387,7 @@ function discovery_plus_unlock_test()
local url = "https://us1-prod-direct.discoveryplus.com/token?deviceId=d1a4a5d25212400d1e6985984604d740&realm=go&shortlived=true" local url = "https://us1-prod-direct.discoveryplus.com/token?deviceId=d1a4a5d25212400d1e6985984604d740&realm=go&shortlived=true"
local url1 = "https://us1-prod-direct.discoveryplus.com/users/me" local url1 = "https://us1-prod-direct.discoveryplus.com/users/me"
local region local region
local old_region = ""
local regex = uci:get("openclash", "config", "stream_auto_select_region_key_discovery_plus") or "" local regex = uci:get("openclash", "config", "stream_auto_select_region_key_discovery_plus") or ""
local token = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' '%s'", UA, url)) local token = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' '%s'", UA, url))
if token and json.parse(token) and json.parse(token).data and json.parse(token).data.attributes then if token and json.parse(token) and json.parse(token).data and json.parse(token).data.attributes then
@ -1359,13 +1404,13 @@ function discovery_plus_unlock_test()
end end
if not datamatch(region, regex) then if not datamatch(region, regex) then
status = 3 status = 3
elseif old_region and region ~= old_region and not all_test then elseif old_region ~= "" and region ~= old_region and not all_test then
status = 4 status = 4
end end
if status == 2 and not all_test and region ~= old_region then if status == 2 and not all_test and ((old_region ~= "" and region ~= old_region) or (old_region == "")) then
fs.writefile(string.format("/tmp/openclash_%s_region", type), region) fs.writefile(string.format("/tmp/openclash_%s_region", type), region)
end end
return region return region, old_region
end end
end end
end end
@ -1376,6 +1421,7 @@ function bilibili_unlock_test()
local randsession = luci.sys.exec("cat /dev/urandom | head -n 32 | md5sum | head -c 32") local randsession = luci.sys.exec("cat /dev/urandom | head -n 32 | md5sum | head -c 32")
local region, httpcode, data, url local region, httpcode, data, url
local regex = uci:get("openclash", "config", "stream_auto_select_region_key_bilibili") or "" local regex = uci:get("openclash", "config", "stream_auto_select_region_key_bilibili") or ""
local old_region = ""
if regex == "HK/MO/TW" then if regex == "HK/MO/TW" then
url = string.format("https://api.bilibili.com/pgc/player/web/playurl?avid=18281381&cid=29892777&qn=0&type=&otype=json&ep_id=183799&fourk=1&fnver=0&fnval=16&session=%s&module=bangumi", randsession) url = string.format("https://api.bilibili.com/pgc/player/web/playurl?avid=18281381&cid=29892777&qn=0&type=&otype=json&ep_id=183799&fourk=1&fnver=0&fnval=16&session=%s&module=bangumi", randsession)
region = "HK/MO/TW" region = "HK/MO/TW"
@ -1398,13 +1444,13 @@ function bilibili_unlock_test()
if fs.isfile(string.format("/tmp/openclash_%s_region", type)) then if fs.isfile(string.format("/tmp/openclash_%s_region", type)) then
old_region = fs.readfile(string.format("/tmp/openclash_%s_region", type)) old_region = fs.readfile(string.format("/tmp/openclash_%s_region", type))
end end
if old_region and region ~= old_region and not all_test then if old_region ~= "" and region ~= old_region and not all_test then
status = 4 status = 4
end end
if status == 2 and not all_test and region ~= old_region then if status == 2 and not all_test and ((old_region ~= "" and region ~= old_region) or (old_region == "")) then
fs.writefile(string.format("/tmp/openclash_%s_region", type), region) fs.writefile(string.format("/tmp/openclash_%s_region", type), region)
end end
return region return region, old_region
end end
end end
end end
@ -1420,6 +1466,9 @@ function google_not_cn_test()
if tonumber(httpcode) == 200 then if tonumber(httpcode) == 200 then
status = 2 status = 2
region = "NOT CN" region = "NOT CN"
if not all_test then
fs.writefile(string.format("/tmp/openclash_%s_region", type), tested_proxy[-1])
end
else else
region = "CN" region = "CN"
status = 1 status = 1

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
. /usr/share/openclash/log.sh . /usr/share/openclash/log.sh
set_lock() { set_lock() {
@ -23,31 +23,33 @@ fi
LAST_OPVER="/tmp/openclash_last_version" LAST_OPVER="/tmp/openclash_last_version"
LAST_VER=$(sed -n 1p "$LAST_OPVER" 2>/dev/null |sed "s/^v//g" |tr -d "\n") LAST_VER=$(sed -n 1p "$LAST_OPVER" 2>/dev/null |sed "s/^v//g" |tr -d "\n")
OP_CV=$(opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F '-' '{print $1}' |awk -F 'Version: ' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null) OP_CV=$(rm -f /var/lock/opkg.lock && opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F '-' '{print $1}' |awk -F 'Version: ' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
OP_LV=$(sed -n 1p $LAST_OPVER 2>/dev/null |awk -F '-' '{print $1}' |awk -F 'v' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null) OP_LV=$(sed -n 1p "$LAST_OPVER" 2>/dev/null |awk -F '-' '{print $1}' |awk -F 'v' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master") RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master")
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0) github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
LOG_FILE="/tmp/openclash.log"
set_lock set_lock
if [ "$(expr "$OP_LV" \> "$OP_CV")" -eq 1 ] && [ -f "$LAST_OPVER" ]; then if [ -n "$OP_CV" ] && [ -n "$OP_LV" ] && [ "$(expr "$OP_LV" \> "$OP_CV")" -eq 1 ] && [ -f "$LAST_OPVER" ]; then
LOG_OUT "Start Downloading【OpenClash - v$LAST_VER】..." LOG_OUT "Start Downloading【OpenClash - v$LAST_VER】..."
if [ "$github_address_mod" != "0" ]; then if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -sL -m 30 --speed-time 15 --speed-limit 1 https://cdn.jsdelivr.net/gh/vernesong/OpenClash@"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk >/dev/null 2>&1 curl -SsL -m 30 --speed-time 15 --speed-limit 1 "$github_address_mod"gh/vernesong/OpenClash@"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/openclash.ipk" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ]; then
curl -sL -m 30 --speed-time 15 --speed-limit 1 https://fastly.jsdelivr.net/gh/vernesong/OpenClash@"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk >/dev/null 2>&1
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -sL -m 30 --speed-time 15 --speed-limit 1 https://raw.fastgit.org/vernesong/OpenClash/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk >/dev/null 2>&1 curl -SsL -m 30 --speed-time 15 --speed-limit 1 https://raw.fastgit.org/vernesong/OpenClash/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/openclash.ipk" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else else
curl -sL -m 30 --speed-time 15 --speed-limit 1 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk >/dev/null 2>&1 curl -SsL -m 30 --speed-time 15 --speed-limit 1 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/openclash.ipk" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
else else
curl -sL -m 30 --speed-time 15 --speed-limit 1 https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk >/dev/null 2>&1 curl -SsL -m 30 --speed-time 15 --speed-limit 1 https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/openclash.ipk" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
if [ "$?" != "0" ]; then if [ "${PIPESTATUS[0]}" -ne 0 ]; then
curl -sL -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk >/dev/null 2>&1 curl -SsL -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/openclash.ipk" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
curl_status=${PIPESTATUS[0]}
else
curl_status=0
fi fi
if [ "$?" == "0" ] && [ -s "/tmp/openclash.ipk" ]; then if [ "$curl_status" -eq 0 ] && [ -s "/tmp/openclash.ipk" ]; then
LOG_OUT "【OpenClash - v$LAST_VER】Download Successful, Start Pre Update Test..." LOG_OUT "【OpenClash - v$LAST_VER】Download Successful, Start Pre Update Test..."
if [ -z "$(opkg install /tmp/openclash.ipk --noaction 2>/dev/null |grep 'Upgrading luci-app-openclash on root' 2>/dev/null)" ]; then if [ -z "$(opkg install /tmp/openclash.ipk --noaction 2>/dev/null |grep 'Upgrading luci-app-openclash on root' 2>/dev/null)" ]; then
@ -115,7 +117,7 @@ EOF
fi fi
fi fi
else else
if [ ! -f "$LAST_OPVER" ]; then if [ ! -f "$LAST_OPVER" ] || [ -z "$OP_CV" ] || [ -z "$OP_LV" ]; then
LOG_OUT "Failed to Get Version Information, Please Try Again Later..." LOG_OUT "Failed to Get Version Information, Please Try Again Later..."
else else
LOG_OUT "OpenClash Has not Been Updated, Stop Continuing!" LOG_OUT "OpenClash Has not Been Updated, Stop Continuing!"

View File

@ -1,38 +1,40 @@
#!/bin/sh #!/bin/bash
CKTIME=$(date "+%Y-%m-%d-%H") CKTIME=$(date "+%Y-%m-%d-%H")
LAST_OPVER="/tmp/openclash_last_version" LAST_OPVER="/tmp/openclash_last_version"
RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master") RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master")
OP_CV=$(opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F '-' '{print $1}' |awk -F 'Version: ' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null) OP_CV=$(rm -f /var/lock/opkg.lock && opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F '-' '{print $1}' |awk -F 'Version: ' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
OP_LV=$(sed -n 1p $LAST_OPVER 2>/dev/null |awk -F '-' '{print $1}' |awk -F 'v' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null) OP_LV=$(sed -n 1p $LAST_OPVER 2>/dev/null |awk -F '-' '{print $1}' |awk -F 'v' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0) github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
LOG_FILE="/tmp/openclash.log"
if [ "$CKTIME" != "$(grep "CheckTime" $LAST_OPVER 2>/dev/null |awk -F ':' '{print $2}')" ]; then if [ "$CKTIME" != "$(grep "CheckTime" $LAST_OPVER 2>/dev/null |awk -F ':' '{print $2}')" ]; then
if [ "$github_address_mod" != "0" ]; then if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -sL -m 10 https://cdn.jsdelivr.net/gh/vernesong/OpenClash@"$RELEASE_BRANCH"/version -o $LAST_OPVER >/dev/null 2>&1 curl -SsL -m 10 "$github_address_mod"gh/vernesong/OpenClash@"$RELEASE_BRANCH"/version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ]; then
curl -sL -m 10 https://fastly.jsdelivr.net/gh/vernesong/OpenClash@"$RELEASE_BRANCH"/version -o $LAST_OPVER >/dev/null 2>&1
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -sL -m 10 https://raw.fastgit.org/vernesong/OpenClash/"$RELEASE_BRANCH"/version -o $LAST_OPVER >/dev/null 2>&1 curl -SsL -m 10 https://raw.fastgit.org/vernesong/OpenClash/"$RELEASE_BRANCH"/version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else else
curl -sL -m 10 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/version -o $LAST_OPVER >/dev/null 2>&1 curl -SsL -m 10 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
else else
curl -sL -m 10 https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/version -o $LAST_OPVER >/dev/null 2>&1 curl -SsL -m 10 https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi fi
if [ "$?" != "0" ] || [ -n "$(cat $LAST_OPVER |grep '<html>')" ]; then if [ "${PIPESTATUS[0]}" -ne 0 ] || [ -n "$(cat $LAST_OPVER |grep '<html>')" ]; then
curl -sL -m 10 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/version -o $LAST_OPVER >/dev/null 2>&1 curl -SsL -m 10 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
curl_status=${PIPESTATUS[0]}
else
curl_status=0
fi fi
if [ "$?" == "0" ] && [ -z "$(cat $LAST_OPVER |grep '<html>')" ]; then if [ "$curl_status" -eq 0 ] && [ -z "$(cat $LAST_OPVER |grep '<html>')" ]; then
OP_LV=$(sed -n 1p $LAST_OPVER 2>/dev/null |awk -F '-' '{print $1}' |awk -F 'v' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null) OP_LV=$(sed -n 1p $LAST_OPVER 2>/dev/null |awk -F '-' '{print $1}' |awk -F 'v' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
if [ "$(expr "$OP_CV" \>= "$OP_LV")" -eq 1 ]; then if [ "$(expr "$OP_CV" \>= "$OP_LV")" -eq 1 ]; then
sed -i "/^https:/i\CheckTime:${CKTIME}" "$LAST_OPVER" 2>/dev/null sed -i "/^https:/i\CheckTime:${CKTIME}" "$LAST_OPVER" 2>/dev/null
sed -i '/^https:/,$d' $LAST_OPVER sed -i '/^https:/,$d' $LAST_OPVER
elif [ "$(expr "$OP_LV" \> "$OP_CV")" -eq 1 ] && [ -n "$OP_LV" ]; then elif [ "$(expr "$OP_LV" \> "$OP_CV")" -eq 1 ] && [ -n "$OP_LV" ]; then
sed -i "/^https:/i\CheckTime:${CKTIME}" "$LAST_OPVER" 2>/dev/null sed -i "/^https:/i\CheckTime:${CKTIME}" "$LAST_OPVER" 2>/dev/null
return 2 exit 2
fi fi
else else
rm -rf "$LAST_OPVER" rm -rf "$LAST_OPVER"
@ -41,5 +43,5 @@ elif [ "$(expr "$OP_CV" \>= "$OP_LV")" -eq 1 ]; then
sed -i '/^CheckTime:/,$d' $LAST_OPVER sed -i '/^CheckTime:/,$d' $LAST_OPVER
echo "CheckTime:$CKTIME" >> $LAST_OPVER echo "CheckTime:$CKTIME" >> $LAST_OPVER
elif [ "$(expr "$OP_LV" \> "$OP_CV")" -eq 1 ] && [ -n "$OP_LV" ]; then elif [ "$(expr "$OP_LV" \> "$OP_CV")" -eq 1 ] && [ -n "$OP_LV" ]; then
return 2 exit 2
fi 2>/dev/null fi 2>/dev/null

View File

@ -20,11 +20,66 @@ NETFLIX_DOMAINS_LIST="/usr/share/openclash/res/Netflix_Domains.list"
NETFLIX_DOMAINS_CUSTOM_LIST="/etc/openclash/custom/openclash_custom_netflix_domains.list" NETFLIX_DOMAINS_CUSTOM_LIST="/etc/openclash/custom/openclash_custom_netflix_domains.list"
DISNEY_DOMAINS_LIST="/usr/share/openclash/res/Disney_Plus_Domains.list" DISNEY_DOMAINS_LIST="/usr/share/openclash/res/Disney_Plus_Domains.list"
_koolshare=$(cat /usr/lib/os-release 2>/dev/null |grep OPENWRT_RELEASE 2>/dev/null |grep -i koolshare 2>/dev/null) _koolshare=$(cat /usr/lib/os-release 2>/dev/null |grep OPENWRT_RELEASE 2>/dev/null |grep -i koolshare 2>/dev/null)
china_ip_route=$(uci -q get openclash.config.china_ip_route)
en_mode=$(uci -q get openclash.config.en_mode)
CRASH_NUM=0 CRASH_NUM=0
CFG_UPDATE_INT=1 CFG_UPDATE_INT=1
STREAM_DOMAINS_PREFETCH=1 STREAM_DOMAINS_PREFETCH=1
STREAM_AUTO_SELECT=1 STREAM_AUTO_SELECT=1
FW4="$(command -v fw4)" FW4="$(command -v fw4)"
check_dnsmasq() {
if [ -z "$(echo "$en_mode" |grep "redir-host")" ] && [ "$china_ip_route" -eq 1 ]; then
if [ "$(nslookup www.baidu.com 127.0.0.1:5353 >/dev/null 2>&1 || echo $?)" != "1" ]; then
DNSPORT=$(uci -q get dhcp.@dnsmasq[0].port)
if [ -z "$DNSPORT" ]; then
DNSPORT=$(netstat -nlp |grep -E '127.0.0.1:.*dnsmasq' |awk -F '127.0.0.1:' '{print $2}' |awk '{print $1}' |head -1 || echo 53)
fi
if [ -n "$FW4" ]; then
if [ -n "$(nft list chain inet fw4 nat_output |grep 'OpenClash DNS Hijack')" ]; then
LOG_OUT "Tip: Dnsmasq Work is Normal, Restore The Firewall DNS Hijacking Rules..."
for nft in "nat_output" "dstnat"; do
handles=$(nft -a list chain inet fw4 ${nft} |grep "OpenClash DNS Hijack" |awk -F '# handle ' '{print$2}')
for handle in $handles; do
nft delete rule inet fw4 ${nft} handle ${handle}
done
done >/dev/null 2>&1
position=$(nft list chain inet fw4 dstnat |grep "OpenClash" |grep "DNS" |awk -F '# handle ' '{print$2}' |sort -rn |head -1 || ehco 0)
nft add rule inet fw4 dstnat position "$position" tcp dport 53 redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 dstnat position "$position" udp dport 53 redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
if [ "$ipv6_enable" -eq 1 ]; then
nft add rule inet fw4 dstnat position "$position" meta nfproto {ipv6} tcp dport 53 counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 dstnat position "$position" meta nfproto {ipv6} udp dport 53 counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
fi
fi
else
if [ -n "$(iptables -t nat -nL OUTPUT --line-number |grep 'OpenClash DNS Hijack')" ]; then
LOG_OUT "Tip: Dnsmasq Work is Normal, Restore The Firewall DNS Hijacking Rules..."
for ipt in "iptables -nvL OUTPUT -t nat" "iptables -nvL PREROUTING -t nat" "ip6tables -nvL PREROUTING -t nat" "ip6tables -nvL OUTPUT -t nat"; do
lines=$($ipt |sed 1,2d |sed -n "/OpenClash DNS Hijack/=" 2>/dev/null |sort -rn)
if [ -n "$lines" ]; then
for line in $lines; do
$(echo "$ipt" |awk -v OFS=" " '{print $1,$4,$5}' |sed 's/[ ]*$//g') -D $(echo "$ipt" |awk '{print $3}') $line
done
fi
done >/dev/null 2>&1
position=$(iptables -nvL PREROUTING -t nat |sed 1,2d |grep "OpenClash" |sed -n "/DNS/=" 2>/dev/null |sort -rn |head -1 || ehco 0)
[ "$position" -ne 0 ] && let position++
iptables -t nat -I PREROUTING "$position" -p udp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
iptables -t nat -I PREROUTING "$position" -p tcp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
if [ "$ipv6_enable" -eq 1 ]; then
position=$(ip6tables -nvL PREROUTING -t nat |sed 1,2d |grep "OpenClash" |sed -n "/DNS/=" 2>/dev/null |sort -rn |head -1 || ehco 0)
[ "$position" -ne 0 ] && let position++
ip6tables -t nat -I PREROUTING "$position" -p udp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
ip6tables -t nat -I PREROUTING "$position" -p tcp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
fi
fi
fi
fi
fi
}
check_dnsmasq
sleep 60 sleep 60
while :; while :;
@ -99,14 +154,14 @@ if [ "$enable" -eq 1 ]; then
fi fi
## Porxy history ## Porxy history
/usr/share/openclash/openclash_history_get.sh /usr/share/openclash/openclash_history_get.sh
## Log File Size Manage: ## Log File Size Manage:
LOGSIZE=`ls -l /tmp/openclash.log |awk '{print int($5/1024)}'` LOGSIZE=`ls -l /tmp/openclash.log |awk '{print int($5/1024)}'`
if [ "$LOGSIZE" -gt "$log_size" ]; then if [ "$LOGSIZE" -gt "$log_size" ]; then
: > /tmp/openclash.log : > /tmp/openclash.log
LOG_OUT "Watchdog: Log Size Limit, Clean Up All Log Records..." LOG_OUT "Watchdog: Log Size Limit, Clean Up All Log Records..."
fi fi
## 端口转发重启 ## 端口转发重启
last_line=$(iptables -t nat -nL PREROUTING --line-number |awk '{print $1}' 2>/dev/null |awk 'END {print}' |sed -n '$p') last_line=$(iptables -t nat -nL PREROUTING --line-number |awk '{print $1}' 2>/dev/null |awk 'END {print}' |sed -n '$p')
@ -120,6 +175,9 @@ fi
LOG_OUT "Watchdog: Setting Firewall For Enabling Redirect..." LOG_OUT "Watchdog: Setting Firewall For Enabling Redirect..."
fi fi
## 防止 DNSMASQ 加载配置时间过长导致 DNS 无法解析
check_dnsmasq
## Localnetwork 刷新 ## Localnetwork 刷新
lan_ip_cidrs=$(ip route | grep "/" | awk '{print $1}' | grep -vE "^198.18" 2>/dev/null) lan_ip_cidrs=$(ip route | grep "/" | awk '{print $1}' | grep -vE "^198.18" 2>/dev/null)
lan_ip6_cidrs=$(ip -6 route | grep "/" | awk '{print $1}' | grep -vE "^unreachable" 2>/dev/null) lan_ip6_cidrs=$(ip -6 route | grep "/" | awk '{print $1}' | grep -vE "^unreachable" 2>/dev/null)
@ -218,6 +276,10 @@ fi
LOG_OUT "Tip: Start Auto Select Proxy For Disney Plus Unlock..." LOG_OUT "Tip: Start Auto Select Proxy For Disney Plus Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "Disney Plus" >> $LOG_FILE /usr/share/openclash/openclash_streaming_unlock.lua "Disney Plus" >> $LOG_FILE
fi fi
if [ "$stream_auto_select_google_not_cn" -eq 1 ]; then
LOG_OUT "Tip: Start Auto Select Proxy For Google Not CN Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "Google" >> $LOG_FILE
fi
if [ "$stream_auto_select_ytb" -eq 1 ]; then if [ "$stream_auto_select_ytb" -eq 1 ]; then
LOG_OUT "Tip: Start Auto Select Proxy For YouTube Premium Unlock..." LOG_OUT "Tip: Start Auto Select Proxy For YouTube Premium Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "YouTube Premium" >> $LOG_FILE /usr/share/openclash/openclash_streaming_unlock.lua "YouTube Premium" >> $LOG_FILE
@ -258,10 +320,6 @@ fi
LOG_OUT "Tip: Start Auto Select Proxy For Bilibili Unlock..." LOG_OUT "Tip: Start Auto Select Proxy For Bilibili Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "Bilibili" >> $LOG_FILE /usr/share/openclash/openclash_streaming_unlock.lua "Bilibili" >> $LOG_FILE
fi fi
if [ "$stream_auto_select_google_not_cn" -eq 1 ]; then
LOG_OUT "Tip: Start Auto Select Proxy For Google Not CN Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "Google" >> $LOG_FILE
fi
fi fi
fi fi
STREAM_AUTO_SELECT=$(expr "$STREAM_AUTO_SELECT" + 1) STREAM_AUTO_SELECT=$(expr "$STREAM_AUTO_SELECT" + 1)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -8,9 +8,9 @@
<meta name="description" content="Clash web port" /> <meta name="description" content="Clash web port" />
<!--meta name="external-controller" content="http://secret@example.com:9090"--> <!--meta name="external-controller" content="http://secret@example.com:9090"-->
<title>Clash</title> <title>Clash</title>
<script type="module" crossorigin src="./assets/index.7cc327e0.js"></script> <script type="module" crossorigin src="./assets/index.4db75562.js"></script>
<link rel="modulepreload" crossorigin href="./assets/vendor.8d36e21e.js"> <link rel="modulepreload" crossorigin href="./assets/vendor.0ded7ffb.js">
<link rel="stylesheet" href="./assets/index.ebec649d.css"> <link rel="stylesheet" href="./assets/index.7e15a32d.css">
<link rel="manifest" href="./manifest.webmanifest"><script>if('serviceWorker' in navigator) {window.addEventListener('load', () => {navigator.serviceWorker.register('./sw.js', { scope: './' })})}</script></head> <link rel="manifest" href="./manifest.webmanifest"><script>if('serviceWorker' in navigator) {window.addEventListener('load', () => {navigator.serviceWorker.register('./sw.js', { scope: './' })})}</script></head>
<body> <body>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>

View File

@ -1 +1 @@
if(!self.define){let e,s={};const n=(n,i)=>(n=new URL(n+".js",i).href,s[n]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()})).then((()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didnt register its module`);return e})));self.define=(i,t)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(s[r])return;let o={};const l=e=>n(e,r),d={module:{uri:r},exports:o,require:l};s[r]=Promise.all(i.map((e=>d[e]||l(e)))).then((e=>(t(...e),o)))}}define(["./workbox-74eda642"],(function(e){"use strict";self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()})),e.precacheAndRoute([{url:"assets/index.7cc327e0.js",revision:null},{url:"assets/index.ebec649d.css",revision:null},{url:"assets/vendor.8d36e21e.js",revision:null},{url:"index.html",revision:"244b72655b8f5e568d0cec0bb1ba8b28"},{url:"manifest.webmanifest",revision:"d3dd1da0aa7614180924343e65244285"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))})); if(!self.define){let e,s={};const n=(n,i)=>(n=new URL(n+".js",i).href,s[n]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()})).then((()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didnt register its module`);return e})));self.define=(i,t)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(s[r])return;let d={};const o=e=>n(e,r),l={module:{uri:r},exports:d,require:o};s[r]=Promise.all(i.map((e=>l[e]||o(e)))).then((e=>(t(...e),d)))}}define(["./workbox-74eda642"],(function(e){"use strict";self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()})),e.precacheAndRoute([{url:"assets/index.4db75562.js",revision:null},{url:"assets/index.7e15a32d.css",revision:null},{url:"assets/vendor.0ded7ffb.js",revision:null},{url:"index.html",revision:"ccb924b96d21db1a3954a64d986da4e2"},{url:"manifest.webmanifest",revision:"d3dd1da0aa7614180924343e65244285"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}));

View File

@ -1 +1 @@
import{j as e,b,h as y,r as l}from"./index.2addc377.js";const F="_spining_4i8sg_1",M="_spining_keyframes_4i8sg_1",j={spining:F,spining_keyframes:M},{useState:v}=y;function B({children:s}){return e("span",{className:j.spining,children:s})}const H={right:10,bottom:10},L=({children:s,...n})=>e("button",{type:"button",...n,className:"rtf--ab",children:s}),E=({children:s,...n})=>e("button",{type:"button",className:"rtf--mb",...n,children:s}),O={bottom:24,right:24},R=({event:s="hover",style:n=O,alwaysShowTitle:i=!1,children:f,icon:g,mainButtonStyles:h,onClick:p,text:d,..._})=>{const[a,r]=v(!1),c=i||!a,u=()=>r(!0),m=()=>r(!1),x=()=>s==="hover"&&u(),k=()=>s==="hover"&&m(),N=t=>p?p(t):(t.persist(),s==="click"?a?m():u():null),$=(t,o)=>{t.persist(),r(!1),setTimeout(()=>{o(t)},1)},C=()=>l.exports.Children.map(f,(t,o)=>l.exports.isValidElement(t)?b("li",{className:`rtf--ab__c ${"top"in n?"top":""}`,children:[l.exports.cloneElement(t,{"data-testid":`action-button-${o}`,"aria-label":t.props.text||`Menu button ${o+1}`,"aria-hidden":c,tabIndex:a?0:-1,...t.props,onClick:I=>{t.props.onClick&&$(I,t.props.onClick)}}),t.props.text&&e("span",{className:`${"right"in n?"right":""} ${i?"always-show":""}`,"aria-hidden":c,children:t.props.text})]}):null);return e("ul",{onMouseEnter:x,onMouseLeave:k,className:`rtf ${a?"open":"closed"}`,"data-testid":"fab",style:n,..._,children:b("li",{className:"rtf--mb__c",children:[e(E,{onClick:N,style:h,"data-testid":"main-button",role:"button","aria-label":"Floating menu",tabIndex:0,children:g}),d&&e("span",{className:`${"right"in n?"right":""} ${i?"always-show":""}`,"aria-hidden":c,children:d}),e("ul",{children:C()})]})})};export{L as A,R as F,B as I,H as p}; import{j as e,b,h as y,r as l}from"./index.1428ab75.js";const F="_spining_4i8sg_1",M="_spining_keyframes_4i8sg_1",j={spining:F,spining_keyframes:M},{useState:v}=y;function B({children:s}){return e("span",{className:j.spining,children:s})}const H={right:10,bottom:10},L=({children:s,...n})=>e("button",{type:"button",...n,className:"rtf--ab",children:s}),E=({children:s,...n})=>e("button",{type:"button",className:"rtf--mb",...n,children:s}),O={bottom:24,right:24},R=({event:s="hover",style:n=O,alwaysShowTitle:i=!1,children:f,icon:g,mainButtonStyles:h,onClick:p,text:d,..._})=>{const[a,r]=v(!1),c=i||!a,u=()=>r(!0),m=()=>r(!1),x=()=>s==="hover"&&u(),k=()=>s==="hover"&&m(),N=t=>p?p(t):(t.persist(),s==="click"?a?m():u():null),$=(t,o)=>{t.persist(),r(!1),setTimeout(()=>{o(t)},1)},C=()=>l.exports.Children.map(f,(t,o)=>l.exports.isValidElement(t)?b("li",{className:`rtf--ab__c ${"top"in n?"top":""}`,children:[l.exports.cloneElement(t,{"data-testid":`action-button-${o}`,"aria-label":t.props.text||`Menu button ${o+1}`,"aria-hidden":c,tabIndex:a?0:-1,...t.props,onClick:I=>{t.props.onClick&&$(I,t.props.onClick)}}),t.props.text&&e("span",{className:`${"right"in n?"right":""} ${i?"always-show":""}`,"aria-hidden":c,children:t.props.text})]}):null);return e("ul",{onMouseEnter:x,onMouseLeave:k,className:`rtf ${a?"open":"closed"}`,"data-testid":"fab",style:n,..._,children:b("li",{className:"rtf--mb__c",children:[e(E,{onClick:N,style:h,"data-testid":"main-button",role:"button","aria-label":"Floating menu",tabIndex:0,children:g}),d&&e("span",{className:`${"right"in n?"right":""} ${i?"always-show":""}`,"aria-hidden":c,children:d}),e("ul",{children:C()})]})})};export{L as A,R as F,B as I,H as p};

View File

@ -1 +1 @@
import{r as m,b as l,j as t,i as u,d as y,H as T,J as b,x as L,K as P,u as R,C as N,S as z,L as C,N as W,g as w,O as k,h as j,c as I}from"./index.2addc377.js";import{a as O,F}from"./index.esm.d79e6b4f.js";import{r as M,s as $,f as H}from"./logs.e4cdcb93.js";import{d as A}from"./debounce.c2d20996.js";import{u as B}from"./useRemainingViewPortHeight.4e5a0898.js";import{F as D,p as E}from"./Fab.ac4f3b29.js";import{P as K,a as q}from"./play.f2fb5ccc.js";function J(e,n){if(e==null)return{};var r=V(e,n),a,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)a=s[o],!(n.indexOf(a)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,a)||(r[a]=e[a]))}return r}function V(e,n){if(e==null)return{};var r={},a=Object.keys(e),o,s;for(s=0;s<a.length;s++)o=a[s],!(n.indexOf(o)>=0)&&(r[o]=e[o]);return r}var f=m.exports.forwardRef(function(e,n){var r=e.color,a=r===void 0?"currentColor":r,o=e.size,s=o===void 0?24:o,p=J(e,["color","size"]);return l("svg",{ref:n,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:a,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...p,children:[t("circle",{cx:"11",cy:"11",r:"8"}),t("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})});f.propTypes={color:u.exports.string,size:u.exports.oneOfType([u.exports.string,u.exports.number])};f.displayName="Search";const Y=f,G="_RuleSearch_1oz2t_1",Q="_RuleSearchContainer_1oz2t_5",U="_inputWrapper_1oz2t_10",X="_input_1oz2t_10",Z="_iconWrapper_1oz2t_35",g={RuleSearch:G,RuleSearchContainer:Q,inputWrapper:U,input:X,iconWrapper:Z};function ee({dispatch:e,searchText:n,updateSearchText:r}){const[a,o]=m.exports.useState(n),s=m.exports.useCallback(i=>{e(r(i))},[e,r]),p=m.exports.useMemo(()=>A(s,300),[s]),h=i=>{o(i.target.value),p(i.target.value)};return t("div",{className:g.RuleSearch,children:l("div",{className:g.RuleSearchContainer,children:[t("div",{className:g.inputWrapper,children:t("input",{type:"text",value:a,onChange:h,className:g.input})}),t("div",{className:g.iconWrapper,children:t(Y,{size:20})})]})})}const te=e=>({searchText:T(e),updateSearchText:b}),oe=y(te)(ee),re="_logMeta_7a1x3_1",ae="_logType_7a1x3_8",ne="_logTime_7a1x3_18",se="_logText_7a1x3_24",ce="_logsWrapper_7a1x3_37",ie="_logPlaceholder_7a1x3_51",le="_logPlaceholderIcon_7a1x3_64",pe="_search_7a1x3_68",c={logMeta:re,logType:ae,logTime:ne,logText:se,logsWrapper:ce,logPlaceholder:ie,logPlaceholderIcon:le,search:pe},{useCallback:v,memo:ge,useEffect:he}=j,_=30,de={debug:"#28792c",info:"var(--bg-log-info-tag)",warning:"#b99105",error:"#c11c1c"};function ue({time:e,even:n,payload:r,type:a}){const o=I({even:n},"log");return t("div",{className:o,children:l("div",{className:c.logMeta,children:[t("div",{className:c.logTime,children:e}),t("div",{className:c.logType,style:{backgroundColor:de[a]},children:a}),t("div",{className:c.logText,children:r})]})})}function me(e,n){return n[e].id}const _e=ge(({index:e,style:n,data:r})=>{const a=r[e];return t("div",{style:n,children:t(ue,{...a})})},O);function fe({dispatch:e,logLevel:n,apiConfig:r,logs:a,logStreamingPaused:o}){const s=L(),p=v(()=>{o?M({...r,logLevel:n}):$(),s.app.updateAppConfig("logStreamingPaused",!o)},[r,n,o,s.app]),h=v(S=>e(P(S)),[e]);he(()=>{H({...r,logLevel:n},h)},[r,n,h]);const[i,x]=B(),{t:d}=R();return l("div",{children:[t(N,{title:d("Logs")}),t("div",{className:c.search,children:t(oe,{})}),t("div",{ref:i,style:{paddingBottom:_},children:a.length===0?l("div",{className:c.logPlaceholder,style:{height:x-_},children:[t("div",{className:c.logPlaceholderIcon,children:t(z,{width:200,height:200})}),t("div",{children:d("no_logs")})]}):l("div",{className:c.logsWrapper,children:[t(F,{height:x-_,width:"100%",itemCount:a.length,itemSize:80,itemData:a,itemKey:me,children:_e}),t(D,{icon:o?t(K,{size:16}):t(q,{size:16}),mainButtonStyles:o?{background:"#e74c3c"}:{},style:E,text:d(o?"Resume Refresh":"Pause Refresh"),onClick:p})]})})]})}const xe=e=>({logs:C(e),logLevel:W(e),apiConfig:w(e),logStreamingPaused:k(e)}),Re=y(xe)(fe);export{Re as default}; import{r as m,b as l,j as t,i as u,d as y,H as T,J as b,x as L,K as P,u as R,C as N,S as z,L as C,N as W,g as w,O as k,h as j,c as I}from"./index.1428ab75.js";import{a as O,F}from"./index.esm.7b716043.js";import{r as M,s as $,f as H}from"./logs.6e20f0cf.js";import{d as A}from"./debounce.c2d20996.js";import{u as B}from"./useRemainingViewPortHeight.2e9a6590.js";import{F as D,p as E}from"./Fab.4f6fab8b.js";import{P as K,a as q}from"./play.59a01dbd.js";function J(e,n){if(e==null)return{};var r=V(e,n),a,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)a=s[o],!(n.indexOf(a)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,a)||(r[a]=e[a]))}return r}function V(e,n){if(e==null)return{};var r={},a=Object.keys(e),o,s;for(s=0;s<a.length;s++)o=a[s],!(n.indexOf(o)>=0)&&(r[o]=e[o]);return r}var f=m.exports.forwardRef(function(e,n){var r=e.color,a=r===void 0?"currentColor":r,o=e.size,s=o===void 0?24:o,p=J(e,["color","size"]);return l("svg",{ref:n,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:a,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...p,children:[t("circle",{cx:"11",cy:"11",r:"8"}),t("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})});f.propTypes={color:u.exports.string,size:u.exports.oneOfType([u.exports.string,u.exports.number])};f.displayName="Search";const Y=f,G="_RuleSearch_1oz2t_1",Q="_RuleSearchContainer_1oz2t_5",U="_inputWrapper_1oz2t_10",X="_input_1oz2t_10",Z="_iconWrapper_1oz2t_35",g={RuleSearch:G,RuleSearchContainer:Q,inputWrapper:U,input:X,iconWrapper:Z};function ee({dispatch:e,searchText:n,updateSearchText:r}){const[a,o]=m.exports.useState(n),s=m.exports.useCallback(i=>{e(r(i))},[e,r]),p=m.exports.useMemo(()=>A(s,300),[s]),h=i=>{o(i.target.value),p(i.target.value)};return t("div",{className:g.RuleSearch,children:l("div",{className:g.RuleSearchContainer,children:[t("div",{className:g.inputWrapper,children:t("input",{type:"text",value:a,onChange:h,className:g.input})}),t("div",{className:g.iconWrapper,children:t(Y,{size:20})})]})})}const te=e=>({searchText:T(e),updateSearchText:b}),oe=y(te)(ee),re="_logMeta_7a1x3_1",ae="_logType_7a1x3_8",ne="_logTime_7a1x3_18",se="_logText_7a1x3_24",ce="_logsWrapper_7a1x3_37",ie="_logPlaceholder_7a1x3_51",le="_logPlaceholderIcon_7a1x3_64",pe="_search_7a1x3_68",c={logMeta:re,logType:ae,logTime:ne,logText:se,logsWrapper:ce,logPlaceholder:ie,logPlaceholderIcon:le,search:pe},{useCallback:v,memo:ge,useEffect:he}=j,_=30,de={debug:"#28792c",info:"var(--bg-log-info-tag)",warning:"#b99105",error:"#c11c1c"};function ue({time:e,even:n,payload:r,type:a}){const o=I({even:n},"log");return t("div",{className:o,children:l("div",{className:c.logMeta,children:[t("div",{className:c.logTime,children:e}),t("div",{className:c.logType,style:{backgroundColor:de[a]},children:a}),t("div",{className:c.logText,children:r})]})})}function me(e,n){return n[e].id}const _e=ge(({index:e,style:n,data:r})=>{const a=r[e];return t("div",{style:n,children:t(ue,{...a})})},O);function fe({dispatch:e,logLevel:n,apiConfig:r,logs:a,logStreamingPaused:o}){const s=L(),p=v(()=>{o?M({...r,logLevel:n}):$(),s.app.updateAppConfig("logStreamingPaused",!o)},[r,n,o,s.app]),h=v(S=>e(P(S)),[e]);he(()=>{H({...r,logLevel:n},h)},[r,n,h]);const[i,x]=B(),{t:d}=R();return l("div",{children:[t(N,{title:d("Logs")}),t("div",{className:c.search,children:t(oe,{})}),t("div",{ref:i,style:{paddingBottom:_},children:a.length===0?l("div",{className:c.logPlaceholder,style:{height:x-_},children:[t("div",{className:c.logPlaceholderIcon,children:t(z,{width:200,height:200})}),t("div",{children:d("no_logs")})]}):l("div",{className:c.logsWrapper,children:[t(F,{height:x-_,width:"100%",itemCount:a.length,itemSize:80,itemData:a,itemKey:me,children:_e}),t(D,{icon:o?t(K,{size:16}):t(q,{size:16}),mainButtonStyles:o?{background:"#e74c3c"}:{},style:E,text:d(o?"Resume Refresh":"Pause Refresh"),onClick:p})]})})]})}const xe=e=>({logs:C(e),logLevel:W(e),apiConfig:w(e),logStreamingPaused:k(e)}),Re=y(xe)(fe);export{Re as default};

Some files were not shown because too many files have changed in this diff Show More