mirror of
https://github.com/kenzok8/small.git
synced 2025-01-05 10:36:40 +08:00
update 2024-12-31 20:24:29
This commit is contained in:
parent
1c51459664
commit
28368447fe
@ -1,8 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-openclash
|
||||
PKG_VERSION:=0.46.050
|
||||
PKG_RELEASE:=beta
|
||||
PKG_VERSION:=0.46.064
|
||||
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
@ -57,7 +56,7 @@ define Build/Prepare
|
||||
$(CP) $(CURDIR)/luasrc $(PKG_BUILD_DIR)
|
||||
$(foreach po,$(wildcard ${CURDIR}/po/zh-cn/*.po), \
|
||||
po2lmo $(po) $(PKG_BUILD_DIR)/$(patsubst %.po,%.lmo,$(notdir $(po)));)
|
||||
sed -i "s/v0.00.00-beta/v$(PKG_VERSION)-beta/g" $(PKG_BUILD_DIR)/root/www/luci-static/resources/openclash/img/version.svg >/dev/null 2>&1
|
||||
sed -i "s/v0.00.00/v$(PKG_VERSION)/g" $(PKG_BUILD_DIR)/root/www/luci-static/resources/openclash/img/version.svg >/dev/null 2>&1
|
||||
chmod 0755 $(PKG_BUILD_DIR)/root/etc/init.d/openclash
|
||||
chmod -R 0755 $(PKG_BUILD_DIR)/root/usr/share/openclash/
|
||||
mkdir -p $(PKG_BUILD_DIR)/root/etc/openclash/config
|
||||
@ -105,7 +104,7 @@ endef
|
||||
|
||||
define Package/$(PKG_NAME)/postinst
|
||||
#!/bin/sh
|
||||
sed -i "s/v0.00.00-beta/v$(PKG_VERSION)-beta/g" /www/luci-static/resources/openclash/img/version.svg >/dev/null 2>&1
|
||||
sed -i "s/v0.00.00/v$(PKG_VERSION)/g" /www/luci-static/resources/openclash/img/version.svg >/dev/null 2>&1
|
||||
exit 0
|
||||
endef
|
||||
|
||||
@ -113,6 +112,7 @@ define Package/$(PKG_NAME)/prerm
|
||||
#!/bin/sh
|
||||
uci -q set openclash.config.enable=0
|
||||
uci -q commit openclash
|
||||
[ -n "$(pidof clash)" ] && /etc/init.d/openclash stop 2>/dev/null
|
||||
cp -f "/etc/config/openclash" "/tmp/openclash.bak" >/dev/null 2>&1
|
||||
cp -rf "/etc/openclash" "/tmp/openclash" >/dev/null 2>&1
|
||||
cp -rf "/usr/share/openclash/ui/yacd" "/tmp/openclash_yacd" >/dev/null 2>&1
|
||||
@ -122,9 +122,15 @@ endef
|
||||
|
||||
define Package/$(PKG_NAME)/postrm
|
||||
#!/bin/sh
|
||||
dnsmasqconfdir="$(uci -q get dhcp.@dnsmasq[0].confdir || echo '/tmp/dnsmasq.d')"
|
||||
dnsmasqconfdir="${dnsmasqconfdir%*/}"
|
||||
DEFAULT_DNSMASQ_CFGID="$$(uci -q show "dhcp.@dnsmasq[0]" | awk 'NR==1 {split($0, conf, /[.=]/); print conf[2]}')"
|
||||
if [ -f "/tmp/etc/dnsmasq.conf.$DEFAULT_DNSMASQ_CFGID" ]; then
|
||||
DNSMASQ_CONF_DIR="$$(awk -F '=' '/^conf-dir=/ {print $2}' "/tmp/etc/dnsmasq.conf.$DEFAULT_DNSMASQ_CFGID")"
|
||||
else
|
||||
DNSMASQ_CONF_DIR="/tmp/dnsmasq.d"
|
||||
fi
|
||||
DNSMASQ_CONF_DIR=$${DNSMASQ_CONF_DIR%*/}
|
||||
rm -rf /etc/openclash >/dev/null 2>&1
|
||||
rm -rf /etc/config/openclash >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash.log >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash_start.log >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash_last_version >/dev/null 2>&1
|
||||
@ -135,9 +141,9 @@ define Package/$(PKG_NAME)/postrm
|
||||
rm -rf /tmp/rule_providers_name >/dev/null 2>&1
|
||||
rm -rf /tmp/clash_last_version >/dev/null 2>&1
|
||||
rm -rf /usr/share/openclash/backup >/dev/null 2>&1
|
||||
rm -rf ${dnsmasqconfdir}/dnsmasq_openclash_custom_domain.conf >/dev/null 2>&1
|
||||
rm -rf ${dnsmasqconfdir}/dnsmasq_openclash_chnroute_pass.conf >/dev/null 2>&1
|
||||
rm -rf ${dnsmasqconfdir}/dnsmasq_openclash_chnroute6_pass.conf >/dev/null 2>&1
|
||||
rm -rf ${DNSMASQ_CONF_DIR}/dnsmasq_openclash_custom_domain.conf >/dev/null 2>&1
|
||||
rm -rf ${DNSMASQ_CONF_DIR}/dnsmasq_openclash_chnroute_pass.conf >/dev/null 2>&1
|
||||
rm -rf ${DNSMASQ_CONF_DIR}/dnsmasq_openclash_chnroute6_pass.conf >/dev/null 2>&1
|
||||
rm -rf /tmp/dler* >/dev/null 2>&1
|
||||
rm -rf /tmp/etc/openclash >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash_edit_file_name >/dev/null 2>&1
|
||||
@ -146,8 +152,10 @@ define Package/$(PKG_NAME)/postrm
|
||||
sed -i '/.*kB maximum content size*/c\export let HTTP_MAX_CONTENT = 1024*100; // 100 kB maximum content size' /usr/share/ucode/luci/http.uc >/dev/null 2>&1
|
||||
uci -q delete firewall.openclash
|
||||
uci -q commit firewall
|
||||
[ -f "/etc/config/ucitrack" ] && {
|
||||
uci -q delete ucitrack.@openclash[-1]
|
||||
uci -q commit ucitrack
|
||||
}
|
||||
rm -rf /tmp/luci-*
|
||||
exit 0
|
||||
endef
|
||||
|
@ -104,6 +104,8 @@ local device_arh = luci.sys.exec("uname -m |tr -d '\n'")
|
||||
|
||||
if pcall(require, "luci.model.ipkg") then
|
||||
opkg = require "luci.model.ipkg"
|
||||
else
|
||||
opkg = nil
|
||||
end
|
||||
|
||||
local core_path_mode = uci:get("openclash", "config", "small_flash_memory")
|
||||
@ -158,19 +160,8 @@ local function chnroutev6()
|
||||
end
|
||||
|
||||
local function daip()
|
||||
local daip, lan_int_name
|
||||
lan_int_name = uci:get("openclash", "config", "lan_interface_name") or "0"
|
||||
if lan_int_name == "0" then
|
||||
daip = luci.sys.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
|
||||
else
|
||||
daip = luci.sys.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name))
|
||||
end
|
||||
if not daip or daip == "" then
|
||||
daip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'")
|
||||
end
|
||||
if not daip or daip == "" then
|
||||
daip = luci.sys.exec("ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1 | tr -d '\n'")
|
||||
end
|
||||
local daip
|
||||
daip = fs.lanip()
|
||||
return daip
|
||||
end
|
||||
|
||||
@ -212,11 +203,23 @@ local function startlog()
|
||||
return line_trans
|
||||
end
|
||||
|
||||
local function pkg_type()
|
||||
if fs.access("/usr/bin/apk") then
|
||||
return "apk"
|
||||
else
|
||||
return "opkg"
|
||||
end
|
||||
end
|
||||
|
||||
local function coremodel()
|
||||
if opkg and opkg.info("libc") and opkg.info("libc")["libc"] then
|
||||
return opkg.info("libc")["libc"]["Architecture"]
|
||||
else
|
||||
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")
|
||||
if fs.access("/bin/opkg") then
|
||||
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")
|
||||
elseif fs.access("/usr/bin/apk") then
|
||||
return luci.sys.exec("apk list libc 2>/dev/null |awk '{print $2}'")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -246,7 +249,11 @@ local function opcv()
|
||||
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"]
|
||||
else
|
||||
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}'")
|
||||
if fs.access("/bin/opkg") then
|
||||
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}'")
|
||||
elseif fs.access("/usr/bin/apk") then
|
||||
return "v" .. luci.sys.exec("apk list luci-app-openclash 2>/dev/null |grep 'installed' | grep -oE '\\d+(\\.\\d+)*' | head -1")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -614,10 +621,18 @@ function set_subinfo_url()
|
||||
end
|
||||
|
||||
function sub_info_get()
|
||||
local filepath, filename, sub_url, sub_info, info, upload, download, total, expire, http_code, len, percent, day_left, day_expire, surplus, used
|
||||
local sub_ua, filepath, filename, sub_url, sub_info, info, upload, download, total, expire, http_code, len, percent, day_left, day_expire, surplus, used
|
||||
local info_tb = {}
|
||||
filename = luci.http.formvalue("filename")
|
||||
sub_info = ""
|
||||
sub_ua = "Clash"
|
||||
uci:foreach("openclash", "config_subscribe",
|
||||
function(s)
|
||||
if s.name == filename and s.sub_ua then
|
||||
sub_ua = s.sub_ua
|
||||
end
|
||||
end
|
||||
)
|
||||
if filename and not is_start() then
|
||||
uci:foreach("openclash", "subscribe_info",
|
||||
function(s)
|
||||
@ -640,7 +655,7 @@ function sub_info_get()
|
||||
if not sub_url then
|
||||
sub_info = "No Sub Info Found"
|
||||
else
|
||||
info = luci.sys.exec(string.format("curl -sLI -X GET -m 10 -w 'http_code='%%{http_code} -H 'User-Agent: Clash' '%s'", sub_url))
|
||||
info = luci.sys.exec(string.format("curl -sLI -X GET -m 10 -w 'http_code='%%{http_code} -H 'User-Agent: %s' '%s'", sub_ua, sub_url))
|
||||
if not info or tonumber(string.sub(string.match(info, "http_code=%d+"), 11, -1)) ~= 200 then
|
||||
info = luci.sys.exec(string.format("curl -sLI -X GET -m 10 -w 'http_code='%%{http_code} -H 'User-Agent: Quantumultx' '%s'", sub_url))
|
||||
end
|
||||
@ -660,20 +675,34 @@ function sub_info_get()
|
||||
expire = os.date("%Y-%m-%d", day_expire) or "null"
|
||||
if day_expire and os.time() <= day_expire then
|
||||
day_left = math.ceil((day_expire - os.time()) / (3600*24))
|
||||
if math.ceil(day_left / 365) > 50 then
|
||||
day_left = "∞"
|
||||
end
|
||||
elseif day_expire == nil then
|
||||
day_left = "null"
|
||||
else
|
||||
day_left = 0
|
||||
end
|
||||
if used and total and used < total then
|
||||
if used and total and used <= total then
|
||||
percent = string.format("%.1f",((total-used)/total)*100) or nil
|
||||
elseif used == nil or total == nil or total == 0 then
|
||||
surplus = fs.filesize(total - used) or "null"
|
||||
elseif used == nil and total and total > 0.0 then
|
||||
percent = 100
|
||||
surplus = total
|
||||
elseif total and total == 0.0 then
|
||||
percent = 100
|
||||
surplus = "∞"
|
||||
else
|
||||
percent = 0
|
||||
surplus = "null"
|
||||
end
|
||||
if total and total > 0.0 then
|
||||
total = fs.filesize(total) or "null"
|
||||
elseif total and total == 0.0 then
|
||||
total = "∞"
|
||||
else
|
||||
total = "null"
|
||||
end
|
||||
surplus = fs.filesize(total - used) or "null"
|
||||
total = fs.filesize(total) or "null"
|
||||
used = fs.filesize(used) or "null"
|
||||
sub_info = "Successful"
|
||||
else
|
||||
@ -816,7 +845,7 @@ end
|
||||
|
||||
local function s(e)
|
||||
local t=0
|
||||
local a={' B/S',' KB/S',' MB/S',' GB/S',' TB/S'}
|
||||
local a={' B/S',' KB/S',' MB/S',' GB/S',' TB/S',' PB/S'}
|
||||
if (e<=1024) then
|
||||
return e..a[1]
|
||||
else
|
||||
@ -1080,6 +1109,7 @@ function action_update_ma()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({
|
||||
oplv = oplv(),
|
||||
pkg_type = pkg_type(),
|
||||
corelv = corelv(),
|
||||
corever = corever();
|
||||
})
|
||||
|
@ -75,7 +75,7 @@ if a then
|
||||
ck.template="openclash/cfg_check"
|
||||
sb.template="openclash/sub_info_show"
|
||||
|
||||
btnis=tb:option(Button,"switch",translate("Switch"))
|
||||
btnis=tb:option(Button,"switch",translate("SwiTch"))
|
||||
btnis.template="openclash/other_button"
|
||||
btnis.render=function(o,t,a)
|
||||
if not e[t] then return false end
|
||||
|
@ -17,20 +17,7 @@ bold_off = [[</strong>]]
|
||||
|
||||
local op_mode = string.sub(luci.sys.exec('uci get openclash.config.operation_mode 2>/dev/null'),0,-2)
|
||||
if not op_mode then op_mode = "redir-host" end
|
||||
local lan_int_name = uci:get("openclash", "config", "lan_interface_name") or "0"
|
||||
|
||||
local lan_ip
|
||||
if lan_int_name == "0" then
|
||||
lan_ip = SYS.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
|
||||
else
|
||||
lan_ip = SYS.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name))
|
||||
end
|
||||
if not lan_ip or lan_ip == "" then
|
||||
lan_ip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'")
|
||||
end
|
||||
if not lan_ip or lan_ip == "" then
|
||||
lan_ip = luci.sys.exec("ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1 | tr -d '\n'")
|
||||
end
|
||||
local lan_ip = fs.lanip()
|
||||
m = Map("openclash", translate("Overwrite Settings"))
|
||||
m.pageaction = false
|
||||
m.description = translate("Note: To restore the default configuration, try accessing:").." <a href='javascript:void(0)' onclick='javascript:restore_config(this)'>http://"..lan_ip.."/cgi-bin/luci/admin/services/openclash/restore</a>"..
|
||||
@ -82,11 +69,10 @@ o:value("http://captive.apple.com/generate_204")
|
||||
o.default = "0"
|
||||
|
||||
o = s:taboption("settings", Value, "github_address_mod", translate("Github Address Modify"))
|
||||
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://mirror.ghproxy.com/\")'>https://mirror.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://ghp.ci/\")'>https://ghp.ci/</a>"
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("https://fastly.jsdelivr.net/")
|
||||
o:value("https://testingcf.jsdelivr.net/")
|
||||
o:value("https://raw.fastgit.org/")
|
||||
o:value("https://cdn.jsdelivr.net/")
|
||||
o.default = "0"
|
||||
|
||||
|
@ -86,9 +86,10 @@ end
|
||||
---- UA
|
||||
o = s:option(Value, "sub_ua", "User-Agent")
|
||||
o.description = font_red..bold_on..translate("Used for Downloading Subscriptions, Defaults to Clash")..bold_off..font_off
|
||||
o:value("Clash")
|
||||
o:value("clash.meta")
|
||||
o.default = "Clash"
|
||||
o:value("clash-verge/v1.5.1")
|
||||
o:value("Clash")
|
||||
o.default = "clash.meta"
|
||||
o.rmempty = true
|
||||
|
||||
---- subconverter
|
||||
|
@ -201,7 +201,7 @@ st.template="openclash/cfg_check"
|
||||
ck.template="openclash/cfg_check"
|
||||
sb.template="openclash/sub_info_show"
|
||||
|
||||
btnis=tb:option(Button,"switch",translate("Switch"))
|
||||
btnis=tb:option(Button,"switch",translate("SwiTch"))
|
||||
btnis.template="openclash/other_button"
|
||||
btnis.render=function(o,t,a)
|
||||
if not e[t] then return false end
|
||||
|
@ -95,6 +95,17 @@ end
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
|
||||
o = s:option(ListValue, "MainlandTV", translate("CN Mainland TV"))
|
||||
o:depends("rule_name", "lhie1")
|
||||
o.rmempty = true
|
||||
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
|
||||
if groupname ~= nil and groupname ~= "" then
|
||||
o:value(groupname)
|
||||
end
|
||||
end
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
|
||||
o = s:option(ListValue, "Proxy", translate("Proxy"))
|
||||
o:depends("rule_name", "lhie1")
|
||||
o.rmempty = true
|
||||
@ -150,17 +161,6 @@ end
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
|
||||
o = s:option(ListValue, "HBOGo", translate("HBO Go"))
|
||||
o:depends("rule_name", "lhie1")
|
||||
o.rmempty = true
|
||||
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
|
||||
if groupname ~= nil and groupname ~= "" then
|
||||
o:value(groupname)
|
||||
end
|
||||
end
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
|
||||
o = s:option(ListValue, "Pornhub", translate("Pornhub"))
|
||||
o:depends("rule_name", "lhie1")
|
||||
o.rmempty = true
|
||||
@ -381,6 +381,17 @@ end
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
|
||||
o = s:option(ListValue, "HTTPDNS", translate("HTTPDNS"))
|
||||
o:depends("rule_name", "lhie1")
|
||||
o.rmempty = true
|
||||
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
|
||||
if groupname ~= nil and groupname ~= "" then
|
||||
o:value(groupname)
|
||||
end
|
||||
end
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
|
||||
o = s:option(ListValue, "Domestic", translate("Domestic"))
|
||||
o:depends("rule_name", "lhie1")
|
||||
o.rmempty = true
|
||||
|
@ -29,8 +29,6 @@ o = s:option(ListValue, "rule_sources", translate("Choose Template For Create Co
|
||||
o.description = translate("Use Other Rules To Create Config")
|
||||
o:depends("create_config", 1)
|
||||
o:value("lhie1", translate("lhie1 Rules"))
|
||||
o:value("ConnersHua", translate("ConnersHua(Provider-type) Rules"))
|
||||
o:value("ConnersHua_return", translate("ConnersHua Return Rules"))
|
||||
|
||||
o = s:option(Flag, "mix_proxies", translate("Mix Proxies"))
|
||||
o.description = font_red .. bold_on .. translate("Mix This Page's Proxies") .. bold_off .. font_off
|
||||
@ -255,24 +253,27 @@ o = a:option(Button,"Load_Config", " ")
|
||||
o.inputtitle = translate("Read Config")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
luci.sys.call("/usr/share/openclash/yml_groups_get.sh 2>/dev/null &")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "openclash"))
|
||||
m.uci:commit("openclash")
|
||||
luci.sys.call("/usr/share/openclash/yml_groups_get.sh 2>/dev/null &")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "openclash"))
|
||||
end
|
||||
|
||||
o = a:option(Button, "Commit", " ")
|
||||
o.inputtitle = translate("Commit Settings")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
fs.unlink("/tmp/Proxy_Group")
|
||||
fs.unlink("/tmp/Proxy_Group")
|
||||
m.uci:commit("openclash")
|
||||
end
|
||||
|
||||
o = a:option(Button, "Apply", " ")
|
||||
o.inputtitle = translate("Apply Settings")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
fs.unlink("/tmp/Proxy_Group")
|
||||
luci.sys.call("/usr/share/openclash/yml_groups_set.sh >/dev/null 2>&1 &")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "openclash"))
|
||||
m.uci:commit("openclash")
|
||||
fs.unlink("/tmp/Proxy_Group")
|
||||
luci.sys.call("/usr/share/openclash/yml_groups_set.sh >/dev/null 2>&1 &")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "openclash"))
|
||||
end
|
||||
|
||||
m:append(Template("openclash/toolbar_show"))
|
||||
|
@ -16,19 +16,7 @@ bold_off = [[</strong>]]
|
||||
|
||||
local op_mode = string.sub(luci.sys.exec('uci get openclash.config.operation_mode 2>/dev/null'),0,-2)
|
||||
if not op_mode then op_mode = "redir-host" end
|
||||
local lan_int_name = uci:get("openclash", "config", "lan_interface_name") or "0"
|
||||
local lan_ip
|
||||
if lan_int_name == "0" then
|
||||
lan_ip = SYS.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
|
||||
else
|
||||
lan_ip = SYS.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name))
|
||||
end
|
||||
if not lan_ip or lan_ip == "" then
|
||||
lan_ip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'")
|
||||
end
|
||||
if not lan_ip or lan_ip == "" then
|
||||
lan_ip = luci.sys.exec("ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1 | tr -d '\n'")
|
||||
end
|
||||
local lan_ip = fs.lanip()
|
||||
m = Map("openclash", translate("Plugin Settings"))
|
||||
m.pageaction = false
|
||||
m.description = translate("Note: To restore the default configuration, try accessing:").." <a href='javascript:void(0)' onclick='javascript:restore_config(this)'>http://"..lan_ip.."/cgi-bin/luci/admin/services/openclash/restore</a>"..
|
||||
@ -204,10 +192,63 @@ mac_w.datatype = "list(macaddr)"
|
||||
mac_w.rmempty = true
|
||||
mac_w:depends("lan_ac_mode", "1")
|
||||
|
||||
o = s:taboption("lan_ac", DynamicList, "wan_ac_black_ips", translate("WAN Bypassed Host List"))
|
||||
o.datatype = "ipmask"
|
||||
o.description = translate("In The Fake-IP Mode, Only Pure IP Requests Are Supported")
|
||||
|
||||
s2 = m:section(TypedSection, "lan_ac_traffic", translate("Lan Traffic Access List"),
|
||||
"1."..translate("The Traffic From The Local Specified Port Will Not Pass The Core, Try To Set When The Bypass Gateway Forwarding Fails").."; ".."2."..translate("In The Fake-IP Mode, Only Pure IP Requests Are Supported"))
|
||||
|
||||
s2.template = "cbi/tblsection"
|
||||
s2.sortable = true
|
||||
s2.anonymous = true
|
||||
s2.addremove = true
|
||||
s2.rmempty = false
|
||||
|
||||
o = s2:option(Value, "comment", translate("Comment"))
|
||||
o.rmempty = true
|
||||
|
||||
o = s2:option(Flag, "enabled", translate("Enable"))
|
||||
o.rmempty = false
|
||||
o.default = o.enabled
|
||||
o.cfgvalue = function(...)
|
||||
return Flag.cfgvalue(...) or "1"
|
||||
end
|
||||
|
||||
ip_ac = s2:option(Value, "src_ip", translate("Internal addresses"))
|
||||
ip_ac.datatype = "ipmask"
|
||||
ip_ac.placeholder = "0.0.0.0/0"
|
||||
ip_ac.rmempty = false
|
||||
|
||||
o = s2:option(Value, "src_port", translate("Internal ports"))
|
||||
o.datatype = "or(port, portrange)"
|
||||
o.placeholder = translate("5000 or 1234-2345")
|
||||
o.rmempty = false
|
||||
|
||||
o = s2:option(ListValue, "proto", translate("Proto"))
|
||||
o:value("udp", translate("UDP"))
|
||||
o:value("tcp", translate("TCP"))
|
||||
o:value("both", translate("Both"))
|
||||
o.default = "tcp"
|
||||
o.rmempty = false
|
||||
|
||||
o = s2:option(ListValue, "family", translate("Family"))
|
||||
o:value("ipv4", translate("IPv4"))
|
||||
o:value("ipv6", translate("IPv6"))
|
||||
o:value("both", translate("Both"))
|
||||
o.default = "tcp"
|
||||
o.rmempty = false
|
||||
|
||||
o = s2:option(ListValue, "target", translate("Target"))
|
||||
o:value("return", translate("Return"))
|
||||
o:value("accept", translate("Accept"))
|
||||
o.rmempty = false
|
||||
|
||||
luci.ip.neighbors({ family = 4 }, function(n)
|
||||
if n.mac and n.dest then
|
||||
ip_b:value(n.dest:string())
|
||||
ip_w:value(n.dest:string())
|
||||
ip_ac:value(n.dest:string())
|
||||
mac_b:value(n.mac, "%s (%s)" %{ n.mac, n.dest:string() })
|
||||
mac_w:value(n.mac, "%s (%s)" %{ n.mac, n.dest:string() })
|
||||
end
|
||||
@ -218,22 +259,13 @@ luci.ip.neighbors({ family = 6 }, function(n)
|
||||
if n.mac and n.dest then
|
||||
ip_b:value(n.dest:string())
|
||||
ip_w:value(n.dest:string())
|
||||
ip_ac:value(n.dest:string())
|
||||
mac_b:value(n.mac, "%s (%s)" %{ n.mac, n.dest:string() })
|
||||
mac_w:value(n.mac, "%s (%s)" %{ n.mac, n.dest:string() })
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
o = s:taboption("lan_ac", DynamicList, "wan_ac_black_ips", translate("WAN Bypassed Host List"))
|
||||
o.datatype = "ipmask"
|
||||
o.description = translate("In The Fake-IP Mode, Only Pure IP Requests Are Supported")
|
||||
|
||||
o = s:taboption("lan_ac", DynamicList, "lan_ac_black_ports", translate("Lan Bypassed Port List"))
|
||||
o.datatype = "or(port, portrange)"
|
||||
o.placeholder = translate("5000 or 1234-2345")
|
||||
o:value("5000", translate("5000(NAS)"))
|
||||
o.description = "1."..translate("The Traffic From The Local Specified Port Will Not Pass The Core, Try To Set When The Bypass Gateway Forwarding Fails").."<br>".."2."..translate("In The Fake-IP Mode, Only Pure IP Requests Are Supported")
|
||||
|
||||
---- Traffic Control
|
||||
o = s:taboption("traffic_control", Flag, "router_self_proxy", font_red..bold_on..translate("Router-Self Proxy")..bold_off..font_off)
|
||||
o.description = translate("Only Supported for Rule Mode")..", "..font_red..bold_on..translate("ALL Functions In Stream Enhance Tag Will Not Work After Disable")..bold_off..font_off
|
||||
@ -496,28 +528,6 @@ o.template = "openclash/other_stream_option"
|
||||
o.value = "Amazon Prime Video"
|
||||
o:depends("stream_auto_select_prime_video", "1")
|
||||
|
||||
--HBO Now
|
||||
o = s:taboption("stream_enhance", Flag, "stream_auto_select_hbo_now", font_red..translate("HBO Now")..font_off)
|
||||
o.default = 0
|
||||
o:depends("stream_auto_select", "1")
|
||||
|
||||
o = s:taboption("stream_enhance", Value, "stream_auto_select_group_key_hbo_now", translate("Group Filter"))
|
||||
o.default = "HBO|HBONow|HBO Now"
|
||||
o.placeholder = "HBO|HBONow|HBO Now"
|
||||
o.description = translate("It Will Be Searched According To The Regex When Auto Search Group Fails")
|
||||
o:depends("stream_auto_select_hbo_now", "1")
|
||||
|
||||
o = s:taboption("stream_enhance", Value, "stream_auto_select_node_key_hbo_now", translate("Unlock Nodes Filter"))
|
||||
o.default = ""
|
||||
o.description = translate("It Will Be Selected Nodes According To The Regex")
|
||||
o:depends("stream_auto_select_hbo_now", "1")
|
||||
|
||||
o = s:taboption("stream_enhance", DummyValue, "HBO Now", translate("Manual Test"))
|
||||
o.rawhtml = true
|
||||
o.template = "openclash/other_stream_option"
|
||||
o.value = "HBO Now"
|
||||
o:depends("stream_auto_select_hbo_now", "1")
|
||||
|
||||
--HBO Max
|
||||
o = s:taboption("stream_enhance", Flag, "stream_auto_select_hbo_max", font_red..translate("HBO Max")..font_off)
|
||||
o.default = 0
|
||||
@ -552,40 +562,6 @@ o.template = "openclash/other_stream_option"
|
||||
o.value = "HBO Max"
|
||||
o:depends("stream_auto_select_hbo_max", "1")
|
||||
|
||||
--HBO GO Asia
|
||||
o = s:taboption("stream_enhance", Flag, "stream_auto_select_hbo_go_asia", font_red..translate("HBO GO Asia")..font_off)
|
||||
o.default = 0
|
||||
o:depends("stream_auto_select", "1")
|
||||
|
||||
o = s:taboption("stream_enhance", Value, "stream_auto_select_group_key_hbo_go_asia", translate("Group Filter"))
|
||||
o.default = "HBO|HBOGO|HBO GO"
|
||||
o.placeholder = "HBO|HBOGO|HBO GO"
|
||||
o.description = translate("It Will Be Searched According To The Regex When Auto Search Group Fails")
|
||||
o:depends("stream_auto_select_hbo_go_asia", "1")
|
||||
|
||||
o = s:taboption("stream_enhance", Value, "stream_auto_select_region_key_hbo_go_asia", translate("Unlock Region Filter"))
|
||||
o.default = ""
|
||||
o.placeholder = "HK|SG|TW"
|
||||
o.description = translate("It Will Be Selected Region(Country Shortcode) According To The Regex")
|
||||
o:depends("stream_auto_select_hbo_go_asia", "1")
|
||||
function o.validate(self, value)
|
||||
if value ~= m.uci:get("openclash", "config", "stream_auto_select_region_key_hbo_go_asia") then
|
||||
fs.unlink("/tmp/openclash_HBO GO Asia_region")
|
||||
end
|
||||
return value
|
||||
end
|
||||
|
||||
o = s:taboption("stream_enhance", Value, "stream_auto_select_node_key_hbo_go_asia", translate("Unlock Nodes Filter"))
|
||||
o.default = ""
|
||||
o.description = translate("It Will Be Selected Nodes According To The Regex")
|
||||
o:depends("stream_auto_select_hbo_go_asia", "1")
|
||||
|
||||
o = s:taboption("stream_enhance", DummyValue, "HBO GO Asia", translate("Manual Test"))
|
||||
o.rawhtml = true
|
||||
o.template = "openclash/other_stream_option"
|
||||
o.value = "HBO GO Asia"
|
||||
o:depends("stream_auto_select_hbo_go_asia", "1")
|
||||
|
||||
--TVB Anywhere+
|
||||
o = s:taboption("stream_enhance", Flag, "stream_auto_select_tvb_anywhere", font_red..translate("TVB Anywhere+")..font_off)
|
||||
o.default = 0
|
||||
@ -787,7 +763,7 @@ o:depends("stream_auto_select", "1")
|
||||
|
||||
o = s:taboption("stream_enhance", Value, "stream_auto_select_group_key_openai", translate("Group Filter"))
|
||||
o.default = "OpenAI|ChatGPT"
|
||||
o.placeholder = "OpenAI|ChatGPT"
|
||||
o.placeholder = "OpenAI|ChatGPT|AI"
|
||||
o.description = translate("It Will Be Searched According To The Regex When Auto Search Group Fails")
|
||||
o:depends("stream_auto_select_openai", "1")
|
||||
|
||||
|
@ -29,6 +29,8 @@ local os = require "os"
|
||||
local ltn12 = require "luci.ltn12"
|
||||
local fs = require "nixio.fs"
|
||||
local nutil = require "nixio.util"
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local SYS = require "luci.sys"
|
||||
|
||||
local type = type
|
||||
local string = string
|
||||
@ -255,10 +257,27 @@ end
|
||||
|
||||
function filesize(e)
|
||||
local t=0
|
||||
local a={' KB',' MB',' GB',' TB'}
|
||||
local a={' KB',' MB',' GB',' TB',' PB'}
|
||||
repeat
|
||||
e=e/1024
|
||||
t=t+1
|
||||
until(e<=1024)
|
||||
return string.format("%.1f",e)..a[t]
|
||||
end
|
||||
|
||||
function lanip()
|
||||
local lan_int_name = uci:get("openclash", "config", "lan_interface_name") or "0"
|
||||
local lan_ip
|
||||
if lan_int_name == "0" then
|
||||
lan_ip = SYS.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
|
||||
else
|
||||
lan_ip = SYS.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' |head -1 | tr -d '\n'", lan_int_name))
|
||||
end
|
||||
if not lan_ip or lan_ip == "" then
|
||||
lan_ip = SYS.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' |head -1 | tr -d '\n'")
|
||||
end
|
||||
if not lan_ip or lan_ip == "" then
|
||||
lan_ip = SYS.exec("ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1 | tr -d '\n'")
|
||||
end
|
||||
return lan_ip
|
||||
end
|
@ -111,6 +111,7 @@
|
||||
padding-top: 5px;
|
||||
margin: 0 0 0 -12%;
|
||||
line-height: 35px;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.card .general .dler-info {
|
||||
@ -177,8 +178,9 @@
|
||||
|
||||
.card .general .btn {
|
||||
color: #fff;
|
||||
border-color: #337ab7;
|
||||
border-color: #337ab7 !important;
|
||||
background: #1473e6;
|
||||
background-color: #1473e6 !important;
|
||||
box-shadow: 0 8px 16px -8px rgba(0,0,0,0.4);
|
||||
border-radius: 6px;
|
||||
width: 90px;
|
||||
|
@ -82,10 +82,9 @@
|
||||
<div class="select-popup-body">
|
||||
<div class="select-option" data-value="https://fastly.jsdelivr.net/">https://fastly.jsdelivr.net/</div>
|
||||
<div class="select-option" data-value="https://testingcf.jsdelivr.net/">https://testingcf.jsdelivr.net/</div>
|
||||
<div class="select-option" data-value="https://raw.fastgit.org/">https://raw.fastgit.org/</div>
|
||||
<div class="select-option" data-value="https://cdn.jsdelivr.net/">https://cdn.jsdelivr.net/</div>
|
||||
<div class="select-option" data-value="custom"><%:Custom Your CDN URL%></div>
|
||||
<input type="text" id="customOptionInput" class="custom-option-input" value="https://mirror.ghproxy.com/" placeholder="<%:Type CDN URL, Format Like%> https://mirror.ghproxy.com/" style="display: none;">
|
||||
<input type="text" id="customOptionInput" class="custom-option-input" value="https://ghp.ci/" placeholder="<%:Type CDN URL, Format Like%> https://ghp.ci/" style="display: none;">
|
||||
<div class="select-option" id="addCustomOption" style="display: none;"><%:Add%></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -176,7 +176,7 @@
|
||||
</table>
|
||||
</fieldset>
|
||||
<fieldset id="state" class="cbi-section">
|
||||
<table>
|
||||
<table width="100%">
|
||||
<tr><td width="100%" colspan="4">
|
||||
<p style="margin: 10px 0; text-align: center">
|
||||
<b><%:Please ensure that all items are displayed normally before running. If you need to update, please go to the global settings page%></b>
|
||||
@ -678,7 +678,7 @@
|
||||
function ws_mmessage(event) {
|
||||
var data = JSON.parse(event.data)
|
||||
if (data.inuse) {
|
||||
document.getElementById("mem_t").innerHTML = "<font style=\"color:green\">"+bytesToSize(data.inuse)+"/S</font>";
|
||||
document.getElementById("mem_t").innerHTML = "<font style=\"color:green\">"+bytesToSize(data.inuse)+"</font>";
|
||||
}
|
||||
else {
|
||||
document.getElementById("mem_t").innerHTML = "<font style=\"color:green\">0 KB</font>";
|
||||
@ -687,7 +687,7 @@
|
||||
};
|
||||
|
||||
function bytesToSize(bytes) {
|
||||
var sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
|
||||
var sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
|
||||
if (bytes == 0) return '0 B';
|
||||
var i = Math.floor(Math.log(bytes) / Math.log(1024));
|
||||
return i == 0 ? (bytes / Math.pow(1024, i)) + ' ' + sizes[i] : (bytes / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i];
|
||||
|
@ -12,7 +12,6 @@
|
||||
.sub_tab_show{
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
color: var(--gray-dark);
|
||||
font-size: 12px;
|
||||
margin: 0 auto;
|
||||
-webkit-transition: all 1.5s;
|
||||
@ -36,6 +35,18 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
:root[data-darkmode="true"] {
|
||||
|
||||
#icon_wrench {
|
||||
-webkit-filter: invert(1);
|
||||
filter: invert(1);
|
||||
}
|
||||
#icon_arrow {
|
||||
-webkit-filter: invert(1);
|
||||
filter: invert(1);
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<%
|
||||
@ -44,7 +55,7 @@
|
||||
local filename = fs.filename(val)
|
||||
local idname = math.random(1000)..(string.match(filename, "[%w_]+") or "")
|
||||
%>
|
||||
<div class="sub_div"><span id='<%=idname%>' class="sub_tab"></span> <span class="sub_setting"><img src='/luci-static/resources/openclash/img/arrow-clockwise-light.svg' height="20px" title='<%:Refresh%>' alt='<%:Refresh%>' onclick='return sub_info_refresh_<%=idname%>(this)'></span> <span class="sub_setting"><img src='/luci-static/resources/openclash/img/wrench-light.svg' height="20px" title='<%:Specify URL%>' alt='<%:Specify URL%>' onclick='return set_subinfo_url_<%=idname%>(this,"<%=filename%>")'></span></div>
|
||||
<div class="sub_div"><span id='<%=idname%>' class="sub_tab"></span> <span class="sub_setting"><img id="icon_arrow" src='/luci-static/resources/openclash/img/arrow-clockwise-light.svg' height="20px" title='<%:Refresh%>' alt='<%:Refresh%>' onclick='return sub_info_refresh_<%=idname%>(this)'></span> <span class="sub_setting"><img id="icon_wrench" src='/luci-static/resources/openclash/img/wrench-light.svg' height="20px" title='<%:Specify URL%>' alt='<%:Specify URL%>' onclick='return set_subinfo_url_<%=idname%>(this,"<%=filename%>")'></span></div>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
|
||||
@ -57,7 +68,7 @@ function progressbar_<%=idname%>(v, m, pc, np, f, t, tr) {
|
||||
'<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 >= 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%%">' +
|
||||
'<small>%s '+ (f ? f : '/') +' %s ' + (np ? "" : '(%s%%)') + (tr == "null" ? '<div style="visibility: hidden;">' : '<div style="visibility: visible;">') + '%s (<%:Remaining%> %s <%:days%>)</small>' +
|
||||
'<small style="color: black">%s '+ (f ? f : '/') +' %s ' + (np ? "" : '(%s%%)') + (tr == "null" ? '<div style="visibility: hidden;">' : '<div style="visibility: visible;">') + '%s (<%:Remaining%> %s <%:days%>)</small>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>', pc, v, m, pc, t, tr
|
||||
|
@ -66,6 +66,14 @@ local sectiontype = "_"..self.config.."_"..string.match(self.sectiontype, "[%w_]
|
||||
ul{
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
h3{
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.cbi-value-field .cbi-dropdown, .cbi-value-field .cbi-input-select, .cbi-value input[type="text"], .cbi-value input[type="password"] {
|
||||
min-width: auto;
|
||||
}
|
||||
|
||||
#tab-header-<%=self.config%>-<%=self.sectiontype%>{
|
||||
min-height: 35px;
|
||||
@ -123,7 +131,7 @@ local sectiontype = "_"..self.config.."_"..string.match(self.sectiontype, "[%w_]
|
||||
<!-- tblsection -->
|
||||
<fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
|
||||
<% if self.title and #self.title > 0 then -%>
|
||||
<legend><%=self.title%></legend>
|
||||
<h3><%=self.title%></h3>
|
||||
<%- end %>
|
||||
<%- if self.sortable then -%>
|
||||
<input type="hidden" id="cbi.sts.<%=self.config%>.<%=self.sectiontype%>" name="cbi.sts.<%=self.config%>.<%=self.sectiontype%>" value="" />
|
||||
@ -184,7 +192,7 @@ local sectiontype = "_"..self.config.."_"..string.match(self.sectiontype, "[%w_]
|
||||
<%- count = count + 1; end; end; if self.sortable then -%>
|
||||
<th class="cbi-section-table-cell"><%:Sort%></th>
|
||||
<%- end; if self.extedit or self.addremove then -%>
|
||||
<th class="cbi-section-table-cell"> </th>
|
||||
<th class="cbi-section-table-cell"><%:Edit%></th>
|
||||
<%- count = count + 1; end -%>
|
||||
</tr>
|
||||
<tr class="cbi-section-table-descr">
|
||||
@ -194,6 +202,8 @@ local sectiontype = "_"..self.config.."_"..string.match(self.sectiontype, "[%w_]
|
||||
<%- else -%>
|
||||
<th></th>
|
||||
<%- end -%>
|
||||
<%- end; if self.extedit or self.addremove then -%>
|
||||
<th></th>
|
||||
<%- end -%>
|
||||
<%- for i, k in pairs(self.children) do if not k.optional then -%>
|
||||
<th class="cbi-section-table-cell"<%=width(k)%>><%=k.description%></th>
|
||||
|
@ -33,6 +33,14 @@ local sectiontype = "_"..self.config.."_"..string.match(self.sectiontype, "[%w_]
|
||||
ul{
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
h3{
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.cbi-value-field .cbi-dropdown, .cbi-value-field .cbi-input-select, .cbi-value input[type="text"], .cbi-value input[type="password"] {
|
||||
min-width: auto;
|
||||
}
|
||||
|
||||
#tab-header-<%=self.config%>-<%=self.sectiontype%>{
|
||||
min-height: 35px;
|
||||
@ -90,7 +98,7 @@ local sectiontype = "_"..self.config.."_"..string.match(self.sectiontype, "[%w_]
|
||||
<!-- tblsection -->
|
||||
<fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
|
||||
<% if self.title and #self.title > 0 then -%>
|
||||
<legend><%=self.title%></legend>
|
||||
<h3><%=self.title%></h3>
|
||||
<%- end %>
|
||||
<%- if self.sortable then -%>
|
||||
<input type="hidden" id="cbi.sts.<%=self.config%>.<%=self.sectiontype%>" name="cbi.sts.<%=self.config%>.<%=self.sectiontype%>" value="" />
|
||||
@ -133,7 +141,7 @@ local sectiontype = "_"..self.config.."_"..string.match(self.sectiontype, "[%w_]
|
||||
<%- count = count + 1; end; end; if self.sortable then -%>
|
||||
<th class="cbi-section-table-cell"><%:Sort%></th>
|
||||
<%- end; if self.extedit or self.addremove then -%>
|
||||
<th class="cbi-section-table-cell"> </th>
|
||||
<th class="cbi-section-table-cell"><%:Edit%></th>
|
||||
<%- count = count + 1; end -%>
|
||||
</tr>
|
||||
<tr class="cbi-section-table-descr">
|
||||
@ -143,6 +151,8 @@ local sectiontype = "_"..self.config.."_"..string.match(self.sectiontype, "[%w_]
|
||||
<%- else -%>
|
||||
<th></th>
|
||||
<%- end -%>
|
||||
<%- end; if self.extedit or self.addremove then -%>
|
||||
<th></th>
|
||||
<%- end -%>
|
||||
<%- for i, k in pairs(self.children) do if not k.optional then -%>
|
||||
<th class="cbi-section-table-cell"<%=width(k)%>><%=k.description%></th>
|
||||
|
@ -283,14 +283,14 @@
|
||||
{
|
||||
var v = core_version.value;
|
||||
var r = release_branch.value;
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "save_corever_branch")%>', {core_ver: v, release_branch: r}, function(x, status) {
|
||||
if (x && x.status == 200) {
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "coreupdate")%>', {core_type: type}, function(x, status) {
|
||||
btn.value = '<%:Check And Update%>';
|
||||
btn.disabled = false;
|
||||
return false;
|
||||
});
|
||||
}
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "save_corever_branch")%>', {core_ver: v, release_branch: r}, function(x, status) {
|
||||
if (x && x.status == 200) {
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "coreupdate")%>', {core_type: type}, function(x, status) {
|
||||
btn.value = '<%:Check And Update%>';
|
||||
btn.disabled = false;
|
||||
return false;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -298,13 +298,13 @@
|
||||
{
|
||||
var r = release_branch.value;
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "save_corever_branch")%>', {release_branch: r}, function(x, status) {
|
||||
if (x && x.status == 200) {
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "opupdate")%>', null, function(x, status) {
|
||||
btn.value = '<%:Check And Update%>';
|
||||
btn.disabled = false;
|
||||
return false;
|
||||
});
|
||||
}
|
||||
if (x && x.status == 200) {
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "opupdate")%>', null, function(x, status) {
|
||||
btn.value = '<%:Check And Update%>';
|
||||
btn.disabled = false;
|
||||
return false;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -346,7 +346,12 @@
|
||||
var oplv = status.oplv;
|
||||
var oplvis = oplv.substring(oplv.indexOf("v") + 1,oplv.indexOf(","));
|
||||
if ( oplvis != "" ) {
|
||||
url2='https://raw.githubusercontent.com/vernesong/OpenClash/package/'+r+'/luci-app-openclash_'+oplvis+'_all.ipk';
|
||||
if (status.pkg_type == "apk") {
|
||||
url2='https://raw.githubusercontent.com/vernesong/OpenClash/package/'+r+'/luci-app-openclash-'+oplvis+'.apk';
|
||||
}
|
||||
else {
|
||||
url2='https://raw.githubusercontent.com/vernesong/OpenClash/package/'+r+'/luci-app-openclash_'+oplvis+'_all.ipk';
|
||||
}
|
||||
window.location.href=url2;
|
||||
}
|
||||
else {
|
||||
|
@ -518,6 +518,9 @@ msgstr "国际流媒体"
|
||||
msgid "AsianTV"
|
||||
msgstr "亚洲流媒体"
|
||||
|
||||
msgid "CN Mainland TV"
|
||||
msgstr "大陆流媒体"
|
||||
|
||||
msgid "Proxy"
|
||||
msgstr "必须代理的流量"
|
||||
|
||||
@ -912,7 +915,7 @@ msgstr "文件名"
|
||||
msgid "Grammar Check"
|
||||
msgstr "语法检查"
|
||||
|
||||
msgid "Switch"
|
||||
msgid "SwiTch"
|
||||
msgstr "切换"
|
||||
|
||||
msgid "Size"
|
||||
@ -1620,6 +1623,9 @@ msgstr "OpenClash 更新成功,即将进行重启!"
|
||||
msgid "OpenClash Update Failed, The File is Saved in /tmp/openclash.ipk, Please Try to Update Manually!"
|
||||
msgstr "OpenClash 更新失败,文件保存在 /tmp/openclash.ipk,请尝试手动更新!"
|
||||
|
||||
msgid "OpenClash Update Failed, The File is Saved in /tmp/openclash.apk, Please Try to Update Manually!"
|
||||
msgstr "OpenClash 更新失败,文件保存在 /tmp/openclash.apk,请尝试手动更新!"
|
||||
|
||||
msgid "Download Failed, Please Check The Network or Try Again Later!"
|
||||
msgstr "下载失败,请检查网络或稍后再试!"
|
||||
|
||||
@ -2292,9 +2298,6 @@ msgstr "错误:设置自定义规则失败,"
|
||||
msgid "Error: Set BT/P2P DIRECT Rules Failed,"
|
||||
msgstr "错误:设置仅代理命中规则流量(BT/P2P直连)失败,"
|
||||
|
||||
msgid "Error: Set Loop Protect Rules Failed,"
|
||||
msgstr "错误:设置防回环规则失败,"
|
||||
|
||||
msgid "Error: Set lhie1 Rules Failed,"
|
||||
msgstr "错误:设置第三方规则(lhie1)失败,"
|
||||
|
||||
@ -2484,15 +2487,9 @@ msgstr "提示:开始自动选择(检测)Netflix 解锁节点..."
|
||||
msgid "Tip: Start Auto Select Proxy For Disney Plus Unlock..."
|
||||
msgstr "提示:开始自动选择(检测)Disney Plus 解锁节点..."
|
||||
|
||||
msgid "Tip: Start Auto Select Proxy For HBO Now Unlock..."
|
||||
msgstr "提示:开始自动选择(检测)HBO Now 解锁节点..."
|
||||
|
||||
msgid "Tip: Start Auto Select Proxy For HBO Max Unlock..."
|
||||
msgstr "提示:开始自动选择(检测)HBO Max 解锁节点..."
|
||||
|
||||
msgid "Tip: Start Auto Select Proxy For HBO GO Asia Unlock..."
|
||||
msgstr "提示:开始自动选择(检测)HBO GO Asia 解锁节点..."
|
||||
|
||||
msgid "Tip: Start Auto Select Proxy For YouTube Premium Unlock..."
|
||||
msgstr "提示:开始自动选择(检测)YouTube Premium 解锁节点..."
|
||||
|
||||
@ -2526,15 +2523,9 @@ msgstr "Netflix 策略组:"
|
||||
msgid "Disney Plus Group:"
|
||||
msgstr "Disney Plus 策略组:"
|
||||
|
||||
msgid "HBO Now Group:"
|
||||
msgstr "HBO Now 策略组:"
|
||||
|
||||
msgid "HBO Max Group:"
|
||||
msgstr "HBO Max 策略组:"
|
||||
|
||||
msgid "HBO GO Asia Group:"
|
||||
msgstr "HBO GO Asia 策略组:"
|
||||
|
||||
msgid "TVB Anywhere+ Group:"
|
||||
msgstr "TVB Anywhere+ 策略组:"
|
||||
|
||||
@ -2919,8 +2910,8 @@ msgstr "节点域名解析"
|
||||
msgid "Use For Node Domain Resolve"
|
||||
msgstr "用于解析节点域名的 IP 地址"
|
||||
|
||||
msgid "Lan Bypassed Port List"
|
||||
msgstr "绕过核心的来源端口"
|
||||
msgid "Lan Traffic Access List"
|
||||
msgstr "来源流量访问控制"
|
||||
|
||||
msgid "The Traffic From The Local Specified Port Will Not Pass The Core, Try To Set When The Bypass Gateway Forwarding Fails"
|
||||
msgstr "来自本地指定端口的流量不会通过核心,在旁路网关(旁路由)下转发失败时尝试设置"
|
||||
@ -3057,6 +3048,9 @@ msgstr "警告:TUN 接口启动失败,请检查依赖情况或稍后重试
|
||||
msgid "Warning: TUN Interface Start Failed, Try to Restart Again..."
|
||||
msgstr "警告:TUN 接口启动失败,尝试重启内核..."
|
||||
|
||||
msgid "Error: Core Start Failed, Please Check The Log Infos!"
|
||||
msgstr "错误:内核启动失败,请查看《内核日志》排查失败原因!"
|
||||
|
||||
msgid "Forced Sniff Pure IP Connections"
|
||||
msgstr "强制探测(嗅探)所有纯 IP 的连接"
|
||||
|
||||
@ -3121,7 +3115,7 @@ msgid "in the firewall rule settings"
|
||||
msgstr "存在于防火墙规则设置"
|
||||
|
||||
msgid "auto bypassing may cause the normal connection of the client not to reach the core, if necessary, please add your own in the access control!"
|
||||
msgstr "自动绕过后可能造成客户端的正常连接无法到达内核,如有需要,请在访问控制中自行添加!"
|
||||
msgstr "自动绕过后可能造成客户端的正常连接无法到达内核,如有需要,请在插件设置-来源流量访问控制中自行添加!"
|
||||
|
||||
msgid "Tip: Start Add Port Bypassing Rules For Firewall Redirect and Firewall Rules..."
|
||||
msgstr "提示:正在根据防火墙端口转发和防火墙通信规则添加端口绕过规则..."
|
||||
@ -3431,3 +3425,30 @@ msgstr "全局"
|
||||
|
||||
msgid "Direct"
|
||||
msgstr "直连"
|
||||
|
||||
msgid "Error: Config File Overwrite Failed,"
|
||||
msgstr "错误:配置文件覆写失败,"
|
||||
|
||||
msgid "Edit"
|
||||
msgstr "编辑"
|
||||
|
||||
msgid "Proto"
|
||||
msgstr "通讯协议"
|
||||
|
||||
msgid "Family"
|
||||
msgstr "地址类型"
|
||||
|
||||
msgid "Comment"
|
||||
msgstr "备注"
|
||||
|
||||
msgid "Internal addresses"
|
||||
msgstr "内部地址"
|
||||
|
||||
msgid "Internal ports"
|
||||
msgstr "内部端口"
|
||||
|
||||
msgid "Target"
|
||||
msgstr "对象"
|
||||
|
||||
msgid "Error: Network Anomaly, Suspend Unlock Detection..."
|
||||
msgstr "错误:网络异常,暂停解锁检测..."
|
@ -12,7 +12,6 @@ config openclash 'config'
|
||||
option auto_update '0'
|
||||
option auto_update_time '0'
|
||||
option cn_port '9090'
|
||||
option dashboard_password '123456'
|
||||
option dashboard_forward_ssl '0'
|
||||
option rule_source '0'
|
||||
option enable_custom_dns '0'
|
||||
|
@ -14,7 +14,15 @@ BACKUP_FILE="/etc/openclash/backup/$(uci -q get openclash.config.config_path |aw
|
||||
CONFIG_FILE="/etc/openclash/$(uci -q get openclash.config.config_path |awk -F '/' '{print $5}' 2>/dev/null)"
|
||||
TMP_CONFIG_FILE="/tmp/yaml_config_tmp_$(uci -q get openclash.config.config_path |awk -F '/' '{print $5}' 2>/dev/null)"
|
||||
FW4=$(command -v fw4)
|
||||
DNSMASQ_CONF_DIR=$(uci -q get dhcp.@dnsmasq[0].confdir || echo '/tmp/dnsmasq.d')
|
||||
# 获取默认的 DNSMASQ 配置 ID
|
||||
DEFAULT_DNSMASQ_CFGID="$(uci -q show "dhcp.@dnsmasq[0]" | awk 'NR==1 {split($0, conf, /[.=]/); print conf[2]}')"
|
||||
# 从 conf-dir 行中提取配置目录路径
|
||||
if [ -f "/tmp/etc/dnsmasq.conf.$DEFAULT_DNSMASQ_CFGID" ]; then
|
||||
DNSMASQ_CONF_DIR="$(awk -F '=' '/^conf-dir=/ {print $2}' "/tmp/etc/dnsmasq.conf.$DEFAULT_DNSMASQ_CFGID")"
|
||||
else
|
||||
DNSMASQ_CONF_DIR="/tmp/dnsmasq.d"
|
||||
fi
|
||||
# 设置 DNSMASQ_CONF_DIR,并去除路径末尾的斜杠
|
||||
DNSMASQ_CONF_DIR=${DNSMASQ_CONF_DIR%*/}
|
||||
}
|
||||
CLASH="/etc/openclash/clash"
|
||||
@ -460,7 +468,7 @@ do_run_file()
|
||||
|
||||
#Some MIPS devices file system cound not use db
|
||||
source "/etc/openwrt_release"
|
||||
[ "$small_flash_memory" == "1" ] || [ -n "$(echo $core_version |grep mips)" ] || [ -n "$(echo $DISTRIB_ARCH |grep mips)" ] || [ -n "$(opkg status libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' |grep mips)" ] && mkdir -p /tmp/etc/openclash && CACHE_PATH="/tmp/etc/openclash/cache.db"
|
||||
[ "$small_flash_memory" == "1" ] || [ -n "$(echo $core_version |grep mips)" ] || [ -n "$(echo $DISTRIB_ARCH |grep mips)" ] || [ -n "$(opkg status libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' |grep mips)" ] || [ -n "$(apk list libc 2>/dev/null |grep mips)" ] && mkdir -p /tmp/etc/openclash && CACHE_PATH="/tmp/etc/openclash/cache.db"
|
||||
|
||||
[ -f "/etc/openclash/geosite.dat" ] && {
|
||||
mv "/etc/openclash/geosite.dat" "/etc/openclash/GeoSite.dat" 2>/dev/null
|
||||
@ -654,27 +662,6 @@ do_run_file()
|
||||
|
||||
}
|
||||
|
||||
config_test()
|
||||
{
|
||||
if [ -f "$CLASH" ]; then
|
||||
LOG_OUT "Test The Config File First..."
|
||||
test_info=$(nohup $CLASH -t -d $CLASH_CONFIG -f "$CONFIG_FILE")
|
||||
local IFS=$'\n'
|
||||
for i in $test_info; do
|
||||
if [ -n "$(echo "$i" |grep "configuration file")" ]; then
|
||||
local info=$(echo "$i" |sed "s# ${CONFIG_FILE} #【${CONFIG_FILE}】#g")
|
||||
LOG_OUT "$info"
|
||||
else
|
||||
echo "$i" >> "$LOG_FILE"
|
||||
fi
|
||||
done
|
||||
if [ -n "$(echo "$test_info" |grep "test failed")" ]; then
|
||||
LOG_OUT "Error: Config File Tested Faild, Please Check The Log Infos!"
|
||||
start_fail
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
start_run_core()
|
||||
{
|
||||
ulimit -SHn 65535 2>/dev/null
|
||||
@ -684,7 +671,6 @@ start_run_core()
|
||||
if ! $quick_start; then
|
||||
mv "$TMP_CONFIG_FILE" "$CONFIG_FILE" 2>/dev/null
|
||||
rm -rf "$TMP_CONFIG_FILE" 2>/dev/null
|
||||
config_test
|
||||
fi
|
||||
chown root:root /etc/openclash/core/* 2>/dev/null
|
||||
kill_clash
|
||||
@ -748,23 +734,15 @@ upnp_exclude()
|
||||
if [ -n "$line" ]; then
|
||||
upnp_ip=$(echo "$line" |awk -F ':' '{print $3}')
|
||||
upnp_dp=$(echo "$line" |awk -F ':' '{print $4}')
|
||||
upnp_type=$(echo "$line" |awk -F ':' '{print $1}')
|
||||
if [ -n "$upnp_ip" ] && [ -n "$upnp_dp" ]; then
|
||||
upnp_type=$(echo "$line" |awk -F ':' '{print $1}' |tr '[A-Z]' '[a-z]')
|
||||
if [ -n "$upnp_ip" ] && [ -n "$upnp_dp" ] && [ -n "$upnp_type" ]; then
|
||||
if [ -n "$FW4" ]; then
|
||||
if [ -z "$(nft list chain inet fw4 openclash_upnp |grep "$upnp_ip" |grep "$upnp_dp")" ]; then
|
||||
if [ "$upnp_type" == "UDP" ]; then
|
||||
nft add rule inet fw4 openclash_upnp ip saddr { "$upnp_ip" } udp sport "$upnp_dp" counter return 2>/dev/null
|
||||
else
|
||||
nft add rule inet fw4 openclash_upnp ip saddr { "$upnp_ip" } tcp sport "$upnp_dp" counter return 2>/dev/null
|
||||
fi
|
||||
if [ -z "$(nft list chain inet fw4 openclash_upnp |grep "$upnp_ip" |grep "$upnp_dp" |grep "$upnp_type")" ]; then
|
||||
nft add rule inet fw4 openclash_upnp ip saddr { "$upnp_ip" } "$upnp_type" sport "$upnp_dp" counter return 2>/dev/null
|
||||
fi
|
||||
else
|
||||
if [ -z "$(iptables -t mangle -nL openclash_upnp |grep "$upnp_ip" |grep "$upnp_dp")" ]; then
|
||||
if [ "$upnp_type" == "UDP" ]; then
|
||||
iptables -t mangle -A openclash_upnp -p udp -s "$upnp_ip" --sport "$upnp_dp" -j RETURN 2>/dev/null
|
||||
else
|
||||
iptables -t mangle -A openclash_upnp -p tcp -s "$upnp_ip" --sport "$upnp_dp" -j RETURN 2>/dev/null
|
||||
fi
|
||||
if [ -z "$(iptables -t mangle -nL openclash_upnp |grep "$upnp_ip" |grep "$upnp_dp" |grep "$upnp_type")" ]; then
|
||||
iptables -t mangle -A openclash_upnp -p "$upnp_type" -s "$upnp_ip" --sport "$upnp_dp" -j RETURN 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@ -777,6 +755,7 @@ check_core_status()
|
||||
{
|
||||
TUN_WAIT=0
|
||||
TUN_RESTART=1
|
||||
CORE_HTTP_CODE=0
|
||||
if [ -n "$en_mode_tun" ] || [ "$ipv6_mode" -eq 2 ] || [ "$ipv6_mode" -eq 3 ]; then
|
||||
if [ -n "$en_mode_tun" ]; then
|
||||
ip_="ip"
|
||||
@ -818,13 +797,130 @@ check_core_status()
|
||||
ip route add default dev utun table "$PROXY_ROUTE_TABLE"
|
||||
ip rule add fwmark "$PROXY_FWMARK" ipproto icmp table main pref 8000
|
||||
ip rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE" pref 8001
|
||||
else
|
||||
reg4='^((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$'
|
||||
while ( [ -n "$(pidof clash)" ] && [ "$CORE_HTTP_CODE" != "200" ] && [ "$TUN_RESTART" -le 120 ] && [[ "$lan_ip" =~ $reg4 ]] )
|
||||
do
|
||||
CORE_HTTP_CODE=$(curl -m 5 -o /dev/null -s -w '%{http_code}' -H 'Content-Type: application/json' -H "Authorization: Bearer ${da_password}" -XGET http://${lan_ip}:${cn_port}/group)
|
||||
let TUN_WAIT++
|
||||
sleep 1
|
||||
done >/dev/null 2>&1
|
||||
if ! [[ "$lan_ip" =~ $reg4 ]]; then
|
||||
sleep 10
|
||||
fi
|
||||
if [ -z "$(pidof clash)" ]; then
|
||||
LOG_OUT "Error: Core Start Failed, Please Check The Log Infos!"
|
||||
start_fail
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
firewall_lan_ac_traffic()
|
||||
{
|
||||
local src_port src_ip proto target enabled family comment
|
||||
config_get "src_port" "$section" "src_port" ""
|
||||
config_get "src_ip" "$section" "src_ip" ""
|
||||
config_get "proto" "$section" "proto" "both"
|
||||
config_get "target" "$section" "target" "return"
|
||||
config_get "enabled" "$section" "enabled" "0"
|
||||
config_get "family" "$section" "family" "both"
|
||||
config_get "comment" "$section" "comment" "lan_ac_traffic"
|
||||
|
||||
if [ "$enabled" == "0" ] || [ -z "$src_port" ] || [ -z "$src_ip" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
local e_udp=false
|
||||
local e_tcp=false
|
||||
if [ $proto == "tcp" ]; then e_tcp=true; fi
|
||||
if [ $proto == "udp" ]; then e_udp=true; fi
|
||||
if [ $proto == "both" ]; then e_tcp=true; e_udp=true; fi
|
||||
|
||||
if [ -n "$FW4" ]; then
|
||||
if [ "$family" == "both" ] || [ "$family" == "ipv4" ]; then
|
||||
if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 2 ]; then
|
||||
if $e_tcp ; then
|
||||
nft insert rule inet fw4 openclash_output position 0 meta nfproto {ipv4} ip daddr != { "$fakeip_range" } ip saddr { "$src_ip" } tcp sport "$src_port" counter $target comment "\"$comment\"" >/dev/null 2>&1
|
||||
nft insert rule inet fw4 openclash position 0 ip daddr != { "$fakeip_range" } ip saddr { "$src_ip" } tcp sport "$src_port" counter $target comment "\"$comment\"" >/dev/null 2>&1
|
||||
fi
|
||||
if $e_udp ; then
|
||||
nft insert rule inet fw4 openclash_mangle_output position 0 meta nfproto {ipv4} ip daddr != { "$fakeip_range" } ip saddr { "$src_ip" } udp sport "$src_port" counter $target comment "\"$comment\"" >/dev/null 2>&1
|
||||
nft insert rule inet fw4 openclash_mangle position 0 ip daddr != { "$fakeip_range" } ip saddr { "$src_ip" } udp sport "$src_port" counter $target comment "\"$comment\"" >/dev/null 2>&1
|
||||
fi
|
||||
elif [ "$en_mode_tun" -eq 1 ]; then
|
||||
if $e_tcp ; then
|
||||
nft insert rule inet fw4 openclash_mangle_output position 0 meta nfproto {ipv4} ip daddr != { "$fakeip_range" } ip saddr { "$src_ip" } tcp sport "$src_port" counter $target comment "\"$comment\"" >/dev/null 2>&1
|
||||
nft insert rule inet fw4 openclash_mangle position 0 ip daddr != { "$fakeip_range" } ip saddr { "$src_ip" } tcp sport "$src_port" counter $target comment "\"$comment\"" >/dev/null 2>&1
|
||||
fi
|
||||
if $e_udp ; then
|
||||
nft insert rule inet fw4 openclash_mangle_output position 0 meta nfproto {ipv4} ip daddr != { "$fakeip_range" } ip saddr { "$src_ip" } udp sport "$src_port" counter $target comment "\"$comment\"" >/dev/null 2>&1
|
||||
nft insert rule inet fw4 openclash_mangle position 0 ip daddr != { "$fakeip_range" } ip saddr { "$src_ip" } udp sport "$src_port" counter $target comment "\"$comment\"" >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ipv6_enable" -eq 1 ]; then
|
||||
if [ "$family" == "both" ] || [ "$family" == "ipv6" ]; then
|
||||
if $e_tcp ; then
|
||||
nft insert rule inet fw4 openclash_v6 position 0 ip6 saddr { "$src_ip" } tcp sport "$src_port" counter $target comment "\"$comment\"" >/dev/null 2>&1
|
||||
nft insert rule inet fw4 openclash_output_v6 position 0 ip6 saddr { "$src_ip" } tcp sport "$src_port" counter $target comment "\"$comment\"" >/dev/null 2>&1
|
||||
nft insert rule inet fw4 openclash_mangle_v6 position 0 ip6 saddr { "$src_ip" } tcp sport "$src_port" counter $target comment "\"$comment\"" >/dev/null 2>&1
|
||||
nft insert rule inet fw4 openclash_mangle_output_v6 position 0 meta nfproto {ipv6} ip6 saddr { "$src_ip" } tcp sport "$src_port" counter $target comment "\"$comment\"" >/dev/null 2>&1
|
||||
fi
|
||||
if $e_udp ; then
|
||||
nft insert rule inet fw4 openclash_mangle_v6 position 0 ip6 saddr { "$src_ip" } udp sport "$src_port" counter $target comment "\"$comment\"" >/dev/null 2>&1
|
||||
nft insert rule inet fw4 openclash_mangle_output_v6 position 0 meta nfproto {ipv6} ip6 saddr { "$src_ip" } udp sport "$src_port" counter $target comment "\"$comment\"" >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
src_port=$(echo $src_port |sed "s/-/:/g" 2>/dev/null)
|
||||
if [ $target == "accept" ]; then target="ACCEPT"; fi
|
||||
if [ $target == "return" ]; then target="RETURN"; fi
|
||||
|
||||
if [ "$family" == "both" ] || [ "$family" == "ipv4" ]; then
|
||||
if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 2 ]; then
|
||||
if $e_tcp ; then
|
||||
iptables -t nat -I openclash_output -p tcp ! -d "$fakeip_range" -s "$src_ip" --sport "$src_port" -j $target -m comment --comment "$comment" >/dev/null 2>&1
|
||||
iptables -t nat -I openclash -p tcp ! -d "$fakeip_range" -s "$src_ip" --sport "$src_port" -j $target -m comment --comment "$comment" >/dev/null 2>&1
|
||||
fi
|
||||
if $e_udp ; then
|
||||
iptables -t mangle -I openclash_output -p udp ! -d "$fakeip_range" -s "$src_ip" --sport "$src_port" -j $target -m comment --comment "$comment" >/dev/null 2>&1
|
||||
iptables -t mangle -I openclash -p udp ! -d "$fakeip_range" -s "$src_ip" --sport "$src_port" -j $target -m comment --comment "$comment" >/dev/null 2>&1
|
||||
fi
|
||||
elif [ "$en_mode_tun" -eq 1 ]; then
|
||||
if $e_tcp ; then
|
||||
iptables -t mangle -I openclash_output -p tcp ! -d "$fakeip_range" -s "$src_ip" --sport "$src_port" -j $target -m comment --comment "$comment" >/dev/null 2>&1
|
||||
iptables -t mangle -I openclash -p tcp ! -d "$fakeip_range" -s "$src_ip" --sport "$src_port" -j $target -m comment --comment "$comment" >/dev/null 2>&1
|
||||
fi
|
||||
if $e_udp ; then
|
||||
iptables -t mangle -I openclash_output -p udp ! -d "$fakeip_range" -s "$src_ip" --sport "$src_port" -j $target -m comment --comment "$comment" >/dev/null 2>&1
|
||||
iptables -t mangle -I openclash -p udp ! -d "$fakeip_range" -s "$src_ip" --sport "$src_port" -j $target -m comment --comment "$comment" >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ipv6_enable" -eq 1 ]; then
|
||||
if [ "$family" == "both" ] || [ "$family" == "ipv6" ]; then
|
||||
if $e_tcp ; then
|
||||
ip6tables -t nat -I openclash -s "$src_ip" -p tcp --sport "$src_port" -j $target -m comment --comment "$comment" >/dev/null 2>&1
|
||||
ip6tables -t nat -A openclash_output -s "$src_ip" -p tcp --sport "$src_port" -j $target -m comment --comment "$comment" >/dev/null 2>&1
|
||||
ip6tables -t mangle -I openclash -s "$src_ip" -p tcp --sport "$src_port" -j $target -m comment --comment "$comment" >/dev/null 2>&1
|
||||
ip6tables -t mangle -I openclash_output -p tcp -s "$src_ip" --sport "$src_port" -j $target -m comment --comment "$comment" >/dev/null 2>&1
|
||||
fi
|
||||
if $e_udp ; then
|
||||
ip6tables -t mangle -I openclash -p udp -s "$src_ip" --sport "$src_port" -j $target -m comment --comment "$comment" >/dev/null 2>&1
|
||||
ip6tables -t mangle -I openclash_output -p udp -s "$src_ip" --sport "$src_port" -j $target -m comment --comment "$comment" >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
firewall_rule_exclude()
|
||||
{
|
||||
local section="$1"
|
||||
local name src dest dest_port proto target enabled family
|
||||
local name src dest dest_port dest_ip proto target enabled family
|
||||
|
||||
config_get "name" "$section" "name" ""
|
||||
config_get "src" "$section" "src" ""
|
||||
@ -836,6 +932,18 @@ firewall_rule_exclude()
|
||||
config_get "enabled" "$section" "enabled" ""
|
||||
config_get "family" "$section" "family" ""
|
||||
|
||||
ipv6_suffix_to_nft_format() {
|
||||
local ipv6_with_prefix="$1"
|
||||
if [[ "$ipv6_with_prefix" =~ / ]]; then
|
||||
local suffix="${ipv6_with_prefix%%/*}"
|
||||
local prefix="${ipv6_with_prefix##*/}"
|
||||
echo "& $prefix == $suffix"
|
||||
else
|
||||
echo "$ipv6_with_prefix"
|
||||
fi
|
||||
}
|
||||
nft_ipv6=$(ipv6_suffix_to_nft_format "$dest_ip")
|
||||
|
||||
if [ a"$target" != aACCEPT ] || [ a"$enabled" == a0 ]; then
|
||||
return
|
||||
fi
|
||||
@ -860,6 +968,8 @@ firewall_rule_exclude()
|
||||
fi
|
||||
|
||||
if [ -n "$FW4" ]; then
|
||||
dest_ip=$(echo $dest_ip |sed "s/ /,/g" 2>/dev/null)
|
||||
|
||||
if [ -z "$family" ] || [ "$family" == "ipv4" ]; then
|
||||
if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 2 ]; then
|
||||
for i in $dest_port; do
|
||||
@ -908,22 +1018,35 @@ firewall_rule_exclude()
|
||||
if $e_tcp ; then
|
||||
if [ -z "$dest_ip" ]; then
|
||||
nft insert rule inet fw4 openclash_mangle_v6 position 0 meta nfproto {ipv6} tcp sport "$i" counter return >/dev/null 2>&1
|
||||
nft insert rule inet fw4 openclash_v6 position 0 meta nfproto {ipv6} tcp sport "$i" counter return >/dev/null 2>&1
|
||||
else
|
||||
nft insert rule inet fw4 openclash_mangle_v6 position 0 ip6 saddr { "$dest_ip" } tcp sport "$i" counter return >/dev/null 2>&1
|
||||
if [[ "$dest_ip" =~ , ]]; then
|
||||
nft insert rule inet fw4 openclash_mangle_v6 position 0 ip6 saddr { "$dest_ip" } tcp sport "$i" counter return >/dev/null 2>&1
|
||||
nft insert rule inet fw4 openclash_v6 position 0 ip6 saddr { "$dest_ip" } tcp sport "$i" counter return >/dev/null 2>&1
|
||||
else
|
||||
nft insert rule inet fw4 openclash_mangle_v6 position 0 ip6 saddr "$nft_ipv6" tcp sport "$i" counter return >/dev/null 2>&1
|
||||
nft insert rule inet fw4 openclash_v6 position 0 ip6 saddr "$nft_ipv6" tcp sport "$i" counter return >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
nft insert rule inet fw4 openclash_mangle_output_v6 position 0 meta nfproto {ipv6} tcp sport "$i" counter return >/dev/null 2>&1
|
||||
nft insert rule inet fw4 openclash_output_v6 position 0 meta nfproto {ipv6} tcp sport "$i" counter return >/dev/null 2>&1
|
||||
fi
|
||||
if $e_udp ; then
|
||||
if [ -z "$dest_ip" ]; then
|
||||
nft insert rule inet fw4 openclash_mangle_v6 position 0 meta nfproto {ipv6} udp sport "$i" counter return >/dev/null 2>&1
|
||||
else
|
||||
nft insert rule inet fw4 openclash_mangle_v6 position 0 ip6 saddr { "$dest_ip" } udp sport "$i" counter return >/dev/null 2>&1
|
||||
if [[ "$dest_ip" =~ , ]]; then
|
||||
nft insert rule inet fw4 openclash_mangle_v6 position 0 ip6 saddr { "$dest_ip" } udp sport "$i" counter return >/dev/null 2>&1
|
||||
else
|
||||
nft insert rule inet fw4 openclash_mangle_v6 position 0 ip6 saddr "$nft_ipv6" udp sport "$i" counter return >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
nft insert rule inet fw4 openclash_mangle_output_v6 position 0 meta nfproto {ipv6} udp sport "$i" counter return >/dev/null 2>&1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
dest_port=$(echo $dest_port |sed "s/-/:/g" 2>/dev/null)
|
||||
dest_ip=$(echo $dest_ip |sed "s/ /,/g" 2>/dev/null)
|
||||
@ -970,16 +1093,19 @@ firewall_rule_exclude()
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ipv6_enable" -eq 1 ] && [ -n "$(ip6tables -t mangle -L 2>&1 | grep -o 'Chain')" ]; then
|
||||
if [ "$ipv6_enable" -eq 1 ]; then
|
||||
if [ -z "$family" ] || [ "$family" == "ipv6" ]; then
|
||||
for i in $dest_port; do
|
||||
if $e_tcp ; then
|
||||
if [ -z "$dest_ip" ]; then
|
||||
ip6tables -t mangle -I openclash -p tcp --sport "$i" -j RETURN >/dev/null 2>&1
|
||||
ip6tables -t nat -I openclash -p tcp --sport "$i" -j RETURN >/dev/null 2>&1
|
||||
else
|
||||
ip6tables -t mangle -I openclash -s "$dest_ip" -p tcp --sport "$i" -j RETURN >/dev/null 2>&1
|
||||
ip6tables -t nat -I openclash -s "$dest_ip" -p tcp --sport "$i" -j RETURN >/dev/null 2>&1
|
||||
fi
|
||||
ip6tables -t mangle -I openclash_output -p tcp --sport "$i" -j RETURN >/dev/null 2>&1
|
||||
ip6tables -t nat -I openclash_output -p tcp --sport "$i" -j RETURN >/dev/null 2>&1
|
||||
fi
|
||||
if $e_udp ; then
|
||||
if [ -z "$dest_ip" ]; then
|
||||
@ -1248,13 +1374,6 @@ if [ -n "$FW4" ]; then
|
||||
config_list_foreach "config" "wan_ac_black_ips" nft_ac_add "wan_ac_black_ips" "wan_ac_black_ipv6s"
|
||||
fi
|
||||
|
||||
#lan port ac
|
||||
if [ -n "$(uci -q get openclash.config.lan_ac_black_ports)" ]; then
|
||||
nft 'add set inet fw4 lan_ac_black_ports { type inet_service; }'
|
||||
config_load "openclash"
|
||||
config_list_foreach "config" "lan_ac_black_ports" nft_ac_add "lan_ac_black_ports"
|
||||
fi
|
||||
|
||||
#local
|
||||
nft 'add set inet fw4 localnetwork { type ipv4_addr; flags interval; auto-merge; }'
|
||||
#nft 'delete set inet fw4 localnetwork'
|
||||
@ -1286,7 +1405,6 @@ if [ -n "$FW4" ]; then
|
||||
#nft 'delete chain inet fw4 openclash_post'
|
||||
nft 'add chain inet fw4 openclash_post'
|
||||
nft 'flush chain inet fw4 openclash_post'
|
||||
nft 'add rule inet fw4 openclash_post ip saddr @localnetwork tcp sport @lan_ac_black_ports counter return'
|
||||
nft add rule inet fw4 openclash_post meta mark "$PROXY_FWMARK" counter accept
|
||||
nft 'add rule inet fw4 openclash_post ip daddr @localnetwork counter return'
|
||||
nft 'add rule inet fw4 openclash_post meta nfproto {ipv4} fib saddr type != { local } meta skuid != 65534 counter masquerade'
|
||||
@ -1399,7 +1517,6 @@ if [ -n "$FW4" ]; then
|
||||
if [ -z "$en_mode_tun" ] && [ "$en_mode" = "fake-ip" ]; then
|
||||
nft add rule inet fw4 openclash ip protocol tcp ip daddr { "$fakeip_range" } counter redirect to "$proxy_port"
|
||||
fi
|
||||
nft 'add rule inet fw4 openclash ip saddr @localnetwork tcp sport @lan_ac_black_ports counter return'
|
||||
nft 'add rule inet fw4 openclash ip daddr @wan_ac_black_ips counter return'
|
||||
nft 'add rule inet fw4 openclash ip saddr @lan_ac_black_ips counter return'
|
||||
nft 'add rule inet fw4 openclash ether saddr @lan_ac_black_macs counter return'
|
||||
@ -1442,7 +1559,6 @@ if [ -n "$FW4" ]; then
|
||||
if [ "$en_mode" = "fake-ip" ]; then
|
||||
nft add rule inet fw4 openclash_mangle meta l4proto { udp } ip daddr { "$fakeip_range" } mark set "$PROXY_FWMARK" tproxy ip to 127.0.0.1:"$tproxy_port" counter accept
|
||||
fi
|
||||
nft 'add rule inet fw4 openclash_mangle ip saddr @localnetwork udp sport @lan_ac_black_ports counter return'
|
||||
nft 'add rule inet fw4 openclash_mangle ip daddr @wan_ac_black_ips counter return'
|
||||
nft 'add rule inet fw4 openclash_mangle ip saddr @lan_ac_black_ips counter return'
|
||||
nft 'add rule inet fw4 openclash_mangle ether saddr @lan_ac_black_macs counter return'
|
||||
@ -1503,7 +1619,6 @@ if [ -n "$FW4" ]; then
|
||||
nft 'add chain inet fw4 openclash_output'
|
||||
nft 'flush chain inet fw4 openclash_output'
|
||||
nft 'add rule inet fw4 openclash_output ip daddr @localnetwork counter return'
|
||||
nft 'add rule inet fw4 openclash_output ip saddr @localnetwork tcp sport @lan_ac_black_ports counter return'
|
||||
|
||||
if [ "$en_mode" = "fake-ip" ] && [ "$en_mode_tun" != "1" ]; then
|
||||
nft add rule inet fw4 openclash_output ip protocol tcp ip daddr { "$fakeip_range" } skuid != 65534 counter redirect to "$proxy_port"
|
||||
@ -1539,7 +1654,6 @@ if [ -n "$FW4" ]; then
|
||||
nft add rule inet fw4 openclash_mangle_output tcp dport 53 skuid != 65534 meta mark set "$PROXY_FWMARK" counter
|
||||
fi
|
||||
nft 'add rule inet fw4 openclash_mangle_output ip daddr @localnetwork counter return'
|
||||
nft 'add rule inet fw4 openclash_mangle_output ip saddr @localnetwork meta l4proto {tcp,udp} th sport @lan_ac_black_ports counter return'
|
||||
if [ "$en_mode" = "fake-ip" ]; 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 { "$fakeip_range" } mark set "$PROXY_FWMARK" counter
|
||||
@ -1587,7 +1701,6 @@ if [ -n "$FW4" ]; then
|
||||
#其他流量
|
||||
nft 'add rule inet fw4 openclash_mangle meta l4proto {tcp,udp} iifname utun counter return'
|
||||
nft add rule inet fw4 openclash_mangle ip daddr @localnetwork counter return
|
||||
nft 'add rule inet fw4 openclash_mangle ip saddr @localnetwork meta l4proto {tcp,udp} th sport @lan_ac_black_ports counter return'
|
||||
nft 'add rule inet fw4 openclash_mangle ip daddr @wan_ac_black_ips counter return'
|
||||
nft 'add rule inet fw4 openclash_mangle ip saddr @lan_ac_black_ips counter return'
|
||||
nft 'add rule inet fw4 openclash_mangle ether saddr @lan_ac_black_macs counter return'
|
||||
@ -1767,7 +1880,6 @@ if [ -n "$FW4" ]; then
|
||||
nft 'add chain inet fw4 openclash_v6'
|
||||
nft 'flush chain inet fw4 openclash_v6'
|
||||
nft add rule inet fw4 openclash_v6 ip6 daddr @localnetwork6 counter return
|
||||
nft 'add rule inet fw4 openclash_v6 ip6 saddr @localnetwork6 meta nfproto {ipv6} sport @lan_ac_black_ports counter return'
|
||||
nft 'add rule inet fw4 openclash_v6 ip6 daddr @wan_ac_black_ipv6s counter return'
|
||||
nft 'add rule inet fw4 openclash_v6 ip6 saddr @lan_ac_black_ipv6s counter return'
|
||||
nft 'add rule inet fw4 openclash_v6 ether saddr @lan_ac_black_macs counter return'
|
||||
@ -1801,7 +1913,6 @@ if [ -n "$FW4" ]; then
|
||||
nft 'add chain inet fw4 openclash_output_v6'
|
||||
nft 'flush chain inet fw4 openclash_output_v6'
|
||||
nft 'add rule inet fw4 openclash_output_v6 ip6 daddr @localnetwork6 counter return'
|
||||
nft 'add rule inet fw4 openclash_output_v6 ip6 saddr @localnetwork6 meta nfproto {ipv6} sport @lan_ac_black_ports counter return'
|
||||
nft 'add rule inet fw4 openclash_output_v6 skuid != 65534 ip6 daddr @wan_ac_black_ipv6s counter return'
|
||||
if [ "$en_mode" = "redir-host" ]; then
|
||||
nft 'add rule inet fw4 openclash_output_v6 meta nfproto {ipv6} th dport != @common_ports skuid != 65534 counter return'
|
||||
@ -1830,7 +1941,6 @@ if [ -n "$FW4" ]; then
|
||||
nft 'add rule inet fw4 openclash_mangle_v6 meta nfproto {ipv6} udp iifname lo counter return'
|
||||
nft add rule inet fw4 openclash_mangle_v6 ip6 daddr @localnetwork6 counter return
|
||||
nft 'add rule inet fw4 openclash_mangle_v6 meta nfproto {ipv6} udp dport 53 counter return'
|
||||
nft 'add rule inet fw4 openclash_mangle_v6 ip6 saddr @localnetwork6 meta nfproto {ipv6} sport @lan_ac_black_ports counter return'
|
||||
nft 'add rule inet fw4 openclash_mangle_v6 ip6 daddr @wan_ac_black_ipv6s counter return'
|
||||
|
||||
if [ "$en_mode" == "redir-host" ]; then
|
||||
@ -1871,7 +1981,6 @@ if [ -n "$FW4" ]; then
|
||||
nft 'flush chain inet fw4 openclash_mangle_output_v6'
|
||||
nft add rule inet fw4 openclash_mangle_output_v6 meta nfproto {ipv6} skuid != 65534 tcp dport 53 mark set "$PROXY_FWMARK" counter
|
||||
nft 'add rule inet fw4 openclash_mangle_output_v6 ip6 daddr @localnetwork6 counter return'
|
||||
nft 'add rule inet fw4 openclash_mangle_output_v6 ip6 saddr @localnetwork6 meta nfproto {ipv6} sport @lan_ac_black_ports counter return'
|
||||
nft 'add rule inet fw4 openclash_mangle_output_v6 skuid != 65534 ip6 daddr @wan_ac_black_ipv6s counter return'
|
||||
if [ "$en_mode" = "redir-host" ]; then
|
||||
nft 'add rule inet fw4 openclash_mangle_output_v6 meta nfproto {ipv6} th dport != @common_ports skuid != 65534 counter return'
|
||||
@ -1940,7 +2049,6 @@ if [ -n "$FW4" ]; then
|
||||
#nft 'delete chain inet fw4 openclash_post_v6'
|
||||
nft 'add chain inet fw4 openclash_post_v6'
|
||||
nft 'flush chain inet fw4 openclash_post_v6'
|
||||
nft 'add rule inet fw4 openclash_post_v6 ip6 saddr @localnetwork6 meta nfproto {ipv6} sport @lan_ac_black_ports counter return'
|
||||
nft add rule inet fw4 openclash_post_v6 meta nfproto {ipv6} meta mark "$PROXY_FWMARK" counter accept
|
||||
nft 'add rule inet fw4 openclash_post_v6 ip6 daddr @localnetwork6 counter return'
|
||||
nft 'add rule inet fw4 openclash_post_v6 meta nfproto {ipv6} fib saddr type != { local } meta skuid != 65534 counter masquerade'
|
||||
@ -2031,13 +2139,6 @@ if [ -z "$FW4" ]; then
|
||||
config_list_foreach "config" "wan_ac_black_ips" ac_add "wan_ac_black_ips" "wan_ac_black_ipv6s"
|
||||
fi
|
||||
|
||||
#lan port ac
|
||||
if [ -n "$(uci -q get openclash.config.lan_ac_black_ports)" ]; then
|
||||
ipset create lan_ac_black_ports bitmap:port range 0-65535
|
||||
config_load "openclash"
|
||||
config_list_foreach "config" "lan_ac_black_ports" ac_add "lan_ac_black_ports"
|
||||
fi
|
||||
|
||||
#local
|
||||
ipset create localnetwork hash:net
|
||||
if [ -f "/etc/openclash/custom/openclash_custom_localnetwork_ipv4.list" ]; then
|
||||
@ -2075,7 +2176,6 @@ if [ -z "$FW4" ]; then
|
||||
if [ "$bypass_gateway_compatible" -eq 1 ]; then
|
||||
iptables -t nat -N openclash_post
|
||||
iptables -t nat -F openclash_post
|
||||
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 mark --mark "$PROXY_FWMARK" -j ACCEPT
|
||||
iptables -t nat -A openclash_post -m set --match-set localnetwork dst -j RETURN
|
||||
iptables -t nat -A openclash_post $addr_local $owner -j MASQUERADE
|
||||
@ -2186,7 +2286,6 @@ if [ -z "$FW4" ]; then
|
||||
if [ -z "$en_mode_tun" ] && [ "$en_mode" = "fake-ip" ]; then
|
||||
iptables -t nat -A openclash -p tcp -d "$fakeip_range" -j REDIRECT --to-ports "$proxy_port"
|
||||
fi
|
||||
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 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
|
||||
@ -2229,7 +2328,6 @@ if [ -z "$FW4" ]; then
|
||||
if [ "$en_mode" = "fake-ip" ]; then
|
||||
iptables -t mangle -A openclash -p udp -d "$fakeip_range" -j TPROXY --on-port "$tproxy_port" --tproxy-mark "$PROXY_FWMARK"
|
||||
fi
|
||||
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 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
|
||||
@ -2292,7 +2390,6 @@ if [ -z "$FW4" ]; then
|
||||
fi
|
||||
if [ "$router_self_proxy" = "1" ]; then
|
||||
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 >/dev/null 2>&1
|
||||
iptables -t nat -A openclash_output $owner -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1
|
||||
if [ "$en_mode" = "redir-host" ]; then
|
||||
iptables -t nat -A openclash_output $owner -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
|
||||
@ -2323,7 +2420,6 @@ if [ -z "$FW4" ]; then
|
||||
iptables -t mangle -I openclash_output $owner -p tcp --dport 53 -j MARK --set-mark "$PROXY_FWMARK"
|
||||
fi
|
||||
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 >/dev/null 2>&1
|
||||
if [ "$en_mode_tun" -eq 1 ]; then
|
||||
iptables -t mangle -A openclash_output $owner -d "$fakeip_range" -j MARK --set-mark "$PROXY_FWMARK"
|
||||
if [ "$router_self_proxy" = "1" ]; then
|
||||
@ -2347,7 +2443,6 @@ if [ -z "$FW4" ]; then
|
||||
iptables -t mangle -N 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 src -m set --match-set lan_ac_black_ports src -j RETURN >/dev/null 2>&1
|
||||
iptables -t mangle -A openclash_output $owner -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1
|
||||
iptables -t mangle -A openclash_output $owner -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
|
||||
if [ "$china_ip_route" != "0" ]; then
|
||||
@ -2374,7 +2469,6 @@ if [ -z "$FW4" ]; then
|
||||
#其他流量
|
||||
iptables -t mangle -A openclash -i utun -j RETURN
|
||||
iptables -t mangle -A openclash -m set --match-set localnetwork dst -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 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
|
||||
@ -2555,7 +2649,6 @@ if [ -z "$FW4" ]; then
|
||||
ip6tables -t nat -N openclash
|
||||
ip6tables -t nat -F openclash
|
||||
ip6tables -t nat -A openclash -m set --match-set localnetwork6 dst -j RETURN
|
||||
ip6tables -t nat -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 nat -A openclash -m set --match-set wan_ac_black_ipv6s dst -j RETURN >/dev/null 2>&1
|
||||
ip6tables -t nat -A openclash -m set --match-set lan_ac_black_ipv6s src -j RETURN >/dev/null 2>&1
|
||||
ip6tables -t nat -A openclash -m set --match-set lan_ac_black_macs src -j RETURN >/dev/null 2>&1
|
||||
@ -2587,7 +2680,6 @@ if [ -z "$FW4" ]; then
|
||||
ip6tables -t nat -N openclash_output
|
||||
ip6tables -t nat -F openclash_output
|
||||
ip6tables -t nat -A openclash_output -m set --match-set localnetwork6 dst -j RETURN
|
||||
ip6tables -t nat -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 nat -A openclash_output $owner -m set --match-set wan_ac_black_ipv6s dst -j RETURN >/dev/null 2>&1
|
||||
if [ "$en_mode" = "redir-host" ]; then
|
||||
ip6tables -t nat -A openclash_output $owner -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
|
||||
@ -2614,7 +2706,6 @@ if [ -z "$FW4" ]; then
|
||||
ip6tables -t mangle -A openclash -i lo -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
|
||||
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 lan_ac_black_macs src -j RETURN >/dev/null 2>&1
|
||||
ip6tables -t mangle -A openclash -m set --match-set lan_ac_black_ipv6s src -j RETURN >/dev/null 2>&1
|
||||
@ -2656,7 +2747,6 @@ if [ -z "$FW4" ]; then
|
||||
ip6tables -t mangle -A openclash_output $owner -p tcp --dport 53 -j MARK --set-mark "$PROXY_FWMARK"
|
||||
fi
|
||||
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 >/dev/null 2>&1
|
||||
ip6tables -t mangle -A openclash_output $owner -m set --match-set wan_ac_black_ipv6s dst -j RETURN >/dev/null 2>&1
|
||||
if [ "$en_mode" = "redir-host" ]; then
|
||||
ip6tables -t mangle -A openclash_output $owner -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
|
||||
@ -2723,7 +2813,6 @@ if [ -z "$FW4" ]; then
|
||||
if [ "$bypass_gateway_compatible" -eq 1 ]; then
|
||||
ip6tables -t nat -N openclash_post
|
||||
ip6tables -t nat -F openclash_post
|
||||
ip6tables -t nat -A openclash_post -m set --match-set localnetwork6 src -m set --match-set lan_ac_black_ports src -j RETURN >/dev/null 2>&1
|
||||
ip6tables -t nat -A openclash_post -m mark --mark "$PROXY_FWMARK" -j ACCEPT
|
||||
ip6tables -t nat -A openclash_post -m set --match-set localnetwork6 dst -j RETURN
|
||||
ip6tables -t nat -A openclash_post $addr_local $owner -j MASQUERADE
|
||||
@ -2758,6 +2847,8 @@ LOG_OUT "Tip: Start Add Port Bypassing Rules For Firewall Redirect and Firewall
|
||||
config_load "firewall"
|
||||
config_foreach firewall_redirect_exclude "redirect"
|
||||
config_foreach firewall_rule_exclude "rule"
|
||||
config_load "openclash"
|
||||
config_foreach firewall_lan_ac_traffic "lan_ac_traffic"
|
||||
|
||||
#Custom
|
||||
|
||||
@ -2845,7 +2936,6 @@ revert_firewall()
|
||||
ipset destroy wan_ac_black_ips >/dev/null 2>&1
|
||||
ipset destroy common_ports >/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
|
||||
}
|
||||
|
||||
@ -2872,12 +2962,12 @@ get_config()
|
||||
fakeip_range=$(uci -q get openclash.config.fakeip_range)
|
||||
fi
|
||||
[ -z "$fakeip_range" ] && fakeip_range="198.18.0.1/16"
|
||||
lan_interface_name=$(uci -q get openclash.config.lan_interface_name || echo 0)
|
||||
|
||||
lan_interface_name=$(uci -q get openclash.config.lan_interface_name || echo 0)
|
||||
if [ "$lan_interface_name" = "0" ]; then
|
||||
lan_ip=$(uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
|
||||
lan_ip=$(uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' |head -1 || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
|
||||
else
|
||||
lan_ip=$(ip address show $lan_interface_name | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}')
|
||||
lan_ip=$(ip address show $lan_interface_name | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' |head -1)
|
||||
fi
|
||||
|
||||
wan_ip4s=$(/usr/share/openclash/openclash_get_network.lua "wanip" 2>/dev/null)
|
||||
@ -2917,7 +3007,7 @@ get_config()
|
||||
enable_respect_rules=$(uci -q get openclash.config.enable_respect_rules || echo 0)
|
||||
intranet_allowed_wan_name=$(uci -q get openclash.config.intranet_allowed_wan_name || echo 0)
|
||||
custom_fakeip_filter_mode=$(uci -q get openclash.config.custom_fakeip_filter_mode || echo "blacklist")
|
||||
iptables_compat=$(iptables -m owner -h| grep "owner match options" || echo 0)
|
||||
iptables_compat=$(iptables -m owner -h 2>/dev/null | grep "owner match options" || echo 0)
|
||||
[ -z "$dns_port" ] && dns_port=7874 && uci -q set openclash.config.dns_port=7874
|
||||
uci -q commit openclash
|
||||
}
|
||||
@ -2927,7 +3017,7 @@ start()
|
||||
|
||||
enable=$(uci -q get openclash.config.enable)
|
||||
[ "$enable" != "1" ] && LOG_OUT "Warning: OpenClash Now Disabled, Need Start From Luci Page, Exit..." && SLOG_CLEAN && del_lock && exit 0
|
||||
|
||||
service openclash enable
|
||||
LOG_OUT "OpenClash Start Running..."
|
||||
|
||||
config_choose
|
||||
@ -2943,8 +3033,8 @@ start()
|
||||
if ! $quick_start; then
|
||||
LOG_OUT "Step 3: Modify The Config File..."
|
||||
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" "$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" "$find_process_mode" "$fakeip_range" "$global_client_fingerprint" "$ipv6_mode" "$stack_type_v6" "$enable_unified_delay" "$enable_respect_rules" "$custom_fakeip_filter_mode"
|
||||
/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_redirect_dns" "$fakeip_range" "$en_mode"
|
||||
/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" "$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" "$find_process_mode" "$fakeip_range" "$global_client_fingerprint" "$ipv6_mode" "$stack_type_v6" "$enable_unified_delay" "$enable_respect_rules" "$custom_fakeip_filter_mode" "$iptables_compat"
|
||||
/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" "$enable_redirect_dns" "$en_mode"
|
||||
#Custom overwrite
|
||||
if [ -f "/etc/openclash/custom/openclash_custom_overwrite.sh" ]; then
|
||||
chmod +x /etc/openclash/custom/openclash_custom_overwrite.sh >/dev/null 2>&1
|
||||
@ -3022,6 +3112,7 @@ stop()
|
||||
|
||||
LOG_OUT "Step 6: Delete OpenClash Residue File..."
|
||||
if [ "$enable" != "1" ]; then
|
||||
service openclash disable
|
||||
rm -rf /tmp/clash_last_version >/dev/null 2>&1
|
||||
rm -rf /tmp/Proxy_Group >/dev/null 2>&1
|
||||
rm -rf /tmp/rules_name >/dev/null 2>&1
|
||||
|
@ -9,9 +9,10 @@
|
||||
LOG_OUT "Tip: Start Running Custom Overwrite Scripts..."
|
||||
LOGTIME=$(echo $(date "+%Y-%m-%d %H:%M:%S"))
|
||||
LOG_FILE="/tmp/openclash.log"
|
||||
CONFIG_FILE="$1" #config path
|
||||
#Config Path
|
||||
CONFIG_FILE="$1"
|
||||
|
||||
#Simple Demo:
|
||||
#Simple Demo:
|
||||
#Key Overwrite Demo
|
||||
#1--config path
|
||||
#2--key name
|
||||
@ -28,6 +29,13 @@ CONFIG_FILE="$1" #config path
|
||||
#ruby_edit "$CONFIG_FILE" "['dns']['nameserver-policy']" "{'+.msftconnecttest.com'=>'114.114.114.114', '+.msftncsi.com'=>'114.114.114.114', 'geosite:gfw'=>['https://dns.cloudflare.com/dns-query', 'https://dns.google/dns-query#ecs=1.1.1.1/24&ecs-override=true'], 'geosite:cn'=>['114.114.114.114'], 'geosite:geolocation-!cn'=>['https://dns.cloudflare.com/dns-query', 'https://dns.google/dns-query#ecs=1.1.1.1/24&ecs-override=true']}"
|
||||
#ruby_edit "$CONFIG_FILE" "['sniffer']" "{'enable'=>true, 'parse-pure-ip'=>true, 'force-domain'=>['+.netflix.com', '+.nflxvideo.net', '+.amazonaws.com', '+.media.dssott.com'], 'skip-domain'=>['+.apple.com', 'Mijia Cloud', 'dlg.io.mi.com', '+.oray.com', '+.sunlogin.net'], 'sniff'=>{'TLS'=>nil, 'HTTP'=>{'ports'=>[80, '8080-8880'], 'override-destination'=>true}}}"
|
||||
|
||||
#Hash Merge Demo
|
||||
#1--config path
|
||||
#2--key name
|
||||
#3--hash
|
||||
#ruby_merge_hash "$CONFIG_FILE" "['proxy-providers']" "'TW'=>{'type'=>'http', 'path'=>'./proxy_provider/TW.yaml', 'url'=>'https://gist.githubusercontent.com/raw/tw_clash', 'interval'=>3600, 'health-check'=>{'enable'=>true, 'url'=>'http://cp.cloudflare.com/generate_204', 'interval'=>300}}"
|
||||
#ruby_merge_hash "$CONFIG_FILE" "['rule-providers']" "'Reject'=>{'type'=>'http', 'behavior'=>'classical', 'url'=>'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Reject.yaml', 'path'=>'./rule_provider/Reject', 'interval'=>86400}"
|
||||
|
||||
#Array Insert Value Demo:
|
||||
#1--config path
|
||||
#2--key name
|
||||
@ -35,6 +43,15 @@ CONFIG_FILE="$1" #config path
|
||||
#4--value
|
||||
#ruby_arr_insert "$CONFIG_FILE" "['dns']['nameserver']" "0" "114.114.114.114"
|
||||
|
||||
#Array Insert Hash Demo:
|
||||
#1--config path
|
||||
#2--key name
|
||||
#3--position(start from 0, end with -1)
|
||||
#4--hash
|
||||
#ruby_arr_insert_hash "$CONFIG_FILE" "['proxy-groups']" "0" "{'name'=>'Disney', 'type'=>'select', 'disable-udp'=>false, 'use'=>['TW', 'SG', 'HK']}"
|
||||
#ruby_arr_insert_hash "$CONFIG_FILE" "['proxies']" "0" "{'name'=>'HKG 01', 'type'=>'ss', 'server'=>'cc.hd.abc', 'port'=>'12345', 'cipher'=>'aes-128-gcm', 'password'=>'123456', 'udp'=>true, 'plugin'=>'obfs', 'plugin-opts'=>{'mode'=>'http', 'host'=>'microsoft.com'}}"
|
||||
#ruby_arr_insert_hash "$CONFIG_FILE" "['listeners']" "0" "{'name'=>'name', 'type'=>'shadowsocks', 'port'=>'12345', 'listen'=>'0.0.0.0', 'rule'=>'sub-rule-1', 'proxy'=>'proxy'}"
|
||||
|
||||
#Array Insert Other Array Demo:
|
||||
#1--config path
|
||||
#2--key name
|
||||
|
@ -44,14 +44,18 @@ cat > "/lib/upgrade/keep.d/luci-app-openclash" <<-EOF
|
||||
EOF
|
||||
|
||||
#Set Dashboard Secret
|
||||
uci -q set openclash.config.dashboard_password="$(tr -cd 'a-zA-Z0-9' </dev/urandom 2>/dev/null| head -c8 || date +%N| md5sum |head -c8)"
|
||||
if [ -z "$(uci -q get openclash.config.dashboard_password)" ]; then
|
||||
uci -q set openclash.config.dashboard_password="$(tr -cd 'a-zA-Z0-9' </dev/urandom 2>/dev/null| head -c8 || date +%N| md5sum |head -c8)"
|
||||
fi
|
||||
|
||||
#Set authentication
|
||||
uci_name_tmp=$(uci add openclash authentication)
|
||||
uci_set="uci -q set openclash.$uci_name_tmp."
|
||||
${uci_set}enabled="1"
|
||||
${uci_set}username="Clash"
|
||||
${uci_set}password="$(tr -cd 'a-zA-Z0-9' </dev/urandom 2>/dev/null| head -c8 || date +%N| md5sum |head -c8)"
|
||||
#Set Authentication
|
||||
if [ -z "$(uci -q get openclash.@authentication[0])" ]; then
|
||||
uci_name_tmp=$(uci -q add openclash authentication)
|
||||
uci_set="uci -q set openclash.$uci_name_tmp."
|
||||
${uci_set}enabled="1"
|
||||
${uci_set}username="Clash"
|
||||
${uci_set}password="$(tr -cd 'a-zA-Z0-9' </dev/urandom 2>/dev/null| head -c8 || date +%N| md5sum |head -c8)"
|
||||
fi
|
||||
|
||||
#Set Core Model
|
||||
source "/etc/openwrt_release"
|
||||
@ -98,6 +102,10 @@ uci -q commit openclash
|
||||
|
||||
#Restore
|
||||
if [ -f "/tmp/openclash.bak" ]; then
|
||||
#delete old geosite database first
|
||||
if [ "/etc/openclash/GeoSite.dat" -nt "/tmp/openclash/GeoSite.dat" ]; then
|
||||
rm -rf "/tmp/openclash/GeoSite.dat" >/dev/null 2>&1
|
||||
fi
|
||||
mv -f "/tmp/openclash.bak" "/etc/config/openclash" >/dev/null 2>&1
|
||||
cp -rf "/tmp/openclash/." "/etc/openclash/" >/dev/null 2>&1
|
||||
if [ -d "/tmp/openclash_dashboard/" ]; then
|
||||
@ -192,5 +200,5 @@ sed -i '/.*kB maximum content size*/c\export let HTTP_MAX_CONTENT = 1024*10240;
|
||||
|
||||
/etc/init.d/uhttpd restart >/dev/null 2>&1
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
rm -f /tmp/luci-indexcache* >/dev/null 2>&1
|
||||
exit 0
|
||||
|
@ -25,8 +25,6 @@ if [ "$TIME" != "$CHTIME" ]; then
|
||||
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 -m 60 "$github_address_mod"gh/vernesong/OpenClash@core/"$RELEASE_BRANCH"/core_version -o $LAST_OPVER 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | 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://raw.fastgit.org/" ]; then
|
||||
curl -SsL -m 60 https://raw.fastgit.org/vernesong/OpenClash/core/"$RELEASE_BRANCH"/core_version -o $LAST_OPVER 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
else
|
||||
curl -SsL -m 60 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/core/"$RELEASE_BRANCH"/core_version -o $LAST_OPVER 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
fi
|
||||
|
@ -52,8 +52,6 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
|
||||
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 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"gh/vernesong/OpenClash@core/"$RELEASE_BRANCH"/meta/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_meta.tar.gz 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | 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://raw.fastgit.org/" ]; then
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.fastgit.org/vernesong/OpenClash/core/"$RELEASE_BRANCH"/meta/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_meta.tar.gz 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | 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
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/core/"$RELEASE_BRANCH"/meta/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_meta.tar.gz 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | 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
|
||||
@ -90,6 +88,8 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
|
||||
uci -q set openclash.config.config_reload=1
|
||||
uci -q commit openclash
|
||||
if ([ -z "$2" ] || ([ -n "$2" ] && [ "$2" != "one_key_update" ])) && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ] && [ "$(unify_ps_prevent)" -eq 0 ]; then
|
||||
uci -q set openclash.config.config_reload=0
|
||||
uci -q commit openclash
|
||||
/etc/init.d/openclash restart >/dev/null 2>&1 &
|
||||
fi
|
||||
else
|
||||
|
@ -13,7 +13,15 @@ del_lock() {
|
||||
|
||||
set_lock
|
||||
|
||||
DNSMASQ_CONF_DIR=$(uci -q get dhcp.@dnsmasq[0].confdir || echo '/tmp/dnsmasq.d')
|
||||
# 获取默认的 DNSMASQ 配置 ID
|
||||
DEFAULT_DNSMASQ_CFGID="$(uci -q show "dhcp.@dnsmasq[0]" | awk 'NR==1 {split($0, conf, /[.=]/); print conf[2]}')"
|
||||
# 从 conf-dir 行中提取配置目录路径
|
||||
if [ -f "/tmp/etc/dnsmasq.conf.$DEFAULT_DNSMASQ_CFGID" ]; then
|
||||
DNSMASQ_CONF_DIR="$(awk -F '=' '/^conf-dir=/ {print $2}' "/tmp/etc/dnsmasq.conf.$DEFAULT_DNSMASQ_CFGID")"
|
||||
else
|
||||
DNSMASQ_CONF_DIR="/tmp/dnsmasq.d"
|
||||
fi
|
||||
# 设置 DNSMASQ_CONF_DIR,并去除路径末尾的斜杠
|
||||
DNSMASQ_CONF_DIR=${DNSMASQ_CONF_DIR%*/}
|
||||
rm -rf ${DNSMASQ_CONF_DIR}/dnsmasq_openclash_custom_domain.conf >/dev/null 2>&1
|
||||
if [ "$(uci get openclash.config.enable_custom_domain_dns_server 2>/dev/null)" = "1" ] && [ "$(uci get openclash.config.enable_redirect_dns 2>/dev/null)" = "1" ]; then
|
||||
@ -30,4 +38,4 @@ if [ "$(uci get openclash.config.enable_custom_domain_dns_server 2>/dev/null)" =
|
||||
fi
|
||||
fi
|
||||
|
||||
del_lock
|
||||
del_lock
|
||||
|
@ -12,6 +12,15 @@ del_lock() {
|
||||
rm -rf "/tmp/lock/openclash_debug.lock"
|
||||
}
|
||||
|
||||
ipk_v()
|
||||
{
|
||||
if [ -x "/bin/opkg" ]; then
|
||||
echo $(opkg status "$1" 2>/dev/null |grep 'Version' |awk -F ': ' '{print $2}' 2>/dev/null)
|
||||
elif [ -x "/usr/bin/apk" ]; then
|
||||
echo $(apk list "$1" 2>/dev/null |grep 'installed' | grep -oE '\d+(\.\d+)*' | head -1)
|
||||
fi
|
||||
}
|
||||
|
||||
DEBUG_LOG="/tmp/openclash_debug.log"
|
||||
LOGTIME=$(echo $(date "+%Y-%m-%d %H:%M:%S"))
|
||||
set_lock
|
||||
@ -31,11 +40,15 @@ en_mode=$(uci -q get openclash.config.en_mode)
|
||||
RAW_CONFIG_FILE=$(uci -q get openclash.config.config_path)
|
||||
CONFIG_FILE="/etc/openclash/$(uci -q get openclash.config.config_path |awk -F '/' '{print $5}' 2>/dev/null)"
|
||||
core_model=$(uci -q get openclash.config.core_version)
|
||||
cpu_model=$(opkg status libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' 2>/dev/null)
|
||||
if [ -x "/bin/opkg" ]; then
|
||||
cpu_model=$(opkg status libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' 2>/dev/null)
|
||||
elif [ -x "/usr/bin/apk" ]; then
|
||||
cpu_model=$(apk list libc 2>/dev/null|awk '{print $2}')
|
||||
fi
|
||||
core_meta_version=$(/etc/openclash/core/clash_meta -v 2>/dev/null |awk -F ' ' '{print $3}' |head -1 2>/dev/null)
|
||||
servers_update=$(uci -q get openclash.config.servers_update)
|
||||
mix_proxies=$(uci -q get openclash.config.mix_proxies)
|
||||
op_version=$(opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F 'Version: ' '{print "v"$2}')
|
||||
op_version=$(ipk_v "luci-app-openclash")
|
||||
china_ip_route=$(uci -q get openclash.config.china_ip_route)
|
||||
common_ports=$(uci -q get openclash.config.common_ports)
|
||||
router_self_proxy=$(uci -q get openclash.config.router_self_proxy)
|
||||
@ -44,9 +57,9 @@ da_password=$(uci -q get openclash.config.dashboard_password)
|
||||
cn_port=$(uci -q get openclash.config.cn_port)
|
||||
lan_interface_name=$(uci -q get openclash.config.lan_interface_name || echo "0")
|
||||
if [ "$lan_interface_name" = "0" ]; then
|
||||
lan_ip=$(uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
|
||||
lan_ip=$(uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' |head -1 || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
|
||||
else
|
||||
lan_ip=$(ip address show $(uci -q -p $lan_interface_name) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}')
|
||||
lan_ip=$(ip address show $lan_interface_name | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' |head -1)
|
||||
fi
|
||||
dnsmasq_default_resolvfile=$(uci -q get openclash.config.default_resolvfile)
|
||||
|
||||
@ -107,7 +120,7 @@ cat >> "$DEBUG_LOG" <<-EOF
|
||||
|
||||
主机型号: $(cat /tmp/sysinfo/model 2>/dev/null)
|
||||
固件版本: $(cat /usr/lib/os-release 2>/dev/null |grep OPENWRT_RELEASE 2>/dev/null |awk -F '"' '{print $2}' 2>/dev/null)
|
||||
LuCI版本: $(opkg status luci 2>/dev/null |grep 'Version' |awk -F ': ' '{print $2}' 2>/dev/null)
|
||||
LuCI版本: $(ipk_v "luci")
|
||||
内核版本: $(uname -r 2>/dev/null)
|
||||
处理器架构: $cpu_model
|
||||
|
||||
@ -123,36 +136,38 @@ cat >> "$DEBUG_LOG" <<-EOF
|
||||
|
||||
#===================== 依赖检查 =====================#
|
||||
|
||||
dnsmasq-full: $(ts_re "$(opkg status dnsmasq-full 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
coreutils: $(ts_re "$(opkg status coreutils 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
coreutils-nohup: $(ts_re "$(opkg status coreutils-nohup 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
bash: $(ts_re "$(opkg status bash 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
curl: $(ts_re "$(opkg status curl 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
ca-certificates: $(ts_re "$(opkg status ca-certificates 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
ipset: $(ts_re "$(opkg status ipset 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
ip-full: $(ts_re "$(opkg status ip-full 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
libcap: $(ts_re "$(opkg status libcap 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
libcap-bin: $(ts_re "$(opkg status libcap-bin 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
ruby: $(ts_re "$(opkg status ruby 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
ruby-yaml: $(ts_re "$(opkg status ruby-yaml 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
ruby-psych: $(ts_re "$(opkg status ruby-psych 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
ruby-pstore: $(ts_re "$(opkg status ruby-pstore 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
kmod-tun(TUN模式): $(ts_re "$(opkg status kmod-tun 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
luci-compat(Luci >= 19.07): $(ts_re "$(opkg status luci-compat 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
kmod-inet-diag(PROCESS-NAME): $(ts_re "$(opkg status kmod-inet-diag 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
unzip: $(ts_re "$(opkg status unzip 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
dnsmasq-full: $(ts_re "$(ipk_v "dnsmasq-full")")
|
||||
dnsmasq-full(ipset): $(ts_re "$(dnsmasq --version |grep -v no-ipset |grep ipset)")
|
||||
dnsmasq-full(nftset): $(ts_re "$(dnsmasq --version |grep nftset)")
|
||||
coreutils: $(ts_re "$(ipk_v "coreutils")")
|
||||
coreutils-nohup: $(ts_re "$(ipk_v "coreutils-nohup")")
|
||||
bash: $(ts_re "$(ipk_v "bash")")
|
||||
curl: $(ts_re "$(ipk_v "curl")")
|
||||
ca-certificates: $(ts_re "$(ipk_v "ca-certificates")")
|
||||
ipset: $(ts_re "$(ipk_v "ipset")")
|
||||
ip-full: $(ts_re "$(ipk_v "ip-full")")
|
||||
libcap: $(ts_re "$(ipk_v "libcap")")
|
||||
libcap-bin: $(ts_re "$(ipk_v "libcap-bin")")
|
||||
ruby: $(ts_re "$(ipk_v "ruby")")
|
||||
ruby-yaml: $(ts_re "$(ipk_v "ruby-yaml")")
|
||||
ruby-psych: $(ts_re "$(ipk_v "ruby-psych")")
|
||||
ruby-pstore: $(ts_re "$(ipk_v "ruby-pstore")")
|
||||
kmod-tun(TUN模式): $(ts_re "$(ipk_v "kmod-tun")")
|
||||
luci-compat(Luci >= 19.07): $(ts_re "$(ipk_v "luci-compat")")
|
||||
kmod-inet-diag(PROCESS-NAME): $(ts_re "$(ipk_v "kmod-inet-diag")")
|
||||
unzip: $(ts_re "$(ipk_v "unzip")")
|
||||
EOF
|
||||
if [ -n "$(command -v fw4)" ]; then
|
||||
cat >> "$DEBUG_LOG" <<-EOF
|
||||
kmod-nft-tproxy: $(ts_re "$(opkg status kmod-nft-tproxy 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
kmod-nft-tproxy: $(ts_re "$(ipk_v kmod-nft-tproxy)")
|
||||
EOF
|
||||
else
|
||||
cat >> "$DEBUG_LOG" <<-EOF
|
||||
iptables-mod-tproxy: $(ts_re "$(opkg status iptables-mod-tproxy 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
kmod-ipt-tproxy: $(ts_re "$(opkg status kmod-ipt-tproxy 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
iptables-mod-extra: $(ts_re "$(opkg status iptables-mod-extra 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
kmod-ipt-extra: $(ts_re "$(opkg status kmod-ipt-extra 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
kmod-ipt-nat: $(ts_re "$(opkg status kmod-ipt-nat 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
iptables-mod-tproxy: $(ts_re "$(ipk_v "iptables-mod-tproxy")")
|
||||
kmod-ipt-tproxy: $(ts_re "$(ipk_v "kmod-ipt-tproxy")")
|
||||
iptables-mod-extra: $(ts_re "$(ipk_v "iptables-mod-extra")")
|
||||
kmod-ipt-extra: $(ts_re "$(ipk_v "kmod-ipt-extra")")
|
||||
kmod-ipt-nat: $(ts_re "$(ipk_v "kmod-ipt-nat")")
|
||||
EOF
|
||||
fi
|
||||
|
||||
|
@ -6,23 +6,14 @@ require "luci.sys"
|
||||
local uci = require("luci.model.uci").cursor()
|
||||
local json = require "luci.jsonc"
|
||||
local datatype = require "luci.cbi.datatypes"
|
||||
local fs = require "luci.openclash"
|
||||
|
||||
local addr = arg[1]
|
||||
local resolve = arg[2]
|
||||
|
||||
local function debug_dns()
|
||||
local info, ip, host, lan_int_name
|
||||
lan_int_name = uci:get("openclash", "config", "lan_interface_name") or "0"
|
||||
if lan_int_name == "0" then
|
||||
ip = luci.sys.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
|
||||
else
|
||||
ip = luci.sys.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name))
|
||||
end
|
||||
if not ip or ip == "" then
|
||||
ip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'")
|
||||
end
|
||||
if not ip or ip == "" then
|
||||
ip = luci.sys.exec("ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1 | tr -d '\n'")
|
||||
end
|
||||
local info, ip, host
|
||||
ip = fs.lanip()
|
||||
local port = uci:get("openclash", "config", "cn_port")
|
||||
local passwd = uci:get("openclash", "config", "dashboard_password") or ""
|
||||
|
||||
|
@ -11,7 +11,7 @@ local addr = arg[1]
|
||||
|
||||
local function s(e)
|
||||
local t=0
|
||||
local a={' KB',' MB',' GB',' TB'}
|
||||
local a={' KB',' MB',' GB',' TB',' PB'}
|
||||
repeat
|
||||
e=e/1024
|
||||
t=t+1
|
||||
@ -20,19 +20,8 @@ return string.format("%.1f",e)..a[t]
|
||||
end
|
||||
|
||||
local function debug_getcon()
|
||||
local info, ip, host, diag_info, lan_int_name
|
||||
lan_int_name = uci:get("openclash", "config", "lan_interface_name") or "0"
|
||||
if lan_int_name == "0" then
|
||||
ip = luci.sys.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
|
||||
else
|
||||
ip = luci.sys.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name))
|
||||
end
|
||||
if not ip or ip == "" then
|
||||
ip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'")
|
||||
end
|
||||
if not ip or ip == "" then
|
||||
ip = luci.sys.exec("ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1 | tr -d '\n'")
|
||||
end
|
||||
local info, ip, host, diag_info
|
||||
ip = fs.lanip()
|
||||
local port = uci:get("openclash", "config", "cn_port")
|
||||
local passwd = uci:get("openclash", "config", "dashboard_password") or ""
|
||||
if ip and port then
|
||||
|
@ -36,8 +36,6 @@ urlencode() {
|
||||
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 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"gh/FQrabbit/SSTap-Rule@master/rules/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | 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://raw.fastgit.org/" ]; then
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"FQrabbit/SSTap-Rule/master/rules/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
else
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --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 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
fi
|
||||
@ -48,8 +46,6 @@ urlencode() {
|
||||
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 30 -m 60 --speed-time 30 --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 |sed ':a;N;$!ba; s/\n/ /g' | 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://raw.fastgit.org/" ]; then
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --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 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
else
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
fi
|
||||
|
@ -31,8 +31,6 @@
|
||||
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 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "${github_address_mod}gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat" -o /tmp/GeoIP.dat 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | 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://raw.fastgit.org/" ]; then
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "https://raw.fastgit.org/Loyalsoldier/v2ray-rules-dat/release/geoip.dat" -o /tmp/GeoIP.dat 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoIP.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
else
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --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 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoIP.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
fi
|
||||
|
@ -31,8 +31,6 @@
|
||||
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 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat -o /tmp/GeoSite.dat 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | 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://raw.fastgit.org/" ]; then
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.fastgit.org/Loyalsoldier/v2ray-rules-dat/release/geosite.dat -o /tmp/GeoSite.dat 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoSite.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
else
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --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 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoSite.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
fi
|
||||
|
@ -16,9 +16,9 @@ close_all_conection() {
|
||||
SECRET=$(uci -q get openclash.config.dashboard_password)
|
||||
lan_interface_name=$(uci -q get openclash.config.lan_interface_name || echo "0")
|
||||
if [ "$lan_interface_name" = "0" ]; then
|
||||
LAN_IP=$(uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
|
||||
LAN_IP=$(uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' |head -1 || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
|
||||
else
|
||||
LAN_IP=$(ip address show $(uci -q -p $lan_interface_name) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}')
|
||||
LAN_IP=$(ip address show $lan_interface_name | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' |head -1)
|
||||
fi
|
||||
PORT=$(uci -q get openclash.config.cn_port)
|
||||
curl -m 2 -H "Authorization: Bearer ${SECRET}" -H "Content-Type:application/json" -X DELETE http://"$LAN_IP":"$PORT"/connections >/dev/null 2>&1
|
||||
@ -48,7 +48,7 @@ if [ -z "$CONFIG_FILE" ] || [ ! -f "$CONFIG_FILE" ]; then
|
||||
fi
|
||||
|
||||
if [ -n "$(pidof clash)" ] && [ -f "$CONFIG_FILE" ]; then
|
||||
if [ "$small_flash_memory" == "1" ] || [ -n "$(echo $core_version |grep mips)" ] || [ -n "$(echo $DISTRIB_ARCH |grep mips)" ] || [ -n "$(opkg status libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' |grep mips)" ]; then
|
||||
if [ "$small_flash_memory" == "1" ] || [ -n "$(echo $core_version |grep mips)" ] || [ -n "$(echo $DISTRIB_ARCH |grep mips)" ] || [ -n "$(opkg status libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' |grep mips)" ] || [ -n "$(apk list libc 2>/dev/null |grep mips)" ]; then
|
||||
CACHE_PATH="/tmp/etc/openclash/cache.db"
|
||||
if [ -f "$CACHE_PATH" ]; then
|
||||
cmp -s "$CACHE_PATH" "$HISTORY_PATH"
|
||||
|
@ -31,8 +31,6 @@
|
||||
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 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"gh/alecthw/mmdb_china_ip_list@release/lite/Country.mmdb -o /tmp/Country.mmdb 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | 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://raw.fastgit.org/" ]; then
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.fastgit.org/alecthw/mmdb_china_ip_list/release/lite/Country.mmdb -o /tmp/Country.mmdb 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/Country.mmdb" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
else
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --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 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/Country.mmdb" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
fi
|
||||
|
@ -37,8 +37,6 @@
|
||||
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 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"gh/dler-io/Rules@master/Clash/Rule.yaml -o /tmp/rules.yaml 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | 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://raw.fastgit.org/" ]; then
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.fastgit.org/dler-io/Rules/master/Clash/Rule.yaml -o /tmp/rules.yaml 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
else
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --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 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
fi
|
||||
@ -79,8 +77,8 @@
|
||||
elif ! "$(ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
|
||||
Value = YAML.load_file('/usr/share/openclash/res/${rule_name}.yaml');
|
||||
Value_1 = YAML.load_file('/tmp/rules.yaml');
|
||||
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;
|
||||
OLD_GROUP = Value['rules'].collect{|x| x.split(',')[2] or x.split(',')[1]}.uniq.map(&:strip);
|
||||
NEW_GROUP = Value_1['rules'].collect{|x| x.split(',')[2] or x.split(',')[1]}.uniq.map(&:strip);
|
||||
if (OLD_GROUP | NEW_GROUP).eql?(OLD_GROUP) then
|
||||
if (OLD_GROUP | NEW_GROUP).eql?(NEW_GROUP) then
|
||||
puts true
|
||||
@ -99,7 +97,7 @@
|
||||
fi
|
||||
|
||||
#取出规则部分
|
||||
ruby_read "/tmp/rules.yaml" ".select {|x| 'rule-providers' == x or 'script' == x or 'rules' == x }.to_yaml" > "$OTHER_RULE_FILE"
|
||||
ruby_read "/tmp/rules.yaml" ".select {|x| 'rule-providers' == x or 'rules' == x }.to_yaml" > "$OTHER_RULE_FILE"
|
||||
#合并
|
||||
cat "$OTHER_RULE_FILE" > "/tmp/rules.yaml" 2>/dev/null
|
||||
rm -rf /tmp/other_rule* 2>/dev/null
|
||||
|
@ -8,7 +8,7 @@ local HTTP = require "luci.http"
|
||||
local UCI = require("luci.model.uci").cursor()
|
||||
local FS = require "luci.openclash"
|
||||
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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
|
||||
local class_type = type
|
||||
local type = arg[1]
|
||||
local all_test
|
||||
@ -99,12 +99,8 @@ function unlock_auto_select()
|
||||
key_group = UCI:get("openclash", "config", "stream_auto_select_group_key_netflix") or "netflix|奈飞"
|
||||
elseif type == "Disney Plus" then
|
||||
key_group = UCI:get("openclash", "config", "stream_auto_select_group_key_disney") or "disney|迪士尼"
|
||||
elseif type == "HBO Now" then
|
||||
key_group = UCI:get("openclash", "config", "stream_auto_select_group_key_hbo_now") or "hbo|hbonow|hbo now"
|
||||
elseif type == "HBO Max" then
|
||||
key_group = UCI:get("openclash", "config", "stream_auto_select_group_key_hbo_max") or "hbo|hbomax|hbo max"
|
||||
elseif type == "HBO GO Asia" then
|
||||
key_group = UCI:get("openclash", "config", "stream_auto_select_group_key_hbo_go_asia") or "hbo|hbogo|hbo go"
|
||||
elseif type == "YouTube Premium" then
|
||||
key_group = UCI:get("openclash", "config", "stream_auto_select_group_key_ytb") or "youtobe|油管"
|
||||
elseif type == "TVB Anywhere+" then
|
||||
@ -773,20 +769,7 @@ end
|
||||
function get_auth_info()
|
||||
port = UCI:get("openclash", "config", "cn_port")
|
||||
passwd = UCI:get("openclash", "config", "dashboard_password") or ""
|
||||
local lan_int_name = UCI:get("openclash", "config", "lan_interface_name") or "0"
|
||||
if lan_int_name == "0" then
|
||||
ip = SYS.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
|
||||
else
|
||||
ip = SYS.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name))
|
||||
end
|
||||
|
||||
if not ip or ip == "" then
|
||||
ip = SYS.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'")
|
||||
end
|
||||
|
||||
if not ip or ip == "" then
|
||||
ip = SYS.exec("ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1 | tr -d '\n'")
|
||||
end
|
||||
ip = FS.lanip()
|
||||
if not ip or not port then
|
||||
os.exit(0)
|
||||
end
|
||||
@ -825,12 +808,8 @@ function nodes_filter(t, info)
|
||||
regex = UCI:get("openclash", "config", "stream_auto_select_node_key_netflix") or ""
|
||||
elseif type == "Disney Plus" then
|
||||
regex = UCI:get("openclash", "config", "stream_auto_select_node_key_disney") or ""
|
||||
elseif type == "HBO Now" then
|
||||
regex = UCI:get("openclash", "config", "stream_auto_select_node_key_hbo_now") or ""
|
||||
elseif type == "HBO Max" then
|
||||
regex = UCI:get("openclash", "config", "stream_auto_select_node_key_hbo_max") or ""
|
||||
elseif type == "HBO GO Asia" then
|
||||
regex = UCI:get("openclash", "config", "stream_auto_select_node_key_hbo_go_asia") or ""
|
||||
elseif type == "YouTube Premium" then
|
||||
regex = UCI:get("openclash", "config", "stream_auto_select_node_key_ytb") or ""
|
||||
elseif type == "TVB Anywhere+" then
|
||||
@ -889,12 +868,8 @@ function proxy_unlock_test()
|
||||
region, old_region = netflix_unlock_test()
|
||||
elseif type == "Disney Plus" then
|
||||
region, old_region = disney_unlock_test()
|
||||
elseif type == "HBO Now" then
|
||||
region, old_region = hbo_now_unlock_test()
|
||||
elseif type == "HBO Max" then
|
||||
region, old_region = hbo_max_unlock_test()
|
||||
elseif type == "HBO GO Asia" then
|
||||
region, old_region = hbo_go_asia_unlock_test()
|
||||
elseif type == "YouTube Premium" then
|
||||
region, old_region = ytb_unlock_test()
|
||||
elseif type == "TVB Anywhere+" then
|
||||
@ -924,16 +899,12 @@ function auto_get_policy_group(passwd, ip, port)
|
||||
SYS.call('curl -sL -m 5 --limit-rate 1k -o /dev/null https://www.netflix.com &')
|
||||
elseif type == "Disney Plus" then
|
||||
SYS.call('curl -sL -m 5 --limit-rate 1k -o /dev/null https://www.disneyplus.com &')
|
||||
elseif type == "HBO Now" then
|
||||
SYS.call('curl -s -m 5 --limit-rate 50B -o /dev/null https://play.hbonow.com/assets/fonts/Street2-Medium.ttf &')
|
||||
elseif type == "HBO Max" then
|
||||
SYS.call('curl -sL -m 5 --limit-rate 1k -o /dev/null https://www.hbomax.com &')
|
||||
elseif type == "HBO GO Asia" then
|
||||
SYS.call('curl -s -m 5 --limit-rate 50B -o /dev/null https://www.hbogoasia.sg/static/media/GothamLight.8566e233.ttf &')
|
||||
SYS.call('curl -sL -m 5 --limit-rate 1k -o /dev/null https://www.max.com &')
|
||||
elseif type == "YouTube Premium" then
|
||||
SYS.call('curl -sL -m 5 --limit-rate 1k -o /dev/null https://m.youtube.com/premium &')
|
||||
elseif type == "TVB Anywhere+" then
|
||||
SYS.call('curl -sL -m 5 --limit-rate 1k -o /dev/null https://uapisfm.tvbanywhere.com.sg &')
|
||||
SYS.call('curl -sL -m 5 --limit-rate 1k -o /dev/null https://www.tvbanywhere.com/img/tvb/vip_purchase.png &')
|
||||
elseif type == "Amazon Prime Video" then
|
||||
SYS.call('curl -sL -m 5 --limit-rate 1k -o /dev/null https://www.primevideo.com &')
|
||||
elseif type == "DAZN" then
|
||||
@ -947,7 +918,7 @@ function auto_get_policy_group(passwd, ip, port)
|
||||
elseif type == "Google" then
|
||||
SYS.call('curl -sL -m 5 --limit-rate 1k -o /dev/null https://timeline.google.com &')
|
||||
elseif type == "OpenAI" then
|
||||
SYS.call('curl -sL -m 5 --limit-rate 1k -o /dev/null https://chat.openai.com/ &')
|
||||
SYS.call('curl -sL -m 5 --limit-rate 1k -o /dev/null https://chatgpt.com/ &')
|
||||
end
|
||||
os.execute("sleep 1")
|
||||
con = SYS.exec(string.format('curl -sL -m 5 --retry 2 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -XGET http://%s:%s/connections', passwd, ip, port))
|
||||
@ -966,18 +937,8 @@ function auto_get_policy_group(passwd, ip, port)
|
||||
auto_get_group = con.connections[i].chains[#(con.connections[i].chains)]
|
||||
break
|
||||
end
|
||||
elseif type == "HBO Now" then
|
||||
if string.match(con.connections[i].metadata.host, "play%.hbonow%.com") then
|
||||
auto_get_group = con.connections[i].chains[#(con.connections[i].chains)]
|
||||
break
|
||||
end
|
||||
elseif type == "HBO Max" then
|
||||
if string.match(con.connections[i].metadata.host, "www%.hbomax%.com") then
|
||||
auto_get_group = con.connections[i].chains[#(con.connections[i].chains)]
|
||||
break
|
||||
end
|
||||
elseif type == "HBO GO Asia" then
|
||||
if string.match(con.connections[i].metadata.host, "www%.hbogoasia%.sg") then
|
||||
if string.match(con.connections[i].metadata.host, "www%.max%.com") then
|
||||
auto_get_group = con.connections[i].chains[#(con.connections[i].chains)]
|
||||
break
|
||||
end
|
||||
@ -987,7 +948,7 @@ function auto_get_policy_group(passwd, ip, port)
|
||||
break
|
||||
end
|
||||
elseif type == "TVB Anywhere+" then
|
||||
if string.match(con.connections[i].metadata.host, "uapisfm%.tvbanywhere%.com%.sg") then
|
||||
if string.match(con.connections[i].metadata.host, "www%.tvbanywhere%.com") then
|
||||
auto_get_group = con.connections[i].chains[#(con.connections[i].chains)]
|
||||
break
|
||||
end
|
||||
@ -1022,7 +983,7 @@ function auto_get_policy_group(passwd, ip, port)
|
||||
break
|
||||
end
|
||||
elseif type == "OpenAI" then
|
||||
if string.match(con.connections[i].metadata.host, "chat%.openai%.com") then
|
||||
if string.match(con.connections[i].metadata.host, "chatgpt%.com") then
|
||||
auto_get_group = con.connections[i].chains[#(con.connections[i].chains)]
|
||||
break
|
||||
end
|
||||
@ -1264,104 +1225,38 @@ function disney_unlock_test()
|
||||
return
|
||||
end
|
||||
|
||||
function hbo_now_unlock_test()
|
||||
status = 0
|
||||
local url = "https://play.hbonow.com/"
|
||||
local data = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{json} -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
if data then
|
||||
data = JSON.parse(data)
|
||||
end
|
||||
if data then
|
||||
if data.http_code == 200 then
|
||||
status = 1
|
||||
if string.find(data.url_effective,"play%.hbonow%.com") then
|
||||
status = 2
|
||||
end
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
function hbo_max_unlock_test()
|
||||
status = 0
|
||||
local url = "https://www.hbomax.com/"
|
||||
local data = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{json} -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
local url = "https://www.max.com/"
|
||||
local data = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --speed-time 5 --speed-limit 1 --retry 2 -w '_TAG_%%{http_code}_TAG_' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
local result = {}
|
||||
local region = ""
|
||||
local old_region = get_old_region()
|
||||
local old_regex = get_old_regex()
|
||||
local regex = UCI:get("openclash", "config", "stream_auto_select_region_key_hbo_max") or ""
|
||||
if data then
|
||||
data = JSON.parse(data)
|
||||
end
|
||||
if data then
|
||||
if data.http_code == 200 then
|
||||
status = 1
|
||||
if not string.find(data.url_effective,"geo%-availability") then
|
||||
status = 2
|
||||
string.gsub(data.url_effective, '[^/]+', function(w) table.insert(result, w) end)
|
||||
if result[3] then
|
||||
region = string.upper(string.match(result[3], "^%a+"))
|
||||
end
|
||||
if region then
|
||||
if not datamatch(region, regex) then
|
||||
status = 3
|
||||
elseif old_regex ~= regex and not all_test then
|
||||
status = 2
|
||||
elseif old_region ~= "" and region ~= old_region and not all_test then
|
||||
status = 4
|
||||
end
|
||||
if status == 2 and not all_test and region ~= "" and region ~= old_region then
|
||||
write_cache(type, "old_region", region)
|
||||
end
|
||||
if status == 2 and not all_test and regex ~= old_regex then
|
||||
write_cache(type, "old_regex", regex)
|
||||
end
|
||||
end
|
||||
return region, old_region
|
||||
end
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
function hbo_go_asia_unlock_test()
|
||||
status = 0
|
||||
local url = "https://api2.hbogoasia.com/v1/geog?lang=undefined&version=0&bundleId=www.hbogoasia.com"
|
||||
local httpcode = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{http_code} -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
local regex = UCI:get("openclash", "config", "stream_auto_select_region_key_hbo_go_asia") or ""
|
||||
local region = ""
|
||||
local old_region = get_old_region()
|
||||
local old_regex = get_old_regex()
|
||||
if tonumber(httpcode) == 200 then
|
||||
if data and tonumber(string.sub(string.match(data, "_TAG_%d+_TAG_"), 6, 8)) == 200 then
|
||||
status = 1
|
||||
local data = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --speed-time 5 --speed-limit 1 --retry 2 -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
if data then
|
||||
data = JSON.parse(data)
|
||||
for i in string.gmatch(data, "\"url\":\"/%a+/%a+\"") do
|
||||
table.insert(result, string.sub(string.match(i, "/%a+/"), 2, -2))
|
||||
end
|
||||
if data then
|
||||
if data.territory then
|
||||
region = string.sub(string.match(data, "\"countryCode\":\"%a+\""), 16, -2)
|
||||
if region and table_include(result, region) then
|
||||
status = 2
|
||||
region = string.upper(region)
|
||||
if not datamatch(region, regex) then
|
||||
status = 3
|
||||
elseif old_regex ~= regex and not all_test then
|
||||
status = 2
|
||||
if data.country then
|
||||
region = string.upper(data.country)
|
||||
end
|
||||
if region then
|
||||
if not datamatch(region, regex) then
|
||||
status = 3
|
||||
elseif old_regex ~= regex and not all_test then
|
||||
status = 2
|
||||
elseif old_region ~= "" and region ~= old_region and not all_test then
|
||||
status = 4
|
||||
end
|
||||
if status == 2 and not all_test and region ~= "" and region ~= old_region then
|
||||
write_cache(type, "old_region", region)
|
||||
end
|
||||
if status == 2 and not all_test and regex ~= old_regex then
|
||||
write_cache(type, "old_regex", regex)
|
||||
end
|
||||
end
|
||||
return region, old_region
|
||||
elseif old_region ~= "" and region ~= old_region and not all_test then
|
||||
status = 4
|
||||
end
|
||||
if status == 2 and not all_test and region ~= "" and region ~= old_region then
|
||||
write_cache(type, "old_region", region)
|
||||
end
|
||||
if status == 2 and not all_test and regex ~= old_regex then
|
||||
write_cache(type, "old_regex", regex)
|
||||
end
|
||||
return region, old_region
|
||||
end
|
||||
end
|
||||
return
|
||||
@ -1370,15 +1265,14 @@ end
|
||||
function ytb_unlock_test()
|
||||
status = 0
|
||||
local url = "https://m.youtube.com/premium"
|
||||
local httpcode = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --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 old_region = get_old_region()
|
||||
local data, he_data
|
||||
local regex = UCI:get("openclash", "config", "stream_auto_select_region_key_ytb") or ""
|
||||
local old_regex = get_old_regex()
|
||||
if tonumber(httpcode) == 200 then
|
||||
data = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --speed-time 5 --speed-limit 1 --retry 2 -w '_TAG_%%{http_code}_TAG_' -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' -b 'YSC=BiCUU3-5Gdk; CONSENT=YES+cb.20220301-11-p0.en+FX+700; GPS=1; VISITOR_INFO1_LIVE=4VwPMkB7W5A; PREF=tz=Asia.Shanghai; _gcl_au=1.1.1809531354.1646633279' %s", UA, url))
|
||||
if data and tonumber(string.sub(string.match(data, "_TAG_%d+_TAG_"), 6, 8)) == 200 then
|
||||
status = 1
|
||||
data = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' -b 'YSC=BiCUU3-5Gdk; CONSENT=YES+cb.20220301-11-p0.en+FX+700; GPS=1; VISITOR_INFO1_LIVE=4VwPMkB7W5A; PREF=tz=Asia.Shanghai; _gcl_au=1.1.1809531354.1646633279' %s", UA, url))
|
||||
if string.find(data,"www%.google%.cn") or string.find(data, "is not available in your country") then
|
||||
return
|
||||
end
|
||||
@ -1414,17 +1308,14 @@ end
|
||||
function tvb_anywhere_unlock_test()
|
||||
status = 0
|
||||
local url = "https://uapisfm.tvbanywhere.com.sg/geoip/check/platform/android"
|
||||
local httpcode = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --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 old_region = get_old_region()
|
||||
local old_regex = get_old_regex()
|
||||
local regex = UCI:get("openclash", "config", "stream_auto_select_region_key_tvb_anywhere") or ""
|
||||
if tonumber(httpcode) == 200 then
|
||||
local data = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --speed-time 5 --speed-limit 1 --retry 2 -w '_TAG_%%{http_code}_TAG_' -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
if data and tonumber(string.sub(string.match(data, "_TAG_%d+_TAG_"), 6, 8)) == 200 then
|
||||
status = 1
|
||||
local data = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --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
|
||||
data = JSON.parse(data)
|
||||
end
|
||||
data = JSON.parse(data)
|
||||
if data and data.allow_in_this_country then
|
||||
status = 2
|
||||
if data.country then
|
||||
@ -1453,33 +1344,30 @@ end
|
||||
function prime_video_unlock_test()
|
||||
status = 0
|
||||
local url = "https://www.primevideo.com"
|
||||
local httpcode = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --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 old_region = get_old_region()
|
||||
local old_regex = get_old_regex()
|
||||
local regex = UCI:get("openclash", "config", "stream_auto_select_region_key_prime_video") or ""
|
||||
if tonumber(httpcode) == 200 then
|
||||
local data = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --speed-time 5 --speed-limit 1 --retry 2 -w '_TAG_%%{http_code}_TAG_' -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
if data and tonumber(string.sub(string.match(data, "_TAG_%d+_TAG_"), 6, 8)) == 200 then
|
||||
status = 1
|
||||
local data = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --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
|
||||
region = string.sub(string.match(data, "\"currentTerritory\":\"%a+\""), 21, -2)
|
||||
if region then
|
||||
region = string.sub(string.match(data, "\"currentTerritory\":\"%a+\""), 21, -2)
|
||||
if region then
|
||||
status = 2
|
||||
if not datamatch(region, regex) then
|
||||
status = 3
|
||||
elseif old_regex ~= regex and not all_test then
|
||||
status = 2
|
||||
if not datamatch(region, regex) then
|
||||
status = 3
|
||||
elseif old_regex ~= regex and not all_test then
|
||||
status = 2
|
||||
elseif old_region ~= "" and region ~= old_region and not all_test then
|
||||
status = 4
|
||||
end
|
||||
if status == 2 and not all_test and region ~= "" and region ~= old_region then
|
||||
write_cache(type, "old_region", region)
|
||||
end
|
||||
if status == 2 and not all_test and regex ~= old_regex then
|
||||
write_cache(type, "old_regex", regex)
|
||||
end
|
||||
return region, old_region
|
||||
elseif old_region ~= "" and region ~= old_region and not all_test then
|
||||
status = 4
|
||||
end
|
||||
if status == 2 and not all_test and region ~= "" and region ~= old_region then
|
||||
write_cache(type, "old_region", region)
|
||||
end
|
||||
if status == 2 and not all_test and regex ~= old_regex then
|
||||
write_cache(type, "old_regex", regex)
|
||||
end
|
||||
return region, old_region
|
||||
end
|
||||
end
|
||||
return
|
||||
@ -1487,19 +1375,15 @@ end
|
||||
|
||||
function dazn_unlock_test()
|
||||
status = 0
|
||||
local url = "https://www.dazn.com"
|
||||
local url2 = "https://startup.core.indazn.com/misl/v5/Startup"
|
||||
local httpcode = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --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 url = "https://startup.core.indazn.com/misl/v5/Startup"
|
||||
local region
|
||||
local old_region = get_old_region()
|
||||
local old_regex = get_old_regex()
|
||||
local regex = UCI:get("openclash", "config", "stream_auto_select_region_key_dazn") or ""
|
||||
if tonumber(httpcode) == 200 then
|
||||
local data = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --speed-time 5 --speed-limit 1 --retry 2 -w '_TAG_%%{http_code}_TAG_' -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' -X POST -d '{\"LandingPageKey\":\"generic\",\"Languages\":\"zh-CN,zh,en\",\"Platform\":\"web\",\"PlatformAttributes\":{},\"Manufacturer\":\"\",\"PromoCode\":\"\",\"Version\":\"2\"}' %s", UA, url))
|
||||
if data and tonumber(string.sub(string.match(data, "_TAG_%d+_TAG_"), 6, 8)) == 200 then
|
||||
status = 1
|
||||
local data = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' -X POST -d '{\"LandingPageKey\":\"generic\",\"Languages\":\"zh-CN,zh,en\",\"Platform\":\"web\",\"PlatformAttributes\":{},\"Manufacturer\":\"\",\"PromoCode\":\"\",\"Version\":\"2\"}' %s", UA, url2))
|
||||
if data then
|
||||
data = JSON.parse(data)
|
||||
end
|
||||
data = JSON.parse(data)
|
||||
if data and data.Region and data.Region.isAllowed then
|
||||
status = 2
|
||||
if data.Region.GeolocatedCountry then
|
||||
@ -1532,13 +1416,11 @@ function paramount_plus_unlock_test()
|
||||
local old_region = get_old_region()
|
||||
local old_regex = get_old_regex()
|
||||
local regex = UCI:get("openclash", "config", "stream_auto_select_region_key_paramount_plus") or ""
|
||||
local data = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --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)
|
||||
if data and tonumber(data.http_code) == 200 then
|
||||
local data = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --speed-time 5 --speed-limit 1 --retry 2 -w '_TAG_%%{http_code}_TAG_%%{url_effective}_TAGS_' -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
if data and tonumber(string.sub(string.match(data, "_TAG_%d+_TAG_"), 6, 8)) == 200 then
|
||||
status = 1
|
||||
if not string.find(data.url_effective, "intl") then
|
||||
if not string.find(string.match(data, "_TAG_[^\n]+_TAGS_"), "intl") then
|
||||
status = 2
|
||||
data = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
region = string.upper(string.sub(string.match(data, "\"siteEdition\":\"%a+|%a+\""), 19, -2)) or string.upper(string.sub(string.match(data, "property: '%a+'"), 12, -2))
|
||||
if region then
|
||||
if not datamatch(region, regex) then
|
||||
@ -1599,9 +1481,9 @@ end
|
||||
|
||||
function bilibili_unlock_test()
|
||||
status = 0
|
||||
local randsession = SYS.exec("cat /dev/urandom | head -n 32 | md5sum | head -c 32")
|
||||
local randsession = SYS.exec("cat /dev/urandom 2>/dev/null | head -n 32 | md5sum | head -c 32")
|
||||
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 "CN"
|
||||
local old_region = get_old_region()
|
||||
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)
|
||||
@ -1613,26 +1495,23 @@ function bilibili_unlock_test()
|
||||
url = string.format("https://api.bilibili.com/pgc/player/web/playurl?avid=82846771&qn=0&type=&otype=json&ep_id=307247&fourk=1&fnver=0&fnval=16&session=%s&module=bangumi", randsession)
|
||||
region = "CN"
|
||||
end
|
||||
httpcode = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --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))
|
||||
if httpcode and tonumber(httpcode) == 200 then
|
||||
data = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --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
|
||||
data = JSON.parse(data)
|
||||
status = 1
|
||||
if data.code then
|
||||
if data.code == 0 then
|
||||
status = 2
|
||||
if old_region ~= "" and region ~= old_region and not all_test then
|
||||
status = 4
|
||||
end
|
||||
if status == 2 and not all_test and region ~= "" and region ~= old_region then
|
||||
write_cache(type, "old_region", region)
|
||||
end
|
||||
if status == 2 and not all_test and regex ~= old_regex then
|
||||
write_cache(type, "old_regex", regex)
|
||||
end
|
||||
return region, old_region
|
||||
data = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --speed-time 5 --speed-limit 1 --retry 2 -w '_TAG_%%{http_code}_TAG_' -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' '%s'", UA, url))
|
||||
if data and tonumber(string.sub(string.match(data, "_TAG_%d+_TAG_"), 6, 8)) == 200 then
|
||||
data = JSON.parse(data)
|
||||
status = 1
|
||||
if data.code then
|
||||
if data.code == 0 then
|
||||
status = 2
|
||||
if old_region ~= "" and region ~= old_region and not all_test then
|
||||
status = 4
|
||||
end
|
||||
if status == 2 and not all_test and region ~= "" and region ~= old_region then
|
||||
write_cache(type, "old_region", region)
|
||||
end
|
||||
if status == 2 and not all_test and regex ~= old_regex then
|
||||
write_cache(type, "old_regex", regex)
|
||||
end
|
||||
return region, old_region
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1660,17 +1539,23 @@ end
|
||||
|
||||
function openai_unlock_test()
|
||||
status = 0
|
||||
local url = "https://chat.openai.com/"
|
||||
local url = "https://api.openai.com/compliance/cookie_requirements"
|
||||
local url2 = "https://ios.chat.openai.com/"
|
||||
local region_url = "https://chat.openai.com/cdn-cgi/trace"
|
||||
local UA_SEC_CH_UA = '"Google Chrome";v="125", "Chromium";v="125", "Not.A/Brand";v="24"'
|
||||
local regex = UCI:get("openclash", "config", "stream_auto_select_region_key_openai") or ""
|
||||
local region = ""
|
||||
local region_data
|
||||
local old_region = get_old_region()
|
||||
local old_regex = get_old_regex()
|
||||
local data = SYS.exec(string.format("curl -sIL --connect-timeout 5 -m 5 --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 string.find(data, "text/html") then
|
||||
local data = SYS.exec(string.format("curl -sIL --connect-timeout 5 -m 5 --speed-time 5 --speed-limit 1 --retry 2 -H 'authority: api.openai.com' -H 'accept: */*' -H 'accept-language: en-US,en;q=0.9' -H 'authorization: Bearer null' -H 'content-type: application/json' -H 'origin: https://platform.openai.com' -H 'referer: https://platform.openai.com/' -H 'sec-ch-ua: %s' -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: \"Windows\"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-site' -H 'User-Agent: %s' '%s'", UA_SEC_CH_UA, UA, url))
|
||||
local datas = SYS.exec(string.format("curl -sIL --connect-timeout 5 -m 5 --speed-time 5 --speed-limit 1 --retry 2 -H 'authority: ios.chat.openai.com' -H 'accept: */*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'accept-language: en-US,en;q=0.9' -H 'sec-ch-ua: %s' -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: \"Windows\"' -H 'sec-fetch-dest: document' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-site: none' -H 'sec-fetch-user: ?1' -H 'upgrade-insecure-requests: 1' -H 'User-Agent: %s' '%s'", UA_SEC_CH_UA, UA, url2))
|
||||
if data and datas then
|
||||
if string.find(data, "unsupported_country") or string.find(datas, "VPN") then
|
||||
status = 1
|
||||
else
|
||||
status = 2
|
||||
local region_data = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' '%s'", UA, region_url))
|
||||
region_data = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' '%s'", UA, region_url))
|
||||
if region_data and string.match(region_data, "loc=%a+") then
|
||||
region = string.upper(string.sub(string.match(region_data, "loc=%a+"), 5, -1))
|
||||
end
|
||||
@ -1689,11 +1574,23 @@ function openai_unlock_test()
|
||||
write_cache(type, "old_regex", regex)
|
||||
end
|
||||
end
|
||||
else
|
||||
status = 1
|
||||
end
|
||||
return region, old_region
|
||||
end
|
||||
end
|
||||
|
||||
unlock_auto_select()
|
||||
function network_test()
|
||||
local test_url1 = "https://www.gstatic.com/generate_204"
|
||||
local test_url2 = "https://cp.cloudflare.com/generate_204"
|
||||
local httpcode1 = SYS.exec(string.format("curl -sL --connect-timeout 10 -m 15 --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, test_url1))
|
||||
local httpcode2 = SYS.exec(string.format("curl -sL --connect-timeout 10 -m 15 --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, test_url2))
|
||||
if httpcode1 or httpcode2 then
|
||||
if tonumber(httpcode1) == 204 or tonumber(httpcode2) == 204 then
|
||||
unlock_auto_select()
|
||||
return
|
||||
end
|
||||
end
|
||||
print(os.date("%Y-%m-%d %H:%M:%S").." Error: Network Anomaly, Suspend Unlock Detection...")
|
||||
end
|
||||
|
||||
network_test()
|
@ -27,8 +27,12 @@ fi
|
||||
|
||||
LAST_OPVER="/tmp/openclash_last_version"
|
||||
LAST_VER=$(sed -n 1p "$LAST_OPVER" 2>/dev/null |sed "s/^v//g" |tr -d "\n")
|
||||
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)
|
||||
if [ -x "/bin/opkg" ]; then
|
||||
OP_CV=$(rm -f /var/lock/opkg.lock && opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F 'Version: ' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
|
||||
elif [ -x "/usr/bin/apk" ]; then
|
||||
OP_CV=$(apk list luci-app-openclash 2>/dev/null |grep 'installed' | grep -oE '\d+(\.\d+)*' | head -1 |awk -F '.' '{print $2$3}' 2>/dev/null)
|
||||
fi
|
||||
OP_LV=$(sed -n 1p "$LAST_OPVER" 2>/dev/null |awk -F 'v' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
|
||||
RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master")
|
||||
LOG_FILE="/tmp/openclash.log"
|
||||
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
|
||||
@ -60,28 +64,59 @@ if [ -n "$OP_CV" ] && [ -n "$OP_LV" ] && [ "$(expr "$OP_LV" \> "$OP_CV")" -eq 1
|
||||
LOG_OUT "Start Downloading【OpenClash - v$LAST_VER】..."
|
||||
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 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"gh/vernesong/OpenClash@package/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | 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://raw.fastgit.org/" ]; then
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.fastgit.org/vernesong/OpenClash/package/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/openclash.ipk" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
if [ -x "/bin/opkg" ]; then
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"gh/vernesong/OpenClash@package/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/openclash.ipk" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
elif [ -x "/usr/bin/apk" ]; then
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"gh/vernesong/OpenClash@package/"$RELEASE_BRANCH"/luci-app-openclash-"$LAST_VER".apk -o /tmp/openclash.apk 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/openclash.apk" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
fi
|
||||
else
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/package/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/openclash.ipk" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
if [ -x "/bin/opkg" ]; then
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/package/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/openclash.ipk" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
elif [ -x "/usr/bin/apk" ]; then
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/package/"$RELEASE_BRANCH"/luci-app-openclash-"$LAST_VER".apk -o /tmp/openclash.apk 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/openclash.apk" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/vernesong/OpenClash/package/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/openclash.ipk" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
if [ -x "/bin/opkg" ]; then
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/vernesong/OpenClash/package/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/openclash.ipk" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
elif [ -x "/usr/bin/apk" ]; then
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/vernesong/OpenClash/package/"$RELEASE_BRANCH"/luci-app-openclash-"$LAST_VER".apk -o /tmp/openclash.apk 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/openclash.apk" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${PIPESTATUS[0]}" -eq 0 ] && [ -s "/tmp/openclash.ipk" ]; then
|
||||
if [ "${PIPESTATUS[0]}" -eq 0 ]; then
|
||||
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
|
||||
LOG_OUT "【OpenClash - v$LAST_VER】Pre Update Test Failed, The File is Saved in /tmp/openclash.ipk, Please Try to Update Manually!"
|
||||
if [ "$(uci -q get openclash.config.config_reload)" -eq 1 ]; then
|
||||
/etc/init.d/openclash restart >/dev/null 2>&1 &
|
||||
else
|
||||
SLOG_CLEAN
|
||||
if [ -x "/bin/opkg" ]; then
|
||||
if [ -s "/tmp/openclash.ipk" ]; then
|
||||
if [ -z "$(opkg install /tmp/openclash.ipk --noaction 2>/dev/null |grep 'Upgrading luci-app-openclash on root' 2>/dev/null)" ]; then
|
||||
LOG_OUT "【OpenClash - v$LAST_VER】Pre Update Test Failed, The File is Saved in /tmp/openclash.ipk, Please Try to Update Manually!"
|
||||
if [ "$(uci -q get openclash.config.config_reload)" -eq 1 ]; then
|
||||
uci -q set openclash.config.config_reload=0
|
||||
uci -q commit openclash
|
||||
/etc/init.d/openclash restart >/dev/null 2>&1 &
|
||||
else
|
||||
SLOG_CLEAN
|
||||
fi
|
||||
del_lock
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
elif [ -x "/usr/bin/apk" ]; then
|
||||
if [ -s "/tmp/openclash.apk" ]; then
|
||||
apk add -s -q --clean-protected --allow-untrusted /tmp/openclash.apk >/dev/null 2>&1
|
||||
if [ "$?" != "0" ]; then
|
||||
LOG_OUT "【OpenClash - v$LAST_VER】Pre Update Test Failed, The File is Saved in /tmp/openclash.apk, Please Try to Update Manually!"
|
||||
if [ "$(uci -q get openclash.config.config_reload)" -eq 1 ]; then
|
||||
uci -q set openclash.config.config_reload=0
|
||||
uci -q commit openclash
|
||||
/etc/init.d/openclash restart >/dev/null 2>&1 &
|
||||
else
|
||||
SLOG_CLEAN
|
||||
fi
|
||||
del_lock
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
del_lock
|
||||
exit 0
|
||||
fi
|
||||
LOG_OUT "【OpenClash - v$LAST_VER】Pre Update Test Passed, Ready to Update and Please Do not Refresh The Page and Other Operations..."
|
||||
cat > /tmp/openclash_update.sh <<"EOF"
|
||||
@ -103,24 +138,46 @@ SLOG_CLEAN()
|
||||
echo "" > $START_LOG
|
||||
}
|
||||
|
||||
LOG_OUT "Uninstalling The Old Version, Please Do not Refresh The Page or Do Other Operations..."
|
||||
uci -q set openclash.config.enable=0
|
||||
uci -q commit openclash
|
||||
opkg remove --force-depends --force-remove luci-app-openclash
|
||||
LOG_OUT "Installing The New Version, Please Do Not Refresh The Page or Do Other Operations..."
|
||||
opkg install /tmp/openclash.ipk
|
||||
if [ "$?" != "0" ] || [ -z "$(opkg info *openclash |grep Installed-Time)" ]; then
|
||||
opkg install /tmp/openclash.ipk
|
||||
if [ -x "/bin/opkg" ]; then
|
||||
LOG_OUT "Uninstalling The Old Version, Please Do not Refresh The Page or Do Other Operations..."
|
||||
opkg remove --force-depends --force-remove luci-app-openclash
|
||||
fi
|
||||
if [ "$?" == "0" ] && [ -n "$(opkg info *openclash |grep Installed-Time)" ]; then
|
||||
rm -rf /tmp/openclash.ipk >/dev/null 2>&1
|
||||
LOG_OUT "OpenClash Update Successful, About To Restart!"
|
||||
uci -q set openclash.config.enable=1
|
||||
uci -q commit openclash
|
||||
/etc/init.d/openclash restart 2>/dev/null
|
||||
else
|
||||
LOG_OUT "OpenClash Update Failed, The File is Saved in /tmp/openclash.ipk, Please Try to Update Manually!"
|
||||
SLOG_CLEAN
|
||||
LOG_OUT "Installing The New Version, Please Do Not Refresh The Page or Do Other Operations..."
|
||||
if [ -x "/bin/opkg" ]; then
|
||||
opkg install /tmp/openclash.ipk
|
||||
elif [ -x "/usr/bin/apk" ]; then
|
||||
apk add -q --clean-protected --allow-untrusted /tmp/openclash.apk
|
||||
fi
|
||||
if [ -x "/bin/opkg" ]; then
|
||||
if [ "$?" != "0" ] || [ -z "$(opkg info *openclash |grep Installed-Time)" ]; then
|
||||
opkg install /tmp/openclash.ipk
|
||||
fi
|
||||
if [ "$?" == "0" ] && [ -n "$(opkg info *openclash |grep Installed-Time)" ]; then
|
||||
rm -rf /tmp/openclash.ipk >/dev/null 2>&1
|
||||
LOG_OUT "OpenClash Update Successful, About To Restart!"
|
||||
uci -q set openclash.config.enable=1
|
||||
uci -q commit openclash
|
||||
/etc/init.d/openclash restart 2>/dev/null
|
||||
else
|
||||
LOG_OUT "OpenClash Update Failed, The File is Saved in /tmp/openclash.ipk, Please Try to Update Manually!"
|
||||
SLOG_CLEAN
|
||||
fi
|
||||
elif [ -x "/usr/bin/apk" ]; then
|
||||
if [ "$?" != "0" ] || [ -z "$(apk list luci-app-openclash 2>/dev/null |grep 'installed')" ]; then
|
||||
apk add -q --clean-protected --allow-untrusted /tmp/openclash.apk
|
||||
fi
|
||||
if [ "$?" != "0" ] || [ -z "$(apk list luci-app-openclash 2>/dev/null |grep 'installed')" ]; then
|
||||
rm -rf /tmp/openclash.apk >/dev/null 2>&1
|
||||
LOG_OUT "OpenClash Update Successful, About To Restart!"
|
||||
uci -q set openclash.config.enable=1
|
||||
uci -q commit openclash
|
||||
/etc/init.d/openclash restart 2>/dev/null
|
||||
else
|
||||
LOG_OUT "OpenClash Update Failed, The File is Saved in /tmp/openclash.apk, Please Try to Update Manually!"
|
||||
SLOG_CLEAN
|
||||
fi
|
||||
fi
|
||||
EOF
|
||||
chmod 4755 /tmp/openclash_update.sh
|
||||
@ -130,7 +187,10 @@ EOF
|
||||
else
|
||||
LOG_OUT "【OpenClash - v$LAST_VER】Download Failed, Please Check The Network or Try Again Later!"
|
||||
rm -rf /tmp/openclash.ipk >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash.apk >/dev/null 2>&1
|
||||
if [ "$(uci -q get openclash.config.config_reload)" -eq 1 ]; then
|
||||
uci -q set openclash.config.config_reload=0
|
||||
uci -q commit openclash
|
||||
/etc/init.d/openclash restart >/dev/null 2>&1 &
|
||||
else
|
||||
SLOG_CLEAN
|
||||
@ -143,6 +203,8 @@ else
|
||||
LOG_OUT "OpenClash Has not Been Updated, Stop Continuing!"
|
||||
fi
|
||||
if [ "$(uci -q get openclash.config.config_reload)" -eq 1 ]; then
|
||||
uci -q set openclash.config.config_reload=0
|
||||
uci -q commit openclash
|
||||
/etc/init.d/openclash restart >/dev/null 2>&1 &
|
||||
else
|
||||
SLOG_CLEAN
|
||||
|
@ -4,8 +4,12 @@ TIME=$(date "+%Y-%m-%d-%H")
|
||||
CHTIME=$(date "+%Y-%m-%d-%H" -r "/tmp/openclash_last_version" 2>/dev/null)
|
||||
LAST_OPVER="/tmp/openclash_last_version"
|
||||
RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master")
|
||||
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)
|
||||
if [ -x "/bin/opkg" ]; then
|
||||
OP_CV=$(rm -f /var/lock/opkg.lock && opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F 'Version: ' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
|
||||
elif [ -x "/usr/bin/apk" ]; then
|
||||
OP_CV=$(apk list luci-app-openclash 2>/dev/null|grep 'installed' | grep -oE '\d+(\.\d+)*' | head -1 |awk -F '.' '{print $2$3}' 2>/dev/null)
|
||||
fi
|
||||
OP_LV=$(sed -n 1p $LAST_OPVER 2>/dev/null |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)
|
||||
if [ -n "$1" ]; then
|
||||
github_address_mod="$1"
|
||||
@ -16,8 +20,6 @@ if [ "$TIME" != "$CHTIME" ]; then
|
||||
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 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"gh/vernesong/OpenClash@package/"$RELEASE_BRANCH"/version -o $LAST_OPVER 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | 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://raw.fastgit.org/" ]; then
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.fastgit.org/vernesong/OpenClash/package/"$RELEASE_BRANCH"/version -o $LAST_OPVER 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
else
|
||||
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/package/"$RELEASE_BRANCH"/version -o $LAST_OPVER 2>&1 |sed ':a;N;$!ba; s/\n/ /g' | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
|
||||
fi
|
||||
@ -26,7 +28,7 @@ if [ "$TIME" != "$CHTIME" ]; then
|
||||
fi
|
||||
|
||||
if [ "${PIPESTATUS[0]}" -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 'v' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
|
||||
if [ "$(expr "$OP_CV" \>= "$OP_LV")" = "1" ]; then
|
||||
sed -i '/^https:/,$d' $LAST_OPVER
|
||||
elif [ "$(expr "$OP_LV" \> "$OP_CV")" = "1" ] && [ -n "$OP_LV" ]; then
|
||||
|
@ -37,8 +37,8 @@ begin
|
||||
threadsp = [];
|
||||
set_commands = [];
|
||||
reg = /([0-9a-zA-Z-]{1,}\.)+([a-zA-Z]{2,})/;
|
||||
reg4 = /^((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(?::(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?$/;
|
||||
reg6 = /^(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))|\[(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))\](?::(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?$/i;
|
||||
reg4 = /^((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$/;
|
||||
reg6 = /^(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))|\[(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))\]$/i;
|
||||
if Value.key?('proxies') or Value.key?('proxy-providers') then
|
||||
firewall_v = '$FW4';
|
||||
if firewall_v.empty? then
|
||||
@ -159,9 +159,7 @@ do
|
||||
stream_auto_select_interval_now=$(uci -q get openclash.config.stream_auto_select_interval || echo 30)
|
||||
stream_auto_select_netflix=$(uci -q get openclash.config.stream_auto_select_netflix || echo 0)
|
||||
stream_auto_select_disney=$(uci -q get openclash.config.stream_auto_select_disney || echo 0)
|
||||
stream_auto_select_hbo_now=$(uci -q get openclash.config.stream_auto_select_hbo_now || echo 0)
|
||||
stream_auto_select_hbo_max=$(uci -q get openclash.config.stream_auto_select_hbo_max || echo 0)
|
||||
stream_auto_select_hbo_go_asia=$(uci -q get openclash.config.stream_auto_select_hbo_go_asia || echo 0)
|
||||
stream_auto_select_tvb_anywhere=$(uci -q get openclash.config.stream_auto_select_tvb_anywhere || echo 0)
|
||||
stream_auto_select_prime_video=$(uci -q get openclash.config.stream_auto_select_prime_video || echo 0)
|
||||
stream_auto_select_ytb=$(uci -q get openclash.config.stream_auto_select_ytb || echo 0)
|
||||
@ -381,18 +379,10 @@ fi
|
||||
LOG_OUT "Tip: Start Auto Select Proxy For Amazon Prime Video Unlock..."
|
||||
/usr/share/openclash/openclash_streaming_unlock.lua "Amazon Prime Video" >> $LOG_FILE
|
||||
fi
|
||||
if [ "$stream_auto_select_hbo_now" -eq 1 ]; then
|
||||
LOG_OUT "Tip: Start Auto Select Proxy For HBO Now Unlock..."
|
||||
/usr/share/openclash/openclash_streaming_unlock.lua "HBO Now" >> $LOG_FILE
|
||||
fi
|
||||
if [ "$stream_auto_select_hbo_max" -eq 1 ]; then
|
||||
LOG_OUT "Tip: Start Auto Select Proxy For HBO Max Unlock..."
|
||||
/usr/share/openclash/openclash_streaming_unlock.lua "HBO Max" >> $LOG_FILE
|
||||
fi
|
||||
if [ "$stream_auto_select_hbo_go_asia" -eq 1 ]; then
|
||||
LOG_OUT "Tip: Start Auto Select Proxy For HBO GO Asia Unlock..."
|
||||
/usr/share/openclash/openclash_streaming_unlock.lua "HBO GO Asia" >> $LOG_FILE
|
||||
fi
|
||||
if [ "$stream_auto_select_tvb_anywhere" -eq 1 ]; then
|
||||
LOG_OUT "Tip: Start Auto Select Proxy For TVB Anywhere+ Unlock..."
|
||||
/usr/share/openclash/openclash_streaming_unlock.lua "TVB Anywhere+" >> $LOG_FILE
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,164 +1,78 @@
|
||||
rules:
|
||||
- RULE-SET, Reject, AdBlock
|
||||
- RULE-SET, Special, DIRECT
|
||||
- RULE-SET, Netflix, Netflix
|
||||
- RULE-SET, Disney Plus, Disney
|
||||
- RULE-SET, YouTube, YouTube
|
||||
- RULE-SET, Spotify, Spotify
|
||||
- RULE-SET, Bilibili, Asian TV
|
||||
- RULE-SET, IQ, Asian TV
|
||||
- RULE-SET, IQIYI, Asian TV
|
||||
- RULE-SET, Letv, Asian TV
|
||||
- RULE-SET, Netease Music, Asian TV
|
||||
- RULE-SET, Tencent Video, Asian TV
|
||||
- RULE-SET, Youku, Asian TV
|
||||
- RULE-SET, WeTV, Asian TV
|
||||
- RULE-SET, ABC, Global TV
|
||||
- RULE-SET, Abema TV, Global TV
|
||||
- RULE-SET, Amazon, Global TV
|
||||
- RULE-SET, Bahamut, Global TV
|
||||
- RULE-SET, BBC iPlayer, Global TV
|
||||
- RULE-SET, DAZN, Global TV
|
||||
- RULE-SET, Discovery Plus, Global TV
|
||||
- RULE-SET, encoreTVB, Global TV
|
||||
- RULE-SET, F1 TV, Global TV
|
||||
- RULE-SET, Fox Now, Global TV
|
||||
- RULE-SET, Fox+, Global TV
|
||||
- RULE-SET, HBO Go, Global TV
|
||||
- RULE-SET, HBO Max, Global TV
|
||||
- RULE-SET, Hulu Japan, Global TV
|
||||
- RULE-SET, Hulu, Global TV
|
||||
- RULE-SET, Japonx, Global TV
|
||||
- RULE-SET, JOOX, Global TV
|
||||
- RULE-SET, KKBOX, Global TV
|
||||
- RULE-SET, KKTV, Global TV
|
||||
- RULE-SET, Line TV, Global TV
|
||||
- RULE-SET, myTV SUPER, Global TV
|
||||
- RULE-SET, Niconico, Global TV
|
||||
- RULE-SET, Pandora, Global TV
|
||||
- RULE-SET, PBS, Global TV
|
||||
- RULE-SET, Pornhub, Global TV
|
||||
- RULE-SET, Soundcloud, Global TV
|
||||
- RULE-SET, ViuTV, Global TV
|
||||
- RULE-SET, Apple Music, Apple TV
|
||||
- RULE-SET, Apple News, Apple TV
|
||||
- RULE-SET, Apple TV, Apple TV
|
||||
- RULE-SET, Apple, Apple
|
||||
- RULE-SET, Telegram, Telegram
|
||||
- RULE-SET, Crypto, Crypto
|
||||
- RULE-SET, Discord, Discord
|
||||
- RULE-SET, Google FCM, Google FCM
|
||||
- RULE-SET, Microsoft, Microsoft
|
||||
- RULE-SET, AI Suite, AI Suite
|
||||
- RULE-SET, PayPal, PayPal
|
||||
- RULE-SET, Scholar, Scholar
|
||||
- RULE-SET, Speedtest, Speedtest
|
||||
- RULE-SET, Steam, Steam
|
||||
- RULE-SET, miHoYo, miHoYo
|
||||
- RULE-SET, PROXY, Proxy
|
||||
- RULE-SET, Domestic, Domestic
|
||||
- RULE-SET, Domestic IPs, Domestic
|
||||
- RULE-SET, LAN, DIRECT
|
||||
- GEOIP, CN, Domestic
|
||||
- MATCH, Others
|
||||
script:
|
||||
code: |
|
||||
def main(ctx, metadata):
|
||||
ruleset_action = {
|
||||
'Reject': 'AdBlock',
|
||||
'Special': 'DIRECT',
|
||||
'Netflix': 'Netflix',
|
||||
'Disney Plus': 'Disney',
|
||||
'YouTube': 'YouTube',
|
||||
'Spotify': 'Spotify',
|
||||
'Bilibili': 'Asian TV',
|
||||
'IQ': 'Asian TV',
|
||||
'IQIYI': 'Asian TV',
|
||||
'Letv': 'Asian TV',
|
||||
'Netease Music': 'Asian TV',
|
||||
'Tencent Video': 'Asian TV',
|
||||
'Youku': 'Asian TV',
|
||||
'WeTV': 'Asian TV',
|
||||
'ABC': 'Global TV',
|
||||
'Abema TV': 'Global TV',
|
||||
'Amazon': 'Global TV',
|
||||
'Bahamut': 'Global TV',
|
||||
'BBC iPlayer': 'Global TV',
|
||||
'DAZN': 'Global TV',
|
||||
'Discovery Plus': 'Global TV',
|
||||
'encoreTVB': 'Global TV',
|
||||
'F1 TV': 'Global TV',
|
||||
'Fox Now': 'Global TV',
|
||||
'Fox+': 'Global TV',
|
||||
'HBO Go': 'Global TV',
|
||||
'HBO Max': 'Global TV',
|
||||
'Hulu Japan': 'Global TV',
|
||||
'Hulu': 'Global TV',
|
||||
'Japonx': 'Global TV',
|
||||
'JOOX': 'Global TV',
|
||||
'KKBOX': 'Global TV',
|
||||
'KKTV': 'Global TV',
|
||||
'Line TV': 'Global TV',
|
||||
'myTV SUPER': 'Global TV',
|
||||
'Niconico': 'Global TV',
|
||||
'Pandora': 'Global TV',
|
||||
'PBS': 'Global TV',
|
||||
'Pornhub': 'Global TV',
|
||||
'Soundcloud': 'Global TV',
|
||||
'ViuTV': 'Global TV',
|
||||
'Apple Music': 'Apple TV',
|
||||
'Apple News': 'Apple TV',
|
||||
'Apple TV': 'Apple TV',
|
||||
'Apple': 'Apple',
|
||||
'Telegram': 'Telegram',
|
||||
'Crypto': 'Crypto',
|
||||
'Discord': 'Discord',
|
||||
'Google FCM': 'Google FCM',
|
||||
'Microsoft': 'Microsoft',
|
||||
'AI Suite': 'AI Suite',
|
||||
'PayPal': 'PayPal',
|
||||
'Scholar': 'Scholar',
|
||||
'Speedtest': 'Speedtest',
|
||||
'Steam': 'Steam',
|
||||
'miHoYo': 'miHoYo',
|
||||
'PROXY': 'Proxy',
|
||||
'Domestic': 'Domestic',
|
||||
'Domestic IPs': 'Domestic',
|
||||
'LAN': 'DIRECT'
|
||||
}
|
||||
|
||||
port = int(metadata['dst_port'])
|
||||
|
||||
if metadata['network'] == 'UDP' and port == 443:
|
||||
ctx.log('[Script] matched QUIC traffic use reject')
|
||||
return 'REJECT'
|
||||
|
||||
port_list = [21, 22, 23, 53, 80, 123, 143, 194, 443, 465, 587, 853, 993, 995, 998, 2052, 2053, 2082, 2083, 2086, 2095, 2096, 3389, 5222, 5228, 5229, 5230, 8080, 8443, 8880, 8888, 8889]
|
||||
if port not in port_list:
|
||||
ctx.log('[Script] not common port use direct')
|
||||
return 'DIRECT'
|
||||
|
||||
if metadata['dst_ip'] == '':
|
||||
metadata['dst_ip'] = ctx.resolve_ip(metadata['host'])
|
||||
|
||||
for ruleset in ruleset_action:
|
||||
if ctx.rule_providers[ruleset].match(metadata):
|
||||
return ruleset_action[ruleset]
|
||||
|
||||
if metadata['dst_ip'] != '':
|
||||
code = ctx.geoip(metadata['dst_ip'])
|
||||
if code == 'CN':
|
||||
ctx.log('[Script] Geoip CN')
|
||||
return 'Domestic'
|
||||
|
||||
ctx.log('[Script] FINAL')
|
||||
return 'Others'
|
||||
- RULE-SET,AdBlock,AdBlock
|
||||
- RULE-SET,HTTPDNS,HTTPDNS
|
||||
- RULE-SET,Special,DIRECT
|
||||
- RULE-SET,Netflix,Netflix
|
||||
- RULE-SET,Disney Plus,Disney
|
||||
- RULE-SET,YouTube,YouTube
|
||||
- RULE-SET,Max,Max
|
||||
- RULE-SET,Spotify,Spotify
|
||||
- RULE-SET,Bilibili,CN Mainland TV
|
||||
- RULE-SET,IQ,CN Mainland TV
|
||||
- RULE-SET,IQIYI,CN Mainland TV
|
||||
- RULE-SET,Letv,CN Mainland TV
|
||||
- RULE-SET,Netease Music,CN Mainland TV
|
||||
- RULE-SET,Tencent Video,CN Mainland TV
|
||||
- RULE-SET,WeTV,CN Mainland TV
|
||||
- RULE-SET,Youku,CN Mainland TV
|
||||
- RULE-SET,Abema TV,Asian TV
|
||||
- RULE-SET,Bahamut,Asian TV
|
||||
- RULE-SET,Fox+,Asian TV
|
||||
- RULE-SET,Hulu Japan,Asian TV
|
||||
- RULE-SET,Japonx,Asian TV
|
||||
- RULE-SET,JOOX,Asian TV
|
||||
- RULE-SET,KKBOX,Asian TV
|
||||
- RULE-SET,KKTV,Asian TV
|
||||
- RULE-SET,Line TV,Asian TV
|
||||
- RULE-SET,myTV SUPER,Asian TV
|
||||
- RULE-SET,Niconico,Asian TV
|
||||
- RULE-SET,ViuTV,Asian TV
|
||||
- RULE-SET,ABC,Global TV
|
||||
- RULE-SET,Amazon,Global TV
|
||||
- RULE-SET,BBC iPlayer,Global TV
|
||||
- RULE-SET,DAZN,Global TV
|
||||
- RULE-SET,Discovery Plus,Global TV
|
||||
- RULE-SET,encoreTVB,Global TV
|
||||
- RULE-SET,F1 TV,Global TV
|
||||
- RULE-SET,Fox Now,Global TV
|
||||
- RULE-SET,Hulu,Global TV
|
||||
- RULE-SET,Pandora,Global TV
|
||||
- RULE-SET,PBS,Global TV
|
||||
- RULE-SET,Pornhub,Global TV
|
||||
- RULE-SET,Soundcloud,Global TV
|
||||
- RULE-SET,Apple Music,Apple TV
|
||||
- RULE-SET,Apple News,Apple TV
|
||||
- RULE-SET,Apple TV,Apple TV
|
||||
- RULE-SET,Apple,Apple
|
||||
- RULE-SET,Telegram,Telegram
|
||||
- RULE-SET,Crypto,Crypto
|
||||
- RULE-SET,Discord,Discord
|
||||
- RULE-SET,Google FCM,Google FCM
|
||||
- RULE-SET,Microsoft,Microsoft
|
||||
- RULE-SET,AI Suite,AI Suite
|
||||
- RULE-SET,PayPal,PayPal
|
||||
- RULE-SET,Scholar,Scholar
|
||||
- RULE-SET,Speedtest,Speedtest
|
||||
- RULE-SET,Steam,Steam
|
||||
- RULE-SET,miHoYo,miHoYo
|
||||
- RULE-SET,PROXY,Proxy
|
||||
- RULE-SET,Domestic,Domestic
|
||||
- RULE-SET,Domestic IPs,Domestic
|
||||
- RULE-SET,LAN,DIRECT
|
||||
- GEOIP,CN,Domestic
|
||||
- MATCH,Others
|
||||
rule-providers:
|
||||
Reject:
|
||||
AdBlock:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Reject.yaml
|
||||
path: "./Rules/Reject"
|
||||
url: https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/AdBlock.yaml
|
||||
path: "./Rules/AdBlock"
|
||||
interval: 86400
|
||||
HTTPDNS:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/HTTPDNS.yaml
|
||||
path: "./Rules/HTTPDNS"
|
||||
interval: 86400
|
||||
Special:
|
||||
type: http
|
||||
@ -208,6 +122,12 @@ rule-providers:
|
||||
url: https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/YouTube.yaml
|
||||
path: "./Rules/Media/YouTube"
|
||||
interval: 86400
|
||||
Max:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Max.yaml
|
||||
path: "./Rules/Media/Max"
|
||||
interval: 86400
|
||||
Bilibili:
|
||||
type: http
|
||||
behavior: classical
|
||||
@ -346,18 +266,6 @@ rule-providers:
|
||||
url: https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Fox%2B.yaml
|
||||
path: "./Rules/Media/Fox+"
|
||||
interval: 86400
|
||||
HBO Go:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/HBO%20Go.yaml
|
||||
path: "./Rules/Media/HBO_Go"
|
||||
interval: 86400
|
||||
HBO Max:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/HBO%20Max.yaml
|
||||
path: "./Rules/Media/HBO_Max"
|
||||
interval: 86400
|
||||
Hulu Japan:
|
||||
type: http
|
||||
behavior: classical
|
||||
|
@ -3,12 +3,14 @@
|
||||
国内IP白名单(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/,Domestic IPs.yaml
|
||||
国内域名白名单(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/,Domestic.yaml
|
||||
国外常用网站合集(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/,Proxy.yaml
|
||||
广告规则(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/,Reject.yaml
|
||||
广告规则(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/,AdBlock.yaml
|
||||
微软服务,lhie1,classical,dler-io/Rules/master/Clash/Provider/,Microsoft.yaml
|
||||
HTTPDNS(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/,HTTPDNS.yaml
|
||||
ABC,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,ABC.yaml
|
||||
Abema TV,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Abema TV.yaml
|
||||
AbemaTV(By ACL4SSR),ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,AbemaTV.yaml,AbemaTV-ACL4SSR.yaml
|
||||
Adobe,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Adobe.yaml
|
||||
AI Suite,lhie1,classical,dler-io/Rules/master/Clash/Provider/,AI Suite.yaml
|
||||
Amazon(By ACL4SSR),ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Amazon.yaml,Amazon-ACL4SSR.yaml
|
||||
Amazon,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Amazon.yaml
|
||||
AmazonIp,ACL4SSR,ipcidr,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,AmazonIp.yaml
|
||||
@ -28,7 +30,6 @@ Bilibili(By ACL4SSR),ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ru
|
||||
Bilibili,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Bilibili.yaml
|
||||
BilibiliHMT,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,BilibiliHMT.yaml
|
||||
Blizzard,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Blizzard.yaml
|
||||
ChatGPT,lhie1,classical,dler-io/Rules/master/Clash/Provider/,ChatGPT.yaml
|
||||
ChinaCompanyIp,ACL4SSR,ipcidr,ACL4SSR/ACL4SSR/master/Clash/Providers/,ChinaCompanyIp.yaml
|
||||
ChinaDomain,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/,ChinaDomain.yaml
|
||||
ChinaIp(By ACL4SSR),ACL4SSR,ipcidr,ACL4SSR/ACL4SSR/master/Clash/Providers/,ChinaIp.yaml,ChinaIp-ACL4SSR.yaml
|
||||
@ -46,7 +47,7 @@ Google,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Google.
|
||||
GoogleCN,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,GoogleCN.yaml
|
||||
GoogleFCM,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,GoogleFCM.yaml
|
||||
HBO(By ACL4SSR),ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,HBO.yaml,HBO-ACL4SSR.yaml
|
||||
HBO(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,HBO.yaml,HBO-lhie1.yaml
|
||||
HBO MAX(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,MAX.yaml,MAX-lhie1.yaml
|
||||
Hulu Japan,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Hulu Japan.yaml
|
||||
Hulu(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Hulu.yaml,Hulu-lhie1.yaml
|
||||
JOOX(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,JOOX.yaml,JOOX-lhie1.yaml
|
||||
|
@ -67,6 +67,17 @@ RUBY_YAML_PARSE="Thread.new{Value = YAML.load_file('$1'); Value$2=Value$2.uniq;
|
||||
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "$RUBY_YAML_PARSE" 2>/dev/null
|
||||
}
|
||||
|
||||
#hash覆盖
|
||||
ruby_merge_hash()
|
||||
{
|
||||
local Value Value_1 RUBY_YAML_PARSE
|
||||
if [ -z "$1" ] || [ -z "$2" ]; then
|
||||
return
|
||||
fi
|
||||
RUBY_YAML_PARSE="Thread.new{Value = YAML.load_file('$1'); Value$2.merge!($3); File.open('$1','w') {|f| YAML.dump(Value, f)}}.join"
|
||||
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "$RUBY_YAML_PARSE" 2>/dev/null
|
||||
}
|
||||
|
||||
#数组指定位置前添加一组值(不要key)
|
||||
ruby_arr_add_file()
|
||||
{
|
||||
@ -96,7 +107,18 @@ local Value RUBY_YAML_PARSE
|
||||
if [ -z "$1" ] || [ -z "$2" ]; then
|
||||
return
|
||||
fi
|
||||
RUBY_YAML_PARSE="Thread.new{Value = YAML.load_file('$1'); if not Value.key?($2) or Value$2.nil? then Value$2 = []; end; Value$2=Value$2.insert($3,'$4').uniq; File.open('$1','w') {|f| YAML.dump(Value, f)}}.join"
|
||||
RUBY_YAML_PARSE="Thread.new{Value = YAML.load_file('$1'); if not Value$2 or Value$2.nil? then Value$2 = []; end; Value$2=Value$2.insert($3,'$4').uniq; File.open('$1','w') {|f| YAML.dump(Value, f)}}.join"
|
||||
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "$RUBY_YAML_PARSE" 2>/dev/null
|
||||
}
|
||||
|
||||
#数组指定位置前增加Hash
|
||||
ruby_arr_insert_hash()
|
||||
{
|
||||
local Value RUBY_YAML_PARSE
|
||||
if [ -z "$1" ] || [ -z "$2" ]; then
|
||||
return
|
||||
fi
|
||||
RUBY_YAML_PARSE="Thread.new{Value = YAML.load_file('$1'); if not Value$2 or Value$2.nil? then Value$2 = []; end; Value$2=Value$2.insert($3,$4).uniq; File.open('$1','w') {|f| YAML.dump(Value, f)}}.join"
|
||||
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "$RUBY_YAML_PARSE" 2>/dev/null
|
||||
}
|
||||
|
||||
@ -107,7 +129,7 @@ local Value RUBY_YAML_PARSE
|
||||
if [ -z "$1" ] || [ -z "$2" ]; then
|
||||
return
|
||||
fi
|
||||
RUBY_YAML_PARSE="Thread.new{Value = YAML.load_file('$1'); if not Value.key?($2) or Value$2.nil? then Value$2 = []; end; ${4}.reverse.each{|x| Value$2=Value$2.insert($3,x).uniq}; File.open('$1','w') {|f| YAML.dump(Value, f)}}.join"
|
||||
RUBY_YAML_PARSE="Thread.new{Value = YAML.load_file('$1'); if not Value$2 or Value$2.nil? then Value$2 = []; end; ${4}.reverse.each{|x| Value$2=Value$2.insert($3,x).uniq}; File.open('$1','w') {|f| YAML.dump(Value, f)}}.join"
|
||||
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "$RUBY_YAML_PARSE" 2>/dev/null
|
||||
}
|
||||
|
||||
@ -127,6 +149,6 @@ local Value RUBY_YAML_PARSE
|
||||
if [ -z "$1" ] || [ -z "$3" ]; then
|
||||
return
|
||||
fi
|
||||
RUBY_YAML_PARSE="Thread.new{Value = YAML.load_file('$1'); Value$2.delete('$3')}.join"
|
||||
RUBY_YAML_PARSE="Thread.new{Value = YAML.load_file('$1'); Value$2.delete('$3'); File.open('$1','w') {|f| YAML.dump(Value, f)}}.join"
|
||||
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "$RUBY_YAML_PARSE" 2>/dev/null
|
||||
}
|
||||
|
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
@ -0,0 +1 @@
|
||||
import{d as t,bC as r}from"./index-Csmv4Fkv.js";const o=({children:e})=>t(r,{get children(){return[e," - MetaCubeXD"]}});export{o as D};
|
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
import{N as o}from"./index-DACeLBg-.js";/**
|
||||
* @license @tabler/icons-solidjs v3.19.0 - MIT
|
||||
import{N as o}from"./index-Csmv4Fkv.js";/**
|
||||
* @license @tabler/icons-solidjs v3.26.0 - MIT
|
||||
*
|
||||
* This source code is licensed under the MIT license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
@ -1 +0,0 @@
|
||||
import{u as B,f as e,ab as Z,i as t,ac as F,ad as J,F as x,ae as K,af as U,ag as u,ah as Y,ai as ee,g as C,aj as V,ak as R,al as H,Q as te,t as v,A as L,r as P,w as ae,C as re,b as le,y as se,T as ne,$ as k,D as ie,B as A,a3 as oe,a1 as G,a4 as ce,a0 as N,a8 as de,aa as ue,l as ge}from"./index-DACeLBg-.js";import{c as he,g as ve,a as fe,e as me,I as be,f as pe,h as W,i as $e,j as _e,r as Se}from"./index-GtOz1sEE.js";var xe=v('<div class="flex flex-col gap-4"><div><select class="select select-bordered w-full"></select></div><div><select class="select select-bordered w-full"></select></div><div><select class="select select-bordered w-full">'),M=v("<option>");const Ce=d=>{const[r]=B();return e(te,{ref:s=>{var n;return(n=d.ref)==null?void 0:n.call(d,s)},get icon(){return e(Z,{size:24})},get title(){return r("logsSettings")},get children(){var s=xe(),n=s.firstChild,o=n.firstChild,$=n.nextSibling,m=$.firstChild,w=$.nextSibling,b=w.firstChild;return t(n,e(F,{withDivider:!0,get children(){return r("tableSize")}}),o),o.addEventListener("change",a=>J(a.target.value)),t(o,e(x,{get each(){return Object.values(K)},children:a=>(()=>{var i=M();return i.value=a,t(i,()=>r(a)),i})()})),t($,e(F,{withDivider:!0,get children(){return r("logLevel")}}),m),m.addEventListener("change",a=>U(a.target.value)),t(m,e(x,{get each(){return[u.Info,u.Error,u.Warning,u.Debug,u.Silent]},children:a=>(()=>{var i=M();return i.value=a,t(i,()=>r(a)),i})()})),t(w,e(F,{withDivider:!0,get children(){return r("logMaxRows")}}),b),b.addEventListener("change",a=>Y(parseInt(a.target.value))),t(b,e(x,{each:ee,children:a=>(()=>{var i=M();return i.value=a,t(i,a),i})()})),C(()=>o.value=V()),C(()=>m.value=R()),C(()=>b.value=H()),s}})};let q=1;const[we,ye]=L([]),[Q,Le]=L(!1);P(ae(R,(d,r)=>{if(d===r)return;const s=re("logs",{level:R()});P(()=>{const n=s();!n||Q()||(ye(o=>[{...n,seq:q},...o].slice(0,H())),q++)})}));const Ie=()=>({logs:we,paused:Q,setPaused:Le});var Fe=v("<span>"),ke=v('<div class="flex h-full flex-col gap-2"><div class="join w-full"><input type=search class="input input-sm join-item input-primary flex-1 flex-shrink-0"></div><div class="overflow-x-auto whitespace-nowrap rounded-md bg-base-300"><table><thead class="sticky top-0 z-10"></thead><tbody>'),Me=v("<tr>"),Re=v('<th class=bg-base-200><div class="flex items-center"><div>'),Ee=v('<tr class="hover:!bg-primary hover:text-primary-content">'),De=v("<td class=py-2>");const O=(d,r,s,n)=>{const o=Se(d.getValue(r),s);return n({itemRank:o}),o.passed},je=()=>{const d=le();if(!se())return d("/setup",{replace:!0}),null;let r;const[s]=B(),[n,o]=L(""),{logs:$,paused:m,setPaused:w}=Ie(),[b,a]=ne(L([]),{name:"logsTableSorting",storage:localStorage}),i=[{header:s("sequence"),accessorFn:c=>c.seq},{header:s("type"),accessorFn:c=>c.type,cell:({row:c})=>{const p=c.original.type;let g="";switch(p){case u.Error:g="text-error";break;case u.Warning:g="text-warning";break;case u.Info:g="text-info";break;case u.Debug:g="text-success";break}return(()=>{var _=Fe();return k(_,g),t(_,()=>`[${c.original.type}]`),_})()}},{header:s("payload"),accessorFn:c=>c.payload}],E=he({filterFns:{fuzzy:O},state:{get globalFilter(){return n()},get sorting(){return b()}},get data(){return $()},sortDescFirst:!0,columns:i,onGlobalFilterChange:o,onSortingChange:a,globalFilterFn:O,getFilteredRowModel:ve(),getSortedRowModel:fe(),getCoreRowModel:me()});return(()=>{var c=ke(),p=c.firstChild,g=p.firstChild,_=p.nextSibling,D=_.firstChild,z=D.firstChild,X=z.nextSibling;return g.$$input=l=>o(l.target.value),t(p,e(A,{class:"btn-primary join-item btn-sm",onClick:()=>w(l=>!l),get icon(){return ie(()=>!!m())()?e(be,{}):e(pe,{})}}),null),t(p,e(A,{class:"btn-primary join-item btn-sm",onClick:()=>r==null?void 0:r.showModal(),get icon(){return e(oe,{})}}),null),t(z,e(G,{get each(){return E.getHeaderGroups()},children:l=>{const f=l();return(()=>{var h=Me();return t(h,e(G,{get each(){return f.headers},children:y=>{const S=y();return(()=>{var T=Re(),j=T.firstChild,I=j.firstChild;return ce(I,"click",S.column.getToggleSortingHandler(),!0),t(I,()=>W(S.column.columnDef.header,S.getContext())),t(j,()=>({asc:e($e,{}),desc:e(_e,{})})[S.column.getIsSorted()]??null,null),C(()=>k(I,N(S.column.getCanSort()&&"cursor-pointer select-none","flex-1"))),T})()}})),h})()}})),t(X,e(x,{get each(){return E.getRowModel().rows},children:l=>(()=>{var f=Ee();return t(f,e(x,{get each(){return l.getVisibleCells()},children:h=>(()=>{var y=De();return t(y,()=>W(h.column.columnDef.cell,h.getContext())),y})()})),f})()})),t(c,e(Ce,{ref:l=>r=l}),null),C(l=>{var f=s("search"),h=N(de(V()),"table relative rounded-none");return f!==l.e&&ue(g,"placeholder",l.e=f),h!==l.t&&k(D,l.t=h),l},{e:void 0,t:void 0}),c})()};ge(["input","click"]);export{je as default};
|
@ -0,0 +1 @@
|
||||
import{u as O,d as e,ab as V,i as t,ac as I,ad as q,F as x,ae as H,af as Z,ag as d,ah as Q,ai as X,g as C,aj as W,ak as Y,al as J,Q as K,t as h,b as U,y as ee,A as z,am as te,T as re,Y as F,D as ae,B as j,a0 as le,_ as A,a1 as se,Z as G,a7 as ne,a9 as ie,l as oe}from"./index-Csmv4Fkv.js";import{c as ce,I as de,a as ue,f as P,b as ge,d as he,g as ve,e as me,j as fe,r as be}from"./index-CBBLUqwt.js";import{D as pe}from"./DocumentTitle-DG90V81t.js";var _e=h('<div class="flex flex-col gap-4"><div><select class="select select-bordered w-full"></select></div><div><select class="select select-bordered w-full"></select></div><div><select class="select select-bordered w-full">'),k=h("<option>");const $e=v=>{const[l]=O();return e(K,{ref:n=>{var o;return(o=v.ref)==null?void 0:o.call(v,n)},get icon(){return e(V,{size:24})},get title(){return l("logsSettings")},get children(){var n=_e(),o=n.firstChild,c=o.firstChild,_=o.nextSibling,f=_.firstChild,w=_.nextSibling,b=w.firstChild;return t(o,e(I,{withDivider:!0,get children(){return l("tableSize")}}),c),c.addEventListener("change",r=>q(r.target.value)),t(c,e(x,{get each(){return Object.values(H)},children:r=>(()=>{var s=k();return s.value=r,t(s,()=>l(r)),s})()})),t(_,e(I,{withDivider:!0,get children(){return l("logLevel")}}),f),f.addEventListener("change",r=>Z(r.target.value)),t(f,e(x,{get each(){return[d.Info,d.Error,d.Warning,d.Debug,d.Silent]},children:r=>(()=>{var s=k();return s.value=r,t(s,()=>l(r)),s})()})),t(w,e(I,{withDivider:!0,get children(){return l("logMaxRows")}}),b),b.addEventListener("change",r=>Q(parseInt(r.target.value))),t(b,e(x,{each:X,children:r=>(()=>{var s=k();return s.value=r,t(s,r),s})()})),C(()=>c.value=W()),C(()=>f.value=Y()),C(()=>b.value=J()),n}})};var Se=h("<span>"),xe=h('<div class="flex h-full flex-col gap-2"><div class="join w-full"><input type=search class="input input-sm join-item input-primary flex-1 flex-shrink-0"></div><div class="overflow-x-auto whitespace-nowrap rounded-md bg-base-300"><table><thead class="sticky top-0 z-10"></thead><tbody>'),Ce=h("<tr>"),we=h('<th class=bg-base-200><div class="flex items-center"><div>'),ye=h('<tr class="hover:!bg-primary hover:text-primary-content">'),Le=h("<td class=py-2>");const N=(v,l,n,o)=>{const c=be(v.getValue(l),n);return o({itemRank:c}),c.passed},Me=()=>{const v=U();if(!ee())return v("/setup",{replace:!0}),null;let l;const[n]=O(),[o,c]=z(""),{logs:_,paused:f,setPaused:w}=te(),[b,r]=re(z([]),{name:"logsTableSorting",storage:localStorage}),s=[{header:n("sequence"),accessorFn:i=>i.seq},{header:n("type"),accessorFn:i=>i.type,cell:({row:i})=>{const p=i.original.type;let u="";switch(p){case d.Error:u="text-error";break;case d.Warning:u="text-warning";break;case d.Info:u="text-info";break;case d.Debug:u="text-success";break}return(()=>{var $=Se();return F($,u),t($,()=>`[${i.original.type}]`),$})()}},{header:n("payload"),accessorFn:i=>i.payload}],M=ce({filterFns:{fuzzy:N},state:{get globalFilter(){return o()},get sorting(){return b()}},get data(){return _()},sortDescFirst:!0,columns:s,onGlobalFilterChange:c,onSortingChange:r,globalFilterFn:N,getFilteredRowModel:ve(),getSortedRowModel:me(),getCoreRowModel:fe()});return[e(pe,{get children(){return n("logs")}}),(()=>{var i=xe(),p=i.firstChild,u=p.firstChild,$=p.nextSibling,D=$.firstChild,R=D.firstChild,B=R.nextSibling;return u.$$input=a=>c(a.target.value),t(p,e(j,{class:"btn-primary join-item btn-sm",onClick:()=>w(a=>!a),get icon(){return ae(()=>!!f())()?e(de,{}):e(ue,{})}}),null),t(p,e(j,{class:"btn-primary join-item btn-sm",onClick:()=>l==null?void 0:l.showModal(),get icon(){return e(le,{})}}),null),t(R,e(A,{get each(){return M.getHeaderGroups()},children:a=>{const m=a();return(()=>{var g=Ce();return t(g,e(A,{get each(){return m.headers},children:y=>{const S=y();return(()=>{var E=we(),T=E.firstChild,L=T.firstChild;return se(L,"click",S.column.getToggleSortingHandler(),!0),t(L,()=>P(S.column.columnDef.header,S.getContext())),t(T,()=>({asc:e(ge,{}),desc:e(he,{})})[S.column.getIsSorted()]??null,null),C(()=>F(L,G(S.column.getCanSort()&&"cursor-pointer select-none","flex-1"))),E})()}})),g})()}})),t(B,e(x,{get each(){return M.getRowModel().rows},children:a=>(()=>{var m=ye();return t(m,e(x,{get each(){return a.getVisibleCells()},children:g=>(()=>{var y=Le();return t(y,()=>P(g.column.columnDef.cell,g.getContext())),y})()})),m})()})),t(i,e($e,{ref:a=>l=a}),null),C(a=>{var m=n("search"),g=G(ne(W()),"table relative rounded-none");return m!==a.e&&ie(u,"placeholder",a.e=m),g!==a.t&&F(D,a.t=g),a},{e:void 0,t:void 0}),i})()]};oe(["input","click"]);export{Me as default};
|
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
@ -0,0 +1 @@
|
||||
import{u as B,a as T,b as q,c as z,o as H,e as h,d,f as M,i as o,g as N,S as X,B as S,I as G,F as J,t as x,z as b,h as U,s as w,j as K,k as C,l as O,m as Q,v as W,n as Y}from"./index-Csmv4Fkv.js";import{D as Z}from"./DocumentTitle-DG90V81t.js";const l=[];for(let t=0;t<256;++t)l.push((t+256).toString(16).slice(1));function tt(t,n=0){return(l[t[n+0]]+l[t[n+1]]+l[t[n+2]]+l[t[n+3]]+"-"+l[t[n+4]]+l[t[n+5]]+"-"+l[t[n+6]]+l[t[n+7]]+"-"+l[t[n+8]]+l[t[n+9]]+"-"+l[t[n+10]]+l[t[n+11]]+l[t[n+12]]+l[t[n+13]]+l[t[n+14]]+l[t[n+15]]).toLowerCase()}let v;const et=new Uint8Array(16);function nt(){if(!v){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");v=crypto.getRandomValues.bind(crypto)}return v(et)}const st=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),E={randomUUID:st};function lt(t,n,y){if(E.randomUUID&&!n&&!t)return E.randomUUID();t=t||{};const r=t.random||(t.rng||nt)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,tt(r)}var it=x("<option>"),at=x('<div class="mx-auto flex max-w-screen-sm flex-col items-center gap-4 py-10"><form class=contents><div class="flex w-full flex-col gap-4"><div class=flex-1><label class=label><span class=label-text></span></label><input name=url type=url class="input input-bordered w-full"placeholder=http(s)://{hostname}:{port} list=defaultEndpoints><datalist id=defaultEndpoints><option value=http://127.0.0.1:9090></option></datalist></div><div class=flex-1><label class=label><span class=label-text></span></label><input name=secret type=password class="input input-bordered w-full"placeholder=secret></div></div></form><div class="grid w-full grid-cols-2 gap-4">'),rt=x('<div class="badge badge-info flex w-full cursor-pointer items-center justify-between gap-4 py-4"><span class=truncate>');const ot=b.object({url:b.string().min(1),secret:b.string()}),ut=()=>{const[t]=B(),n=T(),y=q(),r=s=>{C(s),y("/overview",{replace:!0})},R=async s=>{const e=h().find(i=>i.id===s);e&&await U(e.url,e.secret)&&r(s)},g=async({url:s,secret:e})=>{const i=Q(s);if(!await U(i,e))return;const a=lt(),c=h().slice(),u=c.find(f=>f.url===i);if(!u){w([{id:a,url:i,secret:e},...c]),r(a);return}u.secret=e,u.id=a,w(c),r(a)},I=s=>{const{message:e}=s;Y.error(e)},{form:$}=z({extend:W({schema:ot}),onSubmit:g,onError:I}),L=s=>{K()===s&&C(""),w(h().filter(e=>e.id!==s))};return H(async()=>{var i,a;const s=n.search||window.location.search||((a=(i=n.hash.match(/\?.*$/))==null?void 0:i[0])==null?void 0:a.replace("?",""));if(!s)return;const e=new URLSearchParams(s);e.has("hostname")?await g({url:`${e.get("http")?"http:":e.get("https")?"https:":window.location.protocol}//${e.get("hostname")}${e.get("port")?`:${e.get("port")}`:""}`,secret:e.get("secret")??""}):h().length===0&&await g({url:"http://127.0.0.1:9090",secret:""})}),[d(Z,{get children(){return t("setup")}}),(()=>{var s=at(),e=s.firstChild,i=e.firstChild,a=i.firstChild,c=a.firstChild,u=c.firstChild,f=c.nextSibling,_=f.nextSibling;_.firstChild;var D=a.nextSibling,k=D.firstChild,j=k.firstChild,V=e.nextSibling;return M($,e,()=>$),o(u,()=>t("endpointURL")),o(_,d(X,{get when(){return window.location.origin!=="http://127.0.0.1:9090"},get children(){var p=it();return N(()=>p.value=window.location.origin),p}}),null),o(j,()=>t("secret")),o(i,d(S,{type:"submit",class:"btn-primary uppercase",get children(){return t("add")}}),null),o(V,d(J,{get each(){return h()},children:({id:p,url:F})=>(()=>{var m=rt(),P=m.firstChild;return m.$$click=()=>R(p),o(P,F),o(m,d(S,{class:"btn-circle btn-ghost btn-xs text-white",onClick:A=>{A.stopPropagation(),L(p)},get children(){return d(G,{})}}),null),m})()})),s})()]};O(["click"]);export{ut as default};
|
@ -1 +0,0 @@
|
||||
import{u as q,a as H,b as M,c as N,v as T,o as X,e as p,d as G,i as o,f as h,g as J,S as K,B as C,I as O,F as Q,t as $,z as b,s as w,h as E,j as W,k as R,l as Y,m as Z,n as tt}from"./index-DACeLBg-.js";var a=[];for(var y=0;y<256;++y)a.push((y+256).toString(16).slice(1));function et(t,n=0){return(a[t[n+0]]+a[t[n+1]]+a[t[n+2]]+a[t[n+3]]+"-"+a[t[n+4]]+a[t[n+5]]+"-"+a[t[n+6]]+a[t[n+7]]+"-"+a[t[n+8]]+a[t[n+9]]+"-"+a[t[n+10]]+a[t[n+11]]+a[t[n+12]]+a[t[n+13]]+a[t[n+14]]+a[t[n+15]]).toLowerCase()}var m,nt=new Uint8Array(16);function st(){if(!m&&(m=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!m))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return m(nt)}var at=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const L={randomUUID:at};function rt(t,n,x){if(L.randomUUID&&!n&&!t)return L.randomUUID();t=t||{};var l=t.random||(t.rng||st)();return l[6]=l[6]&15|64,l[8]=l[8]&63|128,et(l)}var lt=$("<option>"),it=$('<div class="mx-auto flex max-w-screen-sm flex-col items-center gap-4 py-10"><form class=contents><div class="flex w-full flex-col gap-4"><div class=flex-1><label class=label><span class=label-text></span></label><input name=url type=url class="input input-bordered w-full"placeholder=http(s)://{hostname}:{port} list=defaultEndpoints><datalist id=defaultEndpoints><option value=http://127.0.0.1:9090></option></datalist></div><div class=flex-1><label class=label><span class=label-text></span></label><input name=secret type=password class="input input-bordered w-full"placeholder=secret></div></div></form><div class="grid w-full grid-cols-2 gap-4">'),ot=$('<div class="badge badge-info flex w-full cursor-pointer items-center justify-between gap-4 py-4"><span class=truncate>');const ct=b.object({url:b.string().min(1),secret:b.string()}),ut=()=>{const[t]=q(),n=H(),x=M(),l=s=>{R(s),x("/overview")},_=(s,e)=>Z.get(s,{headers:e?{Authorization:`Bearer ${e}`}:{}}).then(({ok:r})=>r).catch(r=>{const{message:i}=r;E.error(i)}),I=async s=>{const e=p().find(r=>r.id===s);e&&await _(e.url,e.secret)&&l(s)},v=async({url:s,secret:e})=>{const r=tt(s);if(!await _(r,e))return;const i=rt(),c=p().slice(),d=c.find(f=>f.url===r);if(!d){w([{id:i,url:r,secret:e},...c]),l(i);return}d.secret=e,d.id=i,w(c),l(i)},k=s=>{const{message:e}=s;E.error(e)},{form:S}=N({extend:T({schema:ct}),onSubmit:v,onError:k}),D=s=>{W()===s&&R(""),w(p().filter(e=>e.id!==s))};return X(()=>{let s=n.search||window.location.search;if(s){const r=n.hash.match(/\?.*$/);Array.isArray(r)&&r[0]&&(s=r[0].replace("?",""))}const e=new URLSearchParams(s);e.has("hostname")?v({url:`${e.get("http")?"http:":e.get("https")?"https:":window.location.protocol}//${e.get("hostname")}${e.get("port")?`:${e.get("port")}`:""}`,secret:e.get("secret")??""}):p().length===0&&v({url:"http://127.0.0.1:9090",secret:""})}),(()=>{var s=it(),e=s.firstChild,r=e.firstChild,i=r.firstChild,c=i.firstChild,d=c.firstChild,f=c.nextSibling,U=f.nextSibling;U.firstChild;var j=i.nextSibling,A=j.firstChild,V=A.firstChild,B=e.nextSibling;return G(S,e,()=>S),o(d,()=>t("endpointURL")),o(U,h(K,{get when(){return window.location.origin!=="http://127.0.0.1:9090"},get children(){var u=lt();return J(()=>u.value=window.location.origin),u}}),null),o(V,()=>t("secret")),o(r,h(C,{type:"submit",class:"btn-primary uppercase",get children(){return t("add")}}),null),o(B,h(Q,{get each(){return p()},children:({id:u,url:F})=>(()=>{var g=ot(),z=g.firstChild;return g.$$click=()=>I(u),o(z,F),o(g,h(C,{class:"btn-circle btn-ghost btn-xs text-white",onClick:P=>{P.stopPropagation(),D(u)},get children(){return h(O,{})}}),null),g})()})),s})()};Y(["click"]);export{ut as default};
|
@ -1 +0,0 @@
|
||||
import{W as a,a$ as m}from"./index-DACeLBg-.js";const s=o=>a(o).locale(m()).fromNow();export{s as f};
|
@ -1,20 +1,20 @@
|
||||
import{N as U,f as Fe,q as L,am as Ie,an as $e}from"./index-DACeLBg-.js";/**
|
||||
* @license @tabler/icons-solidjs v3.19.0 - MIT
|
||||
import{N as U,d as Fe,q as L,an as Ie,ao as $e}from"./index-Csmv4Fkv.js";/**
|
||||
* @license @tabler/icons-solidjs v3.26.0 - MIT
|
||||
*
|
||||
* This source code is licensed under the MIT license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/var Ft=U("outline","player-pause","IconPlayerPause",[["path",{d:"M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"}],["path",{d:"M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"}]]);/**
|
||||
* @license @tabler/icons-solidjs v3.19.0 - MIT
|
||||
* @license @tabler/icons-solidjs v3.26.0 - MIT
|
||||
*
|
||||
* This source code is licensed under the MIT license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/var It=U("outline","player-play","IconPlayerPlay",[["path",{d:"M7 4v16l13 -8z"}]]);/**
|
||||
* @license @tabler/icons-solidjs v3.19.0 - MIT
|
||||
* @license @tabler/icons-solidjs v3.26.0 - MIT
|
||||
*
|
||||
* This source code is licensed under the MIT license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/var $t=U("outline","sort-ascending","IconSortAscending",[["path",{d:"M4 6l7 0"}],["path",{d:"M4 12l7 0"}],["path",{d:"M4 18l9 0"}],["path",{d:"M15 9l3 -3l3 3"}],["path",{d:"M18 6l0 12"}]]);/**
|
||||
* @license @tabler/icons-solidjs v3.19.0 - MIT
|
||||
* @license @tabler/icons-solidjs v3.26.0 - MIT
|
||||
*
|
||||
* This source code is licensed under the MIT license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
@ -53,4 +53,4 @@ import{N as U,f as Fe,q as L,am as Ie,an as $e}from"./index-DACeLBg-.js";/**
|
||||
* LICENSE.md file in the root directory of this source tree.
|
||||
*
|
||||
* @license MIT
|
||||
*/function Dt(e,o){return e?typeof e=="function"?Fe(e,o):e:null}function Ht(e){const o=L({state:{},onStateChange:()=>{},renderFallbackValue:null,mergeOptions:(i,l)=>L(i,l)},e),t=mt(o),[n,r]=Ie(t.initialState);return $e(()=>{t.setOptions(i=>L(i,e,{state:L(n,e.state||{}),onStateChange:l=>{r(l),e.onStateChange==null||e.onStateChange(l)}}))}),t}export{It as I,At as a,xt as b,Ht as c,Et as d,Pt as e,Ft as f,yt as g,Dt as h,$t as i,Mt as j,Vt as r};
|
||||
*/function Dt(e,o){return e?typeof e=="function"?Fe(e,o):e:null}function Ht(e){const o=L({state:{},onStateChange:()=>{},renderFallbackValue:null,mergeOptions:(i,l)=>L(i,l)},e),t=mt(o),[n,r]=Ie(t.initialState);return $e(()=>{t.setOptions(i=>L(i,e,{state:L(n,e.state||{}),onStateChange:l=>{r(l),e.onStateChange==null||e.onStateChange(l)}}))}),t}export{It as I,Ft as a,$t as b,Ht as c,Mt as d,At as e,Dt as f,yt as g,xt as h,Et as i,Pt as j,Vt as r};
|
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
@ -0,0 +1 @@
|
||||
import{W as a,b4 as m}from"./index-Csmv4Fkv.js";const s=o=>a(o).locale(m()).fromNow();export{s as f};
|
@ -9,11 +9,10 @@
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<link rel="icon" type="image/svg+xml" href="./favicon.svg" />
|
||||
<link rel="apple-touch-icon" href="./pwa-192x192.png" />
|
||||
|
||||
<title>metacubexd</title>
|
||||
<script type="module" crossorigin src="./assets/index-DACeLBg-.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-D_QrDGkm.css">
|
||||
<script type="module" crossorigin src="./assets/index-Csmv4Fkv.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-M06kPDrB.css">
|
||||
<link rel="manifest" href="./manifest.webmanifest"><script id="vite-plugin-pwa:register-sw" src="./registerSW.js"></script></head>
|
||||
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
|
||||
|
@ -1 +1 @@
|
||||
{"name":"metacubexd","short_name":"metacubexd","start_url":"./","display":"standalone","background_color":"#ffffff","lang":"en","scope":"./","icons":[{"src":"pwa-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/pwa-512x512.png","sizes":"512x512","type":"image/png"},{"src":"pwa-512x512.png","sizes":"512x512","type":"image/png","purpose":"any maskable"}]}
|
||||
{"name":"MetaCubeXD","short_name":"MetaCubeXD","start_url":"./","display":"standalone","background_color":"#ffffff","lang":"en","scope":"./","description":"Mihomo Dashboard, The Official One, XD","theme_color":"#000000","icons":[{"src":"pwa-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/pwa-512x512.png","sizes":"512x512","type":"image/png"},{"src":"pwa-512x512.png","sizes":"512x512","type":"image/png","purpose":"any maskable"}]}
|
||||
|
@ -1 +1 @@
|
||||
if(!self.define){let s,e={};const i=(i,n)=>(i=new URL(i+".js",n).href,e[i]||new Promise((e=>{if("document"in self){const s=document.createElement("script");s.src=i,s.onload=e,document.head.appendChild(s)}else s=i,importScripts(i),e()})).then((()=>{let s=e[i];if(!s)throw new Error(`Module ${i} didn’t register its module`);return s})));self.define=(n,r)=>{const l=s||("document"in self?document.currentScript.src:"")||location.href;if(e[l])return;let o={};const t=s=>i(s,l),u={module:{uri:l},exports:o,require:t};e[l]=Promise.all(n.map((s=>u[s]||t(s)))).then((s=>(r(...s),o)))}}define(["./workbox-e1498109"],(function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"assets/Config-CcYWVyqe.js",revision:null},{url:"assets/Connections-CVJiJJwm.js",revision:null},{url:"assets/global-Cq-x4U7Q.js",revision:null},{url:"assets/IconReload-C5Iuvpd-.js",revision:null},{url:"assets/index-D_QrDGkm.css",revision:null},{url:"assets/index-DACeLBg-.js",revision:null},{url:"assets/index-GtOz1sEE.js",revision:null},{url:"assets/Logs-LisT8FTz.js",revision:null},{url:"assets/Overview-DiEjGL5X.js",revision:null},{url:"assets/Proxies-A8q5R6Aj.js",revision:null},{url:"assets/Rules-BskxbInP.js",revision:null},{url:"assets/Setup-e28eI3Pt.js",revision:null},{url:"index.html",revision:"4b5142ca4adf9805cc0d4cecaf0ff1cc"},{url:"registerSW.js",revision:"402b66900e731ca748771b6fc5e7a068"},{url:"favicon.svg",revision:"f5b3372f312fbbe60a6ed8c03741ff80"},{url:"pwa-192x192.png",revision:"c45f48fc59b5bf47e6cbf1626aff51fc"},{url:"pwa-512x512.png",revision:"a311504ae6a46bd29b5678a410aaafc6"},{url:"manifest.webmanifest",revision:"4d78c8bc6207146065400ff644fe5a13"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("index.html")))}));
|
||||
if(!self.define){let s,e={};const i=(i,n)=>(i=new URL(i+".js",n).href,e[i]||new Promise((e=>{if("document"in self){const s=document.createElement("script");s.src=i,s.onload=e,document.head.appendChild(s)}else s=i,importScripts(i),e()})).then((()=>{let s=e[i];if(!s)throw new Error(`Module ${i} didn’t register its module`);return s})));self.define=(n,l)=>{const r=s||("document"in self?document.currentScript.src:"")||location.href;if(e[r])return;let o={};const t=s=>i(s,r),u={module:{uri:r},exports:o,require:t};e[r]=Promise.all(n.map((s=>u[s]||t(s)))).then((s=>(l(...s),o)))}}define(["./workbox-e1498109"],(function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"assets/Config-9NNS9COU.js",revision:null},{url:"assets/Connections-N_Z6THP_.js",revision:null},{url:"assets/DocumentTitle-DG90V81t.js",revision:null},{url:"assets/IconReload--QlVe2wP.js",revision:null},{url:"assets/index-CBBLUqwt.js",revision:null},{url:"assets/index-Csmv4Fkv.js",revision:null},{url:"assets/index-M06kPDrB.css",revision:null},{url:"assets/Logs-uIQcQmXC.js",revision:null},{url:"assets/Overview-B99qGorf.js",revision:null},{url:"assets/Proxies-Lk5uJ4LX.js",revision:null},{url:"assets/Rules-C4_l0aqo.js",revision:null},{url:"assets/Setup-CdphtcBj.js",revision:null},{url:"assets/time-CHbJgbks.js",revision:null},{url:"index.html",revision:"0ee677309471325e9389528536c80875"},{url:"registerSW.js",revision:"402b66900e731ca748771b6fc5e7a068"},{url:"favicon.svg",revision:"f5b3372f312fbbe60a6ed8c03741ff80"},{url:"pwa-192x192.png",revision:"c45f48fc59b5bf47e6cbf1626aff51fc"},{url:"pwa-512x512.png",revision:"a311504ae6a46bd29b5678a410aaafc6"},{url:"manifest.webmanifest",revision:"f0952d333375ba4273b4372ffa349b8b"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("index.html")))}));
|
||||
|
@ -341,11 +341,12 @@ threads << Thread.new {
|
||||
Value['log-level']='$9';
|
||||
end;
|
||||
Value['allow-lan']=true;
|
||||
Value['disable-keep-alive']=true;
|
||||
Value['external-controller']='0.0.0.0:$3';
|
||||
Value['secret']='$2';
|
||||
Value['bind-address']='*';
|
||||
Value['external-ui']='/usr/share/openclash/ui';
|
||||
Value['keep-alive-interval']=15;
|
||||
Value['keep-alive-idle']=600;
|
||||
if $6 == 1 then
|
||||
Value['ipv6']=true;
|
||||
else
|
||||
@ -421,10 +422,7 @@ threads << Thread.new {
|
||||
Value['tun']['device']='utun';
|
||||
Value_2={'dns-hijack'=>['tcp://any:53']};
|
||||
Value['tun'].merge!(Value_2);
|
||||
if '$stack_type' != 'mixed' then
|
||||
Value['tun']['gso']=true;
|
||||
Value['tun']['gso-max-size']=65536;
|
||||
end;
|
||||
Value['tun']['endpoint-independent-nat']=true;
|
||||
Value['tun']['auto-route']=false;
|
||||
Value['tun']['auto-detect-interface']=false;
|
||||
Value['tun']['auto-redirect']=false;
|
||||
@ -452,7 +450,7 @@ threads << Thread.new {
|
||||
Value.delete('ebpf');
|
||||
end;
|
||||
|
||||
if '${37}' == '0' then
|
||||
if '${35}' == '0' then
|
||||
Value['routing-mark']=6666;
|
||||
else
|
||||
if Value.key?('routing-mark') then
|
||||
@ -789,6 +787,8 @@ begin
|
||||
YAML.LOG('Tip: Respect-rules Option Need Proxy-server-nameserver Option Must Be Setted, Auto Set to【114.114.114.114, 119.29.29.29, 8.8.8.8, 1.1.1.1】');
|
||||
end;
|
||||
end;
|
||||
rescue Exception => e
|
||||
YAML.LOG('Error: Config File Overwrite Failed,【' + e.message + '】');
|
||||
ensure
|
||||
File.open('$5','w') {|f| YAML.dump(Value, f)};
|
||||
end" 2>/dev/null >> $LOG_FILE
|
@ -242,7 +242,8 @@ ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
|
||||
x['proxies'].each{
|
||||
|y|
|
||||
if Value_1.include?(y) then
|
||||
uci_commands << uci_add + 'other_group=\"^' + y.to_s + '$\"'
|
||||
commands = uci_add + 'other_group=\"^' + y.to_s + '$\"'
|
||||
system(commands)
|
||||
end
|
||||
}
|
||||
end
|
||||
|
@ -47,7 +47,7 @@ cfg_groups_set()
|
||||
sed -i "s/new_servers_group \'${convert_old_name_cfg}\'/new_servers_group \'${convert_name}\'/g" $CFG_FILE 2>/dev/null
|
||||
sed -i "s/relay_groups \'${convert_old_name_cfg}\'/relay_groups \'${convert_name}\'/g" $CFG_FILE 2>/dev/null
|
||||
#第三方规则处理
|
||||
OTHER_RULE_NAMES=("GlobalTV" "AsianTV" "Proxy" "Youtube" "Bilibili" "Bahamut" "HBOGo" "HBOMax" "Pornhub" "Apple" "GoogleFCM" "Scholar" "Microsoft" "Netflix" "Disney" "Spotify" "Steam" "Speedtest" "Telegram" "PayPal" "Netease_Music" "AdBlock" "Domestic" "Others" "miHoYo" "AI Suite" "AppleTV" "Crypto" "Discord")
|
||||
OTHER_RULE_NAMES=("GlobalTV" "AsianTV" "MainlandTV" "Proxy" "Youtube" "Bilibili" "Bahamut" "HBOMax" "Pornhub" "Apple" "GoogleFCM" "Scholar" "Microsoft" "Netflix" "Disney" "Spotify" "Steam" "Speedtest" "Telegram" "PayPal" "Netease_Music" "AdBlock" "Domestic" "Others" "miHoYo" "AI_Suite" "AppleTV" "Crypto" "Discord" "HTTPDNS")
|
||||
for i in ${OTHER_RULE_NAMES[@]}; do
|
||||
sed -i "s/option ${i} \'${convert_old_name_cfg}\'/option ${i} \'${convert_name}\'/g" $CFG_FILE 2>/dev/null
|
||||
done 2>/dev/null
|
||||
|
@ -171,8 +171,8 @@ ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
|
||||
begin
|
||||
YAML.LOG('Start Getting【${CONFIG_NAME} - ' + y['type'].to_s + ' - ' + x.to_s + '】Proxy-provider Setting...');
|
||||
#代理集存在时获取代理集编号
|
||||
cmd = 'grep -E \'\.' + x + '$\' ${match_provider} 2>/dev/null|awk -F \".\" \'{print \$1}\'';
|
||||
provider_nums=%x(#{cmd}).chomp;
|
||||
cmd = 'grep -F \'.' + x + '\' ${match_provider} 2>/dev/null |awk -F \".\" \'{print \$1}\'';
|
||||
provider_nums = %x(#{cmd}).chomp;
|
||||
if not provider_nums.empty? then
|
||||
cmd = 'sed -i \"/^' + provider_nums + '\./c\\#match#\" $match_provider 2>/dev/null';
|
||||
system(cmd);
|
||||
@ -181,7 +181,7 @@ ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
|
||||
uci_add='uci -q add_list openclash.@proxy-provider[' + provider_nums + '].';
|
||||
uci_del='uci -q delete openclash.@proxy-provider[' + provider_nums + '].';
|
||||
cmd = uci_get + 'manual';
|
||||
if not %x(#{cmd}).chomp then
|
||||
if not provider_nums then
|
||||
uci_commands << uci_set + 'manual=0';
|
||||
end;
|
||||
uci_commands << uci_set + 'type=\"' + y['type'].to_s + '\"';
|
||||
@ -269,7 +269,7 @@ ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
|
||||
#新代理集且设置默认策略组时加入指定策略组
|
||||
new_provider_groups = %x{uci get openclash.config.new_servers_group}.chomp.split(\"'\").map { |x| x.strip }.reject { |x| x.empty? };
|
||||
new_provider_groups.each do |x|
|
||||
uci_commands << uci_add + 'groups=\"' + x + '\"'
|
||||
uci_commands << uci_add + 'groups=\"^' + x + '$\"'
|
||||
end
|
||||
elsif '$servers_if_update' != '1' then
|
||||
threads_agr = [];
|
||||
@ -304,8 +304,8 @@ ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
|
||||
begin
|
||||
YAML.LOG('Start Getting【${CONFIG_NAME} - ' + x['type'].to_s + ' - ' + x['name'].to_s + '】Proxy Setting...');
|
||||
#节点存在时获取节点编号
|
||||
cmd = 'grep -E \'\.' + x['name'].to_s + '$\' ${match_servers} 2>/dev/null|awk -F \".\" \'{print \$1}\'';
|
||||
server_num=%x(#{cmd}).chomp;
|
||||
cmd = 'grep -F \'.' + x['name'].to_s + '\' ${match_servers} 2>/dev/null |awk -F \".\" \'{print \$1}\'';
|
||||
server_num = %x(#{cmd}).chomp;
|
||||
if not server_num.empty? then
|
||||
#更新已有节点
|
||||
cmd = 'sed -i \"/^' + server_num + '\./c\\#match#\" $match_servers 2>/dev/null';
|
||||
@ -315,7 +315,7 @@ ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
|
||||
uci_add='uci -q add_list openclash.@servers[' + server_num + '].';
|
||||
uci_del='uci -q delete openclash.@servers[' + server_num + '].';
|
||||
cmd = uci_get + 'manual';
|
||||
if not %x(#{cmd}).chomp then
|
||||
if not server_num then
|
||||
uci_commands << uci_set + 'manual=0';
|
||||
end;
|
||||
else
|
||||
@ -1329,10 +1329,10 @@ ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
|
||||
threads << Thread.new{
|
||||
#加入策略组
|
||||
if '$servers_if_update' == '1' and '$config_group_exist' == '1' and '$servers_update' == '1' and server_num.empty? then
|
||||
#新代理集且设置默认策略组时加入指定策略组
|
||||
#新代理且设置默认策略组时加入指定策略组
|
||||
new_provider_groups = %x{uci get openclash.config.new_servers_group}.chomp.split(\"'\").map { |x| x.strip }.reject { |x| x.empty? };
|
||||
new_provider_groups.each do |x|
|
||||
uci_commands << uci_add + 'groups=\"' + x + '\"'
|
||||
uci_commands << uci_add + 'groups=\"^' + x + '$\"'
|
||||
end
|
||||
elsif '$servers_if_update' != '1' then
|
||||
threads_gr = [];
|
||||
@ -1345,7 +1345,7 @@ ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
|
||||
z['proxies'].each{
|
||||
|v|
|
||||
if v == x['name'] then
|
||||
uci_commands << uci_add + 'groups=^\"' + z['name'] + '$\"'
|
||||
uci_commands << uci_add + 'groups=\"^' + z['name'] + '$\"'
|
||||
break
|
||||
end
|
||||
}
|
||||
|
@ -1577,7 +1577,7 @@ cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: Bilibili
|
||||
type: select
|
||||
proxies:
|
||||
- Asian TV
|
||||
- CN Mainland TV
|
||||
- DIRECT
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
@ -1615,20 +1615,6 @@ cat >> "$SERVER_FILE" <<-EOF
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: HBO Go
|
||||
type: select
|
||||
proxies:
|
||||
- Global TV
|
||||
- DIRECT
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
if [ -f "/tmp/Proxy_Provider" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
use:
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: Pornhub
|
||||
type: select
|
||||
@ -1763,6 +1749,26 @@ cat >> "$SERVER_FILE" <<-EOF
|
||||
- REJECT
|
||||
- DIRECT
|
||||
- Proxy
|
||||
- name: HTTPDNS
|
||||
type: select
|
||||
proxies:
|
||||
- REJECT
|
||||
- DIRECT
|
||||
- Proxy
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
if [ -f "/tmp/Proxy_Provider" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
use:
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: CN Mainland TV
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
if [ -f "/tmp/Proxy_Provider" ]; then
|
||||
@ -1775,8 +1781,8 @@ cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: Asian TV
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
- DIRECT
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
if [ -f "/tmp/Proxy_Provider" ]; then
|
||||
@ -1879,12 +1885,12 @@ ${uci_set}rule_name="lhie1"
|
||||
${uci_set}config="$CONFIG_NAME"
|
||||
${uci_set}GlobalTV="Global TV"
|
||||
${uci_set}AsianTV="Asian TV"
|
||||
${uci_set}MainlandTV="CN Mainland TV"
|
||||
${uci_set}Proxy="Proxy"
|
||||
${uci_set}Youtube="Youtube"
|
||||
${uci_set}Bilibili="Bilibili"
|
||||
${uci_set}Bahamut="Bahamut"
|
||||
${uci_set}HBOMax="HBO Max"
|
||||
${uci_set}HBOGo="HBO Go"
|
||||
${uci_set}Pornhub="Pornhub"
|
||||
${uci_set}Apple="Apple"
|
||||
${uci_set}AppleTV="Apple TV"
|
||||
@ -1900,6 +1906,7 @@ ${uci_set}Spotify="Spotify"
|
||||
${uci_set}Steam="Steam"
|
||||
${uci_set}miHoYo="miHoYo"
|
||||
${uci_set}AdBlock="AdBlock"
|
||||
${uci_set}HTTPDNS="HTTPDNS"
|
||||
${uci_set}Speedtest="Speedtest"
|
||||
${uci_set}Telegram="Telegram"
|
||||
${uci_set}Crypto="Crypto"
|
||||
@ -1917,9 +1924,9 @@ ${uci_set}Others="Others"
|
||||
${UCI_DEL_LIST}="Bilibili" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Bilibili" >/dev/null 2>&1
|
||||
${UCI_DEL_LIST}="Bahamut" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Bahamut" >/dev/null 2>&1
|
||||
${UCI_DEL_LIST}="HBO Max" >/dev/null 2>&1 && ${UCI_ADD_LIST}="HBO Max" >/dev/null 2>&1
|
||||
${UCI_DEL_LIST}="HBO Go" >/dev/null 2>&1 && ${UCI_ADD_LIST}="HBO Go" >/dev/null 2>&1
|
||||
${UCI_DEL_LIST}="Pornhub" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Pornhub" >/dev/null 2>&1
|
||||
${UCI_DEL_LIST}="Asian TV" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Asian TV" >/dev/null 2>&1
|
||||
${UCI_DEL_LIST}="CN Mainland TV" >/dev/null 2>&1 && ${UCI_ADD_LIST}="CN Mainland TV" >/dev/null 2>&1
|
||||
${UCI_DEL_LIST}="Global TV" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Global TV" >/dev/null 2>&1
|
||||
${UCI_DEL_LIST}="Netflix" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Netflix" >/dev/null 2>&1
|
||||
${UCI_DEL_LIST}="Discovery Plus" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Discovery Plus" >/dev/null 2>&1
|
||||
|
@ -133,8 +133,6 @@ yml_gen_rule_provider_file()
|
||||
else
|
||||
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
|
||||
RULE_PROVIDER_FILE_URL="${github_address_mod}gh/"$(echo "$RULE_PROVIDER_FILE_URL_PATH" |awk -F '/master' '{print $1}' 2>/dev/null)"@master"$(echo "$RULE_PROVIDER_FILE_URL_PATH" |awk -F 'master' '{print $2}')""
|
||||
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
|
||||
RULE_PROVIDER_FILE_URL="https://raw.fastgit.org/"$(echo "$RULE_PROVIDER_FILE_URL_PATH" |awk -F '/master' '{print $1}' 2>/dev/null)"/master"$(echo "$RULE_PROVIDER_FILE_URL_PATH" |awk -F 'master' '{print $2}')""
|
||||
else
|
||||
RULE_PROVIDER_FILE_URL="${github_address_mod}https://raw.githubusercontent.com/${RULE_PROVIDER_FILE_URL_PATH}"
|
||||
fi
|
||||
@ -288,7 +286,6 @@ yml_other_set()
|
||||
config_foreach yml_rule_group_get "rule_provider_config" "$3"
|
||||
config_foreach yml_rule_group_get "rule_providers" "$3"
|
||||
config_foreach yml_rule_group_get "game_config" "$3"
|
||||
local fake_ip="$(echo "${11}" |awk -F '/' '{print $1}')"
|
||||
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
|
||||
begin
|
||||
Value = YAML.load_file('$3');
|
||||
@ -312,73 +309,41 @@ yml_other_set()
|
||||
Value['rule-providers']=Value_1['rule-providers']
|
||||
end
|
||||
end;
|
||||
Value['script']=Value_1['script'];
|
||||
Value['rules']=Value_1['rules'];
|
||||
Value['rules'].to_a.collect!{|x|
|
||||
x.to_s.gsub(/,[\s]?Bilibili,[\s]?Asian TV$/, ', Bilibili, $Bilibili#delete_')
|
||||
.gsub(/,[\s]?Bahamut,[\s]?Global TV$/, ', Bahamut, $Bahamut#delete_')
|
||||
.gsub(/,[\s]?HBO Max,[\s]?Global TV$/, ', HBO Max, $HBOMax#delete_')
|
||||
.gsub(/,[\s]?HBO Go,[\s]?Global TV$/, ', HBO Go, $HBOGo#delete_')
|
||||
.gsub(/,[\s]?Discovery Plus,[\s]?Global TV$/, ', Discovery Plus, $Discovery#delete_')
|
||||
.gsub(/,[\s]?DAZN,[\s]?Global TV$/, ', DAZN, $DAZN#delete_')
|
||||
.gsub(/,[\s]?Pornhub,[\s]?Global TV$/, ', Pornhub, $Pornhub#delete_')
|
||||
.gsub(/,[\s]?Global TV$/, ', $GlobalTV#delete_')
|
||||
.gsub(/,[\s]?Asian TV$/, ', $AsianTV#delete_')
|
||||
.gsub(/,[\s]?Proxy$/, ', $Proxy#delete_')
|
||||
.gsub(/,[\s]?YouTube$/, ', $Youtube#delete_')
|
||||
.gsub(/,[\s]?Apple$/, ', $Apple#delete_')
|
||||
.gsub(/,[\s]?Apple TV$/, ', $AppleTV#delete_')
|
||||
.gsub(/,[\s]?Scholar$/, ', $Scholar#delete_')
|
||||
.gsub(/,[\s]?Netflix$/, ', $Netflix#delete_')
|
||||
.gsub(/,[\s]?Disney$/, ', $Disney#delete_')
|
||||
.gsub(/,[\s]?Spotify$/, ', $Spotify#delete_')
|
||||
.gsub(/,[\s]?AI Suite$/, ', $AI_Suite#delete_')
|
||||
.gsub(/,[\s]?Steam$/, ', $Steam#delete_')
|
||||
.gsub(/,[\s]?miHoYo$/, ', $miHoYo#delete_')
|
||||
.gsub(/,[\s]?AdBlock$/, ', $AdBlock#delete_')
|
||||
.gsub(/,[\s]?Speedtest$/, ', $Speedtest#delete_')
|
||||
.gsub(/,[\s]?Telegram$/, ', $Telegram#delete_')
|
||||
.gsub(/,[\s]?Crypto$/, ', $Crypto#delete_')
|
||||
.gsub(/,[\s]?Discord$/, ', $Discord#delete_')
|
||||
.gsub(/,[\s]?Microsoft$/, ', $Microsoft#delete_')
|
||||
.to_s.gsub(/,[\s]?PayPal$/, ', $PayPal#delete_')
|
||||
.gsub(/,[\s]?Domestic$/, ', $Domestic#delete_')
|
||||
.gsub(/,[\s]?Others$/, ', $Others#delete_')
|
||||
.gsub(/,[\s]?Google FCM$/, ', $GoogleFCM#delete_')
|
||||
x.to_s.gsub(/,[\s]?Bilibili,[\s]?CN Mainland TV$/, ',Bilibili,$Bilibili#delete_')
|
||||
.gsub(/,[\s]?Bahamut,[\s]?Asian TV$/, ',Bahamut,$Bahamut#delete_')
|
||||
.gsub(/,[\s]?Max,[\s]?Max$/, ',Max,$HBOMax#delete_')
|
||||
.gsub(/,[\s]?Discovery Plus,[\s]?Global TV$/, ',Discovery Plus,$Discovery#delete_')
|
||||
.gsub(/,[\s]?DAZN,[\s]?Global TV$/, ',DAZN,$DAZN#delete_')
|
||||
.gsub(/,[\s]?Pornhub,[\s]?Global TV$/, ',Pornhub,$Pornhub#delete_')
|
||||
.gsub(/,[\s]?Global TV$/, ',$GlobalTV#delete_')
|
||||
.gsub(/,[\s]?Asian TV$/, ',$AsianTV#delete_')
|
||||
.gsub(/,[\s]?CN Mainland TV$/, ',$MainlandTV#delete_')
|
||||
.gsub(/,[\s]?Proxy$/, ',$Proxy#delete_')
|
||||
.gsub(/,[\s]?YouTube$/, ',$Youtube#delete_')
|
||||
.gsub(/,[\s]?Apple$/, ',$Apple#delete_')
|
||||
.gsub(/,[\s]?Apple TV$/, ',$AppleTV#delete_')
|
||||
.gsub(/,[\s]?Scholar$/, ',$Scholar#delete_')
|
||||
.gsub(/,[\s]?Netflix$/, ',$Netflix#delete_')
|
||||
.gsub(/,[\s]?Disney$/, ',$Disney#delete_')
|
||||
.gsub(/,[\s]?Spotify$/, ',$Spotify#delete_')
|
||||
.gsub(/,[\s]?AI Suite$/, ',$AI_Suite#delete_')
|
||||
.gsub(/,[\s]?Steam$/, ',$Steam#delete_')
|
||||
.gsub(/,[\s]?miHoYo$/, ',$miHoYo#delete_')
|
||||
.gsub(/,[\s]?AdBlock$/, ',$AdBlock#delete_')
|
||||
.gsub(/,[\s]?HTTPDNS$/, ',$HTTPDNS#delete_')
|
||||
.gsub(/,[\s]?Speedtest$/, ',$Speedtest#delete_')
|
||||
.gsub(/,[\s]?Telegram$/, ',$Telegram#delete_')
|
||||
.gsub(/,[\s]?Crypto$/, ',$Crypto#delete_')
|
||||
.gsub(/,[\s]?Discord$/, ',$Discord#delete_')
|
||||
.gsub(/,[\s]?Microsoft$/, ',$Microsoft#delete_')
|
||||
.to_s.gsub(/,[\s]?PayPal$/, ',$PayPal#delete_')
|
||||
.gsub(/,[\s]?Domestic$/, ',$Domestic#delete_')
|
||||
.gsub(/,[\s]?Others$/, ',$Others#delete_')
|
||||
.gsub(/,[\s]?Google FCM$/, ',$GoogleFCM#delete_')
|
||||
.gsub(/#delete_/, '')
|
||||
};
|
||||
Value['script']['code'].to_s.gsub!(/\'Bilibili\': \'Asian TV\'/,'\'Bilibili\': \'$Bilibili#delete_\'')
|
||||
.gsub!(/\'Bahamut\': \'Global TV\'/,'\'Bahamut\': \'$Bahamut#delete_\'')
|
||||
.gsub!(/\'HBO Max\': \'Global TV\'/,'\'HBO Max\': \'$HBOMax#delete_\'')
|
||||
.gsub!(/\'HBO Go\': \'Global TV\'/,'\'HBO Go\': \'$HBOGo#delete_\'')
|
||||
.gsub!(/\'Discovery Plus\': \'Global TV\'/,'\'Discovery Plus\': \'$Discovery#delete_\'')
|
||||
.gsub!(/\'DAZN\': \'Global TV\'/,'\'DAZN\': \'$DAZN#delete_\'')
|
||||
.gsub!(/\'Pornhub\': \'Global TV\'/,'\'Pornhub\': \'$Pornhub#delete_\'')
|
||||
.gsub!(/: \'Global TV\'/,': \'$GlobalTV#delete_\'')
|
||||
.gsub!(/: \'Asian TV\'/,': \'$AsianTV#delete_\'')
|
||||
.gsub!(/: \'Proxy\'/,': \'$Proxy#delete_\'')
|
||||
.gsub!(/: \'YouTube\'/,': \'$Youtube#delete_\'')
|
||||
.gsub!(/: \'Apple\'/,': \'$Apple#delete_\'')
|
||||
.gsub!(/: \'Apple TV\'/,': \'$AppleTV#delete_\'')
|
||||
.gsub!(/: \'Scholar\'/,': \'$Scholar#delete_\'')
|
||||
.gsub!(/: \'Netflix\'/,': \'$Netflix#delete_\'')
|
||||
.gsub!(/: \'Disney\'/,': \'$Disney#delete_\'')
|
||||
.gsub!(/: \'Spotify\'/,': \'$Spotify#delete_\'')
|
||||
.gsub!(/: \'AI Suite\'/,': \'$AI_Suite#delete_\'')
|
||||
.gsub!(/: \'Steam\'/,': \'$Steam#delete_\'')
|
||||
.gsub!(/: \'miHoYo\'/,': \'$miHoYo#delete_\'')
|
||||
.gsub!(/: \'AdBlock\'/,': \'$AdBlock#delete_\'')
|
||||
.gsub!(/: \'Speedtest\'/,': \'$Speedtest#delete_\'')
|
||||
.gsub!(/: \'Telegram\'/,': \'$Telegram#delete_\'')
|
||||
.gsub!(/: \'Crypto\'/,': \'$Crypto#delete_\'')
|
||||
.gsub!(/: \'Discord\'/,': \'$Discord#delete_\'')
|
||||
.gsub!(/: \'Microsoft\'/,': \'$Microsoft#delete_\'')
|
||||
.gsub!(/: \'PayPal\'/,': \'$PayPal#delete_\'')
|
||||
.gsub!(/: \'Domestic\'/,': \'$Domestic#delete_\'')
|
||||
.gsub!(/: \'Google FCM\'/,': \'$GoogleFCM#delete_\'')
|
||||
.gsub!(/return \'Domestic\'$/, 'return \'$Domestic#delete_\'')
|
||||
.gsub!(/return \'Others\'$/, 'return \'$Others#delete_\'')
|
||||
.gsub!(/#delete_/, '');
|
||||
end;
|
||||
rescue Exception => e
|
||||
YAML.LOG('Error: Set lhie1 Rules Failed,【' + e.message + '】');
|
||||
@ -436,19 +401,15 @@ yml_other_set()
|
||||
|
||||
#Router Self Proxy Rule
|
||||
begin
|
||||
if $6 == 0 and ${10} != 2 and '${12}' == 'fake-ip' then
|
||||
if $6 == 0 and $8 != 2 and '$9' == 'fake-ip' then
|
||||
if Value.has_key?('rules') and not Value['rules'].to_a.empty? then
|
||||
if Value['rules'].to_a.grep(/(?=.*SRC-IP-CIDR,'${fake_ip}')/).empty? then
|
||||
Value['rules']=Value['rules'].to_a.insert(0,'SRC-IP-CIDR,${11},DIRECT');
|
||||
end
|
||||
if Value['rules'].to_a.grep(/(?=.*SRC-IP-CIDR,'$7')/).empty? and not '$7'.empty? then
|
||||
Value['rules']=Value['rules'].to_a.insert(0,'SRC-IP-CIDR,$7/32,DIRECT');
|
||||
end;
|
||||
else
|
||||
Value['rules']=['SRC-IP-CIDR,${11},DIRECT','SRC-IP-CIDR,$7/32,DIRECT'];
|
||||
Value['rules']=['SRC-IP-CIDR,$7/32,DIRECT'];
|
||||
end;
|
||||
elsif Value.has_key?('rules') and not Value['rules'].to_a.empty? then
|
||||
Value['rules'].delete('SRC-IP-CIDR,${11},DIRECT');
|
||||
Value['rules'].delete('SRC-IP-CIDR,$7/32,DIRECT');
|
||||
end;
|
||||
rescue Exception => e
|
||||
@ -479,12 +440,7 @@ yml_other_set()
|
||||
end;
|
||||
if File::exist?('/tmp/yaml_rule_set_top_custom.yaml') then
|
||||
Value_1 = YAML.load_file('/tmp/yaml_rule_set_top_custom.yaml');
|
||||
if Value['rules'].to_a.grep(/(?=.*'${fake_ip}')(?=.*REJECT)/).empty? then
|
||||
Value_1['rules'].uniq.reverse.each{|x| Value['rules'].insert(0,x)};
|
||||
else
|
||||
ruby_add_index = Value['rules'].index(Value['rules'].grep(/(?=.*'${fake_ip}')(?=.*REJECT)/).first);
|
||||
Value_1['rules'].uniq.reverse.each{|x| Value['rules'].insert(ruby_add_index + 1,x)};
|
||||
end;
|
||||
Value_1['rules'].uniq.reverse.each{|x| Value['rules'].insert(0,x)};
|
||||
end;
|
||||
else
|
||||
if File::exist?('/tmp/yaml_rule_set_top_custom.yaml') then
|
||||
@ -658,25 +614,6 @@ yml_other_set()
|
||||
rescue Exception => e
|
||||
YAML.LOG('Error: Set Custom Rules Failed,【' + e.message + '】');
|
||||
end;
|
||||
|
||||
#loop prevent
|
||||
begin
|
||||
if Value.has_key?('rules') and not Value['rules'].to_a.empty? then
|
||||
if Value['rules'].to_a.grep(/(?=.*'${fake_ip}')(?=.*REJECT)/).empty? then
|
||||
Value['rules']=Value['rules'].to_a.insert(0,'IP-CIDR,${11},REJECT,no-resolve');
|
||||
end;
|
||||
if Value['rules'].to_a.grep(/(?=.*DST-PORT,'$8',REJECT)/).empty? then
|
||||
Value['rules']=Value['rules'].to_a.insert(0,'DST-PORT,$8,REJECT');
|
||||
end;
|
||||
if Value['rules'].to_a.grep(/(?=.*DST-PORT,'$9',REJECT)/).empty? then
|
||||
Value['rules']=Value['rules'].to_a.insert(0,'DST-PORT,$9,REJECT');
|
||||
end;
|
||||
else
|
||||
Value['rules']=['IP-CIDR,${11},REJECT,no-resolve','DST-PORT,$8,REJECT','DST-PORT,$9,REJECT'];
|
||||
end;
|
||||
rescue Exception => e
|
||||
YAML.LOG('Error: Set Loop Protect Rules Failed,【' + e.message + '】');
|
||||
end;
|
||||
};
|
||||
|
||||
t2=Thread.new{
|
||||
@ -750,10 +687,6 @@ yml_other_set()
|
||||
if x['url'] and x['url'] =~ /^https:\/\/raw.githubusercontent.com/ then
|
||||
x['url'] = '$github_address_mod' + 'gh/' + x['url'].split('/')[3] + '/' + x['url'].split('/')[4] + '@' + x['url'].split(x['url'].split('/')[2] + '/' + x['url'].split('/')[3] + '/' + x['url'].split('/')[4] + '/')[1];
|
||||
end;
|
||||
elsif '$github_address_mod' == 'https://raw.fastgit.org/' then
|
||||
if x['url'] and x['url'] =~ /^https:\/\/raw.githubusercontent.com/ then
|
||||
x['url'] = 'https://raw.fastgit.org/' + x['url'].split('/')[3] + '/' + x['url'].split('/')[4] + '/' + x['url'].split(x['url'].split('/')[2] + '/' + x['url'].split('/')[3] + '/' + x['url'].split('/')[4] + '/')[1];
|
||||
end;
|
||||
else
|
||||
if x['url'] and x['url'] =~ /^https:\/\/(raw.|gist.)(githubusercontent.com|github.com)/ then
|
||||
x['url'] = '$github_address_mod' + x['url'];
|
||||
@ -871,12 +804,12 @@ yml_other_rules_get()
|
||||
config_get "rule_name" "$section" "rule_name" ""
|
||||
config_get "GlobalTV" "$section" "GlobalTV" ""
|
||||
config_get "AsianTV" "$section" "AsianTV" ""
|
||||
config_get "MainlandTV" "$section" "MainlandTV" "DIRECT"
|
||||
config_get "Proxy" "$section" "Proxy" ""
|
||||
config_get "Youtube" "$section" "Youtube" ""
|
||||
config_get "Bilibili" "$section" "Bilibili" ""
|
||||
config_get "Bahamut" "$section" "Bahamut" ""
|
||||
config_get "HBOMax" "$section" "HBOMax" "$GlobalTV"
|
||||
config_get "HBOGo" "$section" "HBOGo" "$GlobalTV"
|
||||
config_get "Pornhub" "$section" "Pornhub" ""
|
||||
config_get "Apple" "$section" "Apple" ""
|
||||
config_get "Scholar" "$section" "Scholar" ""
|
||||
@ -885,6 +818,7 @@ yml_other_rules_get()
|
||||
config_get "Spotify" "$section" "Spotify" ""
|
||||
config_get "Steam" "$section" "Steam" ""
|
||||
config_get "AdBlock" "$section" "AdBlock" ""
|
||||
config_get "HTTPDNS" "$section" "HTTPDNS" "REJECT"
|
||||
config_get "Netease_Music" "$section" "Netease_Music" ""
|
||||
config_get "Speedtest" "$section" "Speedtest" ""
|
||||
config_get "Telegram" "$section" "Telegram" ""
|
||||
@ -912,18 +846,18 @@ if [ "$1" != "0" ]; then
|
||||
config_foreach yml_other_rules_get "other_rules" "$5"
|
||||
if [ -z "$rule_name" ]; then
|
||||
SKIP_CUSTOM_OTHER_RULES=1
|
||||
yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" "${10}" "${11}" "${12}"
|
||||
yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
|
||||
exit 0
|
||||
#判断策略组是否存在
|
||||
elif [ "$rule_name" = "lhie1" ]; then
|
||||
if [ -z "$(grep -F "$GlobalTV" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$AsianTV" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$MainlandTV" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$Proxy" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$Youtube" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$Bilibili" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$Bahamut" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$HBOMax" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$HBOGo" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$Pornhub" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$Apple" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$AppleTV" /tmp/Proxy_Group)" ]\
|
||||
@ -937,6 +871,7 @@ if [ "$1" != "0" ]; then
|
||||
|| [ -z "$(grep -F "$Steam" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$miHoYo" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$AdBlock" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$HTTPDNS" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$Speedtest" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$Telegram" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$Crypto" /tmp/Proxy_Group)" ]\
|
||||
@ -948,16 +883,16 @@ if [ "$1" != "0" ]; then
|
||||
|| [ -z "$(grep -F "$Domestic" /tmp/Proxy_Group)" ]; then
|
||||
LOG_OUT "Warning: Because of The Different Porxy-Group's Name, Stop Setting The Other Rules!"
|
||||
SKIP_CUSTOM_OTHER_RULES=1
|
||||
yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" "${10}" "${11}" "${12}"
|
||||
yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
if [ -z "$Proxy" ]; then
|
||||
LOG_OUT "Error: Missing Porxy-Group's Name, Stop Setting The Other Rules!"
|
||||
SKIP_CUSTOM_OTHER_RULES=1
|
||||
yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" "${10}" "${11}" "${12}"
|
||||
yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" "${10}" "${11}" "${12}"
|
||||
yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
|
||||
|
@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="186" height="20" role="img" aria-label="Current Version: v0.00.00-beta"><title>Current Version: v0.00.00-beta</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="186" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="97" height="20" fill="#555"/><rect x="97" width="89" height="20" fill="#007ec6"/><rect width="186" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="495" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="870">Current Version</text><text x="495" y="140" transform="scale(.1)" fill="#fff" textLength="870">Current Version</text><text aria-hidden="true" x="1405" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="790">v0.00.00-beta</text><text x="1405" y="140" transform="scale(.1)" fill="#fff" textLength="790">v0.00.00-beta</text></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="164" height="20" role="img" aria-label="Current Version: v0.00.00"><title>Current Version: v0.00.00</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="164" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="97" height="20" fill="#555"/><rect x="97" width="67" height="20" fill="#007ec6"/><rect width="164" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="495" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="870">Current Version</text><text x="495" y="140" transform="scale(.1)" fill="#fff" textLength="870">Current Version</text><text aria-hidden="true" x="1295" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="570">v0.00.00</text><text x="1295" y="140" transform="scale(.1)" fill="#fff" textLength="570">v0.00.00</text></g></svg>
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
@ -146,7 +146,7 @@ end
|
||||
sources.write = dynamicList_write
|
||||
|
||||
---- TCP No Redir Ports
|
||||
local TCP_NO_REDIR_PORTS = m.uci:get(appname, "@global_forwarding[0]", "tcp_no_redir_ports")
|
||||
local TCP_NO_REDIR_PORTS = m:get("@global_forwarding[0]", "tcp_no_redir_ports")
|
||||
o = s:option(Value, "tcp_no_redir_ports", translate("TCP No Redir Ports"))
|
||||
o:value("", translate("Use global config") .. "(" .. TCP_NO_REDIR_PORTS .. ")")
|
||||
o:value("disable", translate("No patterns are used"))
|
||||
@ -154,7 +154,7 @@ o:value("1:65535", translate("All"))
|
||||
o.validate = port_validate
|
||||
|
||||
---- UDP No Redir Ports
|
||||
local UDP_NO_REDIR_PORTS = m.uci:get(appname, "@global_forwarding[0]", "udp_no_redir_ports")
|
||||
local UDP_NO_REDIR_PORTS = m:get("@global_forwarding[0]", "udp_no_redir_ports")
|
||||
o = s:option(Value, "udp_no_redir_ports", translate("UDP No Redir Ports"),
|
||||
"<font color='red'>" ..
|
||||
translate("Fill in the ports you don't want to be forwarded by the agent, with the highest priority.") ..
|
||||
@ -203,7 +203,7 @@ o.value = "1"
|
||||
o:depends({ udp_node = "", ['!reverse'] = true })
|
||||
|
||||
---- TCP Proxy Drop Ports
|
||||
local TCP_PROXY_DROP_PORTS = m.uci:get(appname, "@global_forwarding[0]", "tcp_proxy_drop_ports")
|
||||
local TCP_PROXY_DROP_PORTS = m:get("@global_forwarding[0]", "tcp_proxy_drop_ports")
|
||||
o = s:option(Value, "tcp_proxy_drop_ports", translate("TCP Proxy Drop Ports"))
|
||||
o:value("", translate("Use global config") .. "(" .. TCP_PROXY_DROP_PORTS .. ")")
|
||||
o:value("disable", translate("No patterns are used"))
|
||||
@ -212,7 +212,7 @@ o:depends({ use_global_config = true })
|
||||
o:depends({ _tcp_node_bool = "1" })
|
||||
|
||||
---- UDP Proxy Drop Ports
|
||||
local UDP_PROXY_DROP_PORTS = m.uci:get(appname, "@global_forwarding[0]", "udp_proxy_drop_ports")
|
||||
local UDP_PROXY_DROP_PORTS = m:get("@global_forwarding[0]", "udp_proxy_drop_ports")
|
||||
o = s:option(Value, "udp_proxy_drop_ports", translate("UDP Proxy Drop Ports"))
|
||||
o:value("", translate("Use global config") .. "(" .. UDP_PROXY_DROP_PORTS .. ")")
|
||||
o:value("disable", translate("No patterns are used"))
|
||||
@ -222,7 +222,7 @@ o:depends({ use_global_config = true })
|
||||
o:depends({ _tcp_node_bool = "1" })
|
||||
|
||||
---- TCP Redir Ports
|
||||
local TCP_REDIR_PORTS = m.uci:get(appname, "@global_forwarding[0]", "tcp_redir_ports")
|
||||
local TCP_REDIR_PORTS = m:get("@global_forwarding[0]", "tcp_redir_ports")
|
||||
o = s:option(Value, "tcp_redir_ports", translate("TCP Redir Ports"), translatef("Only work with using the %s node.", "TCP"))
|
||||
o:value("", translate("Use global config") .. "(" .. TCP_REDIR_PORTS .. ")")
|
||||
o:value("1:65535", translate("All"))
|
||||
@ -234,7 +234,7 @@ o:depends({ use_global_config = true })
|
||||
o:depends({ _tcp_node_bool = "1" })
|
||||
|
||||
---- UDP Redir Ports
|
||||
local UDP_REDIR_PORTS = m.uci:get(appname, "@global_forwarding[0]", "udp_redir_ports")
|
||||
local UDP_REDIR_PORTS = m:get("@global_forwarding[0]", "udp_redir_ports")
|
||||
o = s:option(Value, "udp_redir_ports", translate("UDP Redir Ports"), translatef("Only work with using the %s node.", "UDP"))
|
||||
o:value("", translate("Use global config") .. "(" .. UDP_REDIR_PORTS .. ")")
|
||||
o:value("1:65535", translate("All"))
|
||||
|
@ -37,7 +37,7 @@ end
|
||||
|
||||
local socks_list = {}
|
||||
|
||||
local tcp_socks_server = "127.0.0.1" .. ":" .. (m.uci:get(appname, "@global[0]", "tcp_node_socks_port") or "1070")
|
||||
local tcp_socks_server = "127.0.0.1" .. ":" .. (m:get("@global[0]", "tcp_node_socks_port") or "1070")
|
||||
local socks_table = {}
|
||||
socks_table[#socks_table + 1] = {
|
||||
id = tcp_socks_server,
|
||||
@ -594,7 +594,7 @@ o = s:taboption("DNS", Flag, "dns_redirect", translate("DNS Redirect"), translat
|
||||
o.default = "1"
|
||||
o.rmempty = false
|
||||
|
||||
if (m.uci:get(appname, "@global_forwarding[0]", "use_nft") or "0") == "1" then
|
||||
if (m:get("@global_forwarding[0]", "use_nft") or "0") == "1" then
|
||||
o = s:taboption("DNS", Button, "clear_ipset", translate("Clear NFTSET"), translate("Try this feature if the rule modification does not take effect."))
|
||||
else
|
||||
o = s:taboption("DNS", Button, "clear_ipset", translate("Clear IPSET"), translate("Try this feature if the rule modification does not take effect."))
|
||||
|
@ -4,7 +4,7 @@ local appname = "passwall"
|
||||
m = Map(appname, translate("Node Config"))
|
||||
m.redirect = api.url()
|
||||
|
||||
if not arg[1] or not m.uci:get(appname, arg[1]) then
|
||||
if not arg[1] or not m:get(arg[1]) then
|
||||
luci.http.redirect(api.url("node_list"))
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ o.rmempty = false
|
||||
local auto_switch_tip
|
||||
local current_node = api.get_cache_var("socks_" .. arg[1])
|
||||
if current_node then
|
||||
local n = m.uci:get_all(appname, current_node)
|
||||
local n = m:get(current_node)
|
||||
if n then
|
||||
if tonumber(m:get(arg[1], "enable_autoswitch") or 0) == 1 then
|
||||
if n then
|
||||
|
@ -655,11 +655,21 @@ function gen_config(var)
|
||||
}
|
||||
}
|
||||
if inbound.sniffing.enabled == true then
|
||||
inbound.sniffing.destOverride = {"http", "tls", "quic", (remote_dns_fake) and "fakedns"}
|
||||
inbound.sniffing.destOverride = {"http", "tls", "quic"}
|
||||
inbound.sniffing.metadataOnly = false
|
||||
inbound.sniffing.routeOnly = xray_settings.sniffing_override_dest ~= "1" or nil
|
||||
inbound.sniffing.domainsExcluded = xray_settings.sniffing_override_dest == "1" and get_domain_excluded() or nil
|
||||
end
|
||||
if remote_dns_fake then
|
||||
inbound.sniffing.enabled = true
|
||||
if not inbound.sniffing.destOverride then
|
||||
inbound.sniffing.destOverride = {"fakedns"}
|
||||
inbound.sniffing.metadataOnly = true
|
||||
else
|
||||
table.insert(inbound.sniffing.destOverride, "fakedns")
|
||||
inbound.sniffing.metadataOnly = false
|
||||
end
|
||||
end
|
||||
|
||||
if tcp_redir_port then
|
||||
local tcp_inbound = api.clone(inbound)
|
||||
|
@ -2,12 +2,12 @@
|
||||
<%
|
||||
local api = require "luci.passwall.api"
|
||||
local appname = 'passwall'
|
||||
local uci = self.map.uci
|
||||
local ss_type = uci:get(appname, "@global_subscribe[0]", "ss_type") or "xray"
|
||||
local trojan_type = uci:get(appname, "@global_subscribe[0]", "trojan_type") or "xray"
|
||||
local vmess_type = uci:get(appname, "@global_subscribe[0]", "vmess_type") or "xray"
|
||||
local vless_type = uci:get(appname, "@global_subscribe[0]", "vless_type") or "xray"
|
||||
local hysteria2_type = uci:get(appname, "@global_subscribe[0]", "hysteria2_type") or "sing-box"
|
||||
local map = self.map
|
||||
local ss_type = map:get("@global_subscribe[0]", "ss_type") or "xray"
|
||||
local trojan_type = map:get("@global_subscribe[0]", "trojan_type") or "xray"
|
||||
local vmess_type = map:get("@global_subscribe[0]", "vmess_type") or "xray"
|
||||
local vless_type = map:get("@global_subscribe[0]", "vless_type") or "xray"
|
||||
local hysteria2_type = map:get("@global_subscribe[0]", "hysteria2_type") or "sing-box"
|
||||
-%>
|
||||
<script src="<%=resource%>/qrcode.min.js"></script>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
|
@ -2159,7 +2159,7 @@ ISP_DNS=$(cat $RESOLVFILE 2>/dev/null | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+\.[0-9
|
||||
ISP_DNS6=$(cat $RESOLVFILE 2>/dev/null | grep -E "([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4}" | awk -F % '{print $1}' | awk -F " " '{print $2}'| sort -u | grep -v -Fx ::1 | grep -v -Fx ::)
|
||||
|
||||
DEFAULT_DNS=$(uci show dhcp.@dnsmasq[0] | grep "\.server=" | awk -F '=' '{print $2}' | sed "s/'//g" | tr ' ' '\n' | grep -v "\/" | head -2 | sed ':label;N;s/\n/,/;b label')
|
||||
[ -z "${DEFAULT_DNS}" ] && [ "$(echo $ISP_DNS | tr ' ' '\n' | wc -l)" -le 2 ] && DEFAULT_DNS=$(echo -n $ISP_DNS | tr ' ' '\n' | head -2 | tr '\n' ',')
|
||||
[ -z "${DEFAULT_DNS}" ] && [ "$(echo $ISP_DNS | tr ' ' '\n' | wc -l)" -le 2 ] && DEFAULT_DNS=$(echo -n $ISP_DNS | tr ' ' '\n' | head -2 | tr '\n' ',' | sed 's/,$//')
|
||||
LOCAL_DNS="${DEFAULT_DNS:-119.29.29.29,223.5.5.5}"
|
||||
IPT_APPEND_DNS=${LOCAL_DNS}
|
||||
|
||||
|
@ -654,11 +654,21 @@ function gen_config(var)
|
||||
}
|
||||
}
|
||||
if inbound.sniffing.enabled == true then
|
||||
inbound.sniffing.destOverride = {"http", "tls", "quic", (remote_dns_fake) and "fakedns"}
|
||||
inbound.sniffing.destOverride = {"http", "tls", "quic"}
|
||||
inbound.sniffing.metadataOnly = false
|
||||
inbound.sniffing.routeOnly = xray_settings.sniffing_override_dest ~= "1" or nil
|
||||
inbound.sniffing.domainsExcluded = xray_settings.sniffing_override_dest == "1" and get_domain_excluded() or nil
|
||||
end
|
||||
if remote_dns_fake then
|
||||
inbound.sniffing.enabled = true
|
||||
if not inbound.sniffing.destOverride then
|
||||
inbound.sniffing.destOverride = {"fakedns"}
|
||||
inbound.sniffing.metadataOnly = true
|
||||
else
|
||||
table.insert(inbound.sniffing.destOverride, "fakedns")
|
||||
inbound.sniffing.metadataOnly = false
|
||||
end
|
||||
end
|
||||
|
||||
local tcp_inbound = api.clone(inbound)
|
||||
tcp_inbound.tag = "tcp_redir"
|
||||
|
@ -1363,7 +1363,7 @@ ISP_DNS6=$(cat $RESOLVFILE 2>/dev/null | grep -E "([A-Fa-f0-9]{1,4}::?){1,7}[A-F
|
||||
|
||||
DEFAULT_DNSMASQ_CFGID=$(uci show dhcp.@dnsmasq[0] | awk -F '.' '{print $2}' | awk -F '=' '{print $1}'| head -1)
|
||||
DEFAULT_DNS=$(uci show dhcp.@dnsmasq[0] | grep "\.server=" | awk -F '=' '{print $2}' | sed "s/'//g" | tr ' ' '\n' | grep -v "\/" | head -2 | sed ':label;N;s/\n/,/;b label')
|
||||
[ -z "${DEFAULT_DNS}" ] && DEFAULT_DNS=$(echo -n $ISP_DNS | tr ' ' '\n' | head -2 | tr '\n' ',')
|
||||
[ -z "${DEFAULT_DNS}" ] && DEFAULT_DNS=$(echo -n $ISP_DNS | tr ' ' '\n' | head -2 | tr '\n' ',' | sed 's/,$//')
|
||||
AUTO_DNS=${DEFAULT_DNS:-119.29.29.29}
|
||||
|
||||
DNSMASQ_CONF_DIR=/tmp/dnsmasq.d
|
||||
|
Loading…
Reference in New Issue
Block a user