update 2022-09-10 23:44:13

This commit is contained in:
github-actions[bot] 2022-09-10 23:44:13 +08:00
parent 8de61e0602
commit ad9a0f5190
81 changed files with 1832 additions and 856 deletions

View File

@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=hysteria PKG_NAME:=hysteria
PKG_VERSION:=1.2.0 PKG_VERSION:=1.2.1
PKG_RELEASE:=$(AUTORELEASE) PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/HyNetwork/hysteria/tar.gz/v$(PKG_VERSION)? PKG_SOURCE_URL:=https://codeload.github.com/HyNetwork/hysteria/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=aeff737d81860e736cf2ce239bf8391aea0f50957315eb0b20ea40fd07f29460 PKG_HASH:=cdac1f149651ca5eaa77ea69ee913d0f1391a07da681ad4908a60a6603307543
PKG_LICENSE:=MIT PKG_LICENSE:=MIT
PKG_LICENSE_FILE:=LICENSE PKG_LICENSE_FILE:=LICENSE
@ -20,7 +20,7 @@ PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1 PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0 PKG_USE_MIPS16:=0
GO_PKG:=github.com/tobyxdd/hysteria GO_PKG:=github.com/HyNetwork/hysteria
GO_PKG_BUILD_PKG:=$(GO_PKG)/cmd GO_PKG_BUILD_PKG:=$(GO_PKG)/cmd
GO_PKG_LDFLAGS_X:=main.appVersion=$(PKG_VERSION) GO_PKG_LDFLAGS_X:=main.appVersion=$(PKG_VERSION)

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-openclash PKG_NAME:=luci-app-openclash
PKG_VERSION:=0.45.51 PKG_VERSION:=0.45.59
PKG_RELEASE:=beta PKG_RELEASE:=beta
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash> PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>
@ -12,6 +12,18 @@ include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)/config define Package/$(PKG_NAME)/config
config PACKAGE_kmod-inet-diag config PACKAGE_kmod-inet-diag
default y if PACKAGE_$(PKG_NAME) default y if PACKAGE_$(PKG_NAME)
config PACKAGE_kmod-nft-tproxy
default y if PACKAGE_firewall4
config PACKAGE_kmod-ipt-nat
default y if ! PACKAGE_firewall4
config PACKAGE_iptables-mod-tproxy
default y if ! PACKAGE_firewall4
config PACKAGE_iptables-mod-extra
default y if ! PACKAGE_firewall4
endef endef
define Package/$(PKG_NAME) define Package/$(PKG_NAME)
@ -19,8 +31,8 @@ define Package/$(PKG_NAME)
SUBMENU:=3. Applications SUBMENU:=3. Applications
TITLE:=LuCI support for clash TITLE:=LuCI support for clash
PKGARCH:=all PKGARCH:=all
DEPENDS:=+iptables +dnsmasq-full +coreutils +coreutils-nohup +bash +curl +ca-bundle +ipset +ip-full \ DEPENDS:=+dnsmasq-full +coreutils +coreutils-nohup +bash +curl +ca-bundle +ipset +ip-full \
+iptables-mod-tproxy +iptables-mod-extra +libcap +libcap-bin +libcap-bin +ruby +ruby-yaml +kmod-tun +unzip +libcap +libcap-bin +libcap-bin +ruby +ruby-yaml +kmod-tun +unzip
MAINTAINER:=vernesong MAINTAINER:=vernesong
endef endef

View File

@ -700,6 +700,7 @@ function action_get_run_mode()
luci.http.prepare_content("application/json") luci.http.prepare_content("application/json")
luci.http.write_json({ luci.http.write_json({
clash = is_running(), clash = is_running(),
watchdog = is_watchdog(),
mode = mode(); mode = mode();
}) })
else else

View File

@ -76,6 +76,7 @@ o.default = "false"
o.rmempty = false o.rmempty = false
o = s:option(Value, "test_url", translate("Test URL")) o = s:option(Value, "test_url", translate("Test URL"))
o:value("http://cp.cloudflare.com/generate_204")
o:value("http://www.gstatic.com/generate_204") o:value("http://www.gstatic.com/generate_204")
o:value("https://cp.cloudflare.com/generate_204") o:value("https://cp.cloudflare.com/generate_204")
o.rmempty = false o.rmempty = false

View File

@ -134,17 +134,6 @@ end
o:value("DIRECT") o:value("DIRECT")
o:value("REJECT") o:value("REJECT")
o = s:option(ListValue, "Douyin", translate("Douyin"))
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, "Bahamut", translate("Bahamut")) o = s:option(ListValue, "Bahamut", translate("Bahamut"))
o:depends("rule_name", "lhie1") o:depends("rule_name", "lhie1")
o.rmempty = true o.rmempty = true
@ -332,6 +321,17 @@ end
o:value("DIRECT") o:value("DIRECT")
o:value("REJECT") o:value("REJECT")
o = s:option(ListValue, "Discord", translate("Discord"))
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, "PayPal", translate("PayPal")) o = s:option(ListValue, "PayPal", translate("PayPal"))
o:depends("rule_name", "lhie1") o:depends("rule_name", "lhie1")
o.rmempty = true o.rmempty = true

View File

@ -97,6 +97,7 @@ o:value("true", translate("Enable"))
o.default = true o.default = true
o = s:option(Value, "health_check_url", translate("Health Check URL")) o = s:option(Value, "health_check_url", translate("Health Check URL"))
o:value("http://cp.cloudflare.com/generate_204")
o:value("http://www.gstatic.com/generate_204") o:value("http://www.gstatic.com/generate_204")
o:value("https://cp.cloudflare.com/generate_204") o:value("https://cp.cloudflare.com/generate_204")
o.rmempty = false o.rmempty = false

View File

@ -66,7 +66,7 @@ o.default = "fake-ip"
end end
o = s:taboption("op_mode", Flag, "enable_udp_proxy", font_red..bold_on..translate("Proxy UDP Traffics")..bold_off..font_off) o = s:taboption("op_mode", Flag, "enable_udp_proxy", font_red..bold_on..translate("Proxy UDP Traffics")..bold_off..font_off)
o.description = translate("The Servers Must Support UDP forwarding")..", "..font_red..bold_on..translate("If Docker is Installed, UDP May Not Forward Normally")..bold_off..font_off o.description = translate("The Servers Must Support UDP forwarding").."<br>"..font_red..bold_on.."1."..translate("If Docker is Installed, UDP May Not Forward Normally").."<br>2."..translate("In Fake-ip Mode, Even If This Option is Turned Off, Domain Type Connections Still Pass Through The Core For The Availability")..bold_off..font_off
o:depends("en_mode", "redir-host") o:depends("en_mode", "redir-host")
o:depends("en_mode", "fake-ip") o:depends("en_mode", "fake-ip")
o.default = 1 o.default = 1
@ -597,7 +597,7 @@ o.description = translate("In The Fake-IP Mode, Only Pure IP Requests Are Suppor
o = s:taboption("lan_ac", DynamicList, "lan_ac_black_ports", translate("Lan Bypassed Port List")) o = s:taboption("lan_ac", DynamicList, "lan_ac_black_ports", translate("Lan Bypassed Port List"))
o.datatype = "port" o.datatype = "port"
o:value("5000", translate("5000(NAS)")) o:value("5000", translate("5000(NAS)"))
o.description = translate("The Traffic From The Local Specified Port Will Not Pass The Core, Try To Set When The Bypass Gateway Forwarding Fails") 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")
o = s:taboption("lan_ac", Value, "local_network_pass", translate("Local IPv4 Network Bypassed List")) o = s:taboption("lan_ac", Value, "local_network_pass", translate("Local IPv4 Network Bypassed List"))
o.template = "cbi/tvalue" o.template = "cbi/tvalue"
@ -1207,6 +1207,28 @@ o.template = "openclash/other_stream_option"
o.value = "Bilibili" o.value = "Bilibili"
o:depends("stream_auto_select_bilibili", "1") o:depends("stream_auto_select_bilibili", "1")
--Google not cn
o = s:taboption("stream_enhance", Flag, "stream_auto_select_google_not_cn", font_red..translate("Google Not CN")..font_off)
o.default = 0
o:depends("stream_auto_select", "1")
o = s:taboption("stream_enhance", Value, "stream_auto_select_group_key_google_not_cn", translate("Group Filter"))
o.default = "Google"
o.placeholder = "Google"
o.description = translate("It Will Be Searched According To The Regex When Auto Search Group Fails")
o:depends("stream_auto_select_google_not_cn", "1")
o = s:taboption("stream_enhance", Value, "stream_auto_select_node_key_google_not_cn", translate("Unlock Nodes Filter"))
o.default = ""
o.description = translate("It Will Be Selected Nodes According To The Regex")
o:depends("stream_auto_select_google_not_cn", "1")
o = s:taboption("stream_enhance", DummyValue, "Google", translate("Manual Test"))
o.rawhtml = true
o.template = "openclash/other_stream_option"
o.value = "Google"
o:depends("stream_auto_select_google_not_cn", "1")
---- update Settings ---- update Settings
o = s:taboption("rules_update", Flag, "other_rule_auto_update", translate("Auto Update")) o = s:taboption("rules_update", Flag, "other_rule_auto_update", translate("Auto Update"))
o.description = font_red..bold_on..translate("Auto Update Other Rules")..bold_off..font_off o.description = font_red..bold_on..translate("Auto Update Other Rules")..bold_off..font_off

View File

@ -131,6 +131,7 @@
text-overflow: ellipsis; text-overflow: ellipsis;
line-height: 25px; line-height: 25px;
height: 25px; height: 25px;
text-align: left;
} }
.card .general .dler-result { .card .general .dler-result {

View File

@ -284,7 +284,7 @@
luci_protocol = (window.location.protocol == "http:" ? "ws://" : "wss://") + status.daip + ":" + status.cn_port; luci_protocol = (window.location.protocol == "http:" ? "ws://" : "wss://") + status.daip + ":" + status.cn_port;
}; };
if (status.clash) { if (status.clash && status.watchdog) {
radio_mode.style.display = "inline-block"; radio_mode.style.display = "inline-block";
radio_de.style.display = "none"; radio_de.style.display = "none";
} }
@ -294,7 +294,7 @@
radio_de.innerHTML = "<b style=color:red><%:Not Running%></b>"; radio_de.innerHTML = "<b style=color:red><%:Not Running%></b>";
}; };
if (status.clash) { if (status.clash && status.watchdog) {
radio_ru_mode.style.display = "inline-block"; radio_ru_mode.style.display = "inline-block";
} }
else { else {
@ -480,12 +480,12 @@
if (x && x.status == 200 && status.mode) { if (x && x.status == 200 && status.mode) {
if (status.mode == "fake-ip" || status.mode == "fake-ip-tun" || status.mode == "fake-ip-mix") if (status.mode == "fake-ip" || status.mode == "fake-ip-tun" || status.mode == "fake-ip-mix")
{ {
mode.innerHTML = status.clash ? "<b style=color:green><%:Fake-IP%></b>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;" : '<b style=color:red><%:Not Running%></b>'; mode.innerHTML = status.clash && status.watchdog ? "<b style=color:green><%:Fake-IP%></b>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;" : '<b style=color:red><%:Not Running%></b>';
radio_run_normal.innerHTML = "<%:Enhance%>" radio_run_normal.innerHTML = "<%:Enhance%>"
} }
else if (status.mode == "redir-host" || status.mode == "redir-host-tun" || status.mode == "redir-host-mix") else if (status.mode == "redir-host" || status.mode == "redir-host-tun" || status.mode == "redir-host-mix")
{ {
mode.innerHTML = status.clash ? "<b style=color:green><%:Redir-Host%></b>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;" : '<b style=color:red><%:Not Running%></b>'; mode.innerHTML = status.clash && status.watchdog ? "<b style=color:green><%:Redir-Host%></b>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;" : '<b style=color:red><%:Not Running%></b>';
radio_run_normal.innerHTML = "<%:Compatible%>" radio_run_normal.innerHTML = "<%:Compatible%>"
}; };
for (i=0; i<radio_ru.length; i++) { for (i=0; i<radio_ru.length; i++) {

View File

@ -1945,6 +1945,9 @@ msgstr "提示: 检测到内核文件不存在,准备开始下载..."
msgid "Tip: Detected that the Chnroute Cidr List is not Installed, Ready to Download..." msgid "Tip: Detected that the Chnroute Cidr List is not Installed, Ready to Download..."
msgstr "提示: 检测到大陆白名单列表不存在,准备开始下载..." msgstr "提示: 检测到大陆白名单列表不存在,准备开始下载..."
msgid "Tip: Detected that the Chnroute Cidr List Format is wrong, Ready to Reformat..."
msgstr "提示: 检测到大陆白名单列表格式错误,准备重新格式化..."
msgid "Error: Could Not Load The Capsh Library, Please Verify The Capsh Shell Library Work Well..." msgid "Error: Could Not Load The Capsh Library, Please Verify The Capsh Shell Library Work Well..."
msgstr "错误Capsh 异常请尝试重新安装依赖【libcap】和相应的Capsh库终止启动..." msgstr "错误Capsh 异常请尝试重新安装依赖【libcap】和相应的Capsh库终止启动..."
@ -2572,6 +2575,9 @@ msgstr "提示开始自动选择检测Discovery Plus 解锁节点..."
msgid "Tip: Start Auto Select Proxy For Bilibili Unlock..." msgid "Tip: Start Auto Select Proxy For Bilibili Unlock..."
msgstr "提示开始自动选择检测Bilibili 解锁节点..." msgstr "提示开始自动选择检测Bilibili 解锁节点..."
msgid "Tip: Start Auto Select Proxy For Google Not CN Unlock..."
msgstr "提示开始自动选择检测Google 非送中节点..."
msgid "Netflix Group:" msgid "Netflix Group:"
msgstr "Netflix 策略组:" msgstr "Netflix 策略组:"
@ -2608,6 +2614,9 @@ msgstr "Discovery Plus 策略组:"
msgid "Bilibili Group:" msgid "Bilibili Group:"
msgstr "Bilibili 策略组:" msgstr "Bilibili 策略组:"
msgid "Google Group:"
msgstr "Google 策略组:"
msgid "full support." msgid "full support."
msgstr "完整解锁。" msgstr "完整解锁。"
@ -3123,3 +3132,12 @@ msgstr "低延迟优先"
msgid "Random" msgid "Random"
msgstr "随机选择" msgstr "随机选择"
msgid "Tip: You have seted the authentication of SOCKS5/HTTP(S) proxy with"
msgstr "提示:您为 SOCKS5/HTTP(S) 代理设置的账户密码为"
msgid "Google Not CN"
msgstr "Google 非送中"
msgid "In Fake-ip Mode, Even If This Option is Turned Off, Domain Type Connections Still Pass Through The Core For The Availability"
msgstr "在 Fake-IP 模式时,即使关闭此选项,域名类型的连接仍将通过核心以保证可用性"

View File

@ -25,6 +25,7 @@ START_LOG="/tmp/openclash_start.log"
LOCK_FILE=/tmp/lock/openclash.lock LOCK_FILE=/tmp/lock/openclash.lock
PROXY_FWMARK="0x162" PROXY_FWMARK="0x162"
PROXY_ROUTE_TABLE="0x162" PROXY_ROUTE_TABLE="0x162"
FW4="$(command -v fw4)"
set_lock() { set_lock() {
exec 888>"$LOCK_FILE" 2>/dev/null exec 888>"$LOCK_FILE" 2>/dev/null
@ -364,7 +365,7 @@ yml_other_rules_get()
check_run_quick() check_run_quick()
{ {
quick_start=true quick_start=true
check_file="$RAW_CONFIG_FILE /etc/openclash/custom/openclash_custom_domain_dns.list /etc/openclash/custom/openclash_custom_domain_dns_policy.list /etc/openclash/custom/openclash_custom_fake_filter.list /etc/openclash/custom/openclash_custom_fallback_filter.yaml /etc/openclash/custom/openclash_custom_hosts.list /etc/openclash/custom/openclash_custom_rules.list /etc/openclash/custom/openclash_custom_rules_2.list $dev_core_path $tun_core_path $meta_core_path $ipdb_path $geosite_path $geoip_path $chnr_path $chnr6_path /usr/share/openclash/res/ConnersHua.yaml /usr/share/openclash/res/ConnersHua_return.yaml /usr/share/openclash/res/lhie1.yaml /usr/share/openclash/res/openclash_version /etc/openclash/custom/openclash_force_sniffing_domain.list /etc/openclash/custom/openclash_sniffing_domain_filter.list /etc/openclash/custom/openclash_sniffing_port_filter.yaml /etc/openclash/custom/openclash_custom_localnetwork_ipv4.list /etc/openclash/custom/openclash_custom_localnetwork_ipv6.list" check_file="$(echo $RAW_CONFIG_FILE | tr " " "?") /etc/openclash/custom/openclash_custom_domain_dns.list /etc/openclash/custom/openclash_custom_domain_dns_policy.list /etc/openclash/custom/openclash_custom_fake_filter.list /etc/openclash/custom/openclash_custom_fallback_filter.yaml /etc/openclash/custom/openclash_custom_hosts.list /etc/openclash/custom/openclash_custom_rules.list /etc/openclash/custom/openclash_custom_rules_2.list $dev_core_path $tun_core_path $meta_core_path $ipdb_path $geosite_path $geoip_path $chnr_path $chnr6_path /usr/share/openclash/res/ConnersHua.yaml /usr/share/openclash/res/ConnersHua_return.yaml /usr/share/openclash/res/lhie1.yaml /etc/openclash/custom/openclash_force_sniffing_domain.yaml /etc/openclash/custom/openclash_sniffing_domain_filter.yaml /etc/openclash/custom/openclash_sniffing_port_filter.yaml /etc/openclash/custom/openclash_custom_localnetwork_ipv4.list /etc/openclash/custom/openclash_custom_localnetwork_ipv6.list /etc/openclash/custom/openclash_custom_chnroute_pass.list /etc/openclash/custom/openclash_custom_chnroute6_pass.list"
if [ ! -f "$CONFIG_FILE" ] || [ ! -f "/tmp/openclash_config.tmp" ] || [ ! -f "/tmp/openclash.change" ]; then if [ ! -f "$CONFIG_FILE" ] || [ ! -f "/tmp/openclash_config.tmp" ] || [ ! -f "/tmp/openclash.change" ]; then
quick_start=false quick_start=false
return return
@ -376,7 +377,7 @@ check_run_quick()
else else
if [ -s "/tmp/openclash.change" ]; then if [ -s "/tmp/openclash.change" ]; then
for i in $check_file; do for i in $check_file; do
if [ -z "$(grep "$i $(date -r $i)$" "/tmp/openclash.change")" ]; then if [ -z "$(grep "$i $(date -r "$i")$" "/tmp/openclash.change")" ]; then
LOG_OUT "Tip: Because of the file【 $i 】modificated, Pause quick start..." LOG_OUT "Tip: Because of the file【 $i 】modificated, Pause quick start..."
quick_start=false quick_start=false
break break
@ -395,7 +396,7 @@ write_run_quick()
if ! $quick_start; then if ! $quick_start; then
: > "/tmp/openclash.change" : > "/tmp/openclash.change"
for i in $check_file; do for i in $check_file; do
echo "$i $(date -r $i)" >> "/tmp/openclash.change" echo "$i $(date -r "$i")" >> "/tmp/openclash.change"
done 2>/dev/null done 2>/dev/null
fi fi
} }
@ -592,6 +593,23 @@ do_run_file()
LOG_OUT "Tip: Detected that the Chnroute Cidr List is not Installed, Ready to Download..." LOG_OUT "Tip: Detected that the Chnroute Cidr List is not Installed, Ready to Download..."
/usr/share/openclash/openclash_chnroute.sh /usr/share/openclash/openclash_chnroute.sh
fi fi
if [ -n "$FW4" ]; then
if [ -z "$(cat "$chnr_path" |grep "define china_ip_route")" ] || [ -z "$(cat "$chnr6_path" |grep "define china_ip6_route")" ]; then
LOG_OUT "Tip: Detected that the Chnroute Cidr List Format is wrong, Ready to Reformat..."
/usr/share/openclash/openclash_chnroute.sh
if [ -z "$(cat "$chnr_path" |grep "define china_ip_route")" ] || [ -z "$(cat "$chnr6_path" |grep "define china_ip6_route")" ]; then
start_fail
fi
fi
else
if [ -n "$(cat "$chnr_path" |grep "define china_ip_route")" ] || [ -n "$(cat "$chnr6_path" |grep "define china_ip6_route")" ]; then
LOG_OUT "Tip: Detected that the Chnroute Cidr List Format is wrong, Ready to Reformat..."
/usr/share/openclash/openclash_chnroute.sh
if [ -n "$(cat "$chnr_path" |grep "define china_ip_route")" ] || [ -n "$(cat "$chnr6_path" |grep "define china_ip6_route")" ]; then
start_fail
fi
fi
fi
if [ ! -f "$chnr_path" ] || [ ! -f "$chnr6_path" ]; then if [ ! -f "$chnr_path" ] || [ ! -f "$chnr6_path" ]; then
start_fail start_fail
fi fi
@ -842,6 +860,16 @@ try_restore_start()
} }
#防火墙设置部分 #防火墙设置部分
nft_ac_add()
{
if [ -z "$1" ]; then
return
fi
nft add element inet fw4 "$2" { "$1" } 2>/dev/null
[ -n "$3" ] && nft add element inet fw4 "$3" { "$1" } 2>/dev/null
}
ac_add() ac_add()
{ {
if [ -z "$1" ]; then if [ -z "$1" ]; then
@ -886,6 +914,72 @@ firewall_rule_exclude()
return return
fi fi
if [ -n "$FW4" ]; then
if [ -z "$family" ] || [ "$family" == "ipv4" ]; then
if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 2 ]; then
for i in $dest_port; do
if $e_tcp ; then
nft insert rule inet fw4 openclash_output position 0 meta nfproto {ipv4} tcp sport "$i" counter return >/dev/null 2>&1
if [ -z "$dest_ip" ]; then
nft insert rule inet fw4 openclash position 0 meta nfproto {ipv4} tcp sport "$i" counter return >/dev/null 2>&1
else
nft insert rule inet fw4 openclash position 0 ip saddr { "$dest_ip" } tcp sport "$i" counter return >/dev/null 2>&1
fi
fi
if $e_udp ; then
nft insert rule inet fw4 openclash_mangle_output position 0 meta nfproto {ipv4} udp sport "$i" counter return >/dev/null 2>&1
if [ -z "$dest_ip" ]; then
nft insert rule inet fw4 openclash_mangle position 0 meta nfproto {ipv4} udp sport "$i" counter return >/dev/null 2>&1
else
nft insert rule inet fw4 openclash_mangle position 0 ip saddr { "$dest_ip" } udp sport "$i" counter return >/dev/null 2>&1
fi
fi
done
elif [ "$en_mode_tun" -eq 1 ]; then
for i in $dest_port; do
if $e_tcp ; then
nft insert rule inet fw4 openclash_mangle_output position 0 meta nfproto {ipv4} tcp sport "$i" counter return >/dev/null 2>&1
if [ -z "$dest_ip" ]; then
nft insert rule inet fw4 openclash_mangle position 0 meta nfproto {ipv4} tcp sport "$i" counter return >/dev/null 2>&1
else
nft insert rule inet fw4 openclash_mangle position 0 ip saddr { "$dest_ip" } tcp sport "$i" counter return >/dev/null 2>&1
fi
fi
if $e_udp ; then
nft insert rule inet fw4 openclash_mangle_output position 0 meta nfproto {ipv4} udp sport "$i" counter return >/dev/null 2>&1
if [ -z "$dest_ip" ]; then
nft insert rule inet fw4 openclash_mangle position 0 meta nfproto {ipv4} udp sport "$i" counter return >/dev/null 2>&1
else
nft insert rule inet fw4 openclash_mangle position 0 ip saddr { "$dest_ip" } udp sport "$i" counter return >/dev/null 2>&1
fi
fi
done
fi
fi
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
nft insert rule inet fw4 openclash_mangle_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
fi
nft insert rule inet fw4 openclash_mangle_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
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_port=$(echo $dest_port |sed "s/-/:/g" 2>/dev/null)
dest_ip=$(echo $dest_ip |sed "s/ /,/g" 2>/dev/null) dest_ip=$(echo $dest_ip |sed "s/ /,/g" 2>/dev/null)
@ -953,6 +1047,7 @@ firewall_rule_exclude()
done done
fi fi
fi fi
fi
} }
firewall_redirect_exclude() firewall_redirect_exclude()
@ -982,6 +1077,58 @@ firewall_redirect_exclude()
return return
fi fi
if [ -n "$FW4" ]; 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 ip saddr { "$dest_ip" } tcp sport "$dest_port" counter return >/dev/null 2>&1
nft insert rule inet fw4 openclash_output position 0 ip saddr { "$dest_ip" } tcp dport "$src_dport" counter return >/dev/null 2>&1
fi
if $e_udp ; then
nft insert rule inet fw4 openclash_mangle_output position 0 ip saddr { "$dest_ip" } udp sport "$dest_port" counter return >/dev/null 2>&1
nft insert rule inet fw4 openclash_mangle_output position 0 ip saddr { "$dest_ip" } udp dport "$src_dport" counter return >/dev/null 2>&1
if [ -n "$dest_ip" ]; then
nft insert rule inet fw4 openclash_mangle position 0 ip saddr { "$dest_ip" } udp sport "$dest_port" counter return >/dev/null 2>&1
nft insert rule inet fw4 openclash_mangle position 0 ip saddr { "$dest_ip" } udp dport "$src_dport" counter return >/dev/null 2>&1
fi
fi
elif [ "$en_mode_tun" -eq 1 ]; then
if $e_tcp ; then
nft insert rule inet fw4 openclash_mangle_output position 0 ip saddr { "$dest_ip" } tcp sport "$dest_port" counter return >/dev/null 2>&1
nft insert rule inet fw4 openclash_mangle_output position 0 ip saddr { "$dest_ip" } tcp dport "$src_dport" counter return >/dev/null 2>&1
if [ -n "$dest_ip" ]; then
nft insert rule inet fw4 openclash_mangle position 0 ip saddr { "$dest_ip" } tcp sport "$dest_port" counter return >/dev/null 2>&1
nft insert rule inet fw4 openclash_mangle position 0 ip saddr { "$dest_ip" } tcp dport "$src_dport" counter return >/dev/null 2>&1
fi
fi
if $e_udp ; then
nft insert rule inet fw4 openclash_mangle_output position 0 ip saddr { "$dest_ip" } udp sport "$dest_port" counter return >/dev/null 2>&1
nft insert rule inet fw4 openclash_mangle_output position 0 ip saddr { "$dest_ip" } udp dport "$src_dport" counter return >/dev/null 2>&1
if [ -n "$dest_ip" ]; then
nft insert rule inet fw4 openclash_mangle position 0 ip saddr { "$dest_ip" } udp sport "$dest_port" counter return >/dev/null 2>&1
nft insert rule inet fw4 openclash_mangle position 0 ip saddr { "$dest_ip" } udp dport "$src_dport" counter return >/dev/null 2>&1
fi
fi
fi
if [ "$ipv6_enable" -eq 1 ]; then
if $e_tcp ; then
if [ -n "$dest_ip" ]; then
nft insert rule inet fw4 openclash_mangle_v6 position 0 ip6 saddr { "$dest_ip" } tcp sport "$dest_port" counter return >/dev/null 2>&1
nft insert rule inet fw4 openclash_mangle_v6 position 0 ip6 saddr { "$dest_ip" } tcp dport "$src_dport" counter return >/dev/null 2>&1
fi
nft insert rule inet fw4 openclash_mangle_output_v6 position 0 ip6 saddr { "$dest_ip" } tcp sport "$dest_port" counter return >/dev/null 2>&1
nft insert rule inet fw4 openclash_mangle_output_v6 position 0 ip6 saddr { "$dest_ip" } tcp dport "$src_dport" counter return >/dev/null 2>&1
fi
if $e_udp ; then
if [ -n "$dest_ip" ]; then
nft insert rule inet fw4 openclash_mangle_v6 position 0 ip6 saddr { "$dest_ip" } udp sport "$dest_port" counter return >/dev/null 2>&1
nft insert rule inet fw4 openclash_mangle_v6 position 0 ip6 saddr { "$dest_ip" } udp dport "$src_dport" counter return >/dev/null 2>&1
fi
nft insert rule inet fw4 openclash_mangle_output_v6 position 0 ip6 saddr { "$dest_ip" } udp sport "$dest_port" counter return >/dev/null 2>&1
nft insert rule inet fw4 openclash_mangle_output_v6 position 0 ip6 saddr { "$dest_ip" } udp dport "$src_dport" counter return >/dev/null 2>&1
fi
fi
else
dest_port=$(echo $dest_port |sed "s/-/:/g" 2>/dev/null) dest_port=$(echo $dest_port |sed "s/-/:/g" 2>/dev/null)
src_dport=$(echo $src_dport |sed "s/-/:/g" 2>/dev/null) src_dport=$(echo $src_dport |sed "s/-/:/g" 2>/dev/null)
dest_ip=$(echo $dest_ip |sed "s/ /,/g" 2>/dev/null) dest_ip=$(echo $dest_ip |sed "s/ /,/g" 2>/dev/null)
@ -1037,7 +1184,7 @@ firewall_redirect_exclude()
ip6tables -t mangle -I openclash_output -p udp "$dest_ip" --dport "$src_dport" -j RETURN >/dev/null 2>&1 ip6tables -t mangle -I openclash_output -p udp "$dest_ip" --dport "$src_dport" -j RETURN >/dev/null 2>&1
fi fi
fi fi
fi
} }
set_firewall() set_firewall()
@ -1052,7 +1199,8 @@ if [ -z "$(uci -q get firewall.openclash)" ] || [ -z "$(uci -q get ucitrack.@ope
uci -q set firewall.openclash=include uci -q set firewall.openclash=include
uci -q set firewall.openclash.type=script uci -q set firewall.openclash.type=script
uci -q set firewall.openclash.path=/var/etc/openclash.include uci -q set firewall.openclash.path=/var/etc/openclash.include
uci -q set firewall.openclash.reload=1 [ -n "$FW4" ] || uci -q set firewall.openclash.reload=1
uci -q commit firewall
fi fi
mkdir -p /var/etc mkdir -p /var/etc
@ -1060,6 +1208,500 @@ cat > "/var/etc/openclash.include" <<-EOF
/etc/init.d/openclash reload "firewall" >/dev/null 2>&1 /etc/init.d/openclash reload "firewall" >/dev/null 2>&1
EOF EOF
local settype nftflag
if dnsmasq --version | grep -q 'Compile time options:.* nftset'; then
settype="nftset"
nftflag="inet#fw4#"
else
settype="ipset"
fi
if [ -n "$FW4" ]; then
if [ "$china_ip_route" = "1" ] || [ "$disable_udp_quic" = "1" ]; then
nft 'flush set inet fw4 china_ip_route'
nft -f '/etc/openclash/china_ip_route.ipset' 2>/dev/null
CHNROUTE_WAIT=0
while ( [ -z "$(nft list sets |grep "set china_ip_route {")" ] && [ "$CHNROUTE_WAIT" -le 3 ] )
do
nft -f '/etc/openclash/china_ip_route.ipset' 2>/dev/null
done
mkdir -p /tmp/dnsmasq.d 2>/dev/null
echo "add set inet fw4 china_ip_route_pass { type ipv4_addr; flags interval; auto-merge; }" >>/tmp/openclash_china_ip_route_pass.list
[ -z `(awk '!/^$/&&!/^#/&&/(^([1-9]|1[0-9]|1[1-9]{2}|2[0-4][0-9]|25[0-5])\.)(([0-9]{1,2}|1[1-9]{2}|2[0-4][0-9]|25[0-5])\.){2}([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-5][0-9]|25[0-4])((\/[0-9][0-9])?)$/{printf(" %s,'" "'\n",$0)}' /etc/openclash/custom/openclash_custom_chnroute_pass.list)` ] || {
echo "define china_ip_route_pass = {" >/tmp/openclash_china_ip_route_pass.list
awk '!/^$/&&!/^#/&&/(^([1-9]|1[0-9]|1[1-9]{2}|2[0-4][0-9]|25[0-5])\.)(([0-9]{1,2}|1[1-9]{2}|2[0-4][0-9]|25[0-5])\.){2}([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-5][0-9]|25[0-4])((\/[0-9][0-9])?)$/{printf(" %s,'" "'\n",$0)}' /etc/openclash/custom/openclash_custom_chnroute_pass.list >>/tmp/openclash_china_ip_route_pass.list 2>/dev/null
echo "}" >>/tmp/openclash_china_ip_route_pass.list
echo 'add element inet fw4 china_ip_route_pass $china_ip_route_pass' >>/tmp/openclash_china_ip_route_pass.list
}
awk '!/^$/&&!/^#/&&!/(^([1-9]|1[0-9]|1[1-9]{2}|2[0-4][0-9]|25[0-5])\.)(([0-9]{1,2}|1[1-9]{2}|2[0-4][0-9]|25[0-5])\.){2}([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-5][0-9]|25[0-4])((\/[0-9][0-9])?)$/{printf("'${settype}'=/%s/'${nftflag}'china_ip_route_pass'" "'\n",$0)}' /etc/openclash/custom/openclash_custom_chnroute_pass.list >>/tmp/dnsmasq.d/dnsmasq_openclash_chnroute_pass.conf 2>/dev/null
nft 'flush set inet fw4 china_ip_route_pass' 2>/dev/null
nft -f '/tmp/openclash_china_ip_route_pass.list' 2>/dev/null
rm -rf /tmp/openclash_china_ip_route_pass.list 2>/dev/null
fi
if [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(nft list chain inet fw4 dstnat |grep 'OpenClash DNS Hijack')"]; then
DNSPORT=$(uci -q get dhcp.@dnsmasq[0].port)
if [ -z "$DNSPORT" ]; then
DNSPORT=$(netstat -nlp |grep -E '127.0.0.1:.*dnsmasq' |awk -F '127.0.0.1:' '{print $2}' |awk '{print $1}' |head -1 || echo "$dns_port")
fi
nft insert rule inet fw4 dstnat position 0 tcp dport 53 redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft insert rule inet fw4 dstnat position 0 udp dport 53 redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
fi
#lan_google_dns_ac
if [ -n "$(uci -q get openclash.config.lan_block_google_dns_ips)" ]; then
nft 'add set inet fw4 lan_block_google_dns_ips { type ipv4_addr; flags interval; auto-merge; }' 2>/dev/null
nft 'add set inet fw4 lan_block_google_dns_ipv6s { type ipv6_addr; flags interval; auto-merge; }' 2>/dev/null
config_load "openclash"
config_list_foreach "config" "lan_block_google_dns_ips" nft_ac_add "lan_block_google_dns_ips" "lan_block_google_dns_ipv6s"
fi
if [ -n "$(uci -q get openclash.config.lan_block_google_dns_macs)" ]; then
nft 'add set inet fw4 lan_block_google_dns_macs { type ether_addr; }' 2>/dev/null
config_load "openclash"
config_list_foreach "config" "lan_block_google_dns_macs" nft_ac_add "lan_block_google_dns_macs"
fi
#lan_ac
if [ "$operation_mode" = "redir-host" ] && [ "$en_mode" = "redir-host" ]; then
if [ "$lan_ac_mode" = "0" ]; then
if [ -n "$(uci -q get openclash.config.lan_ac_black_ips)" ]; then
nft 'add set inet fw4 lan_ac_black_ips { type ipv4_addr; flags interval; auto-merge; }' 2>/dev/null
nft 'add set inet fw4 lan_ac_black_ipv6s { type ipv6_addr; flags interval; auto-merge; }' 2>/dev/null
config_load "openclash"
config_list_foreach "config" "lan_ac_black_ips" nft_ac_add "lan_ac_black_ips" "lan_ac_black_ipv6s"
fi
if [ -n "$(uci -q get openclash.config.lan_ac_black_macs)" ]; then
nft 'add set inet fw4 lan_ac_black_macs { type ether_addr; }' 2>/dev/null
config_load "openclash"
config_list_foreach "config" "lan_ac_black_macs" nft_ac_add "lan_ac_black_macs"
fi
elif [ "$lan_ac_mode" = "1" ]; then
if [ -n "$(uci -q get openclash.config.lan_ac_white_ips)" ]; then
nft 'add set inet fw4 lan_ac_white_ips { type ipv4_addr; flags interval; auto-merge; }' 2>/dev/null
nft 'add set inet fw4 lan_ac_white_ipv6s { type ipv6_addr; flags interval; auto-merge; }' 2>/dev/null
config_load "openclash"
config_list_foreach "config" "lan_ac_white_ips" nft_ac_add "lan_ac_white_ips" "lan_ac_white_ipv6s"
fi
if [ -n "$(uci -q get openclash.config.lan_ac_white_macs)" ]; then
nft 'add set inet fw4 lan_ac_white_macs { type ether_addr; }' 2>/dev/null
config_load "openclash"
config_list_foreach "config" "lan_ac_white_macs" nft_ac_add "lan_ac_white_macs"
fi
fi
fi
#wan ac
if [ -n "$(uci -q get openclash.config.wan_ac_black_ips)" ]; then
nft 'add set inet fw4 wan_ac_black_ips { type ipv4_addr; flags interval; auto-merge; }' 2>/dev/null
nft 'add set inet fw4 wan_ac_black_ipv6s { type ipv6_addr; flags interval; auto-merge; }' 2>/dev/null
config_load "openclash"
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; }' 2>/dev/null
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'
if [ -f "/etc/openclash/custom/openclash_custom_localnetwork_ipv4.list" ]; then
for line in `cat "/etc/openclash/custom/openclash_custom_localnetwork_ipv4.list"`
do
nft add element inet fw4 localnetwork { "$line" } 2>/dev/null
done 2>/dev/null
else
nft 'add element inet fw4 localnetwork { 0.0.0.0/8, 127.0.0.0/8, 10.0.0.0/8, 169.254.0.0/16, 192.168.0.0/16, 224.0.0.0/4, 240.0.0.0/4, 172.16.0.0/12, 100.64.0.0/10}'
fi
if [ -n "$lan_ip_cidrs" ]; then
for lan_ip_cidr in $lan_ip_cidrs; do
nft add element inet fw4 localnetwork { "$lan_ip_cidr" } 2>/dev/null
done
fi
if [ -n "$wan_ip4s" ]; then
for wan_ip4 in $wan_ip4s; do
nft add element inet fw4 localnetwork { "$wan_ip4" } 2>/dev/null
done
fi
#common ports
if [ "$common_ports" = "1" ]; then
common_port="21 22 23 53 80 123 143 194 443 465 587 853 993 995 998 2052 2053 2082 2083 2086 2095 2096 5222 5228 5229 5230 8080 8443 8880 8888 8889"
nft 'add set inet fw4 common_ports { type inet_service; }'
for i in $common_port; do
nft add element inet fw4 common_ports { "$i" }
done
fi
#bypass gateway compatible
if [ "$bypass_gateway_compatible" -eq 1 ]; then
#nft 'delete chain inet fw4 openclash_post' 2>/dev/null
nft 'add chain inet fw4 openclash_post' 2>/dev/null
nft 'flush chain inet fw4 openclash_post' 2>/dev/null
nft add rule inet fw4 openclash_post meta mark "$PROXY_FWMARK" counter accept 2>/dev/null
nft 'add rule inet fw4 openclash_post ip daddr @localnetwork counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_post meta nfproto {ipv4} fib saddr type != { local } meta skuid != 65534 counter masquerade' 2>/dev/null
nft add rule inet fw4 srcnat meta nfproto {ipv4} counter jump openclash_post comment \"OpenClash Bypass Gateway Compatible\" 2>/dev/null
fi
#intranet allowed
if [ "$intranet_allowed" -eq 1 ]; then
wan_ints=$(nft list chain inet fw4 input |grep -e "jump input_wan" 2>/dev/null |awk '{for (i=1;i<=NF;i++) {if ($i ~ /iifname/) {print $(i+1)}}}' 2>/dev/null |sed 's/"//g')
if [ -n "$wan_ints" ]; then
nft 'add chain inet fw4 openclash_wan_input' 2>/dev/null
nft 'flush chain inet fw4 openclash_wan_input' 2>/dev/null
for wan_int in $wan_ints; do
#nft delete rule inet fw4 input $(nft -a list chain inet fw4 input |grep "@localnetwork" |awk -F '# ' '{print$2}')
nft insert rule inet fw4 input position 0 iifname "$wan_int" ip saddr != @localnetwork counter jump openclash_wan_input 2>/dev/null
done
nft add rule inet fw4 openclash_wan_input udp dport {$proxy_port,$tproxy_port,$cn_port,$http_port,$socks_port,$mixed_port,$dns_port} counter reject
nft add rule inet fw4 openclash_wan_input tcp dport {$proxy_port,$tproxy_port,$cn_port,$http_port,$socks_port,$mixed_port,$dns_port} counter reject
fi
fi
if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 2 ]; then
#tcp
nft 'add chain inet fw4 openclash' 2>/dev/null
nft 'flush chain inet fw4 openclash' 2>/dev/null
nft 'add rule inet fw4 openclash ip daddr @localnetwork counter return' 2>/dev/null
if [ -z "$en_mode_tun" ] && [ "$en_mode" = "fake-ip" ]; then
nft add rule inet fw4 openclash ip protocol tcp ip daddr {198.18.0.0/16} counter redirect to "$proxy_port" 2>/dev/null
fi
nft 'add rule inet fw4 openclash ip saddr @localnetwork tcp sport @lan_ac_black_ports counter return' 2>/dev/null
nft 'add rule inet fw4 openclash ip daddr @wan_ac_black_ips counter return' 2>/dev/null
nft 'add rule inet fw4 openclash ip saddr @lan_ac_black_ips counter return' 2>/dev/null
nft 'add rule inet fw4 openclash ether saddr @lan_ac_black_macs counter return' 2>/dev/null
nft 'add rule inet fw4 openclash ether saddr != @lan_ac_white_macs counter return' 2>/dev/null
nft 'add rule inet fw4 openclash ip saddr != @lan_ac_white_ips counter return' 2>/dev/null
if [ "$en_mode" = "redir-host" ]; then
nft 'add rule inet fw4 openclash tcp dport != @common_ports counter return' 2>/dev/null
if [ "$china_ip_route" = "1" ]; then
nft 'add rule inet fw4 openclash ip daddr @china_ip_route ip daddr != @china_ip_route_pass counter return' 2>/dev/null
fi
fi
nft add rule inet fw4 openclash ip protocol tcp counter redirect to "$proxy_port" 2>/dev/null
nft 'add rule inet fw4 dstnat ip protocol tcp counter jump openclash' 2>/dev/null
if [ -z "$en_mode_tun" ]; then
#Google dns
nft insert rule inet fw4 dstnat position 0 ip daddr { 8.8.8.8, 8.8.4.4 } tcp dport 53 counter redirect to "$proxy_port" comment \"OpenClash Google DNS Hijack\" 2>/dev/null
#udp
if [ "$enable_udp_proxy" -eq 1 ]; then
modprobe nft_tproxy >/dev/null 2>&1
ip rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE"
ip route add local 0.0.0.0/0 dev lo table "$PROXY_ROUTE_TABLE"
nft 'add chain inet fw4 openclash_mangle' 2>/dev/null
nft 'flush chain inet fw4 openclash_mangle' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle ip daddr @localnetwork counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle udp dport 53 counter return' 2>/dev/null
if [ "$en_mode" = "fake-ip" ]; then
nft add rule inet fw4 openclash_mangle meta l4proto { udp } ip daddr {198.18.0.0/16} mark set "$PROXY_FWMARK" tproxy ip to 127.0.0.1:"$tproxy_port" counter accept 2>/dev/null
fi
nft 'add rule inet fw4 openclash_mangle ip saddr @localnetwork udp sport @lan_ac_black_ports counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle ip daddr @wan_ac_black_ips counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle ip saddr @lan_ac_black_ips counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle ether saddr @lan_ac_black_macs counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle ether saddr != @lan_ac_white_macs counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle ip saddr != @lan_ac_white_ips counter return' 2>/dev/null
if [ "$en_mode" = "redir-host" ]; then
nft 'add rule inet fw4 openclash_mangle udp dport != @common_ports counter return' 2>/dev/null
if [ "$china_ip_route" = "1" ]; then
nft 'add rule inet fw4 openclash_mangle ip daddr @china_ip_route ip daddr != @china_ip_route_pass counter return' 2>/dev/null
fi
fi
nft add rule inet fw4 openclash_mangle meta l4proto { udp } mark set "$PROXY_FWMARK" tproxy ip to 127.0.0.1:"$tproxy_port" counter accept 2>/dev/null
nft 'add rule inet fw4 mangle_prerouting ip protocol udp counter jump openclash_mangle' 2>/dev/null
elif [ "$en_mode" = "fake-ip" ]; then
modprobe nft_tproxy >/dev/null 2>&1
ip rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE"
ip route add local 0.0.0.0/0 dev lo table "$PROXY_ROUTE_TABLE"
nft 'add chain inet fw4 openclash_mangle' 2>/dev/null
nft 'flush chain inet fw4 openclash_mangle' 2>/dev/null
nft add rule inet fw4 openclash_mangle meta l4proto { udp } ip daddr {198.18.0.0/16} mark set "$PROXY_FWMARK" tproxy ip to 127.0.0.1:"$tproxy_port" counter accept 2>/dev/null
nft 'add rule inet fw4 mangle_prerouting ip protocol udp counter jump openclash_mangle' 2>/dev/null
nft 'add chain inet fw4 openclash_mangle_output' 2>/dev/null
nft 'flush chain inet fw4 openclash_mangle_output' 2>/dev/null
nft add rule inet fw4 openclash_mangle_output meta l4proto { udp } ip daddr {198.18.0.0/16} mark set "$PROXY_FWMARK" 2>/dev/null
nft 'add rule inet fw4 mangle_output ip protocol udp counter jump openclash_mangle_output' 2>/dev/null
fi
#quic
if [ "$disable_udp_quic" -eq 1 ]; then
nft insert rule inet fw4 input position 0 udp dport 443 ip daddr != @china_ip_route counter reject comment \"OpenClash QUIC REJECT\" 2>/dev/null
fi
fi
nft 'add chain inet fw4 openclash_output' 2>/dev/null
nft 'flush chain inet fw4 openclash_output' 2>/dev/null
nft 'add rule inet fw4 openclash_output ip daddr @localnetwork counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_output ip saddr @localnetwork tcp sport @lan_ac_black_ports counter return' 2>/dev/null
if [ "$en_mode" = "fake-ip" ]; then
nft add rule inet fw4 openclash_output ip protocol tcp ip daddr {198.18.0.0/16} skuid != 65534 counter redirect to "$proxy_port" 2>/dev/null
fi
nft add rule inet fw4 openclash_output tcp dport != @common_ports skuid != 65534 counter return 2>/dev/null
if [ "$en_mode" = "redir-host" ]; then
nft 'add rule inet fw4 openclash_output ip daddr @wan_ac_black_ips counter return' 2>/dev/null
if [ "$china_ip_route" = "1" ]; then
nft 'add rule inet fw4 openclash_output skuid != 65534 ip daddr @china_ip_route ip daddr != @china_ip_route_pass counter return' 2>/dev/null
fi
fi
nft add rule inet fw4 openclash_output ip protocol tcp skuid != 65534 counter redirect to "$proxy_port" 2>/dev/null
nft 'add chain inet fw4 nat_output { type nat hook output priority -1; }'
nft 'add rule inet fw4 nat_output ip protocol tcp counter jump openclash_output' 2>/dev/null
fi
if [ -n "$en_mode_tun" ]; then
#TUN模式
#启动TUN
TUN_WAIT=0
ip link set utun up
while ( [ -n "$(pidof clash)" ] && [ -z "$(ip route list |grep utun)" ] && [ "$TUN_WAIT" -le 3 ] )
do
ip link set utun up
let TUN_WAIT++
sleep 2
done
ip route replace default dev utun table "$PROXY_ROUTE_TABLE"
ip rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE"
#MTU UP TO 65535
ifconfig utun mtu 65535 >/dev/null 2>&1
#设置防火墙
nft 'add chain inet fw4 openclash_mangle_output' 2>/dev/null
nft 'flush chain inet fw4 openclash_mangle_output' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle_output ip daddr @localnetwork counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle_output ip saddr @localnetwork meta l4proto {tcp,udp} th sport @lan_ac_black_ports counter return' 2>/dev/null
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 {198.18.0.0/16} mark set "$PROXY_FWMARK" 2>/dev/null
nft 'add rule inet fw4 openclash_mangle_output meta l4proto {tcp,udp} th dport != @common_ports skuid != 65534 counter return' 2>/dev/null
nft add rule inet fw4 openclash_mangle_output tcp dport { 0-65535 } skuid != 65534 meta mark set "$PROXY_FWMARK" 2>/dev/null
else
nft add rule inet fw4 openclash_mangle_output skuid != 65534 udp dport { 0-65535 } ip daddr {198.18.0.0/16} meta mark set "$PROXY_FWMARK" 2>/dev/null
fi
elif [ "$en_mode" = "redir-host" ] && [ "$en_mode_tun" -eq 1 ]; then
nft 'add rule inet fw4 openclash_mangle_output ip daddr @wan_ac_black_ips counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle_output meta l4proto {tcp,udp} th dport != @common_ports skuid != 65534 counter return' 2>/dev/null
if [ "$china_ip_route" = "1" ]; then
nft 'add rule inet fw4 openclash_mangle_output skuid != 65534 ip daddr @china_ip_route ip daddr != @china_ip_route_pass counter return' 2>/dev/null
fi
nft add rule inet fw4 openclash_mangle_output tcp dport { 0-65535 } skuid != 65534 meta mark set "$PROXY_FWMARK" 2>/dev/null
fi
nft 'add rule inet fw4 mangle_output meta l4proto {tcp,udp} counter jump openclash_mangle_output' 2>/dev/null
nft 'add chain inet fw4 openclash_mangle' 2>/dev/null
nft 'flush chain inet fw4 openclash_mangle' 2>/dev/null
nft 'add chain inet fw4 openclash_dns_hijack' 2>/dev/null
nft 'flush chain inet fw4 openclash_dns_hijack' 2>/dev/null
#其他流量
nft 'add rule inet fw4 openclash_mangle ip daddr @localnetwork counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle ip saddr @localnetwork meta l4proto {tcp,udp} th sport @lan_ac_black_ports counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle ip daddr @wan_ac_black_ips counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle ip saddr @lan_ac_black_ips counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle ether saddr @lan_ac_black_macs counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle ether saddr != @lan_ac_white_macs counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle ip saddr != @lan_ac_white_ips counter return' 2>/dev/null
if [ "$en_mode" = "redir-host" ]; then
nft 'add rule inet fw4 openclash_mangle meta l4proto {tcp,udp} th dport != @common_ports counter return' 2>/dev/null
if [ "$china_ip_route" = "1" ]; then
nft 'add rule inet fw4 openclash_mangle ip daddr @china_ip_route ip daddr != @china_ip_route_pass counter return' 2>/dev/null
fi
fi
nft add rule inet fw4 openclash_mangle meta l4proto {tcp,udp} th dport { 0-65535 } mark set "$PROXY_FWMARK" 2>/dev/null
if [ "$en_mode_tun" -eq 1 ]; then
nft 'insert rule inet fw4 mangle_prerouting position 0 meta l4proto {tcp,udp} counter jump openclash_mangle' 2>/dev/null
nft insert rule inet fw4 dstnat position 0 meta nfproto {ipv4} tcp dport 53 counter accept comment \"OpenClash TCP DNS Hijack\" 2>/dev/null
else
nft 'insert rule inet fw4 mangle_prerouting position 0 meta nfproto {ipv4} tcp dport 53 counter jump openclash_dns_hijack' 2>/dev/null
nft add rule inet fw4 openclash_dns_hijack meta nfproto {ipv4} tcp dport 53 mark set "$PROXY_FWMARK" comment \"OpenClash TCP DNS Hijack\" 2>/dev/null
nft insert rule inet fw4 dstnat position 0 meta nfproto {ipv4} tcp dport 53 counter accept comment \"OpenClash TCP DNS Hijack\" 2>/dev/null
nft 'insert rule inet fw4 mangle_prerouting position 0 ip protocol udp counter jump openclash_mangle' 2>/dev/null
fi
#TUN FORWORD
nft insert rule inet fw4 forward position 0 meta l4proto {tcp,udp} oifname utun counter accept comment \"OpenClash TUN Forward\" 2>/dev/null
#quic
if [ "$disable_udp_quic" -eq 1 ]; then
nft insert rule inet fw4 forward position 0 oifname utun udp dport 443 ip daddr != @china_ip_route counter reject comment \"OpenClash QUIC REJECT\" 2>/dev/null
fi
fi
#google_dns_block
if [ -n "$(uci -q get openclash.config.lan_block_google_dns_ips)" ] || [ -n "$(uci -q get openclash.config.lan_block_google_dns_macs)" ]; then
nft 'add set inet fw4 openclash_google_dns_ips { type ipv4_addr; flags interval; auto-merge; }'
nft 'add element inet fw4 openclash_google_dns_ips { 8.8.8.8, 8.8.4.4 }'
if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 2 ]; then
nft insert rule inet fw4 dstnat position 0 ip saddr @lan_block_google_dns_ips ip daddr @openclash_google_dns_ips counter accept comment \"OpenClash Google DNS Block\" 2>/dev/null
nft insert rule inet fw4 dstnat position 0 ether saddr @lan_block_google_dns_macs ip daddr @openclash_google_dns_ips counter accept comment \"OpenClash Google DNS Block\" 2>/dev/null
fi
nft insert rule inet fw4 forward position 0 ip saddr @lan_block_google_dns_ips ip daddr @openclash_google_dns_ips counter reject comment \"OpenClash Google DNS Block\" 2>/dev/null
nft insert rule inet fw4 forward position 0 ether saddr @lan_block_google_dns_macs ip daddr @openclash_google_dns_ips counter reject comment \"OpenClash Google DNS Block\" 2>/dev/null
fi
#ipv6
if [ "$ipv6_enable" -eq 1 ]; then
if [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(nft list chain inet fw4 dstnat |grep 'OpenClash DNS Hijack')"]; then
nft insert rule inet fw4 dstnat position 0 meta nfproto {ipv6} tcp dport 53 counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft insert rule inet fw4 dstnat position 0 meta nfproto {ipv6} udp dport 53 counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
fi
if [ "$china_ip6_route" = "1" ] || [ "$disable_udp_quic" = "1" ]; then
nft 'flush set inet fw4 china_ip6_route'
nft -f '/etc/openclash/china_ip6_route.ipset' 2>/dev/null
CHNROUTE_WAIT=0
while ( [ -z "$(nft list sets |grep "set china_ip6_route {")" ] && [ "$CHNROUTE_WAIT" -le 3 ] )
do
nft -f '/etc/openclash/china_ip6_route.ipset' 2>/dev/null
done
mkdir -p /tmp/dnsmasq.d 2>/dev/null
echo "add set inet fw4 china_ip6_route_pass { type ipv6_addr; flags interval; auto-merge; }" >>/tmp/openclash_china_ip6_route_pass.list
[ -z `(awk '!/^$/&&!/^#/&&!/^(\*?\.?)*[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})*$/{printf(" %s,'" "'\n",$0)}' /etc/openclash/custom/openclash_custom_chnroute6_pass.list)` ] || {
echo "define china_ip6_route_pass = {" >/tmp/openclash_china_ip6_route_pass.list
awk '!/^$/&&!/^#/&&!/^(\*?\.?)*[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})*$/{printf(" %s,'" "'\n",$0)}' /etc/openclash/custom/openclash_custom_chnroute6_pass.list >>/tmp/openclash_china_ip6_route_pass.list 2>/dev/null
echo "}" >>/tmp/openclash_china_ip6_route_pass.list
echo 'add element inet fw4 china_ip6_route_pass $china_ip6_route_pass' >>/tmp/openclash_china_ip6_route_pass.list
}
awk '!/^$/&&!/^#/&&/^(\*?\.?)*[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})*$/{printf("'${settype}'=/%s/'${nftflag}'china_ip6_route_pass'" "'\n",$0)}' /etc/openclash/custom/openclash_custom_chnroute6_pass.list >>/tmp/dnsmasq.d/dnsmasq_openclash_chnroute6_pass.conf 2>/dev/null
nft 'flush set inet fw4 china_ip6_route_pass' 2>/dev/null
nft -f '/tmp/openclash_china_ip6_route_pass.list' 2>/dev/null
rm -rf /tmp/openclash_china_ip6_route_pass.list 2>/dev/null
fi
#local
nft 'add set inet fw4 localnetwork6 { type ipv6_addr; flags interval; auto-merge; }'
#nft 'delete set inet fw4 localnetwork6'
if [ -f "/etc/openclash/custom/openclash_custom_localnetwork_ipv6.list" ]; then
for line in `cat "/etc/openclash/custom/openclash_custom_localnetwork_ipv6.list"`
do
nft add element inet fw4 localnetwork6 { "$line" } 2>/dev/null
done 2>/dev/null
else
nft 'add element inet fw4 localnetwork6 { ::/128, ::1/128, ::ffff:0:0/96, ::ffff:0:0:0/96, 64:ff9b::/96, 100::/64, 2001::/32, 2001:20::/28, 2001:db8::/32, 2002::/16, fc00::/7, fe80::/10, ff00::/8}'
fi
if [ -n "$lan_ip6_cidrs" ]; then
for lan_ip6_cidr in $lan_ip6_cidrs; do
nft add element inet fw4 localnetwork6 { "$lan_ip6_cidr" } 2>/dev/null
done
fi
if [ -n "$wan_ip6s" ]; then
for wan_ip6 in $wan_ip6s; do
nft add element inet fw4 localnetwork6 { "$wan_ip6" } 2>/dev/null
done
fi
modprobe nft_tproxy >/dev/null 2>&1
ip -6 rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE"
ip -6 route add local ::/0 dev lo table "$PROXY_ROUTE_TABLE"
#Google dns
nft insert rule inet fw4 dstnat position 0 ip6 daddr { 2001:4860:4860::8888, 2001:4860:4860::8844 } tcp dport 53 counter accept comment \"OpenClash Google DNS Hijack\" 2>/dev/null
nft 'add chain inet fw4 openclash_mangle_v6' 2>/dev/null
nft 'flush chain inet fw4 openclash_mangle_v6' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle_v6 ip6 daddr @localnetwork6 counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle_v6 meta nfproto {ipv6} udp dport 53 counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle_v6 ip6 saddr @localnetwork6 meta nfproto {ipv6} sport @lan_ac_black_ports counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle_v6 ip6 daddr @wan_ac_black_ipv6s counter return' 2>/dev/null
if [ "$en_mode" == "redir-host" ]; then
nft 'add rule inet fw4 openclash_mangle_v6 meta nfproto {ipv6} th dport != @common_ports counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle_v6 ip6 saddr @lan_ac_black_ipv6s counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle_v6 ether saddr @lan_ac_black_macs counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle_v6 ether saddr != @lan_ac_white_macs counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle_v6 ip6 saddr != @lan_ac_white_ipv6s counter return' 2>/dev/null
fi
if [ "$china_ip6_route" = "1" ]; then
nft 'add rule inet fw4 openclash_mangle_v6 ip6 daddr @china_ip6_route ip6 daddr != @china_ip6_route_pass counter return' 2>/dev/null
fi
nft add rule inet fw4 openclash_mangle_v6 meta nfproto {ipv6} tcp dport { 0-65535 } mark set "$PROXY_FWMARK" tproxy ip6 to :"$tproxy_port" counter accept comment \"OpenClash TCP Tproxy\" 2>/dev/null
nft 'add rule inet fw4 mangle_prerouting meta nfproto {ipv6} jump openclash_mangle_v6' 2>/dev/null
if [ -z "$_koolshare" ]; then
nft 'add chain inet fw4 openclash_mangle_output_v6' 2>/dev/null
nft 'flush chain inet fw4 openclash_mangle_output_v6' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle_output_v6 ip6 daddr @localnetwork6 counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle_output_v6 ip6 saddr @localnetwork6 meta nfproto {ipv6} sport @lan_ac_black_ports counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle_output_v6 ip6 daddr @wan_ac_black_ipv6s counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_mangle_output_v6 meta nfproto {ipv6} th dport != @common_ports skuid != 65534 counter return' 2>/dev/null
if [ "$china_ip6_route" = "1" ]; then
nft 'add rule inet fw4 openclash_mangle_output_v6 skuid != 65534 ip6 daddr @china_ip6_route ip6 daddr != @china_ip6_route_pass counter return' 2>/dev/null
fi
nft add rule inet fw4 openclash_mangle_output_v6 meta nfproto {ipv6} skuid != 65534 tcp dport { 0-65535 } mark set "$PROXY_FWMARK" 2>/dev/null
nft 'add rule inet fw4 mangle_output meta nfproto {ipv6} counter jump openclash_mangle_output_v6' 2>/dev/null
fi
#udp
if [ "$enable_udp_proxy" -eq 1 ] || [ -n "$en_mode_tun" ]; then
nft add rule inet fw4 openclash_mangle_v6 meta nfproto {ipv6} udp dport { 0-65535 } mark set "$PROXY_FWMARK" tproxy ip6 to :"$tproxy_port" counter accept comment \"OpenClash UDP Tproxy\" 2>/dev/null
fi
#quic
if [ "$disable_udp_quic" -eq 1 ]; then
nft insert rule inet fw4 input position 0 udp dport 443 ip6 daddr != @china_ip6_route counter reject comment \"OpenClash QUIC REJECT\" 2>/dev/null
fi
#bypass gateway compatible
if [ "$bypass_gateway_compatible" -eq 1 ]; then
#nft 'delete chain inet fw4 openclash_post_v6' 2>/dev/null
nft 'add chain inet fw4 openclash_post_v6' 2>/dev/null
nft 'flush chain inet fw4 openclash_post_v6' 2>/dev/null
nft add rule inet fw4 openclash_post_v6 meta nfproto {ipv6} meta mark "$PROXY_FWMARK" counter accept 2>/dev/null
nft 'add rule inet fw4 openclash_post_v6 ip6 daddr @localnetwork6 counter return' 2>/dev/null
nft 'add rule inet fw4 openclash_post_v6 meta nfproto {ipv6} fib saddr type != { local } meta skuid != 65534 counter masquerade' 2>/dev/null
nft add rule inet fw4 srcnat meta nfproto {ipv6} counter jump openclash_post_v6 comment \"OpenClash Bypass Gateway Compatible\" 2>/dev/null
fi
#google_dns_block
if [ -n "$(uci -q get openclash.config.lan_block_google_dns_ips)" ] || [ -n "$(uci -q get openclash.config.lan_block_google_dns_macs)" ]; then
nft 'add set inet fw4 openclash_google_dns_ipv6s { type ipv6_addr; flags interval; auto-merge; }'
nft 'add element inet fw4 openclash_google_dns_ipv6s { 2001:4860:4860::8888, 2001:4860:4860::8844, 2001:4860:4860::6464, 2001:4860:4860::64 }'
nft insert rule inet fw4 dstnat position 0 ip6 saddr @lan_block_google_dns_ipv6s ip6 daddr @openclash_google_dns_ipv6s counter accept comment \"OpenClash Google DNS Block\" 2>/dev/null
nft insert rule inet fw4 dstnat position 0 ether saddr @lan_block_google_dns_macs ip6 daddr @openclash_google_dns_ipv6s counter accept comment \"OpenClash Google DNS Block\" 2>/dev/null
nft insert rule inet fw4 forward position 0 ip6 saddr @lan_block_google_dns_ipv6s ip6 daddr @openclash_google_dns_ipv6s counter reject comment \"OpenClash Google DNS Block\" 2>/dev/null
nft insert rule inet fw4 forward position 0 ether saddr @lan_block_google_dns_macs ip6 daddr @openclash_google_dns_ipv6s counter reject comment \"OpenClash Google DNS Block\" 2>/dev/null
fi
#intranet allowed
if [ "$intranet_allowed" -eq 1 ]; then
wan6_ints=$(nft list chain inet fw4 input |grep -e "jump input_wan" 2>/dev/null |awk '{for (i=1;i<=NF;i++) {if ($i ~ /iifname/) {print $(i+1)}}}' 2>/dev/null |sed 's/"//g')
if [ -n "$wan6_ints" ]; then
nft 'add chain inet fw4 openclash_wan6_input' 2>/dev/null
nft 'flush chain inet fw4 openclash_wan6_input' 2>/dev/null
for wan6_int in $wan6_ints; do
#nft delete rule inet fw4 input $(nft -a list chain inet fw4 input |grep "@localnetwork6" |awk -F '# ' '{print$2}')
nft insert rule inet fw4 input position 0 iifname "$wan6_int" ip6 saddr != @localnetwork6 counter jump openclash_wan6_input 2>/dev/null
done
nft add rule inet fw4 openclash_wan6_input udp dport {$proxy_port,$tproxy_port,$cn_port,$http_port,$socks_port,$mixed_port,$dns_port} counter reject 2>/dev/null
nft add rule inet fw4 openclash_wan6_input tcp dport {$proxy_port,$tproxy_port,$cn_port,$http_port,$socks_port,$mixed_port,$dns_port} counter reject 2>/dev/null
fi
fi
fi 2>/dev/null
else
if [ "$china_ip_route" = "1" ] || [ "$disable_udp_quic" = "1" ]; then if [ "$china_ip_route" = "1" ] || [ "$disable_udp_quic" = "1" ]; then
ipset -! flush china_ip_route 2>/dev/null ipset -! flush china_ip_route 2>/dev/null
ipset -! restore </etc/openclash/china_ip_route.ipset 2>/dev/null ipset -! restore </etc/openclash/china_ip_route.ipset 2>/dev/null
@ -1207,6 +1849,9 @@ if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 2 ]; then
iptables -t nat -N openclash iptables -t nat -N openclash
iptables -t nat -F openclash iptables -t nat -F openclash
iptables -t nat -A openclash -m set --match-set localnetwork dst -j RETURN iptables -t nat -A openclash -m set --match-set localnetwork dst -j RETURN
if [ -z "$en_mode_tun" ] && [ "$en_mode" = "fake-ip" ]; then
iptables -t nat -A openclash -p tcp -d 198.18.0.0/16 -j REDIRECT --to-ports "$proxy_port"
fi
iptables -t nat -A openclash -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN iptables -t nat -A openclash -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN
iptables -t nat -A openclash -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1 iptables -t nat -A openclash -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1
iptables -t nat -A openclash -m set --match-set lan_ac_black_ips src -j RETURN >/dev/null 2>&1 iptables -t nat -A openclash -m set --match-set lan_ac_black_ips src -j RETURN >/dev/null 2>&1
@ -1233,6 +1878,10 @@ if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 2 ]; then
iptables -t mangle -N openclash iptables -t mangle -N openclash
iptables -t mangle -F openclash iptables -t mangle -F openclash
iptables -t mangle -A openclash -m set --match-set localnetwork dst -j RETURN iptables -t mangle -A openclash -m set --match-set localnetwork dst -j RETURN
iptables -t mangle -A openclash -p udp --dport 53 -j RETURN >/dev/null 2>&1
if [ "$en_mode" = "fake-ip" ]; then
iptables -t mangle -A openclash -p udp -d 198.18.0.0/16 -j TPROXY --on-port "$tproxy_port" --tproxy-mark "$PROXY_FWMARK"
fi
iptables -t mangle -A openclash -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN iptables -t mangle -A openclash -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN
iptables -t mangle -A openclash -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1 iptables -t mangle -A openclash -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash -m set --match-set lan_ac_black_macs src -j RETURN >/dev/null 2>&1 iptables -t mangle -A openclash -m set --match-set lan_ac_black_macs src -j RETURN >/dev/null 2>&1
@ -1245,15 +1894,10 @@ if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 2 ]; then
iptables -t mangle -A openclash -m set --match-set china_ip_route dst -m set ! --match-set china_ip_route_pass dst -j RETURN >/dev/null 2>&1 iptables -t mangle -A openclash -m set --match-set china_ip_route dst -m set ! --match-set china_ip_route_pass dst -j RETURN >/dev/null 2>&1
fi fi
fi fi
iptables -t mangle -A openclash -p udp --dport 53 -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash -p udp -j TPROXY --on-port "$tproxy_port" --tproxy-mark "$PROXY_FWMARK" iptables -t mangle -A openclash -p udp -j TPROXY --on-port "$tproxy_port" --tproxy-mark "$PROXY_FWMARK"
iptables -t mangle -A PREROUTING -p udp -j openclash iptables -t mangle -A PREROUTING -p udp -j openclash
#quic
if [ "$disable_udp_quic" -eq 1 ]; then
iptables -I INPUT -p udp --dport 443 -m comment --comment "OpenClash QUIC REJECT" -m set ! --match-set china_ip_route dst -j REJECT >/dev/null 2>&1
fi
elif [ "$en_mode" = "fake-ip" ]; then elif [ "$en_mode" = "fake-ip" ]; then
modprobe xt_TPROXY >/dev/null 2>&1 modprobe xt_TPROXY >/dev/null 2>&1
ip rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE" ip rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE"
@ -1263,21 +1907,26 @@ if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 2 ]; then
iptables -t mangle -A openclash -p udp -d 198.18.0.0/16 -j TPROXY --on-port "$tproxy_port" --tproxy-mark "$PROXY_FWMARK" iptables -t mangle -A openclash -p udp -d 198.18.0.0/16 -j TPROXY --on-port "$tproxy_port" --tproxy-mark "$PROXY_FWMARK"
iptables -t mangle -A PREROUTING -p udp -j openclash iptables -t mangle -A PREROUTING -p udp -j openclash
iptables -t mangle -N openclash_output
iptables -t mangle -F openclash_output
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -p udp -d 198.18.0.0/16 -j MARK --set-mark "$PROXY_FWMARK"
iptables -t mangle -A OUTPUT -p udp -j openclash_output
fi
#quic #quic
if [ "$disable_udp_quic" -eq 1 ]; then if [ "$disable_udp_quic" -eq 1 ]; then
iptables -I INPUT -p udp --dport 443 -m comment --comment "OpenClash QUIC REJECT" -m set ! --match-set china_ip_route dst -j REJECT >/dev/null 2>&1 iptables -I INPUT -p udp --dport 443 -m comment --comment "OpenClash QUIC REJECT" -m set ! --match-set china_ip_route dst -j REJECT >/dev/null 2>&1
fi fi
fi fi
fi
if [ -z "$_koolshare" ]; then if [ -z "$_koolshare" ]; then
iptables -t nat -N openclash_output iptables -t nat -N openclash_output
iptables -t nat -F openclash_output iptables -t nat -F openclash_output
iptables -t nat -A openclash_output -m set --match-set localnetwork dst -j RETURN if [ "$en_mode" = "fake-ip" ] && [ -z "$en_mode_tun" ]; then
iptables -t nat -A openclash_output -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN
if [ "$en_mode" = "fake-ip" ]; then
iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -p tcp -d 198.18.0.0/16 -j REDIRECT --to-ports "$proxy_port" iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -p tcp -d 198.18.0.0/16 -j REDIRECT --to-ports "$proxy_port"
fi fi
iptables -t nat -A openclash_output -m set --match-set localnetwork dst -j RETURN
iptables -t nat -A openclash_output -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN
iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1 iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
if [ "$en_mode" = "redir-host" ]; then if [ "$en_mode" = "redir-host" ]; then
iptables -t nat -A openclash_output -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1 iptables -t nat -A openclash_output -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1
@ -1290,14 +1939,9 @@ if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 2 ]; then
if [ "$en_mode" = "fake-ip" ]; then if [ "$en_mode" = "fake-ip" ]; then
iptables -t nat -N openclash_output iptables -t nat -N openclash_output
iptables -t nat -F openclash_output iptables -t nat -F openclash_output
if [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(iptables -t nat -nL OUTPUT --line-number |grep 'OpenClash DNS Hijack')"]; then
iptables -t nat -I OUTPUT -p udp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack"
iptables -t nat -I OUTPUT -p tcp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack"
fi
iptables -t nat -A openclash_output -m set --match-set localnetwork dst -j RETURN iptables -t nat -A openclash_output -m set --match-set localnetwork dst -j RETURN
iptables -t nat -A openclash_output -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN iptables -t nat -A openclash_output -m set --match-set localnetwork src -m set --match-set lan_ac_black_ports src -j RETURN
iptables -t nat -A openclash_output -p tcp -d 198.18.0.0/16 -j REDIRECT --to-ports "$proxy_port" iptables -t nat -A openclash_output -p tcp -d 198.18.0.0/16 -j REDIRECT --to-ports "$proxy_port"
fi fi
fi fi
iptables -t nat -A OUTPUT -j openclash_output >/dev/null 2>&1 iptables -t nat -A OUTPUT -j openclash_output >/dev/null 2>&1
@ -1472,6 +2116,7 @@ if [ "$ipv6_enable" -eq 1 ] && [ -n "$(ip6tables -t mangle -L 2>&1 | grep -o 'Ch
ip6tables -t mangle -N openclash ip6tables -t mangle -N openclash
ip6tables -t mangle -F openclash ip6tables -t mangle -F openclash
ip6tables -t mangle -A openclash -m set --match-set localnetwork6 dst -j RETURN ip6tables -t mangle -A openclash -m set --match-set localnetwork6 dst -j RETURN
ip6tables -t mangle -A openclash -p udp --dport 53 -j RETURN >/dev/null 2>&1
ip6tables -t mangle -A openclash -m set --match-set localnetwork6 src -m set --match-set lan_ac_black_ports src -j RETURN ip6tables -t mangle -A openclash -m set --match-set localnetwork6 src -m set --match-set lan_ac_black_ports src -j RETURN
ip6tables -t mangle -A openclash -m set --match-set wan_ac_black_ipv6s dst -j RETURN >/dev/null 2>&1 ip6tables -t mangle -A openclash -m set --match-set wan_ac_black_ipv6s dst -j RETURN >/dev/null 2>&1
if [ "$en_mode" == "redir-host" ]; then if [ "$en_mode" == "redir-host" ]; then
@ -1502,9 +2147,8 @@ if [ "$ipv6_enable" -eq 1 ] && [ -n "$(ip6tables -t mangle -L 2>&1 | grep -o 'Ch
fi fi
#udp #udp
if [ "$enable_udp_proxy" -eq 1 ] || [ -n "$en_mode_tun" ]; then if [ "$enable_udp_proxy" -eq 1 ]; then
ip6tables -t mangle -A openclash_output -p udp -m owner ! --uid-owner 65534 -j MARK --set-xmark "$PROXY_FWMARK" ip6tables -t mangle -A openclash -p udp -m comment --comment "OpenClash UDP Tproxy" -j TPROXY --on-port "$tproxy_port" --tproxy-mark "$PROXY_FWMARK"
ip6tables -t mangle -A openclash -p udp -m comment --comment "OpenClash TCP Tproxy" -j TPROXY --on-port "$tproxy_port" --tproxy-mark "$PROXY_FWMARK"
fi fi
#quic #quic
@ -1550,6 +2194,7 @@ if [ "$ipv6_enable" -eq 1 ] && [ -n "$(ip6tables -t mangle -L 2>&1 | grep -o 'Ch
fi fi
fi fi
fi 2>/dev/null fi 2>/dev/null
fi
#端口转发 #端口转发
config_load "firewall" config_load "firewall"
@ -1576,6 +2221,22 @@ revert_firewall()
ip link set dev utun down >/dev/null 2>&1 ip link set dev utun down >/dev/null 2>&1
ip tuntap del utun mode tun >/dev/null 2>&1 ip tuntap del utun mode tun >/dev/null 2>&1
if [ -n "$FW4" ]; then
for nft in "input" "forward" "dstnat" "srcnat" "nat_output" "mangle_prerouting" "mangle_output"; do
local handles=$(nft -a list chain inet fw4 ${nft} |grep -E "openclash|OpenClash" |awk -F '# handle ' '{print$2}')
for handle in $handles; do
nft delete rule inet fw4 ${nft} handle ${handle}
done
done >/dev/null 2>&1
for handle in $(nft -a list chains |grep -E "chain openclash|OpenClash" |awk -F '# handle ' '{print$2}'); do
nft delete chain inet fw4 handle ${handle}
done >/dev/null 2>&1
for handle in $(nft -a list sets |grep -E "set localnetwork|china_ip|lan_ac_|wan_ac_black_|_google_dns_|common_ports" |awk -F '# handle ' '{print$2}'); do
nft delete set inet fw4 handle ${handle}
done >/dev/null 2>&1
else
for ipt in "iptables -nvL INPUT" "iptables -nvL FORWARD" "iptables -nvL POSTROUTING -t nat" "iptables -nvL OUTPUT -t nat" "iptables -nvL OUTPUT -t mangle" "iptables -nvL PREROUTING -t nat" "iptables -nvL PREROUTING -t mangle" "ip6tables -nvL PREROUTING -t mangle" "ip6tables -nvL OUTPUT -t mangle" "ip6tables -nvL PREROUTING -t nat" "ip6tables -nvL INPUT" "ip6tables -nvL POSTROUTING -t nat"; do for ipt in "iptables -nvL INPUT" "iptables -nvL FORWARD" "iptables -nvL POSTROUTING -t nat" "iptables -nvL OUTPUT -t nat" "iptables -nvL OUTPUT -t mangle" "iptables -nvL PREROUTING -t nat" "iptables -nvL PREROUTING -t mangle" "ip6tables -nvL PREROUTING -t mangle" "ip6tables -nvL OUTPUT -t mangle" "ip6tables -nvL PREROUTING -t nat" "ip6tables -nvL INPUT" "ip6tables -nvL POSTROUTING -t nat"; do
for comment in "openclash" "OpenClash"; do for comment in "openclash" "OpenClash"; do
local lines=$($ipt |sed 1,2d |sed -n "/${comment}/=" 2>/dev/null |sort -rn) local lines=$($ipt |sed 1,2d |sed -n "/${comment}/=" 2>/dev/null |sort -rn)
@ -1623,6 +2284,7 @@ revert_firewall()
ipset destroy lan_block_google_dns_ips >/dev/null 2>&1 ipset destroy lan_block_google_dns_ips >/dev/null 2>&1
ipset destroy lan_block_google_dns_macs >/dev/null 2>&1 ipset destroy lan_block_google_dns_macs >/dev/null 2>&1
ipset destroy openclash_google_dns_ips >/dev/null 2>&1 ipset destroy openclash_google_dns_ips >/dev/null 2>&1
fi
} }
get_config() get_config()

View File

@ -129,3 +129,6 @@ shark007.net
#Mijia #Mijia
Mijia Cloud Mijia Cloud
+.dns.google +.dns.google
#招商银行
+.cmbchina.com
+.cmbimg.com

View File

@ -9,7 +9,7 @@ uci -q delete firewall.openclash
uci -q set firewall.openclash=include uci -q set firewall.openclash=include
uci -q set firewall.openclash.type=script uci -q set firewall.openclash.type=script
uci -q set firewall.openclash.path=/var/etc/openclash.include uci -q set firewall.openclash.path=/var/etc/openclash.include
uci -q set firewall.openclash.reload=1 [ -n "$(command -v fw4)" ] || uci -q set firewall.openclash.reload=1
uci -q commit firewall uci -q commit firewall
mkdir -p /etc/openclash/config mkdir -p /etc/openclash/config

View File

@ -24,6 +24,7 @@ dns_port=$(uci -q get openclash.config.dns_port)
enable_redirect_dns=$(uci -q get openclash.config.enable_redirect_dns) enable_redirect_dns=$(uci -q get openclash.config.enable_redirect_dns)
disable_masq_cache=$(uci -q get openclash.config.disable_masq_cache) disable_masq_cache=$(uci -q get openclash.config.disable_masq_cache)
default_resolvfile=$(uci -q get openclash.config.default_resolvfile) default_resolvfile=$(uci -q get openclash.config.default_resolvfile)
FW4="$(command -v fw4)"
if_restart=0 if_restart=0
only_download=0 only_download=0
set_lock set_lock
@ -237,10 +238,28 @@ change_dns()
uci commit dhcp uci commit dhcp
/etc/init.d/dnsmasq restart >/dev/null 2>&1 /etc/init.d/dnsmasq restart >/dev/null 2>&1
fi fi
if [ -n "$FW4" ]; then
for nft in "nat_output" "mangle_output"; do
local handles=$(nft -a list chain inet fw4 ${nft} |grep -E "openclash|OpenClash" |awk -F '# handle ' '{print$2}')
for handle in $handles; do
nft delete rule inet fw4 ${nft} handle ${handle}
done
done >/dev/null 2>&1
echo "$nat_output_rules" |while read line
do >/dev/null 2>&1
nft add rule inet fw4 nat_output ${line}
done
echo "$mangle_output_rules" |while read line
do
nft add rule inet fw4 mangle_output ${line}
done >/dev/null 2>&1
else
iptables -t nat -D OUTPUT -j openclash_output >/dev/null 2>&1 iptables -t nat -D OUTPUT -j openclash_output >/dev/null 2>&1
iptables -t mangle -D OUTPUT -j openclash_output >/dev/null 2>&1 iptables -t mangle -D OUTPUT -j openclash_output >/dev/null 2>&1
iptables -t nat -I OUTPUT -j openclash_output >/dev/null 2>&1 iptables -t nat -A OUTPUT -j openclash_output >/dev/null 2>&1
iptables -t mangle -I OUTPUT -j openclash_output >/dev/null 2>&1 iptables -t mangle -A OUTPUT -j openclash_output >/dev/null 2>&1
fi
[ "$(unify_ps_status "openclash_watchdog.sh")" -eq 0 ] && [ "$(unify_ps_prevent)" -eq 0 ] && nohup /usr/share/openclash/openclash_watchdog.sh & [ "$(unify_ps_status "openclash_watchdog.sh")" -eq 0 ] && [ "$(unify_ps_prevent)" -eq 0 ] && nohup /usr/share/openclash/openclash_watchdog.sh &
fi fi
} }
@ -304,8 +323,19 @@ EOF
uci commit dhcp uci commit dhcp
/etc/init.d/dnsmasq restart >/dev/null 2>&1 /etc/init.d/dnsmasq restart >/dev/null 2>&1
fi fi
if [ -n "$FW4" ]; then
nat_output_rules=$(nft -a list chain inet fw4 nat_output |grep -E "openclash|OpenClash" |awk -F '# handle ' '{print$1}' |sed 's/^[ \t]*//g')
mangle_output_rules=$(nft -a list chain inet fw4 mangle_output |grep -E "openclash|OpenClash" |awk -F '# handle ' '{print$1}' |sed 's/^[ \t]*//g')
for nft in "nat_output" "mangle_output"; do
local handles=$(nft -a list chain inet fw4 ${nft} |grep -E "openclash|OpenClash" |awk -F '# handle ' '{print$2}')
for handle in $handles; do
nft delete rule inet fw4 ${nft} handle ${handle}
done
done >/dev/null 2>&1
else
iptables -t nat -D OUTPUT -j openclash_output >/dev/null 2>&1 iptables -t nat -D OUTPUT -j openclash_output >/dev/null 2>&1
iptables -t mangle -D OUTPUT -j openclash_output >/dev/null 2>&1 iptables -t mangle -D OUTPUT -j openclash_output >/dev/null 2>&1
fi
sleep 3 sleep 3
config_download config_download

View File

@ -2,6 +2,8 @@
. /usr/share/openclash/openclash_ps.sh . /usr/share/openclash/openclash_ps.sh
. /usr/share/openclash/log.sh . /usr/share/openclash/log.sh
FW4="$(command -v fw4)"
set_lock() { set_lock() {
exec 879>"/tmp/lock/openclash_chn.lock" 2>/dev/null exec 879>"/tmp/lock/openclash_chn.lock" 2>/dev/null
flock -x 879 2>/dev/null flock -x 879 2>/dev/null
@ -44,8 +46,16 @@
if [ "$?" -eq "0" ] && [ -s "/tmp/china_ip_route.txt" ]; then if [ "$?" -eq "0" ] && [ -s "/tmp/china_ip_route.txt" ]; then
LOG_OUT "Chnroute Cidr List Download Success, Check Updated..." LOG_OUT "Chnroute Cidr List Download Success, Check Updated..."
#预处理 #预处理
if [ -n "$FW4" ]; then
echo "define china_ip_route = {" >/tmp/china_ip_route.list
awk '!/^$/&&!/^#/{printf(" %s,'" "'\n",$0)}' /tmp/china_ip_route.txt >>/tmp/china_ip_route.list
echo "}" >>/tmp/china_ip_route.list
echo "add set inet fw4 china_ip_route { type ipv4_addr; flags interval; auto-merge; }" >>/tmp/china_ip_route.list
echo 'add element inet fw4 china_ip_route $china_ip_route' >>/tmp/china_ip_route.list
else
echo "create china_ip_route hash:net family inet hashsize 1024 maxelem 1000000" >/tmp/china_ip_route.list echo "create china_ip_route hash:net family inet hashsize 1024 maxelem 1000000" >/tmp/china_ip_route.list
awk '!/^$/&&!/^#/{printf("add china_ip_route %s'" "'\n",$0)}' /tmp/china_ip_route.txt >>/tmp/china_ip_route.list awk '!/^$/&&!/^#/{printf("add china_ip_route %s'" "'\n",$0)}' /tmp/china_ip_route.txt >>/tmp/china_ip_route.list
fi
cmp -s /tmp/china_ip_route.list "$chnr_path" cmp -s /tmp/china_ip_route.list "$chnr_path"
if [ "$?" -ne "0" ]; then if [ "$?" -ne "0" ]; then
LOG_OUT "Chnroute Cidr List Has Been Updated, Starting To Replace The Old Version..." LOG_OUT "Chnroute Cidr List Has Been Updated, Starting To Replace The Old Version..."
@ -74,8 +84,16 @@
if [ "$?" -eq "0" ] && [ -s "/tmp/china_ip6_route.txt" ]; then if [ "$?" -eq "0" ] && [ -s "/tmp/china_ip6_route.txt" ]; then
LOG_OUT "Chnroute6 Cidr List Download Success, Check Updated..." LOG_OUT "Chnroute6 Cidr List Download Success, Check Updated..."
#预处理 #预处理
if [ -n "$FW4" ]; then
echo "define china_ip6_route = {" >/tmp/china_ip6_route.list
awk '!/^$/&&!/^#/{printf(" %s,'" "'\n",$0)}' /tmp/china_ip6_route.txt >>/tmp/china_ip6_route.list
echo "}" >>/tmp/china_ip6_route.list
echo "add set inet fw4 china_ip6_route { type ipv6_addr; flags interval; auto-merge; }" >>/tmp/china_ip6_route.list
echo 'add element inet fw4 china_ip6_route $china_ip6_route' >>/tmp/china_ip6_route.list
else
echo "create china_ip6_route hash:net family inet6 hashsize 1024 maxelem 1000000" >/tmp/china_ip6_route.list echo "create china_ip6_route hash:net family inet6 hashsize 1024 maxelem 1000000" >/tmp/china_ip6_route.list
awk '!/^$/&&!/^#/{printf("add china_ip6_route %s'" "'\n",$0)}' /tmp/china_ip6_route.txt >>/tmp/china_ip6_route.list awk '!/^$/&&!/^#/{printf("add china_ip6_route %s'" "'\n",$0)}' /tmp/china_ip6_route.txt >>/tmp/china_ip6_route.list
fi
cmp -s /tmp/china_ip6_route.list "$chnr6_path" cmp -s /tmp/china_ip6_route.list "$chnr6_path"
if [ "$?" -ne "0" ]; then if [ "$?" -ne "0" ]; then
LOG_OUT "Chnroute6 Cidr List Has Been Updated, Starting To Replace The Old Version..." LOG_OUT "Chnroute6 Cidr List Has Been Updated, Starting To Replace The Old Version..."

View File

@ -109,10 +109,6 @@ curl: $(ts_re "$(opkg status curl 2>/dev/null |grep 'Status' |awk -F ': ' '{prin
ca-certificates: $(ts_re "$(opkg status ca-certificates 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)") 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)") ip-full: $(ts_re "$(opkg status ip-full 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
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)")
libcap: $(ts_re "$(opkg status libcap 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)") 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: $(ts_re "$(opkg status ruby 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
@ -120,9 +116,24 @@ ruby-yaml: $(ts_re "$(opkg status ruby-yaml 2>/dev/null |grep 'Status' |awk -F '
ruby-psych: $(ts_re "$(opkg status ruby-psych 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)") 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)") 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)") 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)") 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)") unzip: $(ts_re "$(opkg status unzip 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
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)")
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)")
EOF
fi
EOF EOF
#core #core
@ -285,7 +296,7 @@ sed -i '/^ \{0,\}secret:/d' "$DEBUG_LOG" 2>/dev/null
#firewall #firewall
cat >> "$DEBUG_LOG" <<-EOF cat >> "$DEBUG_LOG" <<-EOF
#===================== 防火墙设置 =====================# #===================== IPTABLES 防火墙设置 =====================#
#IPv4 NAT chain #IPv4 NAT chain
@ -327,6 +338,17 @@ cat >> "$DEBUG_LOG" <<-EOF
EOF EOF
ip6tables-save -t filter >> "$DEBUG_LOG" 2>/dev/null ip6tables-save -t filter >> "$DEBUG_LOG" 2>/dev/null
if [ -n "$(command -v fw4)" ]; then
cat >> "$DEBUG_LOG" <<-EOF
#===================== NFTABLES 防火墙设置 =====================#
EOF
for nft in "input" "forward" "dstnat" "srcnat" "nat_output" "mangle_prerouting" "mangle_output"; do
nft list chain inet fw4 dstnat >> "$DEBUG_LOG" 2>/dev/null
done >/dev/null 2>&1
fi
cat >> "$DEBUG_LOG" <<-EOF cat >> "$DEBUG_LOG" <<-EOF
#===================== IPSET状态 =====================# #===================== IPSET状态 =====================#

View File

@ -111,6 +111,8 @@ function unlock_auto_select()
key_group = uci:get("openclash", "config", "stream_auto_select_group_key_discovery_plus") or "discovery" key_group = uci:get("openclash", "config", "stream_auto_select_group_key_discovery_plus") or "discovery"
elseif type == "Bilibili" then elseif type == "Bilibili" then
key_group = uci:get("openclash", "config", "stream_auto_select_group_key_bilibili") or "bilibili" key_group = uci:get("openclash", "config", "stream_auto_select_group_key_bilibili") or "bilibili"
elseif type == "Google" then
key_group = uci:get("openclash", "config", "stream_auto_select_group_key_google_not_cn") or "google|谷歌"
end end
if not key_group then key_group = type end if not key_group then key_group = type end
else else
@ -210,10 +212,10 @@ function unlock_auto_select()
value.all = nodes_filter(value.all, info) value.all = nodes_filter(value.all, info)
if select_logic == "random" then if select_logic == "random" then
--sort by random --sort by random
value.all = table_rand(value.all) value.all = table_rand(value.all, proxy_default)
else else
--sort by urltest --sort by urltest
value.all = table_sort_by_urltest(value.all) value.all = table_sort_by_urltest(value.all, proxy_default)
end end
end end
if #(value.all) == 0 then if #(value.all) == 0 then
@ -507,7 +509,7 @@ function datamatch(data, regex)
if result == "true" then return true else return false end if result == "true" then return true else return false end
end end
function table_rand(t) function table_rand(t, d)
if t == nil then if t == nil then
return return
end end
@ -516,16 +518,19 @@ function table_rand(t)
while #t ~= 0 do while #t ~= 0 do
local n = math.random(0, #t) local n = math.random(0, #t)
if t[n] ~= nil then if t[n] ~= nil then
if d ~= nil and table_include(groups, d) and d == t[n] then
table.insert(tab, 1, t[n])
else
table.insert(tab, t[n]) table.insert(tab, t[n])
end
table.remove(t, n) table.remove(t, n)
end end
end end
return tab return tab
end end
function table_sort_by_urltest(t) function table_sort_by_urltest(t, d)
local info, get_delay, group_delay local info, get_delay, group_delay
local count = 1
local tab = {} local tab = {}
local result = {} local result = {}
@ -577,8 +582,12 @@ function table_sort_by_urltest(t)
end) end)
for _, value in pairs(tab) do for _, value in pairs(tab) do
if d ~= nil and table_include(groups, d) and d == value[1] then
table.insert(result, 1, value[1])
else
table.insert(result, value[1]) table.insert(result, value[1])
end end
end
return result return result
end end
@ -666,6 +675,8 @@ function nodes_filter(t, info)
regex = uci:get("openclash", "config", "stream_auto_select_node_key_discovery_plus") or "" regex = uci:get("openclash", "config", "stream_auto_select_node_key_discovery_plus") or ""
elseif type == "Bilibili" then elseif type == "Bilibili" then
regex = uci:get("openclash", "config", "stream_auto_select_node_key_bilibili") or "" regex = uci:get("openclash", "config", "stream_auto_select_node_key_bilibili") or ""
elseif type == "Google" then
regex = uci:get("openclash", "config", "stream_auto_select_node_key_google_not_cn") or ""
end end
if class_type(t) == "table" then if class_type(t) == "table" then
@ -725,6 +736,8 @@ function proxy_unlock_test()
region = discovery_plus_unlock_test() region = discovery_plus_unlock_test()
elseif type == "Bilibili" then elseif type == "Bilibili" then
region = bilibili_unlock_test() region = bilibili_unlock_test()
elseif type == "Google" then
region = google_not_cn_test()
end end
return region return region
end end
@ -756,6 +769,8 @@ function auto_get_policy_group(passwd, ip, port)
luci.sys.call('curl -sL -m 5 --limit-rate 1k -o /dev/null https://www.discoveryplus.com/ &') luci.sys.call('curl -sL -m 5 --limit-rate 1k -o /dev/null https://www.discoveryplus.com/ &')
elseif type == "Bilibili" then elseif type == "Bilibili" then
luci.sys.call('curl -sL -m 5 --limit-rate 1k -o /dev/null https://www.bilibili.com/ &') luci.sys.call('curl -sL -m 5 --limit-rate 1k -o /dev/null https://www.bilibili.com/ &')
elseif type == "Google" then
luci.sys.call('curl -sL -m 5 --limit-rate 1k -o /dev/null https://timeline.google.com &')
end end
os.execute("sleep 1") os.execute("sleep 1")
con = luci.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)) con = luci.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))
@ -824,6 +839,11 @@ function auto_get_policy_group(passwd, ip, port)
auto_get_group = con.connections[i].chains[#(con.connections[i].chains)] auto_get_group = con.connections[i].chains[#(con.connections[i].chains)]
break break
end end
elseif type == "Google" then
if string.match(con.connections[i].metadata.host, "timeline%.google%.com") then
auto_get_group = con.connections[i].chains[#(con.connections[i].chains)]
break
end
end end
end end
end end
@ -1391,4 +1411,21 @@ function bilibili_unlock_test()
end end
end end
function google_not_cn_test()
status = 0
local url = "https://timeline.google.com"
local region
local httpcode = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{http_code} -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' '%s'", UA, url))
if httpcode then
if tonumber(httpcode) == 200 then
status = 2
region = "NOT CN"
else
region = "CN"
status = 1
end
return region
end
end
unlock_auto_select() unlock_auto_select()

View File

@ -6,6 +6,7 @@ CLASH_CONFIG="/etc/openclash"
LOG_FILE="/tmp/openclash.log" LOG_FILE="/tmp/openclash.log"
PROXY_FWMARK="0x162" PROXY_FWMARK="0x162"
PROXY_ROUTE_TABLE="0x162" PROXY_ROUTE_TABLE="0x162"
ipv6_enable=$(uci -q get openclash.config.ipv6_enable)
enable_redirect_dns=$(uci -q get openclash.config.enable_redirect_dns) enable_redirect_dns=$(uci -q get openclash.config.enable_redirect_dns)
dns_port=$(uci -q get openclash.config.dns_port) dns_port=$(uci -q get openclash.config.dns_port)
disable_masq_cache=$(uci -q get openclash.config.disable_masq_cache) disable_masq_cache=$(uci -q get openclash.config.disable_masq_cache)
@ -23,6 +24,7 @@ CRASH_NUM=0
CFG_UPDATE_INT=1 CFG_UPDATE_INT=1
STREAM_DOMAINS_PREFETCH=1 STREAM_DOMAINS_PREFETCH=1
STREAM_AUTO_SELECT=1 STREAM_AUTO_SELECT=1
FW4="$(command -v fw4)"
sleep 60 sleep 60
while :; while :;
@ -46,6 +48,7 @@ do
stream_auto_select_paramount_plus=$(uci -q get openclash.config.stream_auto_select_paramount_plus || echo 0) stream_auto_select_paramount_plus=$(uci -q get openclash.config.stream_auto_select_paramount_plus || echo 0)
stream_auto_select_discovery_plus=$(uci -q get openclash.config.stream_auto_select_discovery_plus || echo 0) stream_auto_select_discovery_plus=$(uci -q get openclash.config.stream_auto_select_discovery_plus || echo 0)
stream_auto_select_bilibili=$(uci -q get openclash.config.stream_auto_select_bilibili || echo 0) stream_auto_select_bilibili=$(uci -q get openclash.config.stream_auto_select_bilibili || echo 0)
stream_auto_select_google_not_cn=$(uci -q get openclash.config.stream_auto_select_google_not_cn || echo 0)
enable=$(uci -q get openclash.config.enable) enable=$(uci -q get openclash.config.enable)
@ -117,6 +120,63 @@ fi
LOG_OUT "Watchdog: Setting Firewall For Enabling Redirect..." LOG_OUT "Watchdog: Setting Firewall For Enabling Redirect..."
fi fi
## Localnetwork 刷新
lan_ip_cidrs=$(ip route | grep "/" | awk '{print $1}' | grep -vE "^198.18" 2>/dev/null)
lan_ip6_cidrs=$(ip -6 route | grep "/" | awk '{print $1}' | grep -vE "^unreachable" 2>/dev/null)
wan_ip4s=$(ifconfig | grep 'inet addr' | awk '{print $2}' | cut -d: -f2 | grep -vE "(^198.18|^192.168|^127.0)" 2>/dev/null)
if [ -n "$FW4" ]; then
if [ -n "$lan_ip_cidrs" ]; then
for lan_ip_cidr in $lan_ip_cidrs; do
nft add element inet fw4 localnetwork { "$lan_ip_cidr" } 2>/dev/null
done
fi
if [ -n "$wan_ip4s" ]; then
for wan_ip4 in $wan_ip4s; do
nft add element inet fw4 localnetwork { "$wan_ip4" } 2>/dev/null
done
fi
if [ "$ipv6_enable" -eq 1 ]; then
if [ -n "$lan_ip6_cidrs" ]; then
for lan_ip6_cidr in $lan_ip6_cidrs; do
nft add element inet fw4 localnetwork6 { "$lan_ip6_cidr" } 2>/dev/null
done
fi
if [ -n "$wan_ip6s" ]; then
for wan_ip6 in $wan_ip6s; do
nft add element inet fw4 localnetwork6 { "$wan_ip6" } 2>/dev/null
done
fi
fi
else
if [ -n "$lan_ip_cidrs" ]; then
for lan_ip_cidr in $lan_ip_cidrs; do
ipset add localnetwork "$lan_ip_cidr" 2>/dev/null
done
fi
if [ -n "$wan_ip4s" ]; then
for wan_ip4 in $wan_ip4s; do
ipset add localnetwork "$wan_ip4" 2>/dev/null
done
fi
if [ "$ipv6_enable" -eq 1 ]; then
if [ -n "$lan_ip6_cidrs" ]; then
for lan_ip6_cidr in $lan_ip6_cidrs; do
ipset add localnetwork6 "$lan_ip6_cidr" 2>/dev/null
done
fi
if [ -n "$wan_ip6s" ]; then
for wan_ip6 in $wan_ip6s; do
ipset add localnetwork6 "$wan_ip6" 2>/dev/null
done
fi
fi
fi
## DNS转发劫持 ## DNS转发劫持
if [ "$enable_redirect_dns" -ne 0 ]; then if [ "$enable_redirect_dns" -ne 0 ]; then
if [ -z "$(uci -q get dhcp.@dnsmasq[0].server |grep "$dns_port")" ] || [ ! -z "$(uci -q get dhcp.@dnsmasq[0].server |awk -F ' ' '{print $2}')" ]; then if [ -z "$(uci -q get dhcp.@dnsmasq[0].server |grep "$dns_port")" ] || [ ! -z "$(uci -q get dhcp.@dnsmasq[0].server |awk -F ' ' '{print $2}')" ]; then
@ -198,6 +258,10 @@ fi
LOG_OUT "Tip: Start Auto Select Proxy For Bilibili Unlock..." LOG_OUT "Tip: Start Auto Select Proxy For Bilibili Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "Bilibili" >> $LOG_FILE /usr/share/openclash/openclash_streaming_unlock.lua "Bilibili" >> $LOG_FILE
fi fi
if [ "$stream_auto_select_google_not_cn" -eq 1 ]; then
LOG_OUT "Tip: Start Auto Select Proxy For Google Not CN Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "Google" >> $LOG_FILE
fi
fi fi
fi fi
STREAM_AUTO_SELECT=$(expr "$STREAM_AUTO_SELECT" + 1) STREAM_AUTO_SELECT=$(expr "$STREAM_AUTO_SELECT" + 1)

View File

@ -16,6 +16,7 @@ rules:
- RULE-SET,ABC,Global TV - RULE-SET,ABC,Global TV
- RULE-SET,Abema TV,Global TV - RULE-SET,Abema TV,Global TV
- RULE-SET,Amazon,Global TV - RULE-SET,Amazon,Global TV
- RULE-SET,Apple Music,Global TV
- RULE-SET,Apple News,Global TV - RULE-SET,Apple News,Global TV
- RULE-SET,Apple TV,Global TV - RULE-SET,Apple TV,Global TV
- RULE-SET,Bahamut,Global TV - RULE-SET,Bahamut,Global TV
@ -43,7 +44,7 @@ rules:
- RULE-SET,ViuTV,Global TV - RULE-SET,ViuTV,Global TV
- RULE-SET,Telegram,Telegram - RULE-SET,Telegram,Telegram
- RULE-SET,Crypto,Crypto - RULE-SET,Crypto,Crypto
- RULE-SET,Douyin,Douyin - RULE-SET,Discord,Discord
- RULE-SET,Steam,Steam - RULE-SET,Steam,Steam
- RULE-SET,Speedtest,Speedtest - RULE-SET,Speedtest,Speedtest
- RULE-SET,PayPal,PayPal - RULE-SET,PayPal,PayPal
@ -77,6 +78,7 @@ script:
"ABC": "Global TV", "ABC": "Global TV",
"Abema TV": "Global TV", "Abema TV": "Global TV",
"Amazon": "Global TV", "Amazon": "Global TV",
"Apple Music": "Global TV",
"Apple News": "Global TV", "Apple News": "Global TV",
"Apple TV": "Global TV", "Apple TV": "Global TV",
"Bahamut": "Global TV", "Bahamut": "Global TV",
@ -104,7 +106,7 @@ script:
"ViuTV": "Global TV", "ViuTV": "Global TV",
"Telegram": "Telegram", "Telegram": "Telegram",
"Crypto": "Crypto", "Crypto": "Crypto",
"Douyin": "Douyin", "Discord": "Discord",
"Steam": "Steam", "Steam": "Steam",
"Speedtest": "Speedtest", "Speedtest": "Speedtest",
"PayPal": "PayPal", "PayPal": "PayPal",
@ -244,6 +246,12 @@ rule-providers:
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Amazon.yaml url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Amazon.yaml
path: "./Rules/Media/Amazon" path: "./Rules/Media/Amazon"
interval: 86400 interval: 86400
Apple Music:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Apple%20Music.yaml
path: "./Rules/Media/Apple_Music"
interval: 86400
Apple News: Apple News:
type: http type: http
behavior: classical behavior: classical
@ -412,11 +420,11 @@ rule-providers:
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Crypto.yaml url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Crypto.yaml
path: "./Rules/Crypto" path: "./Rules/Crypto"
interval: 86400 interval: 86400
Douyin: Discord:
type: http type: http
behavior: classical behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Douyin.yaml url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Discord.yaml
path: "./Rules/Douyin" path: "./Rules/Discord"
interval: 86400 interval: 86400
Steam: Steam:
type: http type: http

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
var E=Object.defineProperty,O=Object.defineProperties;var A=Object.getOwnPropertyDescriptors;var c=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable;var Y=(t,a,r)=>a in t?E(t,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[a]=r,o=(t,a)=>{for(var r in a||(a={}))w.call(a,r)&&Y(t,r,a[r]);if(c)for(var r of c(a))k.call(a,r)&&Y(t,r,a[r]);return t},i=(t,a)=>O(t,A(a));var f=(t,a)=>{var r={};for(var n in t)w.call(t,n)&&a.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&c)for(var n of c(t))a.indexOf(n)<0&&k.call(t,n)&&(r[n]=t[n]);return r};import{j as e,b as y,r as d,h as B}from"./index.5901d226.js";const H="_spining_4i8sg_1",L="_spining_keyframes_4i8sg_1";var R={spining:H,spining_keyframes:L};const{useState:V}=B;function P({children:t}){return e("span",{className:R.spining,children:t})}const Q={right:10,bottom:10},S=r=>{var n=r,{children:t}=n,a=f(n,["children"]);return e("button",i(o({type:"button"},a),{className:"rtf--ab",children:t}))},q=r=>{var n=r,{children:t}=n,a=f(n,["children"]);return e("button",i(o({type:"button",className:"rtf--mb"},a),{children:t}))},D={bottom:24,right:24},U=G=>{var _=G,{event:t="hover",style:a=D,alwaysShowTitle:r=!1,children:n,icon:v,mainButtonStyles:z,onClick:m,text:h}=_,N=f(_,["event","style","alwaysShowTitle","children","icon","mainButtonStyles","onClick","text"]);const[l,b]=V(!1),x=r||!l,g=()=>b(!0),u=()=>b(!1),$=()=>t==="hover"&&g(),j=()=>t==="hover"&&u(),C=s=>m?m(s):(s.persist(),t==="click"?l?u():g():null),I=(s,p)=>{s.persist(),b(!1),setTimeout(()=>{p(s)},1)},F=()=>d.exports.Children.map(n,(s,p)=>d.exports.isValidElement(s)?y("li",{className:`rtf--ab__c ${"top"in a?"top":""}`,children:[d.exports.cloneElement(s,i(o({"data-testid":`action-button-${p}`,"aria-label":s.props.text||`Menu button ${p+1}`,"aria-hidden":x,tabIndex:l?0:-1},s.props),{onClick:M=>{s.props.onClick&&I(M,s.props.onClick)}})),s.props.text&&e("span",{className:`${"right"in a?"right":""} ${r?"always-show":""}`,"aria-hidden":x,children:s.props.text})]}):null);return e("ul",i(o({onMouseEnter:$,onMouseLeave:j,className:`rtf ${l?"open":"closed"}`,"data-testid":"fab",style:a},N),{children:y("li",{className:"rtf--mb__c",children:[e(q,{onClick:C,style:z,"data-testid":"main-button",role:"button","aria-label":"Floating menu",tabIndex:0,children:v}),h&&e("span",{className:`${"right"in a?"right":""} ${r?"always-show":""}`,"aria-hidden":x,children:h}),e("ul",{children:F()})]})}))};export{S as A,U as F,P as I,Q as p};

View File

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

View File

@ -1 +0,0 @@
._RuleSearch_1gcst_1{padding:0 40px 5px}._RuleSearchContainer_1gcst_5{position:relative;height:40px}._inputWrapper_1gcst_10{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);left:0;width:100%}._input_1gcst_10{-webkit-appearance:none;background-color:var(--color-input-bg);background-image:none;border-radius:20px;border:1px solid var(--color-input-border);box-sizing:border-box;color:#c1c1c1;display:inline-block;font-size:inherit;height:40px;outline:none;padding:0 15px 0 35px;transition:border-color .2s cubic-bezier(.645,.045,.355,1);width:100%}._iconWrapper_1gcst_35{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);left:10px}._logMeta_1dg5t_1{display:flex;align-items:center;flex-wrap:wrap;font-size:.9em}._logType_1dg5t_8{color:#eee;flex-shrink:0;text-align:center;width:66px;border-radius:100px;padding:3px 5px;margin:0 8px}._logTime_1dg5t_18{flex-shrink:0;color:#999;font-size:14px}._logText_1dg5t_24{flex-shrink:0;display:flex;font-family:Roboto Mono,Menlo,monospace;align-items:center;padding:8px 0;width:100%;white-space:pre;overflow:auto}._logsWrapper_1dg5t_37{margin:0;padding:0;color:var(--color-text)}._logsWrapper_1dg5t_37 .log{padding:10px 40px;background:var(--color-background)}._logsWrapper_1dg5t_37 .log.even{background:var(--color-background)}._logPlaceholder_1dg5t_51{display:flex;flex-direction:column;align-items:center;justify-content:center;color:#2d2d30}._logPlaceholder_1dg5t_51 div:nth-child(2){color:var(--color-text-secondary);font-size:1.4em;opacity:.6}._logPlaceholderIcon_1dg5t_64{opacity:.3}

View File

@ -1 +0,0 @@
var R=Object.defineProperty,w=Object.defineProperties;var C=Object.getOwnPropertyDescriptors;var S=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var T=(e,t,o)=>t in e?R(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,p=(e,t)=>{for(var o in t||(t={}))N.call(t,o)&&T(e,o,t[o]);if(S)for(var o of S(t))W.call(t,o)&&T(e,o,t[o]);return e},m=(e,t)=>w(e,C(t));import{r as _,b as l,j as a,P as f,d as P,G as k,H as j,w as z,J as I,u as O,C as F,S as M,K as $,L as H,g as A,N as B,h as D,c as E}from"./index.5901d226.js";import{a as K,F as q}from"./index.esm.390d1b7a.js";import{r as G,s as J,f as V}from"./logs.36f1d416.js";import{d as Y}from"./debounce.d080d5e1.js";import{u as Q}from"./useRemainingViewPortHeight.d051faee.js";import{F as U,p as X}from"./Fab.93225453.js";import{P as Z,a as ee}from"./play.56145bca.js";function te(e,t){if(e==null)return{};var o=oe(e,t),n,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],!(t.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,n)||(o[n]=e[n]))}return o}function oe(e,t){if(e==null)return{};var o={},n=Object.keys(e),r,s;for(s=0;s<n.length;s++)r=n[s],!(t.indexOf(r)>=0)&&(o[r]=e[r]);return o}var x=_.exports.forwardRef(function(e,t){var o=e.color,n=o===void 0?"currentColor":o,r=e.size,s=r===void 0?24:r,g=te(e,["color","size"]);return l("svg",m(p({ref:t,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},g),{children:[a("circle",{cx:"11",cy:"11",r:"8"}),a("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}))});x.propTypes={color:f.string,size:f.oneOfType([f.string,f.number])};x.displayName="Search";var re=x;const ae="_RuleSearch_1gcst_1",ne="_RuleSearchContainer_1gcst_5",se="_inputWrapper_1gcst_10",ce="_input_1gcst_10",ie="_iconWrapper_1gcst_35";var d={RuleSearch:ae,RuleSearchContainer:ne,inputWrapper:se,input:ce,iconWrapper:ie};function le({dispatch:e,searchText:t,updateSearchText:o}){const[n,r]=_.exports.useState(t),s=_.exports.useCallback(i=>{e(o(i))},[e,o]),g=_.exports.useMemo(()=>Y(s,300),[s]),h=i=>{r(i.target.value),g(i.target.value)};return a("div",{className:d.RuleSearch,children:l("div",{className:d.RuleSearchContainer,children:[a("div",{className:d.inputWrapper,children:a("input",{type:"text",value:n,onChange:h,className:d.input})}),a("div",{className:d.iconWrapper,children:a(re,{size:20})})]})})}const ge=e=>({searchText:k(e),updateSearchText:j});var pe=P(ge)(le);const de="_logMeta_1dg5t_1",he="_logType_1dg5t_8",ue="_logTime_1dg5t_18",me="_logText_1dg5t_24",fe="_logsWrapper_1dg5t_37",_e="_logPlaceholder_1dg5t_51",ve="_logPlaceholderIcon_1dg5t_64";var c={logMeta:de,logType:he,logTime:ue,logText:me,logsWrapper:fe,logPlaceholder:_e,logPlaceholderIcon:ve};const{useCallback:b,memo:xe,useEffect:ye}=D,v=30,Se={debug:"#28792c",info:"var(--bg-log-info-tag)",warning:"#b99105",error:"#c11c1c"};function Te({time:e,even:t,payload:o,type:n}){const r=E({even:t},"log");return a("div",{className:r,children:l("div",{className:c.logMeta,children:[a("div",{className:c.logTime,children:e}),a("div",{className:c.logType,style:{backgroundColor:Se[n]},children:n}),a("div",{className:c.logText,children:o})]})})}function be(e,t){return t[e].id}const Pe=xe(({index:e,style:t,data:o})=>{const n=o[e];return a("div",{style:t,children:a(Te,p({},n))})},K);function Le({dispatch:e,logLevel:t,apiConfig:o,logs:n,logStreamingPaused:r}){const s=z(),g=b(()=>{r?G(m(p({},o),{logLevel:t})):J(),s.app.updateAppConfig("logStreamingPaused",!r)},[o,t,r,s.app]),h=b(L=>e(I(L)),[e]);ye(()=>{V(m(p({},o),{logLevel:t}),h)},[o,t,h]);const[i,y]=Q(),{t:u}=O();return l("div",{children:[a(F,{title:u("Logs")}),a(pe,{}),a("div",{ref:i,style:{paddingBottom:v},children:n.length===0?l("div",{className:c.logPlaceholder,style:{height:y-v},children:[a("div",{className:c.logPlaceholderIcon,children:a(M,{width:200,height:200})}),a("div",{children:u("no_logs")})]}):l("div",{className:c.logsWrapper,children:[a(q,{height:y-v,width:"100%",itemCount:n.length,itemSize:80,itemData:n,itemKey:be,children:Pe}),a(U,{icon:r?a(Z,{size:16}):a(ee,{size:16}),mainButtonStyles:r?{background:"#e74c3c"}:{},style:X,text:u(r?"Resume Refresh":"Pause Refresh"),onClick:g})]})})]})}const Re=e=>({logs:$(e),logLevel:H(e),apiConfig:A(e),logStreamingPaused:B(e)});var Oe=P(Re)(Le);export{Oe as default};

View File

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

View File

@ -0,0 +1 @@
._RuleSearch_1oz2t_1{padding:0 40px 5px}._RuleSearchContainer_1oz2t_5{position:relative;height:40px}._inputWrapper_1oz2t_10{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);left:0;width:100%}._input_1oz2t_10{-webkit-appearance:none;background-color:var(--color-input-bg);background-image:none;border-radius:20px;border:1px solid var(--color-input-border);box-sizing:border-box;color:#c1c1c1;display:inline-block;font-size:inherit;height:40px;outline:none;padding:0 15px 0 35px;transition:border-color .2s cubic-bezier(.645,.045,.355,1);width:100%}._iconWrapper_1oz2t_35{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);left:10px;display:flex;justify-content:center;align-items:center}._logMeta_7a1x3_1{display:flex;align-items:center;flex-wrap:wrap;font-size:.9em}._logType_7a1x3_8{color:#eee;flex-shrink:0;text-align:center;width:66px;border-radius:100px;padding:3px 5px;margin:0 8px}._logTime_7a1x3_18{flex-shrink:0;color:#999;font-size:14px}._logText_7a1x3_24{flex-shrink:0;display:flex;font-family:Roboto Mono,Menlo,monospace;align-items:center;padding:8px 0;width:100%;white-space:pre;overflow:auto}._logsWrapper_7a1x3_37{margin:0;padding:0;color:var(--color-text)}._logsWrapper_7a1x3_37 .log{padding:10px 40px;background:var(--color-background)}._logsWrapper_7a1x3_37 .log.even{background:var(--color-background)}._logPlaceholder_7a1x3_51{display:flex;flex-direction:column;align-items:center;justify-content:center;color:#2d2d30}._logPlaceholder_7a1x3_51 div:nth-child(2){color:var(--color-text-secondary);font-size:1.4em;opacity:.6}._logPlaceholderIcon_7a1x3_64{opacity:.3}._search_7a1x3_68{max-width:1000px}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
import{j as s}from"./index.2addc377.js";const o="_select_13zm8_1",r={select:o};function i({options:t,selected:c,onChange:l}){return s("select",{className:r.select,value:c,onChange:l,children:t.map(([e,n])=>s("option",{value:e,children:n},e))})}export{i as S};

View File

@ -1 +0,0 @@
import{j as s}from"./index.5901d226.js";const n="_select_13zm8_1";var o={select:n};function i({options:t,selected:c,onChange:l}){return s("select",{className:o.select,value:c,onChange:l,children:t.map(([e,r])=>s("option",{value:e,children:r},e))})}export{i as S};

View File

@ -0,0 +1 @@
import{r as u,b as g,j as i,i as c,c as f,V as x,h as d}from"./index.2addc377.js";import{d as h}from"./debounce.c2d20996.js";function v(t,n){if(t==null)return{};var o=_(t,n),r,e;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(e=0;e<s.length;e++)r=s[e],!(n.indexOf(r)>=0)&&(!Object.prototype.propertyIsEnumerable.call(t,r)||(o[r]=t[r]))}return o}function _(t,n){if(t==null)return{};var o={},r=Object.keys(t),e,s;for(s=0;s<r.length;s++)e=r[s],!(n.indexOf(e)>=0)&&(o[e]=t[e]);return o}var l=u.exports.forwardRef(function(t,n){var o=t.color,r=o===void 0?"currentColor":o,e=t.size,s=e===void 0?24:e,a=v(t,["color","size"]);return g("svg",{ref:n,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...a,children:[i("polyline",{points:"23 4 23 10 17 10"}),i("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]})});l.propTypes={color:c.exports.string,size:c.exports.oneOfType([c.exports.string,c.exports.number])};l.displayName="RotateCw";const b=l,y="_rotate_1dspl_1",m="_isRotating_1dspl_5",R="_rotating_1dspl_1",p={rotate:y,isRotating:m,rotating:R};function P(t){const n=t.size||16,o=f(p.rotate,{[p.isRotating]:t.isRotating});return i("span",{className:o,children:i(b,{size:n})})}const{useCallback:w,useState:j,useMemo:O}=d;function T(t){const[,n]=x(t),[o,r]=j(""),e=O(()=>h(n,300),[n]);return[w(a=>{r(a.target.value),e(a.target.value)},[e]),o]}const k="_input_16a1f_1",C={input:k};function $(t){const[n,o]=T(t.textAtom);return i("input",{className:C.input,type:"text",value:o,onChange:n,placeholder:t.placeholder})}export{P as R,$ as T,b as a};

View File

@ -1 +0,0 @@
var v=Object.defineProperty,h=Object.defineProperties;var x=Object.getOwnPropertyDescriptors;var u=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;var p=(t,e,o)=>e in t?v(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,g=(t,e)=>{for(var o in e||(e={}))_.call(e,o)&&p(t,o,e[o]);if(u)for(var o of u(e))b.call(e,o)&&p(t,o,e[o]);return t},f=(t,e)=>h(t,x(e));import{r as y,b as m,j as i,P as c,c as R,V as w,h as j}from"./index.5901d226.js";import{d as O}from"./debounce.d080d5e1.js";function T(t,e){if(t==null)return{};var o=k(t,e),r,n;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)r=a[n],!(e.indexOf(r)>=0)&&(!Object.prototype.propertyIsEnumerable.call(t,r)||(o[r]=t[r]))}return o}function k(t,e){if(t==null)return{};var o={},r=Object.keys(t),n,a;for(a=0;a<r.length;a++)n=r[a],!(e.indexOf(n)>=0)&&(o[n]=t[n]);return o}var l=y.exports.forwardRef(function(t,e){var o=t.color,r=o===void 0?"currentColor":o,n=t.size,a=n===void 0?24:n,s=T(t,["color","size"]);return m("svg",f(g({ref:e,xmlns:"http://www.w3.org/2000/svg",width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},s),{children:[i("polyline",{points:"23 4 23 10 17 10"}),i("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]}))});l.propTypes={color:c.string,size:c.oneOfType([c.string,c.number])};l.displayName="RotateCw";var C=l;const z="_rotate_1dspl_1",P="_isRotating_1dspl_5",L="_rotating_1dspl_1";var d={rotate:z,isRotating:P,rotating:L};function E(t){const e=t.size||16,o=R(d.rotate,{[d.isRotating]:t.isRotating});return i("span",{className:o,children:i(C,{size:e})})}const{useCallback:$,useState:I,useMemo:N}=j;function W(t){const[,e]=w(t),[o,r]=I(""),n=N(()=>O(e,300),[e]);return[$(s=>{r(s.target.value),n(s.target.value)},[n]),o]}const M="_input_16a1f_1";var S={input:M};function F(t){const[e,o]=W(t.textAtom);return i("input",{className:S.input,type:"text",value:o,onChange:e,placeholder:t.placeholder})}export{E as R,F as T,C as a};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
import{r as f,j as l,i as s}from"./index.2addc377.js";function c(r,i){if(r==null)return{};var n=v(r,i),o,e;if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);for(e=0;e<t.length;e++)o=t[e],!(i.indexOf(o)>=0)&&(!Object.prototype.propertyIsEnumerable.call(r,o)||(n[o]=r[o]))}return n}function v(r,i){if(r==null)return{};var n={},o=Object.keys(r),e,t;for(t=0;t<o.length;t++)e=o[t],!(i.indexOf(e)>=0)&&(n[e]=r[e]);return n}var p=f.exports.forwardRef(function(r,i){var n=r.color,o=n===void 0?"currentColor":n,e=r.size,t=e===void 0?24:e,a=c(r,["color","size"]);return l("svg",{ref:i,xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...a,children:l("polyline",{points:"6 9 12 15 18 9"})})});p.propTypes={color:s.exports.string,size:s.exports.oneOfType([s.exports.string,s.exports.number])};p.displayName="ChevronDown";const u=p;export{u as C};

View File

@ -1 +0,0 @@
var u=Object.defineProperty,y=Object.defineProperties;var g=Object.getOwnPropertyDescriptors;var l=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;var p=(r,e,o)=>e in r?u(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,f=(r,e)=>{for(var o in e||(e={}))w.call(e,o)&&p(r,o,e[o]);if(l)for(var o of l(e))b.call(e,o)&&p(r,o,e[o]);return r},v=(r,e)=>y(r,g(e));import{r as d,j as c,P as s}from"./index.5901d226.js";function j(r,e){if(r==null)return{};var o=O(r,e),n,t;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(t=0;t<i.length;t++)n=i[t],!(e.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(r,n)||(o[n]=r[n]))}return o}function O(r,e){if(r==null)return{};var o={},n=Object.keys(r),t,i;for(i=0;i<n.length;i++)t=n[i],!(e.indexOf(t)>=0)&&(o[t]=r[t]);return o}var a=d.exports.forwardRef(function(r,e){var o=r.color,n=o===void 0?"currentColor":o,t=r.size,i=t===void 0?24:t,h=j(r,["color","size"]);return c("svg",v(f({ref:e,xmlns:"http://www.w3.org/2000/svg",width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},h),{children:c("polyline",{points:"6 9 12 15 18 9"})}))});a.propTypes={color:s.string,size:s.oneOfType([s.string,s.number])};a.displayName="ChevronDown";var x=a;export{x as C};

View File

@ -0,0 +1 @@
function O(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}var M=typeof global=="object"&&global&&global.Object===Object&&global;const R=M;var w=typeof self=="object"&&self&&self.Object===Object&&self,B=R||w||Function("return this")();const W=B;var F=function(){return W.Date.now()};const S=F;var G=/\s/;function U(e){for(var n=e.length;n--&&G.test(e.charAt(n)););return n}var _=/^\s+/;function D(e){return e&&e.slice(0,U(e)+1).replace(_,"")}var H=W.Symbol;const y=H;var L=Object.prototype,X=L.hasOwnProperty,q=L.toString,g=y?y.toStringTag:void 0;function z(e){var n=X.call(e,g),i=e[g];try{e[g]=void 0;var o=!0}catch{}var f=q.call(e);return o&&(n?e[g]=i:delete e[g]),f}var J=Object.prototype,K=J.toString;function Q(e){return K.call(e)}var V="[object Null]",Y="[object Undefined]",$=y?y.toStringTag:void 0;function Z(e){return e==null?e===void 0?Y:V:$&&$ in Object(e)?z(e):Q(e)}function ee(e){return e!=null&&typeof e=="object"}var ne="[object Symbol]";function te(e){return typeof e=="symbol"||ee(e)&&Z(e)==ne}var E=0/0,re=/^[-+]0x[0-9a-f]+$/i,ie=/^0b[01]+$/i,oe=/^0o[0-7]+$/i,ae=parseInt;function k(e){if(typeof e=="number")return e;if(te(e))return E;if(O(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=O(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=D(e);var i=ie.test(e);return i||oe.test(e)?ae(e.slice(2),i?2:8):re.test(e)?E:+e}var fe="Expected a function",ce=Math.max,ue=Math.min;function se(e,n,i){var o,f,s,u,r,c,d=0,v=!1,l=!1,T=!0;if(typeof e!="function")throw new TypeError(fe);n=k(n)||0,O(i)&&(v=!!i.leading,l="maxWait"in i,s=l?ce(k(i.maxWait)||0,n):s,T="trailing"in i?!!i.trailing:T);function j(t){var a=o,b=f;return o=f=void 0,d=t,u=e.apply(b,a),u}function N(t){return d=t,r=setTimeout(m,n),v?j(t):u}function P(t){var a=t-c,b=t-d,I=n-a;return l?ue(I,s-b):I}function h(t){var a=t-c,b=t-d;return c===void 0||a>=n||a<0||l&&b>=s}function m(){var t=S();if(h(t))return x(t);r=setTimeout(m,P(t))}function x(t){return r=void 0,T&&o?j(t):(o=f=void 0,u)}function A(){r!==void 0&&clearTimeout(r),d=0,o=c=f=r=void 0}function C(){return r===void 0?u:x(S())}function p(){var t=S(),a=h(t);if(o=arguments,f=this,c=t,a){if(r===void 0)return N(c);if(l)return clearTimeout(r),r=setTimeout(m,n),j(c)}return r===void 0&&(r=setTimeout(m,n)),u}return p.cancel=A,p.flush=C,p}export{se as d};

View File

@ -1 +0,0 @@
function S(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}var M=typeof global=="object"&&global&&global.Object===Object&&global,R=M,w=typeof self=="object"&&self&&self.Object===Object&&self,B=R||w||Function("return this")(),W=B,F=function(){return W.Date.now()},p=F,G=/\s/;function U(e){for(var n=e.length;n--&&G.test(e.charAt(n)););return n}var _=/^\s+/;function D(e){return e&&e.slice(0,U(e)+1).replace(_,"")}var H=W.Symbol,y=H,L=Object.prototype,X=L.hasOwnProperty,q=L.toString,g=y?y.toStringTag:void 0;function z(e){var n=X.call(e,g),i=e[g];try{e[g]=void 0;var o=!0}catch{}var f=q.call(e);return o&&(n?e[g]=i:delete e[g]),f}var J=Object.prototype,K=J.toString;function Q(e){return K.call(e)}var V="[object Null]",Y="[object Undefined]",$=y?y.toStringTag:void 0;function Z(e){return e==null?e===void 0?Y:V:$&&$ in Object(e)?z(e):Q(e)}function ee(e){return e!=null&&typeof e=="object"}var ne="[object Symbol]";function te(e){return typeof e=="symbol"||ee(e)&&Z(e)==ne}var E=0/0,re=/^[-+]0x[0-9a-f]+$/i,ie=/^0b[01]+$/i,oe=/^0o[0-7]+$/i,ae=parseInt;function k(e){if(typeof e=="number")return e;if(te(e))return E;if(S(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=S(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=D(e);var i=ie.test(e);return i||oe.test(e)?ae(e.slice(2),i?2:8):re.test(e)?E:+e}var fe="Expected a function",ce=Math.max,ue=Math.min;function se(e,n,i){var o,f,s,u,r,c,d=0,O=!1,l=!1,T=!0;if(typeof e!="function")throw new TypeError(fe);n=k(n)||0,S(i)&&(O=!!i.leading,l="maxWait"in i,s=l?ce(k(i.maxWait)||0,n):s,T="trailing"in i?!!i.trailing:T);function j(t){var a=o,b=f;return o=f=void 0,d=t,u=e.apply(b,a),u}function N(t){return d=t,r=setTimeout(m,n),O?j(t):u}function P(t){var a=t-c,b=t-d,I=n-a;return l?ue(I,s-b):I}function h(t){var a=t-c,b=t-d;return c===void 0||a>=n||a<0||l&&b>=s}function m(){var t=p();if(h(t))return x(t);r=setTimeout(m,P(t))}function x(t){return r=void 0,T&&o?j(t):(o=f=void 0,u)}function A(){r!==void 0&&clearTimeout(r),d=0,o=c=f=r=void 0}function C(){return r===void 0?u:x(p())}function v(){var t=p(),a=h(t);if(o=arguments,f=this,c=t,a){if(r===void 0)return N(c);if(l)return clearTimeout(r),r=setTimeout(m,n),j(c)}return r===void 0&&(r=setTimeout(m,n)),u}return v.cancel=A,v.flush=C,v}export{se as d};

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
var $=Object.defineProperty,k=Object.defineProperties;var y=Object.getOwnPropertyDescriptors;var h=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable;var S=(e,t,n)=>t in e?$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t)=>{for(var n in t||(t={}))E.call(t,n)&&S(e,n,t[n]);if(h)for(var n of h(t))A.call(t,n)&&S(e,n,t[n]);return e},v=(e,t)=>k(e,y(t));import{A as O,D as R,E as u}from"./index.5901d226.js";const L="/logs",x=new TextDecoder("utf-8"),F=()=>Math.floor((1+Math.random())*65536).toString(16);let p=!1,i=!1,f="",s,g;function m(e,t){let n;try{n=JSON.parse(e)}catch{console.log("JSON.parse error",JSON.parse(e))}const r=new Date,l=H(r);n.time=l,n.id=+r-0+F(),n.even=p=!p,t(n)}function H(e){const t=e.getFullYear()%100,n=u(e.getMonth()+1,2),r=u(e.getDate(),2),l=u(e.getHours(),2),o=u(e.getMinutes(),2),c=u(e.getSeconds(),2);return`${t}-${n}-${r} ${l}:${o}:${c}`}function M(e,t){return e.read().then(({done:n,value:r})=>{f+=x.decode(r,{stream:!n});const o=f.split(`
`),c=o[o.length-1];for(let d=0;d<o.length-1;d++)m(o[d],t);if(n){m(c,t),f="",console.log("GET /logs streaming done"),i=!1;return}else f=c;return M(e,t)})}function D(e){const t=Object.keys(e);return t.sort(),t.map(n=>e[n]).join("|")}let w,a;function J(e,t){if(e.logLevel==="uninit"||i||s&&s.readyState===1)return;g=t;const n=O(e,L);s=new WebSocket(n),s.addEventListener("error",()=>{N(e,t)}),s.addEventListener("message",function(r){m(r.data,t)})}function Y(){s.close(),a&&a.abort()}function j(e){!g||!s||(s.close(),i=!1,J(e,g))}function N(e,t){if(a&&D(e)!==w)a.abort();else if(i)return;i=!0,w=D(e),a=new AbortController;const n=a.signal,{url:r,init:l}=R(e);fetch(r+L+"?level="+e.logLevel,v(b({},l),{signal:n})).then(o=>{const c=o.body.getReader();M(c,t)},o=>{i=!1,!n.aborted&&console.log("GET /logs error:",o.message)})}export{J as f,j as r,Y as s};

View File

@ -0,0 +1,2 @@
import{D,E as w,G as u}from"./index.2addc377.js";const v="/logs",L=new TextDecoder("utf-8"),M=()=>Math.floor((1+Math.random())*65536).toString(16);let h=!1,i=!1,f="",s,g;function m(e,n){let t;try{t=JSON.parse(e)}catch{console.log("JSON.parse error",JSON.parse(e))}const r=new Date,l=$(r);t.time=l,t.id=+r-0+M(),t.even=h=!h,n(t)}function $(e){const n=e.getFullYear()%100,t=u(e.getMonth()+1,2),r=u(e.getDate(),2),l=u(e.getHours(),2),o=u(e.getMinutes(),2),c=u(e.getSeconds(),2);return`${n}-${t}-${r} ${l}:${o}:${c}`}function p(e,n){return e.read().then(({done:t,value:r})=>{f+=L.decode(r,{stream:!t});const o=f.split(`
`),c=o[o.length-1];for(let d=0;d<o.length-1;d++)m(o[d],n);if(t){m(c,n),f="",console.log("GET /logs streaming done"),i=!1;return}else f=c;return p(e,n)})}function S(e){const n=Object.keys(e);return n.sort(),n.map(t=>e[t]).join("|")}let b,a;function k(e,n){if(e.logLevel==="uninit"||i||s&&s.readyState===1)return;g=n;const t=D(e,v);s=new WebSocket(t),s.addEventListener("error",()=>{y(e,n)}),s.addEventListener("message",function(r){m(r.data,n)})}function O(){s.close(),a&&a.abort()}function R(e){!g||!s||(s.close(),i=!1,k(e,g))}function y(e,n){if(a&&S(e)!==b)a.abort();else if(i)return;i=!0,b=S(e),a=new AbortController;const t=a.signal,{url:r,init:l}=w(e);fetch(r+v+"?level="+e.logLevel,{...l,signal:t}).then(o=>{const c=o.body.getReader();p(c,n)},o=>{i=!1,!t.aborted&&console.log("GET /logs error:",o.message)})}export{k as f,R as r,O as s};

View File

@ -1 +0,0 @@
var h=Object.defineProperty,d=Object.defineProperties;var w=Object.getOwnPropertyDescriptors;var y=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var v=(e,t,r)=>t in e?h(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,p=(e,t)=>{for(var r in t||(t={}))b.call(t,r)&&v(e,r,t[r]);if(y)for(var r of y(t))O.call(t,r)&&v(e,r,t[r]);return e},f=(e,t)=>d(e,w(t));import{r as g,b as j,j as a,P as s}from"./index.5901d226.js";function P(e,t){if(e==null)return{};var r=k(e,t),i,o;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(o=0;o<n.length;o++)i=n[o],!(t.indexOf(i)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,i)||(r[i]=e[i]))}return r}function k(e,t){if(e==null)return{};var r={},i=Object.keys(e),o,n;for(n=0;n<i.length;n++)o=i[n],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}var c=g.exports.forwardRef(function(e,t){var r=e.color,i=r===void 0?"currentColor":r,o=e.size,n=o===void 0?24:o,l=P(e,["color","size"]);return j("svg",f(p({ref:t,xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:i,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),{children:[a("rect",{x:"6",y:"4",width:"4",height:"16"}),a("rect",{x:"14",y:"4",width:"4",height:"16"})]}))});c.propTypes={color:s.string,size:s.oneOfType([s.string,s.number])};c.displayName="Pause";var L=c;function x(e,t){if(e==null)return{};var r=m(e,t),i,o;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(o=0;o<n.length;o++)i=n[o],!(t.indexOf(i)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,i)||(r[i]=e[i]))}return r}function m(e,t){if(e==null)return{};var r={},i=Object.keys(e),o,n;for(n=0;n<i.length;n++)o=i[n],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}var u=g.exports.forwardRef(function(e,t){var r=e.color,i=r===void 0?"currentColor":r,o=e.size,n=o===void 0?24:o,l=x(e,["color","size"]);return a("svg",f(p({ref:t,xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:i,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),{children:a("polygon",{points:"5 3 19 12 5 21 5 3"})}))});u.propTypes={color:s.string,size:s.oneOfType([s.string,s.number])};u.displayName="Play";var W=u;export{W as P,L as a};

View File

@ -0,0 +1 @@
import{r as c,b as u,j as p,i as s}from"./index.2addc377.js";function y(e,n){if(e==null)return{};var i=g(e,n),t,r;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],!(n.indexOf(t)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,t)||(i[t]=e[t]))}return i}function g(e,n){if(e==null)return{};var i={},t=Object.keys(e),r,o;for(o=0;o<t.length;o++)r=t[o],!(n.indexOf(r)>=0)&&(i[r]=e[r]);return i}var l=c.exports.forwardRef(function(e,n){var i=e.color,t=i===void 0?"currentColor":i,r=e.size,o=r===void 0?24:r,a=y(e,["color","size"]);return u("svg",{ref:n,xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...a,children:[p("rect",{x:"6",y:"4",width:"4",height:"16"}),p("rect",{x:"14",y:"4",width:"4",height:"16"})]})});l.propTypes={color:s.exports.string,size:s.exports.oneOfType([s.exports.string,s.exports.number])};l.displayName="Pause";const d=l;function h(e,n){if(e==null)return{};var i=v(e,n),t,r;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],!(n.indexOf(t)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,t)||(i[t]=e[t]))}return i}function v(e,n){if(e==null)return{};var i={},t=Object.keys(e),r,o;for(o=0;o<t.length;o++)r=t[o],!(n.indexOf(r)>=0)&&(i[r]=e[r]);return i}var f=c.exports.forwardRef(function(e,n){var i=e.color,t=i===void 0?"currentColor":i,r=e.size,o=r===void 0?24:r,a=h(e,["color","size"]);return p("svg",{ref:n,xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...a,children:p("polygon",{points:"5 3 19 12 5 21 5 3"})})});f.propTypes={color:s.exports.string,size:s.exports.oneOfType([s.exports.string,s.exports.number])};f.displayName="Play";const w=f;export{w as P,d as a};

View File

@ -1 +1 @@
import{h as r}from"./index.5901d226.js";const{useState:s,useRef:u,useCallback:a,useLayoutEffect:c}=r;function d(){const t=u(null),[n,i]=s(200),e=a(()=>{const{top:o}=t.current.getBoundingClientRect();i(window.innerHeight-o)},[]);return c(()=>(e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}),[e]),[t,n]}export{d as u}; import{h as r}from"./index.2addc377.js";const{useState:s,useRef:u,useCallback:a,useLayoutEffect:c}=r;function d(){const t=u(null),[n,i]=s(200),e=a(()=>{const{top:o}=t.current.getBoundingClientRect();i(window.innerHeight-o)},[]);return c(()=>(e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}),[e]),[t,n]}export{d as u};

View File

@ -7,14 +7,16 @@
<link rel="icon" type="image/png" sizes="128x128" href="yacd-128.png" /> <link rel="icon" type="image/png" sizes="128x128" href="yacd-128.png" />
<link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png" /> <link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png" />
<meta name="apple-mobile-web-app-title" content="yacd"> <meta name="apple-mobile-web-app-title" content="yacd">
<meta name="theme-color" content="#eeeeee" media="(prefers-color-scheme: light)" />
<meta name="theme-color" content="#202020" media="(prefers-color-scheme: dark)" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="application-name" content="yacd" /> <meta name="application-name" content="yacd" />
<meta name="description" content="Yet Another Clash Dashboard" /> <meta name="description" content="Yet Another Clash Dashboard" />
<title>yacd</title> <title>yacd</title>
<script type="module" crossorigin src="./assets/index.5901d226.js"></script> <script type="module" crossorigin src="./assets/index.2addc377.js"></script>
<link rel="stylesheet" href="./assets/index.0e7e7dfd.css"> <link rel="stylesheet" href="./assets/index.487e7aa0.css">
<link rel="manifest" href="./manifest.webmanifest"></head> <link rel="manifest" href="./manifest.webmanifest"><script src="./registerSW.js"></script></head>
<body> <body>
<div id="app" data-base-url="http://127.0.0.1:9090"></div> <div id="app" data-base-url="http://127.0.0.1:9090"></div>

File diff suppressed because one or more lines are too long

View File

@ -81,6 +81,7 @@ yml_auth_get()
if [ -z "$username" ] || [ -z "$password" ]; then if [ -z "$username" ] || [ -z "$password" ]; then
return return
else else
LOG_OUT "Tip: You have seted the authentication of SOCKS5/HTTP(S) proxy with【$username:$password"
echo " - $username:$password" >>/tmp/yaml_openclash_auth echo " - $username:$password" >>/tmp/yaml_openclash_auth
fi fi
} }

View File

@ -971,7 +971,7 @@ EOF
fi fi
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
cat >> "$SERVER_FILE" <<-EOF cat >> "$SERVER_FILE" <<-EOF
url: https://cp.cloudflare.com/generate_204 url: http://cp.cloudflare.com/generate_204
interval: "600" interval: "600"
tolerance: "150" tolerance: "150"
- name: Proxy - name: Proxy
@ -1069,7 +1069,7 @@ EOF
fi fi
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
cat >> "$SERVER_FILE" <<-EOF cat >> "$SERVER_FILE" <<-EOF
url: https://cp.cloudflare.com/generate_204 url: http://cp.cloudflare.com/generate_204
interval: "600" interval: "600"
tolerance: "150" tolerance: "150"
- name: Proxy - name: Proxy
@ -1159,20 +1159,6 @@ cat >> "$SERVER_FILE" <<-EOF
EOF EOF
fi fi
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
cat >> "$SERVER_FILE" <<-EOF
- name: Douyin
type: select
proxies:
- DIRECT
- Asian TV
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 cat >> "$SERVER_FILE" <<-EOF
- name: Bahamut - name: Bahamut
type: select type: select
@ -1404,6 +1390,20 @@ cat >> "$SERVER_FILE" <<-EOF
EOF EOF
fi fi
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
cat >> "$SERVER_FILE" <<-EOF
- name: Discord
type: select
proxies:
- Proxy
- 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 cat >> "$SERVER_FILE" <<-EOF
- name: PayPal - name: PayPal
type: select type: select
@ -1431,7 +1431,6 @@ ${uci_set}AsianTV="Asian TV"
${uci_set}Proxy="Proxy" ${uci_set}Proxy="Proxy"
${uci_set}Youtube="Youtube" ${uci_set}Youtube="Youtube"
${uci_set}Bilibili="Bilibili" ${uci_set}Bilibili="Bilibili"
${uci_set}Douyin="Douyin"
${uci_set}Bahamut="Bahamut" ${uci_set}Bahamut="Bahamut"
${uci_set}HBOMax="HBO Max" ${uci_set}HBOMax="HBO Max"
${uci_set}HBOGo="HBO Go" ${uci_set}HBOGo="HBO Go"
@ -1450,6 +1449,7 @@ ${uci_set}AdBlock="AdBlock"
${uci_set}Speedtest="Speedtest" ${uci_set}Speedtest="Speedtest"
${uci_set}Telegram="Telegram" ${uci_set}Telegram="Telegram"
${uci_set}Crypto="Crypto" ${uci_set}Crypto="Crypto"
${uci_set}Discord="Discord"
${uci_set}PayPal="PayPal" ${uci_set}PayPal="PayPal"
${uci_set}Domestic="Domestic" ${uci_set}Domestic="Domestic"
${uci_set}Others="Others" ${uci_set}Others="Others"
@ -1461,7 +1461,6 @@ ${uci_set}Others="Others"
${UCI_DEL_LIST}="Proxy" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Proxy" >/dev/null 2>&1 ${UCI_DEL_LIST}="Proxy" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Proxy" >/dev/null 2>&1
${UCI_DEL_LIST}="Youtube" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Youtube" >/dev/null 2>&1 ${UCI_DEL_LIST}="Youtube" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Youtube" >/dev/null 2>&1
${UCI_DEL_LIST}="Bilibili" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Bilibili" >/dev/null 2>&1 ${UCI_DEL_LIST}="Bilibili" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Bilibili" >/dev/null 2>&1
${UCI_DEL_LIST}="Douyin" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Douyin" >/dev/null 2>&1
${UCI_DEL_LIST}="Bahamut" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Bahamut" >/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 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}="HBO Go" >/dev/null 2>&1 && ${UCI_ADD_LIST}="HBO Go" >/dev/null 2>&1
@ -1479,6 +1478,7 @@ ${uci_set}Others="Others"
${UCI_DEL_LIST}="Steam" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Steam" >/dev/null 2>&1 ${UCI_DEL_LIST}="Steam" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Steam" >/dev/null 2>&1
${UCI_DEL_LIST}="Telegram" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Telegram" >/dev/null 2>&1 ${UCI_DEL_LIST}="Telegram" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Telegram" >/dev/null 2>&1
${UCI_DEL_LIST}="Crypto" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Crypto" >/dev/null 2>&1 ${UCI_DEL_LIST}="Crypto" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Crypto" >/dev/null 2>&1
${UCI_DEL_LIST}="Discord" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Discord" >/dev/null 2>&1
${UCI_DEL_LIST}="PayPal" >/dev/null 2>&1 && ${UCI_ADD_LIST}="PayPal" >/dev/null 2>&1 ${UCI_DEL_LIST}="PayPal" >/dev/null 2>&1 && ${UCI_ADD_LIST}="PayPal" >/dev/null 2>&1
${UCI_DEL_LIST}="Speedtest" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Speedtest" >/dev/null 2>&1 ${UCI_DEL_LIST}="Speedtest" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Speedtest" >/dev/null 2>&1
} }
@ -1502,7 +1502,7 @@ EOF
fi fi
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
cat >> "$SERVER_FILE" <<-EOF cat >> "$SERVER_FILE" <<-EOF
url: https://cp.cloudflare.com/generate_204 url: http://cp.cloudflare.com/generate_204
interval: "600" interval: "600"
tolerance: "150" tolerance: "150"
- name: Proxy - name: Proxy

View File

@ -549,7 +549,7 @@ yml_other_set()
if defined? Value_2 then if defined? Value_2 then
Value_2.each{|x| Value_2.each{|x|
if ${10} != 1 then if ${10} != 1 then
if x =~ /(^GEOSITE,|^AND,|^OR,|^NOT,|^IP-SUFFIX,|^SRC-IP-SUFFIX,|^IN-TYPE,|PORT,[0-9]+\/+|PORT,[0-9]+-+)/ or x.split(',')[-1] == 'tcp' or x.split(',')[-1] == 'udp' then if x =~ /(^GEOSITE,|^AND,|^OR,|^NOT,|^IP-SUFFIX,|^SRC-IP-SUFFIX,|^IN-TYPE,|^SUB-RULE,|PORT,[0-9]+\/+|PORT,[0-9]+-+)/ or x.split(',')[-1] == 'tcp' or x.split(',')[-1] == 'udp' then
puts '${LOGTIME} Warning: Skip the Custom Rule that Core not Support【' + x + '】' puts '${LOGTIME} Warning: Skip the Custom Rule that Core not Support【' + x + '】'
next next
end; end;
@ -583,7 +583,7 @@ yml_other_set()
end; end;
Value_4.each{|x| Value_4.each{|x|
if ${10} != 1 then if ${10} != 1 then
if x =~ /(^GEOSITE,|^AND,|^OR,|^NOT,|^IP-SUFFIX,|^SRC-IP-SUFFIX,|^IN-TYPE,|PORT,[0-9]+\/+|PORT,[0-9]+-+)/ or x.split(',')[-1] == 'tcp' or x.split(',')[-1] == 'udp' then if x =~ /(^GEOSITE,|^AND,|^OR,|^NOT,|^IP-SUFFIX,|^SRC-IP-SUFFIX,|^IN-TYPE,|^SUB-RULE,|PORT,[0-9]+\/+|PORT,[0-9]+-+)/ or x.split(',')[-1] == 'tcp' or x.split(',')[-1] == 'udp' then
puts '${LOGTIME} Warning: Skip the Custom Rule that Core not Support【' + x + '】' puts '${LOGTIME} Warning: Skip the Custom Rule that Core not Support【' + x + '】'
next next
end; end;
@ -602,7 +602,7 @@ yml_other_set()
if not Value_1['rules'].to_a.empty? and Value_1['rules'].class.to_s == 'Array' then if not Value_1['rules'].to_a.empty? and Value_1['rules'].class.to_s == 'Array' then
Value_1.each{|x| Value_1.each{|x|
if ${10} != 1 then if ${10} != 1 then
if x =~ /(^GEOSITE,|^AND,|^OR,|^NOT,|^IP-SUFFIX,|^SRC-IP-SUFFIX,|^IN-TYPE,|PORT,[0-9]+\/+|PORT,[0-9]+-+)/ or x.split(',')[-1] == 'tcp' or x.split(',')[-1] == 'udp' then if x =~ /(^GEOSITE,|^AND,|^OR,|^NOT,|^IP-SUFFIX,|^SRC-IP-SUFFIX,|^IN-TYPE,|^SUB-RULE,|PORT,[0-9]+\/+|PORT,[0-9]+-+)/ or x.split(',')[-1] == 'tcp' or x.split(',')[-1] == 'udp' then
puts '${LOGTIME} Warning: Skip the Custom Rule that Core not Support【' + x + '】' puts '${LOGTIME} Warning: Skip the Custom Rule that Core not Support【' + x + '】'
Value_1.delete(x); Value_1.delete(x);
end; end;
@ -614,7 +614,7 @@ yml_other_set()
elsif Value_1.class.to_s == 'Array' then elsif Value_1.class.to_s == 'Array' then
Value_1.each{|x| Value_1.each{|x|
if ${10} != 1 then if ${10} != 1 then
if x =~ /(^GEOSITE,|^AND,|^OR,|^NOT,|^IP-SUFFIX,|^SRC-IP-SUFFIX,|^IN-TYPE,|PORT,[0-9]+\/+|PORT,[0-9]+-+)/ or x.split(',')[-1] == 'tcp' or x.split(',')[-1] == 'udp' then if x =~ /(^GEOSITE,|^AND,|^OR,|^NOT,|^IP-SUFFIX,|^SRC-IP-SUFFIX,|^IN-TYPE,|^SUB-RULE,|PORT,[0-9]+\/+|PORT,[0-9]+-+)/ or x.split(',')[-1] == 'tcp' or x.split(',')[-1] == 'udp' then
puts '${LOGTIME} Warning: Skip the Custom Rule that Core not Support【' + x + '】' puts '${LOGTIME} Warning: Skip the Custom Rule that Core not Support【' + x + '】'
Value_1.delete(x); Value_1.delete(x);
end; end;
@ -633,7 +633,7 @@ yml_other_set()
if not Value_2['rules'].to_a.empty? and Value_2['rules'].class.to_s == 'Array' then if not Value_2['rules'].to_a.empty? and Value_2['rules'].class.to_s == 'Array' then
Value_2.each{|x| Value_2.each{|x|
if ${10} != 1 then if ${10} != 1 then
if x =~ /(^GEOSITE,|^AND,|^OR,|^NOT,|^IP-SUFFIX,|^SRC-IP-SUFFIX,|^IN-TYPE,|PORT,[0-9]+\/+|PORT,[0-9]+-+)/ or x.split(',')[-1] == 'tcp' or x.split(',')[-1] == 'udp' then if x =~ /(^GEOSITE,|^AND,|^OR,|^NOT,|^IP-SUFFIX,|^SRC-IP-SUFFIX,|^IN-TYPE,|^SUB-RULE,|PORT,[0-9]+\/+|PORT,[0-9]+-+)/ or x.split(',')[-1] == 'tcp' or x.split(',')[-1] == 'udp' then
puts '${LOGTIME} Warning: Skip the Custom Rule that Core not Support【' + x + '】' puts '${LOGTIME} Warning: Skip the Custom Rule that Core not Support【' + x + '】'
Value_2.delete(x); Value_2.delete(x);
end; end;
@ -645,7 +645,7 @@ yml_other_set()
elsif Value_2.class.to_s == 'Array' then elsif Value_2.class.to_s == 'Array' then
Value_2.each{|x| Value_2.each{|x|
if ${10} != 1 then if ${10} != 1 then
if x =~ /(^GEOSITE,|^AND,|^OR,|^NOT,|^IP-SUFFIX,|^SRC-IP-SUFFIX,|^IN-TYPE,|PORT,[0-9]+\/+|PORT,[0-9]+-+)/ or x.split(',')[-1] == 'tcp' or x.split(',')[-1] == 'udp' then if x =~ /(^GEOSITE,|^AND,|^OR,|^NOT,|^IP-SUFFIX,|^SRC-IP-SUFFIX,|^IN-TYPE,|^SUB-RULE,|PORT,[0-9]+\/+|PORT,[0-9]+-+)/ or x.split(',')[-1] == 'tcp' or x.split(',')[-1] == 'udp' then
puts '${LOGTIME} Warning: Skip the Custom Rule that Core not Support【' + x + '】' puts '${LOGTIME} Warning: Skip the Custom Rule that Core not Support【' + x + '】'
Value_2.delete(x); Value_2.delete(x);
end; end;
@ -675,7 +675,7 @@ yml_other_set()
end end
Value_3.each{|x| Value_3.each{|x|
if ${10} != 1 then if ${10} != 1 then
if x =~ /(^GEOSITE,|^AND,|^OR,|^NOT,|^IP-SUFFIX,|^SRC-IP-SUFFIX,|^IN-TYPE,|PORT,[0-9]+\/+|PORT,[0-9]+-+)/ or x.split(',')[-1] == 'tcp' or x.split(',')[-1] == 'udp' then if x =~ /(^GEOSITE,|^AND,|^OR,|^NOT,|^IP-SUFFIX,|^SRC-IP-SUFFIX,|^IN-TYPE,|^SUB-RULE,|PORT,[0-9]+\/+|PORT,[0-9]+-+)/ or x.split(',')[-1] == 'tcp' or x.split(',')[-1] == 'udp' then
puts '${LOGTIME} Warning: Skip the Custom Rule that Core not Support【' + x + '】' puts '${LOGTIME} Warning: Skip the Custom Rule that Core not Support【' + x + '】'
next next
end; end;
@ -688,6 +688,54 @@ yml_other_set()
end; end;
end; end;
end; end;
#SUB-RULE
if ${10} == 1 then
if Value.has_key?('sub-rules') and not Value['sub-rules'].to_a.empty? then
if File::exist?('/etc/openclash/custom/openclash_custom_rules.list') then
Value_1 = YAML.load_file('/etc/openclash/custom/openclash_custom_rules.list');
if Value_1 != false then
if Value_1.class.to_s == 'Hash' then
if not Value_1['sub-rules'].to_a.empty? and Value_1['sub-rules'].class.to_s == 'Hash' then
Value['sub-rules'] = Value['sub-rules'].merge!(Value_1['sub-rules']);
end;
end;
end;
end;
if File::exist?('/etc/openclash/custom/openclash_custom_rules_2.list') then
Value_2 = YAML.load_file('/etc/openclash/custom/openclash_custom_rules_2.list');
if Value_2 != false then
if Value_2.class.to_s == 'Hash' then
if not Value_2['sub-rules'].to_a.empty? and Value_2['sub-rules'].class.to_s == 'Hash' then
Value['sub-rules'] = Value['sub-rules'].merge!(Value_2['sub-rules']);
end;
end;
end;
end;
else
if File::exist?('/etc/openclash/custom/openclash_custom_rules.list') then
Value_1 = YAML.load_file('/etc/openclash/custom/openclash_custom_rules.list');
if Value_1 != false then
if Value_1.class.to_s == 'Hash' then
if not Value_1['sub-rules'].to_a.empty? and Value_1['sub-rules'].class.to_s == 'Hash' then
Value['sub-rules'] = Value_1['sub-rules'];
end;
end;
end;
end;
if File::exist?('/etc/openclash/custom/openclash_custom_rules_2.list') then
Value_2 = YAML.load_file('/etc/openclash/custom/openclash_custom_rules_2.list');
if Value_2 != false then
if Value_2.class.to_s == 'Hash' then
if not Value_2['sub-rules'].to_a.empty? and Value_2['sub-rules'].class.to_s == 'Hash' then
Value['sub-rules'] = Value_2['sub-rules'];
end;
end;
end;
end;
end;
else
puts '${LOGTIME} Warning: Skip the Custom Rule that Core not Support【sub-rules】'
end;
end; end;
}.join; }.join;
rescue Exception => e rescue Exception => e
@ -795,6 +843,7 @@ yml_other_rules_get()
config_get "Speedtest" "$section" "Speedtest" "" config_get "Speedtest" "$section" "Speedtest" ""
config_get "Telegram" "$section" "Telegram" "" config_get "Telegram" "$section" "Telegram" ""
config_get "Crypto" "$section" "Crypto" "$Proxy" config_get "Crypto" "$section" "Crypto" "$Proxy"
config_get "Discord" "$section" "Discord" "$Proxy"
config_get "Microsoft" "$section" "Microsoft" "" config_get "Microsoft" "$section" "Microsoft" ""
config_get "PayPal" "$section" "PayPal" "" config_get "PayPal" "$section" "PayPal" ""
config_get "Domestic" "$section" "Domestic" "" config_get "Domestic" "$section" "Domestic" ""
@ -802,7 +851,6 @@ yml_other_rules_get()
config_get "GoogleFCM" "$section" "GoogleFCM" "DIRECT" config_get "GoogleFCM" "$section" "GoogleFCM" "DIRECT"
config_get "Discovery" "$section" "Discovery" "$GlobalTV" config_get "Discovery" "$section" "Discovery" "$GlobalTV"
config_get "DAZN" "$section" "DAZN" "$GlobalTV" config_get "DAZN" "$section" "DAZN" "$GlobalTV"
config_get "Douyin" "$section" "Douyin" "$AsianTV"
} }
if [ "$1" != "0" ]; then if [ "$1" != "0" ]; then
@ -856,7 +904,7 @@ if [ "$1" != "0" ]; then
|| [ -z "$(grep -F "$Speedtest" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$Speedtest" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Telegram" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$Telegram" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Crypto" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$Crypto" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Douyin" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$Discord" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Microsoft" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$Microsoft" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$PayPal" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$PayPal" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Others" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$Others" /tmp/Proxy_Group)" ]\
@ -909,12 +957,12 @@ if [ "$1" != "0" ]; then
.gsub(/,Netflix$/, ',$Netflix#d') .gsub(/,Netflix$/, ',$Netflix#d')
.gsub(/,Disney$/, ',$Disney#d') .gsub(/,Disney$/, ',$Disney#d')
.gsub(/,Spotify$/, ',$Spotify#d') .gsub(/,Spotify$/, ',$Spotify#d')
.gsub(/,Douyin$/, ',$Douyin#d')
.gsub(/,Steam$/, ',$Steam#d') .gsub(/,Steam$/, ',$Steam#d')
.gsub(/,AdBlock$/, ',$AdBlock#d') .gsub(/,AdBlock$/, ',$AdBlock#d')
.gsub(/,Speedtest$/, ',$Speedtest#d') .gsub(/,Speedtest$/, ',$Speedtest#d')
.gsub(/,Telegram$/, ',$Telegram#d') .gsub(/,Telegram$/, ',$Telegram#d')
.gsub(/,Crypto$/, ',$Crypto#d') .gsub(/,Crypto$/, ',$Crypto#d')
.gsub(/,Discord$/, ',$Discord#d')
.gsub(/,Microsoft$/, ',$Microsoft#d') .gsub(/,Microsoft$/, ',$Microsoft#d')
.to_s.gsub(/,PayPal$/, ',$PayPal#d') .to_s.gsub(/,PayPal$/, ',$PayPal#d')
.gsub(/,Domestic$/, ',$Domestic#d') .gsub(/,Domestic$/, ',$Domestic#d')
@ -938,12 +986,12 @@ if [ "$1" != "0" ]; then
.gsub!(/: \"Netflix\"/,': \"$Netflix#d\"') .gsub!(/: \"Netflix\"/,': \"$Netflix#d\"')
.gsub!(/: \"Disney\"/,': \"$Disney#d\"') .gsub!(/: \"Disney\"/,': \"$Disney#d\"')
.gsub!(/: \"Spotify\"/,': \"$Spotify#d\"') .gsub!(/: \"Spotify\"/,': \"$Spotify#d\"')
.gsub!(/: \"Douyin\"/,': \"$Douyin#d\"')
.gsub!(/: \"Steam\"/,': \"$Steam#d\"') .gsub!(/: \"Steam\"/,': \"$Steam#d\"')
.gsub!(/: \"AdBlock\"/,': \"$AdBlock#d\"') .gsub!(/: \"AdBlock\"/,': \"$AdBlock#d\"')
.gsub!(/: \"Speedtest\"/,': \"$Speedtest#d\"') .gsub!(/: \"Speedtest\"/,': \"$Speedtest#d\"')
.gsub!(/: \"Telegram\"/,': \"$Telegram#d\"') .gsub!(/: \"Telegram\"/,': \"$Telegram#d\"')
.gsub!(/: \"Crypto\"/,': \"$Crypto#d\"') .gsub!(/: \"Crypto\"/,': \"$Crypto#d\"')
.gsub!(/: \"Discord\"/,': \"$Discord#d\"')
.gsub!(/: \"Microsoft\"/,': \"$Microsoft#d\"') .gsub!(/: \"Microsoft\"/,': \"$Microsoft#d\"')
.gsub!(/: \"PayPal\"/,': \"$PayPal#d\"') .gsub!(/: \"PayPal\"/,': \"$PayPal#d\"')
.gsub!(/: \"Domestic\"/,': \"$Domestic#d\"') .gsub!(/: \"Domestic\"/,': \"$Domestic#d\"')

View File

@ -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.45.51-beta"><title>Current Version: v0.45.51-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.45.51-beta</text><text x="1405" y="140" transform="scale(.1)" fill="#fff" textLength="790">v0.45.51-beta</text></g></svg> <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.45.59-beta"><title>Current Version: v0.45.59-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.45.59-beta</text><text x="1405" y="140" transform="scale(.1)" fill="#fff" textLength="790">v0.45.59-beta</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -136,13 +136,13 @@ define Build/Compile
endef endef
define Build/InstallDev define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include $(INSTALL_DIR) $(1)/usr/include/libcronet
$(CP) \ $(CP) \
$(PKG_BUILD_DIR)/src/components/grpc_support/include/bidirectional_stream_c.h \ $(PKG_BUILD_DIR)/src/components/grpc_support/include/bidirectional_stream_c.h \
$(PKG_BUILD_DIR)/src/components/cronet/native/generated/cronet.idl_c.h \ $(PKG_BUILD_DIR)/src/components/cronet/native/generated/cronet.idl_c.h \
$(PKG_BUILD_DIR)/src/components/cronet/native/include/cronet_c.h \ $(PKG_BUILD_DIR)/src/components/cronet/native/include/cronet_c.h \
$(PKG_BUILD_DIR)/src/components/cronet/native/include/cronet_export.h \ $(PKG_BUILD_DIR)/src/components/cronet/native/include/cronet_export.h \
$(1)/usr/include/ $(1)/usr/include//libcronet/
endef endef
define Package/naiveproxy/install define Package/naiveproxy/install