Skip to content

Commit d0141ee

Browse files
committed
Merge branch 'dev'
2 parents 8ebe09e + 759306e commit d0141ee

29 files changed

+866
-252
lines changed

.github/workflows/compile_meta_core.yml

+46-1
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,20 @@ jobs:
7474
mkdir tmp/bin
7575
cp ./OpenClash/.github/makefile/meta ./tmp/Makefile
7676
77+
- name: Copy loongarch abi1 Makefile
78+
run: |
79+
cd ..
80+
mkdir -p tmp/loong64_abi1/bin
81+
cp ./OpenClash/.github/makefile/meta_loongarch_abi1 ./tmp/loong64_abi1/Makefile
82+
83+
- name: Copy loongarch abi2 Makefile
84+
run: |
85+
cd ..
86+
mkdir -p tmp/loong64_abi2/bin
87+
cp ./OpenClash/.github/makefile/meta_loongarch_abi2 ./tmp/loong64_abi2/Makefile
88+
7789
- name: Setup Go
78-
uses: actions/setup-go@v3
90+
uses: actions/setup-go@v5
7991
with:
8092
go-version: "1.22"
8193
check-latest: true
@@ -94,6 +106,37 @@ jobs:
94106
- name: Copy Clash Bin
95107
run: |
96108
cp -rf "./bin/." "../tmp/bin/"
109+
rm -rf ./bin/*
110+
111+
- name: Setup loongarch abi1 Go
112+
run: |
113+
wget -q https://github.com/xishang0128/loongarch64-golang/releases/download/1.21.5/go1.21.5.linux-amd64-abi1.tar.gz
114+
sudo tar zxf go1.21.5.linux-amd64-abi1.tar.gz -C /usr/local
115+
echo "/usr/local/go/bin" >> $GITHUB_PATH
116+
117+
- name: Compile Meta loongarch abi1 Clash
118+
run: |
119+
cp ../tmp/loong64_abi1/Makefile ./Makefile
120+
make releases
121+
122+
- name: Copy loongarch abi1 Clash Bin
123+
run: |
124+
cp -rf "./bin/." "../tmp/loong64_abi1/bin/"
125+
rm -rf ./bin/*
126+
127+
- name: Setup loongarch abi2 Go
128+
run: |
129+
wget -q https://github.com/xishang0128/loongarch64-golang/releases/download/1.21.5/go1.21.5.linux-amd64-abi2.tar.gz
130+
sudo tar zxf go1.21.5.linux-amd64-abi2.tar.gz -C /usr/local
131+
132+
- name: Compile Meta loongarch abi2 Clash
133+
run: |
134+
cp ../tmp/loong64_abi2/Makefile ./Makefile
135+
make releases
136+
137+
- name: Copy loongarch abi2 Clash Bin
138+
run: |
139+
cp -rf "./bin/." "../tmp/loong64_abi2/bin/"
97140
98141
- name: Clone OpenClash Repository
99142
uses: actions/checkout@v4
@@ -109,6 +152,8 @@ jobs:
109152
run: |
110153
rm -rf ./dev/meta/*
111154
cp -rf "../tmp/bin/." "./dev/meta/"
155+
cp -rf "../tmp/loong64_abi1/bin/." "./dev/meta/"
156+
cp -rf "../tmp/loong64_abi2/bin/." "./dev/meta/"
112157
git config user.name 'github-actions[bot]'
113158
git config user.email 'github-actions[bot]@users.noreply.github.com'
114159
git add .

luci-app-openclash/Makefile

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
include $(TOPDIR)/rules.mk
22

33
PKG_NAME:=luci-app-openclash
4-
PKG_VERSION:=0.46.003
4+
PKG_VERSION:=0.46.011
55
PKG_RELEASE:=beta
66
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>
77

@@ -145,9 +145,6 @@ define Package/$(PKG_NAME)/postrm
145145
uci -q commit firewall
146146
uci -q delete ucitrack.@openclash[-1]
147147
uci -q commit ucitrack
148-
uci -q delete network.utun
149-
uci -q commit network
150-
/etc/init.d/network restart >/dev/null 2>&1 &
151148
rm -rf /tmp/luci-*
152149
exit 0
153150
endef

luci-app-openclash/luasrc/controller/openclash.lua

+20-11
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,13 @@ local function chnroutev6()
175175
end
176176

177177
local function daip()
178-
local daip = luci.sys.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
178+
local daip, lan_int_name
179+
lan_int_name = uci:get("openclash", "config", "lan_interface_name") or "0"
180+
if lan_int_name == "0" then
181+
daip = luci.sys.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
182+
else
183+
daip = luci.sys.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name))
184+
end
179185
if not daip or daip == "" then
180186
daip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'")
181187
end
@@ -345,21 +351,19 @@ local function historychecktime()
345351
end
346352

347353
function core_download()
348-
if uci:get("openclash", "config", "github_address_mod") == "0" or not uci:get("openclash", "config", "github_address_mod") then
349-
uci:set("openclash", "config", "github_address_mod", "https://testingcf.jsdelivr.net/")
350-
uci:commit("openclash")
351-
luci.sys.call("rm -rf /tmp/clash_last_version 2>/dev/null && bash /usr/share/openclash/clash_version.sh >/dev/null 2>&1")
352-
luci.sys.call("bash /usr/share/openclash/openclash_core.sh 'Dev' >/dev/null 2>&1 &")
353-
luci.sys.call("bash /usr/share/openclash/openclash_core.sh 'TUN' >/dev/null 2>&1 &")
354-
luci.sys.call("bash /usr/share/openclash/openclash_core.sh 'Meta' >/dev/null 2>&1 &")
355-
uci:set("openclash", "config", "github_address_mod", "0")
356-
uci:commit("openclash")
354+
local cdn_url = luci.http.formvalue("url")
355+
if cdn_url then
356+
luci.sys.call(string.format("rm -rf /tmp/clash_last_version 2>/dev/null && bash /usr/share/openclash/clash_version.sh '%s' >/dev/null 2>&1", cdn_url))
357+
luci.sys.call(string.format("bash /usr/share/openclash/openclash_core.sh 'Dev' '%s' >/dev/null 2>&1 &", cdn_url))
358+
luci.sys.call(string.format("bash /usr/share/openclash/openclash_core.sh 'TUN' '%s' >/dev/null 2>&1 &", cdn_url))
359+
luci.sys.call(string.format("bash /usr/share/openclash/openclash_core.sh 'Meta' '%s' >/dev/null 2>&1 &", cdn_url))
357360
else
358361
luci.sys.call("rm -rf /tmp/clash_last_version 2>/dev/null && bash /usr/share/openclash/clash_version.sh >/dev/null 2>&1")
359362
luci.sys.call("bash /usr/share/openclash/openclash_core.sh 'Dev' >/dev/null 2>&1 &")
360363
luci.sys.call("bash /usr/share/openclash/openclash_core.sh 'TUN' >/dev/null 2>&1 &")
361364
luci.sys.call("bash /usr/share/openclash/openclash_core.sh 'Meta' >/dev/null 2>&1 &")
362365
end
366+
363367
end
364368

365369
function download_rule()
@@ -410,7 +414,12 @@ function action_remove_all_core()
410414
end
411415

412416
function action_one_key_update()
413-
return luci.sys.call("rm -rf /tmp/*_last_version 2>/dev/null && bash /usr/share/openclash/openclash_update.sh 'one_key_update' >/dev/null 2>&1 &")
417+
local cdn_url = luci.http.formvalue("url")
418+
if cdn_url then
419+
return luci.sys.call(string.format("rm -rf /tmp/*_last_version 2>/dev/null && bash /usr/share/openclash/openclash_update.sh 'one_key_update' '%s' >/dev/null 2>&1 &", cdn_url))
420+
else
421+
return luci.sys.call("rm -rf /tmp/*_last_version 2>/dev/null && bash /usr/share/openclash/openclash_update.sh 'one_key_update' >/dev/null 2>&1 &")
422+
end
414423
end
415424

416425
local function dler_login_info_save()

luci-app-openclash/luasrc/model/cbi/openclash/client.lua

+2
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ dler.reset = false
166166
dler.submit = false
167167
dler:section(SimpleSection).template = "openclash/dlercloud"
168168

169+
m:append(Template("openclash/select_git_cdn"))
170+
169171
if uci:get("openclash", "config", "dler_token") then
170172
return m, dler, form, s, ap, d
171173
else

luci-app-openclash/luasrc/model/cbi/openclash/config-overwrite.lua

+14-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,19 @@ bold_off = [[</strong>]]
1717

1818
local op_mode = string.sub(luci.sys.exec('uci get openclash.config.operation_mode 2>/dev/null'),0,-2)
1919
if not op_mode then op_mode = "redir-host" end
20-
local lan_ip = SYS.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n' || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n' || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1 | tr -d '\n'")
21-
20+
local lan_int_name = uci:get("openclash", "config", "lan_interface_name") or "0"
21+
local lan_ip
22+
if lan_int_name == "0" then
23+
lan_ip = SYS.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
24+
else
25+
lan_ip = SYS.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name))
26+
end
27+
if not lan_ip or lan_ip == "" then
28+
lan_ip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'")
29+
end
30+
if not lan_ip or lan_ip == "" then
31+
lan_ip = luci.sys.exec("ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1 | tr -d '\n'")
32+
end
2233
m = Map("openclash", translate("Overwrite Settings"))
2334
m.pageaction = false
2435
m.description = translate("Note: To restore the default configuration, try accessing:").." <a href='javascript:void(0)' onclick='javascript:restore_config(this)'>http://"..lan_ip.."/cgi-bin/luci/admin/services/openclash/restore</a>"
@@ -69,7 +80,7 @@ o:value("http://captive.apple.com/generate_204")
6980
o.default = "0"
7081

7182
o = s:taboption("settings", Value, "github_address_mod", translate("Github Address Modify"))
72-
o.description = translate("Modify The Github Address In The Config And OpenClash With Proxy(CDN) To Prevent File Download Faild. Format Reference:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://ghproxy.com/\")'>https://ghproxy.com/</a>"
83+
o.description = translate("Modify The Github Address In The Config And OpenClash With Proxy(CDN) To Prevent File Download Faild. Format Reference:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://mirror.ghproxy.com/\")'>https://mirror.ghproxy.com/</a>"
7384
o:value("0", translate("Disable"))
7485
o:value("https://fastly.jsdelivr.net/")
7586
o:value("https://testingcf.jsdelivr.net/")

luci-app-openclash/luasrc/model/cbi/openclash/servers-config.lua

+43-15
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ local hysteria_protocols = {
8181
"faketcp"
8282
}
8383

84+
local hysteria2_protocols = {
85+
"udp"
86+
}
87+
8488
local obfs = {
8589
"plain",
8690
"http_simple",
@@ -157,12 +161,19 @@ o.datatype = "port"
157161
o.rmempty = false
158162
o.default = "443"
159163

160-
o = s:option(Value, "ports", translate("Port Hopping"))
164+
o = s:option(Flag, "flag_port_hopping", translate("Enable Port Hopping"))
165+
o:depends("type", "hysteria")
166+
o:depends("type", "hysteria2")
167+
o.rmempty = true
168+
o.default = "0"
169+
170+
o = s:option(Value, "ports", translate("Port Range"))
161171
o.datatype = "portrange"
162172
o.rmempty = true
163173
o.default = "20000-40000"
164174
o.placeholder = translate("20000-40000")
165-
o:depends("type", "hysteria")
175+
o:depends({type = "hysteria", flag_port_hopping = true})
176+
o:depends({type = "hysteria2", flag_port_hopping = true})
166177

167178
o = s:option(Value, "password", translate("Password"))
168179
o.password = true
@@ -278,18 +289,29 @@ o.default = "1420"
278289
o.placeholder = translate("1420")
279290
o:depends("type", "wireguard")
280291

292+
o = s:option(Flag, "flag_transport", translate("Enable Transport Protocol Settings"))
293+
o:depends("type", "hysteria")
294+
o:depends("type", "hysteria2")
295+
o.rmempty = true
296+
o.default = "0"
297+
281298
o = s:option(ListValue, "hysteria_protocol", translate("Protocol"))
282299
for _, v in ipairs(hysteria_protocols) do o:value(v) end
283-
o.rmempty = false
284-
o:depends("type", "hysteria")
300+
o.rmempty = true
301+
o:depends({type = "hysteria", flag_transport = true})
302+
303+
o = s:option(ListValue, "hysteria2_protocol", translate("Protocol"))
304+
for _, v in ipairs(hysteria2_protocols) do o:value(v) end
305+
o.rmempty = true
306+
o:depends({type = "hysteria2", flag_transport = true})
285307

286-
o = s:option(Value, "hysteria_up", translate("up"))
308+
o = s:option(Value, "hysteria_up", translate("Uplink Capacity(Default:Mbps)"))
287309
o.rmempty = false
288310
o.description = translate("Required")
289311
o:depends("type", "hysteria")
290312
o:depends("type", "hysteria2")
291313

292-
o = s:option(Value, "hysteria_down", translate("down"))
314+
o = s:option(Value, "hysteria_down", translate("Downlink Capacity(Default:Mbps)"))
293315
o.rmempty = false
294316
o.description = translate("Required")
295317
o:depends("type", "hysteria")
@@ -682,32 +704,38 @@ o:depends("type", "hysteria")
682704
o:depends("type", "hysteria2")
683705

684706
-- [[ recv_window_conn ]]--
707+
o = s:option(Flag, "flag_quicparam", translate("Hysterir QUIC parameters"))
708+
o:depends("type", "hysteria")
709+
o.rmempty = true
710+
o.default = "0"
711+
685712
o = s:option(Value, "recv_window_conn", translate("recv_window_conn"))
686713
o.rmempty = true
687714
o.placeholder = translate("QUIC stream receive window")
688715
o.datatype = "uinteger"
689-
o:depends("type", "hysteria")
716+
o:depends({type = "hysteria", flag_quicparam = true})
690717

691718
-- [[ recv_window ]]--
692719
o = s:option(Value, "recv_window", translate("recv_window"))
693720
o.rmempty = true
694721
o.placeholder = translate("QUIC connection receive window")
695722
o.datatype = "uinteger"
696-
o:depends("type", "hysteria")
723+
o:depends({type = "hysteria", flag_quicparam = true})
724+
725+
-- [[ hop_interval ]]--
726+
o = s:option(Value, "hop_interval", translate("Hop Interval (Unit:second)"))
727+
o.rmempty = true
728+
o.default = "10"
729+
o:depends({type = "hysteria", flag_transport = true, flag_port_hopping = true})
730+
o:depends({type = "hysteria2", flag_port_hopping = true})
697731

698732
-- [[ disable_mtu_discovery ]]--
699733
o = s:option(ListValue, "disable_mtu_discovery", translate("disable_mtu_discovery"))
700734
o.rmempty = true
701735
o:value("true")
702736
o:value("false")
703737
o.default = "false"
704-
o:depends("type", "hysteria")
705-
706-
-- [[ hop_interval ]]--
707-
o = s:option(Value, "hop_interval", translate("Hop Interval"))
708-
o.rmempty = true
709-
o.default = "10"
710-
o:depends("type", "hysteria")
738+
o:depends({type = "hysteria", flag_quicparam = true})
711739

712740
o = s:option(ListValue, "packet-addr", translate("Packet-Addr")..translate("(Only Meta Core)"))
713741
o.rmempty = true

luci-app-openclash/luasrc/model/cbi/openclash/settings.lua

+31-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,19 @@ bold_off = [[</strong>]]
1616

1717
local op_mode = string.sub(luci.sys.exec('uci get openclash.config.operation_mode 2>/dev/null'),0,-2)
1818
if not op_mode then op_mode = "redir-host" end
19-
local lan_ip = SYS.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n' || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n' || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1 | tr -d '\n'")
20-
19+
local lan_int_name = uci:get("openclash", "config", "lan_interface_name") or "0"
20+
local lan_ip
21+
if lan_int_name == "0" then
22+
lan_ip = SYS.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
23+
else
24+
lan_ip = SYS.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name))
25+
end
26+
if not lan_ip or lan_ip == "" then
27+
lan_ip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'")
28+
end
29+
if not lan_ip or lan_ip == "" then
30+
lan_ip = luci.sys.exec("ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1 | tr -d '\n'")
31+
end
2132
m = Map("openclash", translate("Plugin Settings"))
2233
m.pageaction = false
2334
m.description = translate("Note: To restore the default configuration, try accessing:").." <a href='javascript:void(0)' onclick='javascript:restore_config(this)'>http://"..lan_ip.."/cgi-bin/luci/admin/services/openclash/restore</a>"..
@@ -256,7 +267,7 @@ if op_mode == "redir-host" then
256267
o.default = 0
257268
else
258269
o = s:taboption("traffic_control", Flag, "china_ip_route", translate("China IP Route"))
259-
o.description = translate("Bypass The China Network Flows, Improve Performance, Depend on Dnsmasq")
270+
o.description = translate("Bypass The China Network Flows, Improve Performance, If Inaccessibility on Bypass Gateway, Try to Enable Bypass Gateway Compatible Option, Depend on Dnsmasq")
260271
o.default = 0
261272
o:depends("enable_redirect_dns", "1")
262273
o:depends("enable_redirect_dns", "0")
@@ -272,6 +283,22 @@ o = s:taboption("traffic_control", Flag, "intranet_allowed", translate("Only int
272283
o.description = translate("When Enabled, The Control Panel And The Connection Broker Port Will Not Be Accessible From The Public Network")
273284
o.default = 1
274285

286+
o = s:taboption("traffic_control", DynamicList, "intranet_allowed_wan_name", translate("WAN Interface Name"))
287+
o.description = translate("Select WAN Interface Name For The Intranet Allowed")
288+
o:depends("intranet_allowed", "1")
289+
local interfaces = SYS.exec("ls -l /sys/class/net/ 2>/dev/null |awk '{print $9}' 2>/dev/null")
290+
for interface in string.gmatch(interfaces, "%S+") do
291+
o:value(interface)
292+
end
293+
294+
o = s:taboption("traffic_control", ListValue, "lan_interface_name", translate("LAN Interface Name"))
295+
o.description = translate("Select LAN Interface Name")
296+
o:value("0", translate("Disable"))
297+
o.default = "0"
298+
for interface in string.gmatch(interfaces, "%S+") do
299+
o:value(interface)
300+
end
301+
275302
o = s:taboption("traffic_control", Value, "local_network_pass", translate("Local IPv4 Network Bypassed List"))
276303
o.template = "cbi/tvalue"
277304
o.description = translate("The Traffic of The Destination For The Specified Address Will Not Pass The Core")
@@ -1297,6 +1324,7 @@ end
12971324

12981325
m:append(Template("openclash/config_editor"))
12991326
m:append(Template("openclash/toolbar_show"))
1327+
m:append(Template("openclash/select_git_cdn"))
13001328

13011329
return m
13021330

0 commit comments

Comments
 (0)