From 6543ddda1751bd3e2f8ee2caa9227c48c8d401fd Mon Sep 17 00:00:00 2001 From: vernesong <42875168+vernesong@users.noreply.github.com> Date: Fri, 20 Sep 2024 12:23:34 +0800 Subject: [PATCH 01/11] chore: refine code --- luci-app-openclash/root/etc/init.d/openclash | 17 ----------------- .../usr/share/openclash/yml_rules_change.sh | 4 ++++ 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/luci-app-openclash/root/etc/init.d/openclash b/luci-app-openclash/root/etc/init.d/openclash index 6ca0954559..3a2500b4da 100644 --- a/luci-app-openclash/root/etc/init.d/openclash +++ b/luci-app-openclash/root/etc/init.d/openclash @@ -1663,15 +1663,6 @@ if [ -n "$FW4" ]; then fi fi fi - if [ "$en_mode" = "fake-ip" ] && [ "$china_ip_route" != "0" ] && [ "$enable_redirect_dns" != "2" ]; then - nft insert rule inet fw4 dstnat position 0 meta nfproto {ipv6} tcp dport 53 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" - nft insert rule inet fw4 dstnat position 0 meta nfproto {ipv6} udp dport 53 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" - nft 'add chain inet fw4 nat_output { type nat hook output priority -1; }' - nft add rule inet fw4 nat_output position 0 meta nfproto {ipv6} tcp dport 53 meta skuid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" - nft add rule inet fw4 nat_output position 0 meta nfproto {ipv6} udp dport 53 meta skuid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" - nft add rule inet fw4 nat_output position 0 meta nfproto {ipv6} tcp dport 12353 meta skuid != 65534 counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" - nft add rule inet fw4 nat_output position 0 meta nfproto {ipv6} udp dport 12353 meta skuid != 65534 counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" - fi if [ "$china_ip6_route" != "0" ] || [ "$disable_udp_quic" = "1" ]; then nft 'flush set inet fw4 china_ip6_route' @@ -2446,14 +2437,6 @@ if [ -z "$FW4" ]; then fi fi fi - if [ "$en_mode" = "fake-ip" ] && [ "$china_ip_route" != "0" ] && [ "$enable_redirect_dns" != "2" ]; then - ip6tables -t nat -I PREROUTING -p udp --dport 53 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" - ip6tables -t nat -I PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" - ip6tables -t nat -I OUTPUT -p udp --dport 53 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" - ip6tables -t nat -I OUTPUT -p tcp --dport 53 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" - ip6tables -t nat -I OUTPUT -p udp --dport 12353 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" - ip6tables -t nat -I OUTPUT -p tcp --dport 12353 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" - fi if [ "$china_ip6_route" != "0" ] || [ "$disable_udp_quic" = "1" ]; then ipset -! flush china_ip6_route diff --git a/luci-app-openclash/root/usr/share/openclash/yml_rules_change.sh b/luci-app-openclash/root/usr/share/openclash/yml_rules_change.sh index e32daddc24..5a2282ce1d 100644 --- a/luci-app-openclash/root/usr/share/openclash/yml_rules_change.sh +++ b/luci-app-openclash/root/usr/share/openclash/yml_rules_change.sh @@ -143,6 +143,10 @@ yml_gen_rule_provider_file() return fi + if [ -z "$RULE_PROVIDER_FILE_NAME" ] || [ -z "$RULE_PROVIDER_FILE_BEHAVIOR" ] || [ -z "$RULE_PROVIDER_FILE_URL" ]; then + return + fi + cat >> "$RULE_PROVIDER_FILE" <<-EOF $1: type: http From 1cd343f248f10dcb02e0460cf32b622b6024ad5b Mon Sep 17 00:00:00 2001 From: vernesong <42875168+vernesong@users.noreply.github.com> Date: Fri, 20 Sep 2024 19:01:01 +0800 Subject: [PATCH 02/11] fix typo --- luci-app-openclash/root/usr/share/openclash/yml_change.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/luci-app-openclash/root/usr/share/openclash/yml_change.sh b/luci-app-openclash/root/usr/share/openclash/yml_change.sh index 6cff2a9805..43b7db978b 100644 --- a/luci-app-openclash/root/usr/share/openclash/yml_change.sh +++ b/luci-app-openclash/root/usr/share/openclash/yml_change.sh @@ -706,7 +706,7 @@ Thread.new{ end; end; if '$1' == 'fake-ip' then - if '$china_ip_route' != '0' then + if '$china_ip_route' != '0' or '$china_ip6_route' != '0' then if Value['dns']['fake-ip-filter-mode'] == 'blacklist' or not Value['dns'].has_key?('fake-ip-filter-mode') then if Value['dns'].has_key?('fake-ip-filter') and not Value['dns']['fake-ip-filter'].to_a.empty? then Value['dns']['fake-ip-filter'].insert(-1,'geosite:cn'); From 7c11f92d48297e349927e456f4eea2cc11775df0 Mon Sep 17 00:00:00 2001 From: vernesong <42875168+vernesong@users.noreply.github.com> Date: Sat, 21 Sep 2024 12:40:50 +0800 Subject: [PATCH 03/11] chore: refine --- luci-app-openclash/root/etc/init.d/openclash | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/luci-app-openclash/root/etc/init.d/openclash b/luci-app-openclash/root/etc/init.d/openclash index 3a2500b4da..ffc83ad04c 100644 --- a/luci-app-openclash/root/etc/init.d/openclash +++ b/luci-app-openclash/root/etc/init.d/openclash @@ -1596,6 +1596,9 @@ if [ -n "$FW4" ]; then elif [ "$enable_redirect_dns" -eq 1 ]; then nft insert rule inet fw4 dstnat position 0 meta nfproto {ipv4} tcp dport 53 counter accept comment \"OpenClash TCP DNS Hijack\" fi + if [ "$router_self_proxy" = 1 ]; then + nft insert rule inet fw4 nat_output position 0 skuid != 65534 meta nfproto {ipv4} tcp dport 53 counter accept comment \"OpenClash TCP DNS Hijack\" + fi #TUN FORWORD nft insert rule inet fw4 forward position 0 meta l4proto {tcp,udp} oifname utun counter accept comment \"OpenClash TUN Forward\" @@ -1664,6 +1667,17 @@ if [ -n "$FW4" ]; then fi fi + if [ "$enable_redirect_dns" -eq 2 ]; then + local position=$(nft -a list chain inet fw4 openclash_dns_redirect |grep "DNS" |grep -v "redirect" |awk -F '# handle ' '{print$2}' |sort -rn |head -1) + [ -z "$position" ] && position=0 + nft insert rule inet fw4 openclash_dns_redirect position "$position" meta nfproto {ipv6} tcp dport 53 counter accept comment \"OpenClash TCP DNS Hijack\" + elif [ "$enable_redirect_dns" -eq 1 ]; then + nft insert rule inet fw4 dstnat position 0 meta nfproto {ipv6} tcp dport 53 counter accept comment \"OpenClash TCP DNS Hijack\" + fi + if [ "$router_self_proxy" = 1 ]; then + nft insert rule inet fw4 nat_output position 0 skuid != 65534 meta nfproto {ipv6} tcp dport 53 counter accept comment \"OpenClash TCP DNS Hijack\" + fi + if [ "$china_ip6_route" != "0" ] || [ "$disable_udp_quic" = "1" ]; then nft 'flush set inet fw4 china_ip6_route' nft -f '/etc/openclash/china_ip6_route.ipset' @@ -2369,6 +2383,9 @@ if [ -z "$FW4" ]; then elif [ "$enable_redirect_dns" -eq 1 ]; then iptables -t nat -I PREROUTING -m comment --comment "OpenClash TCP DNS Hijack" -p tcp --dport 53 -j ACCEPT fi + if [ "$router_self_proxy" = 1 ]; then + iptables -t nat -I OUTPUT -m owner ! --uid-owner 65534 -m comment --comment "OpenClash TCP DNS Hijack" -p tcp --dport 53 -j ACCEPT + fi #TUN FORWORD iptables -I FORWARD -m comment --comment "OpenClash TUN Forward" -o utun -j ACCEPT >/dev/null 2>&1 @@ -2438,6 +2455,19 @@ if [ -z "$FW4" ]; then fi fi + if [ "$ipv6_mode" -eq 2 ]; then + if [ "$enable_redirect_dns" -eq 2 ]; then + local position=$(ip6tables -nvL openclash_dns_redirect -t nat |grep "DNS" |grep -v "REDIRECT" |wc -l) + let position++ + ip6tables -t nat -I openclash_dns_redirect "$position" -m comment --comment "OpenClash TCP DNS Hijack" -p tcp --dport 53 -j ACCEPT + elif [ "$enable_redirect_dns" -eq 1 ]; then + ip6tables -t nat -I PREROUTING -m comment --comment "OpenClash TCP DNS Hijack" -p tcp --dport 53 -j ACCEPT + fi + if [ "$router_self_proxy" = 1 ]; then + ip6tables -t nat -I OUTPUT -p tcp --dport 53 -d ::/0 -m owner ! --uid-owner 65534 -j ACCEPT -m comment --comment "OpenClash DNS Hijack" + fi + fi + if [ "$china_ip6_route" != "0" ] || [ "$disable_udp_quic" = "1" ]; then ipset -! flush china_ip6_route ipset -! restore Date: Sat, 21 Sep 2024 17:08:54 +0800 Subject: [PATCH 04/11] 0.46.032 --- luci-app-openclash/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/luci-app-openclash/Makefile b/luci-app-openclash/Makefile index 8a300acb88..792bf055fc 100644 --- a/luci-app-openclash/Makefile +++ b/luci-app-openclash/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-openclash -PKG_VERSION:=0.46.031 +PKG_VERSION:=0.46.032 PKG_RELEASE:=beta PKG_MAINTAINER:=vernesong From d5a55a1a760b5b8f454805a3b938ef0055e55888 Mon Sep 17 00:00:00 2001 From: vernesong <42875168+vernesong@users.noreply.github.com> Date: Sat, 21 Sep 2024 18:57:28 +0800 Subject: [PATCH 05/11] chore: refine --- luci-app-openclash/po/zh-cn/openclash.zh-cn.po | 5 ++++- luci-app-openclash/root/usr/share/openclash/yml_change.sh | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/luci-app-openclash/po/zh-cn/openclash.zh-cn.po b/luci-app-openclash/po/zh-cn/openclash.zh-cn.po index ec57126108..d1f961cf70 100644 --- a/luci-app-openclash/po/zh-cn/openclash.zh-cn.po +++ b/luci-app-openclash/po/zh-cn/openclash.zh-cn.po @@ -3394,4 +3394,7 @@ msgid "ECS Override" msgstr "ECS 区域地址覆盖" msgid "Override the ECS Subnet Address" -msgstr "强制覆盖 DNS 查询的子网区域地址" \ No newline at end of file +msgstr "强制覆盖 DNS 查询的子网区域地址" + +msgid "Tip: Respect-rules Option Need Proxy-server-nameserver Option Must Be Setted, Auto Set to" +msgstr "提示:使用 Respect-rules 功能时 Proxy-server-nameserver 必须配置,插件将默认将其设置为" \ No newline at end of file diff --git a/luci-app-openclash/root/usr/share/openclash/yml_change.sh b/luci-app-openclash/root/usr/share/openclash/yml_change.sh index 43b7db978b..32d835ea96 100644 --- a/luci-app-openclash/root/usr/share/openclash/yml_change.sh +++ b/luci-app-openclash/root/usr/share/openclash/yml_change.sh @@ -578,7 +578,7 @@ begin Thread.new{ if not Value['dns'].key?('nameserver') or Value['dns']['nameserver'].to_a.empty? then puts '${LOGTIME} Tip: Detected That The nameserver DNS Option Has No Server Set, Starting To Complete...'; - Value_1={'nameserver'=>['system']}; + Value_1={'nameserver'=>['114.114.114.114','119.29.29.29','8.8.8.8','1.1.1.1']}; Value_2={'fallback'=>['https://dns.cloudflare.com/dns-query','https://dns.google/dns-query']}; Value['dns'].merge!(Value_1); Value['dns'].merge!(Value_2); @@ -632,6 +632,12 @@ Thread.new{ Value['dns']['proxy-server-nameserver'] = Value_1['proxy-server-nameserver']; end; end; + if '${34}' == '1' then + if not Value['dns'].has_key?('proxy-server-nameserver') or Value['dns']['proxy-server-nameserver'].to_a.empty? then + Value['dns'].merge!({'proxy-server-nameserver'=>['114.114.114.114','119.29.29.29','8.8.8.8','1.1.1.1']}); + puts '${LOGTIME} Tip: Respect-rules Option Need Proxy-server-nameserver Option Must Be Setted, Auto Set to【114.114.114.114, 119.29.29.29, 8.8.8.8, 1.1.1.1】'; + end; + end; }.join; end; From f3c90850555d29b358843dd5dcb4e60d7f916010 Mon Sep 17 00:00:00 2001 From: vernesong <42875168+vernesong@users.noreply.github.com> Date: Mon, 23 Sep 2024 08:34:03 +0800 Subject: [PATCH 06/11] chore: refine --- luci-app-openclash/root/usr/share/openclash/yml_change.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/luci-app-openclash/root/usr/share/openclash/yml_change.sh b/luci-app-openclash/root/usr/share/openclash/yml_change.sh index 32d835ea96..7fb463fe55 100644 --- a/luci-app-openclash/root/usr/share/openclash/yml_change.sh +++ b/luci-app-openclash/root/usr/share/openclash/yml_change.sh @@ -782,13 +782,6 @@ Thread.new{ if File::exist?('/tmp/yaml_openclash_auth') then Value_1 = YAML.load_file('/tmp/yaml_openclash_auth'); Value['authentication']=Value_1 - if Value.key?('skip-auth-prefixes') and not Value['skip-auth-prefixes'].nil? then - Value['skip-auth-prefixes'].merge!(['127.0.0.1/8','::1/128','10.0.0.0/8','192.168.0.0/16','172.16.0.0/12']); - else - Value['skip-auth-prefixes']=['127.0.0.1/8','::1/128','10.0.0.0/8','192.168.0.0/16','172.16.0.0/12']; - end; - elsif Value.key?('authentication') then - Value.delete('authentication'); end; }.join; rescue Exception => e From 4966b3abccdfbedde9a142dd1177d96893c6a12b Mon Sep 17 00:00:00 2001 From: vernesong <42875168+vernesong@users.noreply.github.com> Date: Mon, 23 Sep 2024 08:41:36 +0800 Subject: [PATCH 07/11] chore: refine --- luci-app-openclash/root/usr/share/openclash/yml_change.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/luci-app-openclash/root/usr/share/openclash/yml_change.sh b/luci-app-openclash/root/usr/share/openclash/yml_change.sh index 7fb463fe55..83d97f46c3 100644 --- a/luci-app-openclash/root/usr/share/openclash/yml_change.sh +++ b/luci-app-openclash/root/usr/share/openclash/yml_change.sh @@ -781,7 +781,11 @@ begin Thread.new{ if File::exist?('/tmp/yaml_openclash_auth') then Value_1 = YAML.load_file('/tmp/yaml_openclash_auth'); - Value['authentication']=Value_1 + if Value.has_key?('authentication') and not Value['authentication'].to_a.empty? then + Value['authentication'].merge!(Value_1); + else + Value['authentication']=Value_1; + end; end; }.join; rescue Exception => e From 9808d20f9ec6132aab63cb8cacb2d805656b7eb0 Mon Sep 17 00:00:00 2001 From: vernesong <42875168+vernesong@users.noreply.github.com> Date: Mon, 23 Sep 2024 19:44:04 +0800 Subject: [PATCH 08/11] Update compile_meta_core.yml --- .github/workflows/compile_meta_core.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/compile_meta_core.yml b/.github/workflows/compile_meta_core.yml index 1c681a637e..625a5e033e 100644 --- a/.github/workflows/compile_meta_core.yml +++ b/.github/workflows/compile_meta_core.yml @@ -111,7 +111,7 @@ jobs: - name: Setup loongarch abi1 Go run: | wget -q https://github.com/MetaCubeX/loongarch64-golang/releases/download/1.22.4/go1.22.4.linux-amd64-abi1.tar.gz - sudo tar zxf go1.21.5.linux-amd64-abi1.tar.gz -C /usr/local + sudo tar zxf go1.22.4.linux-amd64-abi1.tar.gz -C /usr/local echo "/usr/local/go/bin" >> $GITHUB_PATH - name: Compile Meta loongarch abi1 Clash @@ -127,7 +127,7 @@ jobs: - name: Setup loongarch abi2 Go run: | wget -q https://github.com/MetaCubeX/loongarch64-golang/releases/download/1.22.4/go1.22.4.linux-amd64-abi2.tar.gz - sudo tar zxf go1.21.5.linux-amd64-abi2.tar.gz -C /usr/local + sudo tar zxf go1.22.4.linux-amd64-abi2.tar.gz -C /usr/local - name: Compile Meta loongarch abi2 Clash run: | From e3b53dad9d43c9ef32546a205d15d4af2c780fc7 Mon Sep 17 00:00:00 2001 From: LovinYarn Date: Mon, 23 Sep 2024 20:52:32 +0800 Subject: [PATCH 09/11] chore: update metacubexd v1.149.0 (#4046) --- ...{Config-C_o5p4_0.js => Config-mfHMd71S.js} | 2 +- .../metacubexd/assets/Connections-C4lDijqW.js | 1 + .../metacubexd/assets/Connections-CndzxPjV.js | 1 - .../ui/metacubexd/assets/Logs-BT10aNK6.js | 1 - .../ui/metacubexd/assets/Logs-KOUcZ2qF.js | 1 + .../ui/metacubexd/assets/Overview-Cb2jAeC5.js | 795 -- .../ui/metacubexd/assets/Overview-De_zu9wR.js | 795 ++ ...roxies-CiU6kTxV.js => Proxies-DgzLrzio.js} | 2 +- .../ui/metacubexd/assets/Rules-DcWu1S4Q.js | 9 - .../ui/metacubexd/assets/Rules-DrUtyF7O.js | 9 + .../ui/metacubexd/assets/Setup-CqaOhgQf.js | 1 + .../ui/metacubexd/assets/Setup-xfD-b2cx.js | 1 - .../ui/metacubexd/assets/global-BCvoRSag.js | 1 + .../ui/metacubexd/assets/global-CdnCpt5C.js | 1 - .../ui/metacubexd/assets/index-6_sXLHMR.js | 36 + .../{index-QV8LhAb2.js => index-DWMGWNy8.js} | 11757 ++++++++-------- .../ui/metacubexd/assets/index-DzC0BcbT.js | 36 - .../share/openclash/ui/metacubexd/index.html | 2 +- .../usr/share/openclash/ui/metacubexd/sw.js | 2 +- 19 files changed, 7084 insertions(+), 6369 deletions(-) rename luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/{Config-C_o5p4_0.js => Config-mfHMd71S.js} (68%) create mode 100644 luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/Connections-C4lDijqW.js delete mode 100644 luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/Connections-CndzxPjV.js delete mode 100644 luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/Logs-BT10aNK6.js create mode 100644 luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/Logs-KOUcZ2qF.js delete mode 100644 luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/Overview-Cb2jAeC5.js create mode 100644 luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/Overview-De_zu9wR.js rename luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/{Proxies-CiU6kTxV.js => Proxies-DgzLrzio.js} (77%) delete mode 100644 luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/Rules-DcWu1S4Q.js create mode 100644 luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/Rules-DrUtyF7O.js create mode 100644 luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/Setup-CqaOhgQf.js delete mode 100644 luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/Setup-xfD-b2cx.js create mode 100644 luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/global-BCvoRSag.js delete mode 100644 luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/global-CdnCpt5C.js create mode 100644 luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/index-6_sXLHMR.js rename luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/{index-QV8LhAb2.js => index-DWMGWNy8.js} (81%) delete mode 100644 luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/index-DzC0BcbT.js diff --git a/luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/Config-C_o5p4_0.js b/luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/Config-mfHMd71S.js similarity index 68% rename from luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/Config-C_o5p4_0.js rename to luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/Config-mfHMd71S.js index 92b9c431bb..9b4e1f1c04 100644 --- a/luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/Config-C_o5p4_0.js +++ b/luci-app-openclash/root/usr/share/openclash/ui/metacubexd/assets/Config-mfHMd71S.js @@ -1 +1 @@ -import{y as U,C as ne,b3 as re,b as X,x as se,u as B,i as e,f as t,ai as E,S as T,t as f,z as w,b4 as ie,c as W,d as Z,B as D,F as L,b5 as ce,q as J,b6 as $,a6 as oe,_ as v,ag as N,b7 as de,b8 as ue,b9 as ge,ba as be,bb as he,bc as pe,bd as ve,be as fe,bf as me,bg as xe,bh as _e,bi as $e,bj as O,bk as Ce,bl as ke,b2 as ye,j as Se,bm as we,bn as Ee,bo as z,bp as Ie,bq as H,br as De,bs as Le,bt as Te,bu as Ae,bv as Pe,v as K,g as Ne,bw as Fe}from"./index-QV8LhAb2.js";const[Y,Be]=U(""),j=ne(()=>Y().includes("sing-box")),je=()=>{re().then(Be)};var Ue=f('
'),Re=f('
'),Me=f('
'),F=f("