🍓 Sync 2024-05-19 00:24

This commit is contained in:
github-actions[bot] 2024-05-19 00:24:23 +08:00
parent 32f86fa481
commit 8b9403344c
32 changed files with 860 additions and 272 deletions

View File

@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ipt2socks
PKG_VERSION:=1.1.3
PKG_VERSION:=1.1.4
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/zfl9/ipt2socks/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=5279eb1cb7555cf9292423cc9f672dc43e6e214b3411a6df26a6a1cfa59d88b7
PKG_HASH:=68dc76e63951d655c2fd9b420e175b5a75a50014d6db6e729398b41f2c988356
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-openclash
PKG_VERSION:=0.46.003
PKG_VERSION:=0.46.011
PKG_RELEASE:=beta
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>
@ -145,9 +145,6 @@ define Package/$(PKG_NAME)/postrm
uci -q commit firewall
uci -q delete ucitrack.@openclash[-1]
uci -q commit ucitrack
uci -q delete network.utun
uci -q commit network
/etc/init.d/network restart >/dev/null 2>&1 &
rm -rf /tmp/luci-*
exit 0
endef

View File

@ -175,7 +175,13 @@ local function chnroutev6()
end
local function daip()
local daip = luci.sys.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
local daip, lan_int_name
lan_int_name = uci:get("openclash", "config", "lan_interface_name") or "0"
if lan_int_name == "0" then
daip = luci.sys.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
else
daip = luci.sys.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name))
end
if not daip or daip == "" then
daip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'")
end
@ -345,21 +351,19 @@ local function historychecktime()
end
function core_download()
if uci:get("openclash", "config", "github_address_mod") == "0" or not uci:get("openclash", "config", "github_address_mod") then
uci:set("openclash", "config", "github_address_mod", "https://testingcf.jsdelivr.net/")
uci:commit("openclash")
luci.sys.call("rm -rf /tmp/clash_last_version 2>/dev/null && bash /usr/share/openclash/clash_version.sh >/dev/null 2>&1")
luci.sys.call("bash /usr/share/openclash/openclash_core.sh 'Dev' >/dev/null 2>&1 &")
luci.sys.call("bash /usr/share/openclash/openclash_core.sh 'TUN' >/dev/null 2>&1 &")
luci.sys.call("bash /usr/share/openclash/openclash_core.sh 'Meta' >/dev/null 2>&1 &")
uci:set("openclash", "config", "github_address_mod", "0")
uci:commit("openclash")
local cdn_url = luci.http.formvalue("url")
if cdn_url then
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))
luci.sys.call(string.format("bash /usr/share/openclash/openclash_core.sh 'Dev' '%s' >/dev/null 2>&1 &", cdn_url))
luci.sys.call(string.format("bash /usr/share/openclash/openclash_core.sh 'TUN' '%s' >/dev/null 2>&1 &", cdn_url))
luci.sys.call(string.format("bash /usr/share/openclash/openclash_core.sh 'Meta' '%s' >/dev/null 2>&1 &", cdn_url))
else
luci.sys.call("rm -rf /tmp/clash_last_version 2>/dev/null && bash /usr/share/openclash/clash_version.sh >/dev/null 2>&1")
luci.sys.call("bash /usr/share/openclash/openclash_core.sh 'Dev' >/dev/null 2>&1 &")
luci.sys.call("bash /usr/share/openclash/openclash_core.sh 'TUN' >/dev/null 2>&1 &")
luci.sys.call("bash /usr/share/openclash/openclash_core.sh 'Meta' >/dev/null 2>&1 &")
end
end
function download_rule()
@ -410,7 +414,12 @@ function action_remove_all_core()
end
function action_one_key_update()
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 &")
local cdn_url = luci.http.formvalue("url")
if cdn_url then
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))
else
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 &")
end
end
local function dler_login_info_save()

View File

@ -166,6 +166,8 @@ dler.reset = false
dler.submit = false
dler:section(SimpleSection).template = "openclash/dlercloud"
m:append(Template("openclash/select_git_cdn"))
if uci:get("openclash", "config", "dler_token") then
return m, dler, form, s, ap, d
else

View File

@ -17,8 +17,19 @@ bold_off = [[</strong>]]
local op_mode = string.sub(luci.sys.exec('uci get openclash.config.operation_mode 2>/dev/null'),0,-2)
if not op_mode then op_mode = "redir-host" end
local lan_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'")
local lan_int_name = uci:get("openclash", "config", "lan_interface_name") or "0"
local lan_ip
if lan_int_name == "0" then
lan_ip = SYS.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
else
lan_ip = SYS.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name))
end
if not lan_ip or lan_ip == "" then
lan_ip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'")
end
if not lan_ip or lan_ip == "" then
lan_ip = luci.sys.exec("ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1 | tr -d '\n'")
end
m = Map("openclash", translate("Overwrite Settings"))
m.pageaction = false
m.description = translate("Note: To restore the default configuration, try accessing:").." <a href='javascript:void(0)' onclick='javascript:restore_config(this)'>http://"..lan_ip.."/cgi-bin/luci/admin/services/openclash/restore</a>"
@ -69,7 +80,7 @@ o:value("http://captive.apple.com/generate_204")
o.default = "0"
o = s:taboption("settings", Value, "github_address_mod", translate("Github Address Modify"))
o.description = translate("Modify The Github Address In The Config And OpenClash With Proxy(CDN) To Prevent File Download Faild. Format Reference:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://ghproxy.com/\")'>https://ghproxy.com/</a>"
o.description = translate("Modify The Github Address In The Config And OpenClash With Proxy(CDN) To Prevent File Download Faild. Format Reference:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://mirror.ghproxy.com/\")'>https://mirror.ghproxy.com/</a>"
o:value("0", translate("Disable"))
o:value("https://fastly.jsdelivr.net/")
o:value("https://testingcf.jsdelivr.net/")

View File

@ -81,6 +81,10 @@ local hysteria_protocols = {
"faketcp"
}
local hysteria2_protocols = {
"udp"
}
local obfs = {
"plain",
"http_simple",
@ -157,12 +161,19 @@ o.datatype = "port"
o.rmempty = false
o.default = "443"
o = s:option(Value, "ports", translate("Port Hopping"))
o = s:option(Flag, "flag_port_hopping", translate("Enable Port Hopping"))
o:depends("type", "hysteria")
o:depends("type", "hysteria2")
o.rmempty = true
o.default = "0"
o = s:option(Value, "ports", translate("Port Range"))
o.datatype = "portrange"
o.rmempty = true
o.default = "20000-40000"
o.placeholder = translate("20000-40000")
o:depends("type", "hysteria")
o:depends({type = "hysteria", flag_port_hopping = true})
o:depends({type = "hysteria2", flag_port_hopping = true})
o = s:option(Value, "password", translate("Password"))
o.password = true
@ -278,18 +289,29 @@ o.default = "1420"
o.placeholder = translate("1420")
o:depends("type", "wireguard")
o = s:option(Flag, "flag_transport", translate("Enable Transport Protocol Settings"))
o:depends("type", "hysteria")
o:depends("type", "hysteria2")
o.rmempty = true
o.default = "0"
o = s:option(ListValue, "hysteria_protocol", translate("Protocol"))
for _, v in ipairs(hysteria_protocols) do o:value(v) end
o.rmempty = false
o:depends("type", "hysteria")
o.rmempty = true
o:depends({type = "hysteria", flag_transport = true})
o = s:option(Value, "hysteria_up", translate("up"))
o = s:option(ListValue, "hysteria2_protocol", translate("Protocol"))
for _, v in ipairs(hysteria2_protocols) do o:value(v) end
o.rmempty = true
o:depends({type = "hysteria2", flag_transport = true})
o = s:option(Value, "hysteria_up", translate("Uplink Capacity(Default:Mbps)"))
o.rmempty = false
o.description = translate("Required")
o:depends("type", "hysteria")
o:depends("type", "hysteria2")
o = s:option(Value, "hysteria_down", translate("down"))
o = s:option(Value, "hysteria_down", translate("Downlink Capacity(Default:Mbps)"))
o.rmempty = false
o.description = translate("Required")
o:depends("type", "hysteria")
@ -682,18 +704,30 @@ o:depends("type", "hysteria")
o:depends("type", "hysteria2")
-- [[ recv_window_conn ]]--
o = s:option(Flag, "flag_quicparam", translate("Hysterir QUIC parameters"))
o:depends("type", "hysteria")
o.rmempty = true
o.default = "0"
o = s:option(Value, "recv_window_conn", translate("recv_window_conn"))
o.rmempty = true
o.placeholder = translate("QUIC stream receive window")
o.datatype = "uinteger"
o:depends("type", "hysteria")
o:depends({type = "hysteria", flag_quicparam = true})
-- [[ recv_window ]]--
o = s:option(Value, "recv_window", translate("recv_window"))
o.rmempty = true
o.placeholder = translate("QUIC connection receive window")
o.datatype = "uinteger"
o:depends("type", "hysteria")
o:depends({type = "hysteria", flag_quicparam = true})
-- [[ hop_interval ]]--
o = s:option(Value, "hop_interval", translate("Hop Interval (Unit:second)"))
o.rmempty = true
o.default = "10"
o:depends({type = "hysteria", flag_transport = true, flag_port_hopping = true})
o:depends({type = "hysteria2", flag_port_hopping = true})
-- [[ disable_mtu_discovery ]]--
o = s:option(ListValue, "disable_mtu_discovery", translate("disable_mtu_discovery"))
@ -701,13 +735,7 @@ o.rmempty = true
o:value("true")
o:value("false")
o.default = "false"
o:depends("type", "hysteria")
-- [[ hop_interval ]]--
o = s:option(Value, "hop_interval", translate("Hop Interval"))
o.rmempty = true
o.default = "10"
o:depends("type", "hysteria")
o:depends({type = "hysteria", flag_quicparam = true})
o = s:option(ListValue, "packet-addr", translate("Packet-Addr")..translate("(Only Meta Core)"))
o.rmempty = true

View File

@ -16,8 +16,19 @@ bold_off = [[</strong>]]
local op_mode = string.sub(luci.sys.exec('uci get openclash.config.operation_mode 2>/dev/null'),0,-2)
if not op_mode then op_mode = "redir-host" end
local lan_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'")
local lan_int_name = uci:get("openclash", "config", "lan_interface_name") or "0"
local lan_ip
if lan_int_name == "0" then
lan_ip = SYS.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
else
lan_ip = SYS.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name))
end
if not lan_ip or lan_ip == "" then
lan_ip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'")
end
if not lan_ip or lan_ip == "" then
lan_ip = luci.sys.exec("ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1 | tr -d '\n'")
end
m = Map("openclash", translate("Plugin Settings"))
m.pageaction = false
m.description = translate("Note: To restore the default configuration, try accessing:").." <a href='javascript:void(0)' onclick='javascript:restore_config(this)'>http://"..lan_ip.."/cgi-bin/luci/admin/services/openclash/restore</a>"..
@ -256,7 +267,7 @@ if op_mode == "redir-host" then
o.default = 0
else
o = s:taboption("traffic_control", Flag, "china_ip_route", translate("China IP Route"))
o.description = translate("Bypass The China Network Flows, Improve Performance, Depend on Dnsmasq")
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")
o.default = 0
o:depends("enable_redirect_dns", "1")
o:depends("enable_redirect_dns", "0")
@ -272,6 +283,22 @@ o = s:taboption("traffic_control", Flag, "intranet_allowed", translate("Only int
o.description = translate("When Enabled, The Control Panel And The Connection Broker Port Will Not Be Accessible From The Public Network")
o.default = 1
o = s:taboption("traffic_control", DynamicList, "intranet_allowed_wan_name", translate("WAN Interface Name"))
o.description = translate("Select WAN Interface Name For The Intranet Allowed")
o:depends("intranet_allowed", "1")
local interfaces = SYS.exec("ls -l /sys/class/net/ 2>/dev/null |awk '{print $9}' 2>/dev/null")
for interface in string.gmatch(interfaces, "%S+") do
o:value(interface)
end
o = s:taboption("traffic_control", ListValue, "lan_interface_name", translate("LAN Interface Name"))
o.description = translate("Select LAN Interface Name")
o:value("0", translate("Disable"))
o.default = "0"
for interface in string.gmatch(interfaces, "%S+") do
o:value(interface)
end
o = s:taboption("traffic_control", Value, "local_network_pass", translate("Local IPv4 Network Bypassed List"))
o.template = "cbi/tvalue"
o.description = translate("The Traffic of The Destination For The Specified Address Will Not Pass The Core")
@ -1297,6 +1324,7 @@ end
m:append(Template("openclash/config_editor"))
m:append(Template("openclash/toolbar_show"))
m:append(Template("openclash/select_git_cdn"))
return m

View File

@ -6,15 +6,15 @@
<meta charset="utf-8">
<meta http-equiv="x-dns-prefetch-control" content="on">
<link rel="dns-prefetch" href="//cdn.jsdelivr.net">
<link rel="dns-prefetch" href="//whois.pconline.com.cn/ipJson.jsp">
<link rel="dns-prefetch" href="//www.taobao.com/help/getip.php">
<link rel="dns-prefetch" href="//whois.pconline.com.cn">
<link rel="dns-prefetch" href="//forge.speedtest.cn">
<link rel="dns-prefetch" href="//api-ipv4.ip.sb">
<link rel="dns-prefetch" href="//api.ipify.org">
<link rel="dns-prefetch" href="//api.ttt.sh">
<link rel="dns-prefetch" href="//qqwry.api.skk.moe">
<link rel="dns-prefetch" href="//d.skk.moe">
<link rel="preconnect" href="https://www.taobao.com/help/getip.php">
<link rel="preconnect" href="https://whois.pconline.com.cn/ipJson.jsp">
<link rel="preconnect" href="https://forge.speedtest.cn">
<link rel="preconnect" href="https://whois.pconline.com.cn">
<link rel="preconnect" href="https://api-ipv4.ip.sb">
<link rel="preconnect" href="https://api.ipify.org">
<link rel="preconnect" href="https://api.ttt.sh">
@ -63,22 +63,22 @@
.ip-result {
font-size:15px;
margin:0px 0px 0px 5%;
white-space: nowrap; /*强制span不换行*/
display: inline-block; /*将span当做块级元素对待*/
width: 32%; /*限制宽度*/
overflow: hidden; /*超出宽度部分隐藏*/
text-overflow: ellipsis; /*超出部分以点号代替*/
white-space: nowrap;
display: inline-block;
width: 32%;
overflow: hidden;
text-overflow: ellipsis;
vertical-align:bottom;
}
.ip-geo {
font-size:15px;
line-height:20px;
white-space: nowrap; /*强制span不换行*/
display: inline-block; /*将span当做块级元素对待*/
width: 35%; /*限制宽度*/
overflow: hidden; /*超出宽度部分隐藏*/
text-overflow: ellipsis; /*超出部分以点号代替*/
white-space: nowrap;
display: inline-block;
width: 35%;
overflow: hidden;
text-overflow: ellipsis;
text-align: right;
vertical-align:bottom;
}
@ -142,18 +142,17 @@
<p style="margin: 20px 0 20px 8%; padding: 0px !important; text-align: left; font-size: 25px; font-weight: bold;"><%:IP Address%>
<span style="float: right;"><img src="/luci-static/resources/openclash/img/eye-light.svg" height="20px" title="<%:Hide IP%>" alt="<%:Hide IP%>" id="eye-icon" onclick="return privacy_my_ip(this)" /></span>
</p>
<p style="margin: 10px -2% 0 8%; text-align: left; padding-left: 0px !important; padding-right: 0px !important;">
<span class="ip-title">IP.TB&nbsp;&nbsp;&nbsp;&nbsp;<%:Mainland%>:</span><span class="ip-result" id="ip-taobao"></span> <span class="ip-geo" id="ip-taobao-geo"></span>
<span class="ip-title">SpeedTest:</span><span class="ip-result" id="ip-speedtest"></span> <span class="ip-geo" id="ip-speedtest-geo"></span>
</p>
<p style="margin: 10px -2% 0 8%; text-align: left; padding-left: 0px !important; padding-right: 0px !important;">
<span class="ip-title">IP.PC&nbsp;&nbsp;&nbsp;&nbsp;<%:Mainland%>:</span><span class="ip-result" id="ip-pcol"></span> <span class="ip-geo" id="ip-pcol-geo"></span>
<span class="ip-title">PConline:</span><span class="ip-result" id="ip-pcol"></span> <span class="ip-geo" id="ip-pcol-geo"></span>
</p>
<p style="margin: 10px -2% 0 8%; text-align: left; padding-left: 0px !important; padding-right: 0px !important;">
<span class="ip-title">IP.SB&nbsp;&nbsp;&nbsp;&nbsp;<%:Abroad%>:</span><span class="ip-result" id="ip-ipsb"></span> <span class="ip-geo" id="ip-ipsb-geo"></span>
<span class="ip-title">IP.SB:</span><span class="ip-result" id="ip-ipsb"></span> <span class="ip-geo" id="ip-ipsb-geo"></span>
</p>
<p style="margin: 10px -2% 0 8%; text-align: left; padding-left: 0px !important; padding-right: 0px !important;">
<span class="ip-title">IPIFY&nbsp;&nbsp;&nbsp;&nbsp;<%:Abroad%>:</span><span class="ip-result" id="ip-ipify"></span> <span class="ip-geo" id="ip-ipify-geo"></span>
<span class="ip-title">IPIFY:</span><span class="ip-result" id="ip-ipify"></span> <span class="ip-geo" id="ip-ipify-geo"></span>
</p>
</div>
<div style="width: 52%">
@ -190,13 +189,13 @@
const $$ = document;
var ip_pcol_ip;
var ip_ipsb_ip;
var ip_taobao_ip;
var ip_speedtest_ip;
var ip_ipify_ip;
var refresh_http;
var refresh_ip;
$$.getElementById('ip-pcol').innerHTML = '<%:Querying...%>';
$$.getElementById('ip-ipify').innerHTML = '<%:Querying...%>';
$$.getElementById('ip-taobao').innerHTML = '<%:Querying...%>';
$$.getElementById('ip-speedtest').innerHTML = '<%:Querying...%>';
$$.getElementById('ip-ipsb').innerHTML = '<%:Querying...%>';
let random = parseInt(Math.random() * 100000000);
let IP = {
@ -266,8 +265,8 @@
if (localStorage.getItem('privacy_my_ip') != 'true') {
$$.getElementById('ip-speedtest').innerHTML = resp.data.ip;
};
$$.getElementById('ip-speedtest-geo').innerHTML = resp.data.country + resp.data.province + resp.data.city + (resp.data.distinct == "null" ? resp.data.distinct : '') + ' ' + (resp.data.isp == "null" ? resp.data.isp : '');
//IP.parseIPIpip(resp.data.ip, 'ip-speedtest-geo');
//$$.getElementById('ip-speedtest-geo').innerHTML = resp.data.country + resp.data.province + resp.data.city + (resp.data.distinct == "null" ? '' : resp.data.distinct) + ' ' + (resp.data.isp == "null" ? '' : resp.data.isp);
IP.parseIPIpip(resp.data.ip, 'ip-speedtest-geo');
})
},
getIpifyIP: () => {
@ -350,20 +349,19 @@
IP.parseIPIpip(data.ip, 'ip-ipsb-geo');
};
function ipCallback(data){
if (localStorage.getItem('privacy_my_ip') != 'true') {
$$.getElementById('ip-taobao').innerHTML = data.ip;
};
IP.parseIPIpip(data.ip, 'ip-taobao-geo');
};
//function ipCallback(data){
// if (localStorage.getItem('privacy_my_ip') != 'true') {
// $$.getElementById('ip-taobao').innerHTML = data.ip;
// };
// IP.parseIPIpip(data.ip, 'ip-taobao-geo');
//};
function delete_ip_script()
{
var scripts = document.getElementsByTagName('script');
for (var i = scripts.length; i--; ) {
if (document.getElementsByTagName("script")[i]['src'].indexOf('whois.pconline.com.cn') > -1
|| document.getElementsByTagName("script")[i]['src'].indexOf('api-ipv4.ip.sb') > -1
|| document.getElementsByTagName("script")[i]['src'].indexOf('www.taobao.com') > -1) {
|| document.getElementsByTagName("script")[i]['src'].indexOf('api-ipv4.ip.sb') > -1) {
scripts[i].parentNode.removeChild(scripts[i]);
};
};
@ -384,14 +382,9 @@
sbipScript.src='https://api-ipv4.ip.sb/jsonip?callback=getIpsbIP';
mypage.appendChild(sbipScript);
var tbipScript= document.createElement("script");
tbipScript.defer = "defer";
tbipScript.src='https://www.taobao.com/help/getip.php?callback=ipCallback';
mypage.appendChild(tbipScript);
//HTTP.runcheck();
IP.getSpeedIP();
IP.getIpifyIP();
//IP.getSpeedIP();
};
function show_my_ip()
@ -402,11 +395,11 @@
$$.getElementById('eye-icon').alt='<%:Show IP%>';
ip_pcol_ip = $$.getElementById('ip-pcol').innerHTML;
ip_ipsb_ip = $$.getElementById('ip-ipsb').innerHTML;
ip_taobao_ip = $$.getElementById('ip-taobao').innerHTML;
ip_speedtest_ip = $$.getElementById('ip-speedtest').innerHTML;
ip_ipify_ip = $$.getElementById('ip-ipify').innerHTML;
$$.getElementById('ip-pcol').innerHTML = '***.***.***.***';
$$.getElementById('ip-ipsb').innerHTML = '***.***.***.***';
$$.getElementById('ip-taobao').innerHTML = '***.***.***.***';
$$.getElementById('ip-speedtest').innerHTML = '***.***.***.***';
$$.getElementById('ip-ipify').innerHTML = '***.***.***.***';
}
else {
@ -426,13 +419,12 @@
imgobj.alt='<%:Show IP%>';
ip_pcol_ip = $$.getElementById('ip-pcol').innerHTML;
ip_ipsb_ip = $$.getElementById('ip-ipsb').innerHTML;
ip_taobao_ip = $$.getElementById('ip-taobao').innerHTML;
ip_speedtest_ip = $$.getElementById('ip-speedtest').innerHTML;
ip_ipify_ip = $$.getElementById('ip-ipify').innerHTML;
$$.getElementById('ip-pcol').innerHTML = '***.***.***.***';
$$.getElementById('ip-ipsb').innerHTML = '***.***.***.***';
$$.getElementById('ip-taobao').innerHTML = '***.***.***.***';
$$.getElementById('ip-speedtest').innerHTML = '***.***.***.***';
$$.getElementById('ip-ipify').innerHTML = '***.***.***.***';
}
else {
imgobj.src='/luci-static/resources/openclash/img/eye-light.svg';
@ -440,7 +432,7 @@
imgobj.alt='<%:Hide IP%>';
$$.getElementById('ip-pcol').innerHTML = ip_pcol_ip;
$$.getElementById('ip-ipsb').innerHTML = ip_ipsb_ip;
$$.getElementById('ip-taobao').innerHTML = ip_taobao_ip;
$$.getElementById('ip-speedtest').innerHTML = ip_speedtest_ip;
$$.getElementById('ip-ipify').innerHTML = ip_ipify_ip;
localStorage.removeItem('privacy_my_ip');
myip_Load();
@ -460,12 +452,11 @@
HTTP.runcheck();
IP.getIpifyIP();
//IP.getSpeedIP();
IP.getSpeedIP();
show_my_ip();
</script>
<script type="text/javascript">
document.write('<script defer="defer" src="https://whois.pconline.com.cn/ipJson.jsp?callback=getPcolIP&z='+parseInt(Math.random() * 100000000)+'" type="text/javascript"><\/script>');
</script>
<script defer="defer" src="https://api-ipv4.ip.sb/jsonip?callback=getIpsbIP"></script>
<script defer="defer" src="https://www.taobao.com/help/getip.php?callback=ipCallback"></script>
</html>

View File

@ -0,0 +1,195 @@
<style type="text/css">
.select-popup {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: white;
border: 3px solid #9e9e9e;
border-radius: 5px;
padding: 10px;
z-index: 1000;
max-width: 1000%;
min-width: 70%;
width: 70%;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}
.select-popup.hidden {
display: none;
}
.select-popup-header {
font-weight: bold;
margin-bottom: 10px;
font-size: 15px;
}
.select-popup-body {
max-height: 200px;
overflow-y: auto;
}
.select-option {
padding: 5px;
cursor: pointer;
border-bottom: 1px solid #d7d7d7;
}
.select-option:hover {
background-color: #f0f0f0;
}
.custom-option-input {
margin-top: 5px;
padding: 5px;
width: 100%;
}
</style>
<body>
<div id="selectPopup" class="select-popup hidden">
<div class="select-popup-header"><%:Choose CDN For Downloading:%></div>
<div class="select-popup-body">
<div class="select-option" data-value="https://fastly.jsdelivr.net/">https://fastly.jsdelivr.net/</div>
<div class="select-option" data-value="https://testingcf.jsdelivr.net/">https://testingcf.jsdelivr.net/</div>
<div class="select-option" data-value="https://raw.fastgit.org/">https://raw.fastgit.org/</div>
<div class="select-option" data-value="https://cdn.jsdelivr.net/">https://cdn.jsdelivr.net/</div>
<div class="select-option" data-value="custom"><%:Custom Your CDN URL%></div>
<input type="text" id="customOptionInput" class="custom-option-input" value="https://mirror.ghproxy.com/" placeholder="<%:Type CDN URL, Format Like%> https://mirror.ghproxy.com/" style="display: none;">
<div class="select-option" id="addCustomOption" style="display: none;"><%:Add%></div>
</div>
</div>
</body>
<script type="text/javascript">
//<![CDATA[
function isValidURL(str) {
var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name
'((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.&#126;+]*)*'+ // port and path
'(\\?[;&a-z\\d%_.&#126;+=-]*)?'+ // query string
'(\\#[-a-z\\d_]*)?'+'\/$','i'); // fragment locator
return !!pattern.test(str);
};
function HTTP_delay(domain, ID) {
let img = new Image;
let img_start_time = (+new Date());
let timeout = setTimeout(() => {
img.onerror = img.onload = null;
ID.innerHTML = ID.dataset.value + '&nbsp;&nbsp;&nbsp;&nbsp;<font style=\'color:red\'><%:Access Timed Out%></font>'
}, 3000);
img.onerror = () => {
clearTimeout(timeout);
ID.innerHTML = ID.dataset.value + '&nbsp;&nbsp;&nbsp;&nbsp;<font style=\'color:red\'><%:Access Denied%></font>'
};
img.onload = () => {
clearTimeout(timeout);
let img_load_time = (new Date())- img_start_time;
if (img_load_time <= 500) {
ID.innerHTML = ID.dataset.value + '&nbsp;&nbsp;&nbsp;&nbsp;' + '<font style=\'color:#32b643\'>'+img_load_time+'&nbsp;ms</font>'
}
else if (img_load_time > 500 && img_load_time <= 1000) {
ID.innerHTML = ID.dataset.value + '&nbsp;&nbsp;&nbsp;&nbsp;' + '<font style=\'color:orange\'>'+img_load_time+'&nbsp;ms</font>'
}
else {
ID.innerHTML = ID.dataset.value + '&nbsp;&nbsp;&nbsp;&nbsp;' + '<font style=\'color:#e85600\'>'+img_load_time+'&nbsp;ms</font>'
}
};
img.src = `${domain}favicon.ico?${+(new Date)}`;
};
function select_git_cdn(btn, type) {
var selectPopup = document.getElementById('selectPopup');
selectPopup.classList.remove('hidden');
var customOptionInput = document.getElementById('customOptionInput');
var addCustomOption = document.getElementById('addCustomOption');
var selectOptions = document.getElementsByClassName('select-option');
// 隐藏自定义输入和按钮
customOptionInput.style.display = 'none';
addCustomOption.style.display = 'none';
// 添加自定义选项的事件监听
selectPopup.addEventListener('click', select_window, type);
//点击弹窗外部关闭弹窗
document.addEventListener('click', select_window_close);
refresh_httpdelay = setInterval(() => {
for(var i = 0; i < selectOptions.length; i++) {
if (isValidURL(selectOptions[i].dataset.value)) {
HTTP_delay(selectOptions[i].dataset.value, selectOptions[i]);
};
};
}, Math.floor(Math.random()*(7-3+1)+3)*1000);
};
function select_window_close(event) {
if (!selectPopup.contains(event.target)) {
selectPopup.classList.add('hidden');
clearInterval(refresh_httpdelay);
}
};
function select_window(event, type) {
var selectOptions = document.getElementsByClassName('select-option');
var target = event.target;
if (target.classList.contains('select-option') && target.dataset.value === 'custom') {
// 显示自定义输入和按钮
customOptionInput.style.display = 'block';
addCustomOption.style.display = 'block';
} else if (target === addCustomOption) {
// 添加自定义选项到列表中
var newValue = customOptionInput.value.trim();
if (newValue !== '' && isValidURL(newValue)) {
var newOption = document.createElement('div');
newOption.classList.add('select-option');
newOption.textContent = newValue;
newOption.dataset.value = newValue;
selectPopup.querySelector('.select-popup-body').insertBefore(newOption, selectPopup.querySelector('.select-popup-body').children[selectOptions.length - 2]);
// 隐藏自定义输入和按钮
customOptionInput.style.display = 'none';
addCustomOption.style.display = 'none';
}
else {
alert("<%:Please enter a valid URL!%>");
}
} else if (target != addCustomOption && target != customOptionInput && target.classList.contains('select-option')) {
customOptionInput.style.display = 'none';
addCustomOption.style.display = 'none';
if (type === 'core_download') {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "core_download")%>', {url: target.dataset.value}, function(x, status) {
});
}
else {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "one_key_update")%>', {url: target.dataset.value}, function(x, status) {
});
}
selectPopup.classList.add('hidden');
clearInterval(refresh_httpdelay);
}
else if (target != addCustomOption && target != customOptionInput) {
// 点击其他选项或弹窗外部,隐藏自定义输入和按钮
customOptionInput.style.display = 'none';
addCustomOption.style.display = 'none';
}
else {
if (target != customOptionInput) {
selectPopup.classList.add('hidden');
clearInterval(refresh_httpdelay);
}
};
};
//]]>
</script>

View File

@ -997,11 +997,7 @@
{
var r = confirm("<%:You have not installed the core yet, do you want to download and install it now?%>")
if (r == true) {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "core_download")%>', null, function(x, status) {
if ( x && x.status == 200 ) {
window.location.href='<%="'+window.location.protocol+'//'+window.location.hostname+'/cgi-bin/luci/admin/services/openclash/log"%>';
}
});
return select_git_cdn("core_download");
}
}
}

View File

@ -15,6 +15,10 @@
<option value="linux-armv6"><%:linux-armv6%></option>
<option value="linux-armv7"><%:linux-armv7%></option>
<option value="linux-arm64"><%:linux-arm64(armv8)%></option>
<option value="linux-loong64-abi1"><%:linux-loong64-abi1%></option>
<option value="linux-loong64-abi2"><%:linux-loong64-abi2%></option>
<option value="linux-riscv64"><%:linux-riscv64%></option>
<option value="linux-s390x"><%:linux-s390x%></option>
<option value="linux-mips-hardfloat"><%:linux-mips-hardfloat%></option>
<option value="linux-mips-softfloat"><%:linux-mips-softfloat%></option>
<option value="linux-mips64"><%:linux-mips64%></option>
@ -80,6 +84,11 @@
<%:Collecting data...%>
</p>
</td>
<td width="25%">
<p align="center" id="one_key_update_cdn">
<%:Collecting data...%>
</p>
</td>
<td width="25%">
<p align="center" id="one_key_update">
<%:Collecting data...%>
@ -149,20 +158,21 @@
var core_meta_up = document.getElementById('core_meta_up');
var op_up = document.getElementById('op_up');
var update_tip = document.getElementById('update_tip');
var ma_core_up = document.getElementById('ma_core_up');
var ma_core_tun_up = document.getElementById('ma_core_tun_up');
var ma_core_meta_up = document.getElementById('ma_core_meta_up');
var ma_op_up = document.getElementById('ma_op_up');
var restore = document.getElementById('restore');
var backup = document.getElementById('backup');
var backup_ex_core = document.getElementById('backup_ex_core');
var ma_core_up = document.getElementById('ma_core_up');
var ma_core_tun_up = document.getElementById('ma_core_tun_up');
var ma_core_meta_up = document.getElementById('ma_core_meta_up');
var ma_op_up = document.getElementById('ma_op_up');
var restore = document.getElementById('restore');
var backup = document.getElementById('backup');
var backup_ex_core = document.getElementById('backup_ex_core');
var backup_core_only = document.getElementById('backup_core_only');
var backup_config_only = document.getElementById('backup_config_only');
var backup_rule_only = document.getElementById('backup_rule_only');
var backup_proxy_only = document.getElementById('backup_proxy_only');
var one_key_update = document.getElementById('one_key_update');
var remove_core = document.getElementById('remove_core');
var release_branch = document.getElementById('RELEASE_BRANCH');
var one_key_update = document.getElementById('one_key_update');
var one_key_update_cdn = document.getElementById('one_key_update_cdn');
var remove_core = document.getElementById('remove_core');
var release_branch = document.getElementById('RELEASE_BRANCH');
core_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check And Update%>" onclick="return core_update(this,\'Dev\')"/>';
core_tun_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check And Update%>" onclick="return core_update(this,\'TUN\')"/>';
core_meta_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check And Update%>" onclick="return core_update(this,\'Meta\')"/>';
@ -173,6 +183,7 @@
ma_op_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Download%>" onclick="return ma_op_update(this)"/>';
restore.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Restore Default Config%>" onclick="return restore_config(this)"/>';
one_key_update.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:One Click Check Update%>" onclick="return all_one_key_update(this)"/>';
one_key_update_cdn.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:One Click Check Update With CDN%>" onclick="return all_one_key_update_cdn(this)"/>';
remove_core.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Remove Core%>" onclick="return remove_all_core(this)"/>';
backup.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Backup OpenClash%>" onclick="return backup_all_file(this)"/>';
backup_ex_core.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Backup Exclude Cores%>" onclick="return backup_no_core(this)"/>';
@ -539,4 +550,25 @@
});
}
function all_one_key_update_cdn(btn)
{
var v = core_version.value;
var r = release_branch.value;
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "save_corever_branch")%>', {core_ver: v, release_branch: r}, function(x, status) {
if (x && x.status == 200) {
btn.value = '<%:One Click Check Update With CDN%>';
btn.disabled = true;
var r = confirm("<%:Check and Update all Cores and OpenClash?%>")
if (r == true) {
btn.disabled = false;
return select_git_cdn("one_key_update");
}
else {
btn.disabled = false;
return false;
}
}
});
}
//]]></script>

View File

@ -173,8 +173,8 @@ msgstr "实验性:绕过中国大陆 IPv6"
msgid "Bypass The China Network Flows, Improve Performance"
msgstr "启用后中国大陆流量将不再经过内核,提升系统性能"
msgid "Bypass The China Network Flows, Improve Performance, Depend on Dnsmasq"
msgstr "启用后中国大陆流量将不再经过内核,提升系统性能,此功能依赖于 Dnsmasq"
msgid "Bypass The China Network Flows, Improve Performance, If Inaccessibility on Bypass Gateway, Try to Enable Bypass Gateway Compatible Option, Depend on Dnsmasq"
msgstr "启用后中国大陆流量将不再经过内核,提升系统性能,如旁路由遇到无法访问,请尝试启用旁路由兼容模式,此功能依赖于 Dnsmasq"
msgid "Log Level"
msgstr "日志等级"
@ -726,7 +726,7 @@ msgstr "协议"
msgid "Protocol param(optional)"
msgstr "传输协议参数(可选)"
msgid "Obfs"
msgid "obfs"
msgstr "混淆插件"
msgid "Obfs param(optional)"
@ -765,6 +765,36 @@ msgstr "策略组配置(使用一键生成配置文件功能时无需设置)
msgid "Proxies"
msgstr "服务器节点配置"
msgid "Enable Port Hopping"
msgstr "启用端口跃迁"
msgid "Port Range"
msgstr "端口范围值"
msgid "Uplink Capacity(Default:Mbps)"
msgstr "上行链路容量默认Mbps"
msgid "Downlink Capacity(Default:Mbps)"
msgstr "下行链路容量默认Mbps"
msgid "Hop Interval (Unit:second)"
msgstr "跳跃间隔(单位:秒)"
msgid "Obfs"
msgstr "混淆插件"
msgid "Obfs param (optional)"
msgstr "混淆参数(可选)"
msgid "obfs-password"
msgstr "混淆密码"
msgid "Enable Transport Protocol Settings"
msgstr "启用传输协议设置"
msgid "Hysterir QUIC parameters"
msgstr "QUIC 参数"
msgid "Edit Rule Providers"
msgstr "编辑规则集配置"
@ -1389,6 +1419,9 @@ msgstr "还原默认配置"
msgid "One Click Check Update"
msgstr "一键检查更新"
msgid "One Click Check Update With CDN"
msgstr "使用CDN一键检查更新"
msgid "Failed to get the latest version. Please try again later!"
msgstr "最新版本获取失败,请稍后再试!"
@ -1425,12 +1458,6 @@ msgstr "页面已切换为 Redir-Host 模式!"
msgid "IP Address"
msgstr "IP 地址"
msgid "Mainland"
msgstr "国内"
msgid "Abroad"
msgstr "国外"
msgid "Website Access Check"
msgstr "网站访问检查"
@ -1641,11 +1668,11 @@ msgstr "版本内核更新失败,请检查网络或稍后再试!"
msgid "Core Update Successful!"
msgstr "版本内核更新成功!"
msgid "Core Update Failed. Please Make Sure Enough Flash Memory Space And Try Again!"
msgstr "版本内核更新失败,请确认设备闪存空间足够后再试!"
msgid "Core Update Failed. Please Make Sure Enough Flash Memory Space or Selected Correct Core Platform And Try Again!"
msgstr "版本内核更新失败,请确认设备闪存空间足够或内核平台正确后再试!"
msgid "No Compiled Version Selected, Please Select In Global Settings And Try Again!"
msgstr "未选择编译版本,请到全局设置中选择后再试!"
msgid "No Compiled Version Selected, Please Select In Update Page And Try Again!"
msgstr "未选择编译版本,请到升级页面选择后再试!"
msgid "Core Has Not Been Updated, Stop Continuing Operation!"
msgstr "版本内核没有更新,停止继续操作!"
@ -3496,4 +3523,31 @@ msgid "Skip Proxy Address"
msgstr "绕过服务器地址"
msgid "Bypassing Server Addresses And Preventing Duplicate Proxies"
msgstr "绕过服务器地址,防止重复代理"
msgstr "绕过服务器地址,防止重复代理"
msgid "Warning: Unsupported format, Proxies Address Skip Function Ignore Proxy-providers File"
msgstr "警告:不支持的格式,绕过代理服务器地址功能已忽略代理集文件"
msgid "Choose CDN For Downloading:"
msgstr "请在下方选择一个 CDN 地址进行加速下载:"
msgid "Custom Your CDN URL"
msgstr "自定义链接地址"
msgid "Type CDN URL, Format Like"
msgstr "输入链接地址,格式请参考"
msgid "Please enter a valid URL!"
msgstr "请参考示例输入正确的链接地址!"
msgid "WAN Interface Name"
msgstr "WAN 接口名称"
msgid "Select WAN Interface Name For The Intranet Allowed"
msgstr "为仅允许内网指定正确的 WAN 接口名称"
msgid "LAN Interface Name"
msgstr "LAN 接口名称"
msgid "Select LAN Interface Name"
msgstr "指定正确的 LAN 接口名称"

View File

@ -123,88 +123,130 @@ config dns_servers
option enabled '1'
config dns_servers
option type 'https'
option group 'fallback'
option ip 'dns.cloudflare.com/dns-query'
option enabled '0'
option group 'fallback'
option ip '9.9.9.9'
option type 'udp'
config dns_servers
option group 'fallback'
option ip 'dns.google'
option port '853'
option type 'tls'
option enabled '0'
option group 'fallback'
option ip '149.112.112.112'
option type 'udp'
config dns_servers
option group 'fallback'
option type 'https'
option ip '1.1.1.1/dns-query'
option enabled '0'
option group 'fallback'
option ip '2620:fe::fe'
option type 'udp'
config dns_servers
option group 'fallback'
option ip '1.1.1.1'
option port '853'
option type 'tls'
option enabled '0'
option group 'fallback'
option ip '2620:fe::9'
option type 'udp'
config dns_servers
option enabled '0'
option group 'fallback'
option ip '8.8.8.8'
option port '853'
option type 'udp'
config dns_servers
option enabled '0'
option group 'fallback'
option ip '8.8.4.4'
option type 'udp'
config dns_servers
option enabled '0'
option group 'fallback'
option ip '2001:4860:4860::8888'
option type 'udp'
config dns_servers
option enabled '0'
option group 'fallback'
option ip '2001:4860:4860::8844'
option type 'udp'
config dns_servers
option enabled '0'
option group 'fallback'
option ip '2001:da8::666'
option type 'udp'
config dns_servers
option enabled '0'
option group 'fallback'
option ip 'dns.quad9.net'
option type 'tls'
config dns_servers
option type 'udp'
option group 'fallback'
option ip '2001:4860:4860::8888'
option port '53'
option enabled '0'
option group 'fallback'
option ip 'dns.google'
option type 'tls'
config dns_servers
option type 'udp'
option group 'fallback'
option ip '2001:4860:4860::8844'
option port '53'
option enabled '0'
option group 'fallback'
option ip '1.1.1.1'
option type 'tls'
config dns_servers
option type 'udp'
option group 'fallback'
option ip '2001:da8::666'
option port '53'
option enabled '0'
config dns_servers
option group 'fallback'
option type 'https'
option ip 'public.dns.iij.jp/dns-query'
option enabled '0'
config dns_servers
option group 'fallback'
option type 'https'
option ip 'jp.tiar.app/dns-query'
option enabled '0'
config dns_servers
option group 'fallback'
option type 'https'
option ip 'jp.tiarap.org/dns-query'
option enabled '0'
config dns_servers
option group 'fallback'
option ip 'jp.tiar.app'
option type 'tls'
option enabled '0'
config dns_servers
option enabled '0'
option group 'fallback'
option ip 'dot.tiar.app'
option type 'tls'
config dns_servers
option enabled '0'
option group 'fallback'
option ip 'dns.quad9.net/dns-query'
option type 'https'
config dns_servers
option enabled '0'
option group 'fallback'
option ip 'dns.google/dns-query'
option type 'https'
config dns_servers
option enabled '0'
option group 'fallback'
option ip 'dns.cloudflare.com/dns-query'
option type 'https'
config dns_servers
option enabled '0'
option group 'fallback'
option ip '1.1.1.1/dns-query'
option type 'https'
config dns_servers
option enabled '0'
option group 'fallback'
option ip 'public.dns.iij.jp/dns-query'
option type 'https'
config dns_servers
option enabled '0'
option group 'fallback'
option ip 'jp.tiar.app/dns-query'
option type 'https'
config dns_servers
option enabled '0'
option group 'fallback'
option ip 'jp.tiarap.org/dns-query'
option type 'https'
config dns_servers
option enabled '0'
@ -245,5 +287,5 @@ config dns_servers
config dns_servers
option enabled '0'
option group 'fallback'
option type 'https'
option ip 'doh.mullvad.net/dns-query'
option type 'https'

View File

@ -744,6 +744,7 @@ config_test()
{
if [ -f "$CLASH" ]; then
LOG_OUT "Test The Config File First..."
chmod o+w "$CONFIG_FILE" 2>/dev/null
test_info=$(nohup $CLASH -t -d $CLASH_CONFIG -f "$CONFIG_FILE")
local IFS=$'\n'
for i in $test_info; do
@ -934,6 +935,32 @@ ac_add()
[ -n "$3" ] && ipset add "$3" "$1" 2>/dev/null
}
wan_name_add()
{
if [ -z "$1" ]; then
return
fi
if [ -n "$wan_ints" ]; then
wan_ints="$wan_ints $1"
else
wan_ints="$1"
fi
}
wan6_name_add()
{
if [ -z "$1" ]; then
return
fi
if [ -n "$wan6_ints" ]; then
wan6_ints="$wan6_ints $1"
else
wan6_ints="$1"
fi
}
upnp_exclude()
{
if [ -s "$upnp_lease_file" ]; then
@ -1525,7 +1552,12 @@ if [ -n "$FW4" ]; then
#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/ && $(i+1) != "{") {print $(i+1)} if ($i ~ /iifname/ && $(i+1) == "{"){for (j=i+1;j<=NF;j++){if ($j~ /}/) {out="";for (k=i+1;k<=j;k++){out=out" "$k};print out}}}}}' 2>/dev/null |sed 's/"//g'|sed 's/{//g'|sed 's/}//g'|sed 's/,//g')
if [ -n "$intranet_allowed_wan_name" ]; then
config_load "openclash"
config_list_foreach "config" "intranet_allowed_wan_name" wan_name_add
else
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/ && $(i+1) != "{") {print $(i+1)} if ($i ~ /iifname/ && $(i+1) == "{"){for (j=i+1;j<=NF;j++){if ($j~ /}/) {out="";for (k=i+1;k<=j;k++){out=out" "$k};print out}}}}}' 2>/dev/null |sed 's/"//g'|sed 's/{//g'|sed 's/}//g'|sed 's/,//g')
fi
if [ -n "$wan_ints" ]; then
nft 'add chain inet fw4 openclash_wan_input'
nft 'flush chain inet fw4 openclash_wan_input'
@ -1841,6 +1873,9 @@ if [ -n "$FW4" ]; then
#TUN FORWORD
nft insert rule inet fw4 forward position 0 meta l4proto {tcp,udp} oifname utun counter accept comment \"OpenClash TUN Forward\"
nft insert rule inet fw4 forward position 0 meta l4proto {tcp,udp} iifname utun counter accept comment \"OpenClash TUN Forward\"
nft insert rule inet fw4 input position 0 meta l4proto {tcp,udp} iifname utun counter accept comment \"OpenClash TUN Input\"
nft insert rule inet fw4 srcnat position 0 meta nfproto {ipv4} oifname utun counter return comment \"OpenClash TUN Postrouting\"
#quic
if [ "$disable_udp_quic" -eq 1 ]; then
@ -2129,9 +2164,21 @@ if [ -n "$FW4" ]; then
set_tun_tap "v6"
fi
#TUN FORWORD
if [ "$ipv6_mode" -eq 2 ]; then
nft insert rule inet fw4 forward position 0 meta nfproto {ipv6} oifname utun counter accept comment \"OpenClash TUN Forward\"
nft insert rule inet fw4 forward position 0 meta nfproto {ipv6} iifname utun counter accept comment \"OpenClash TUN Forward\"
nft insert rule inet fw4 input position 0 meta nfproto {ipv6} iifname utun counter accept comment \"OpenClash TUN Input\"
nft insert rule inet fw4 srcnat position 0 meta nfproto {ipv6} oifname utun counter return comment \"OpenClash TUN Postrouting\"
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\"
if [ "$ipv6_mode" -eq 2 ]; then
nft insert rule inet fw4 forward position 0 udp dport 443 ip6 daddr != @china_ip6_route counter reject comment \"OpenClash QUIC REJECT\"
else
nft insert rule inet fw4 input position 0 udp dport 443 ip6 daddr != @china_ip6_route counter reject comment \"OpenClash QUIC REJECT\"
fi
fi
#bypass gateway compatible
@ -2158,7 +2205,12 @@ if [ -n "$FW4" ]; then
#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/ && $(i+1) != "{") {print $(i+1)} if ($i ~ /iifname/ && $(i+1) == "{"){for (j=i+1;j<=NF;j++){if ($j~ /}/) {out="";for (k=i+1;k<=j;k++){out=out" "$k};print out}}}}}' 2>/dev/null |sed 's/"//g'|sed 's/{//g'|sed 's/}//g'|sed 's/,//g')
if [ -n "$intranet_allowed_wan_name" ]; then
config_load "openclash"
config_list_foreach "config" "intranet_allowed_wan_name" wan6_name_add
else
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/ && $(i+1) != "{") {print $(i+1)} if ($i ~ /iifname/ && $(i+1) == "{"){for (j=i+1;j<=NF;j++){if ($j~ /}/) {out="";for (k=i+1;k<=j;k++){out=out" "$k};print out}}}}}' 2>/dev/null |sed 's/"//g'|sed 's/{//g'|sed 's/}//g'|sed 's/,//g')
fi
if [ -n "$wan6_ints" ]; then
nft 'add chain inet fw4 openclash_wan6_input'
nft 'flush chain inet fw4 openclash_wan6_input'
@ -2278,7 +2330,12 @@ if [ -z "$FW4" ]; then
#intranet allowed
if [ "$intranet_allowed" -eq 1 ]; then
wan_ints=$(iptables-save -t filter |grep -e "-j zone_wan_input" 2>/dev/null |awk '{for (i=1;i<=NF;i++) {if ($i ~ /-i/) {print $(i+1)}}}' 2>/dev/null)
if [ -n "$intranet_allowed_wan_name" ]; then
config_load "openclash"
config_list_foreach "config" "intranet_allowed_wan_name" wan_name_add
else
wan_ints=$(iptables-save -t filter |grep -e "-j zone_wan_input" 2>/dev/null |awk '{for (i=1;i<=NF;i++) {if ($i ~ /-i/) {print $(i+1)}}}' 2>/dev/null)
fi
if [ -n "$wan_ints" ]; then
iptables -t filter -N openclash_wan_input
iptables -t filter -F openclash_wan_input
@ -2617,7 +2674,10 @@ if [ -z "$FW4" ]; then
fi
#TUN FORWORD
iptables -I FORWARD -m comment --comment "OpenClash TUN Forward" -o utun -j ACCEPT
iptables -I FORWARD -m comment --comment "OpenClash TUN Forward" -o utun -j ACCEPT >/dev/null 2>&1
iptables -I FORWARD -m comment --comment "OpenClash TUN Forward" -i utun -j ACCEPT >/dev/null 2>&1
iptables -I INPUT -m comment --comment "OpenClash TUN Input" -i utun -j ACCEPT >/dev/null 2>&1
iptables -t nat -I POSTROUTING -m comment --comment "OpenClash TUN Postrouting" -o utun -j RETURN >/dev/null 2>&1
#quic
if [ "$disable_udp_quic" -eq 1 ]; then
@ -2889,9 +2949,21 @@ if [ -z "$FW4" ]; then
set_tun_tap "v6"
fi
#TUN FORWORD
if [ "$ipv6_mode" -eq 2 ]; then
ip6tables -I FORWARD -m comment --comment "OpenClash TUN Forward" -o utun -j ACCEPT >/dev/null 2>&1
ip6tables -I FORWARD -m comment --comment "OpenClash TUN Forward" -i utun -j ACCEPT >/dev/null 2>&1
ip6tables -I INPUT -m comment --comment "OpenClash TUN Input" -i utun -j ACCEPT >/dev/null 2>&1
ip6tables -t nat -I POSTROUTING -m comment --comment "OpenClash TUN Postrouting" -o utun -j RETURN >/dev/null 2>&1
fi
#quic
if [ "$disable_udp_quic" -eq 1 ]; then
ip6tables -I INPUT -p udp --dport 443 -m comment --comment "OpenClash QUIC REJECT" -m set ! --match-set china_ip6_route dst -j REJECT >/dev/null 2>&1
if [ "$ipv6_mode" -eq 2 ]; then
ip6tables -I FORWARD -p udp --dport 443 -o utun -m comment --comment "OpenClash QUIC REJECT" -m set ! --match-set china_ip6_route dst -j REJECT >/dev/null 2>&1
else
ip6tables -I INPUT -p udp --dport 443 -m comment --comment "OpenClash QUIC REJECT" -m set ! --match-set china_ip6_route dst -j REJECT >/dev/null 2>&1
fi
fi
#bypass gateway compatible
@ -2921,7 +2993,12 @@ if [ -z "$FW4" ]; then
#intranet allowed
if [ "$intranet_allowed" -eq 1 ]; then
wan6_ints=$(ip6tables-save -t filter |grep -e "-j zone_wan_input" 2>/dev/null |awk '{for (i=1;i<=NF;i++) {if ($i ~ /-i/) {print $(i+1)}}}' 2>/dev/null)
if [ -n "$intranet_allowed_wan_name" ]; then
config_load "openclash"
config_list_foreach "config" "intranet_allowed_wan_name" wan6_name_add
else
wan6_ints=$(ip6tables-save -t filter |grep -e "-j zone_wan_input" 2>/dev/null |awk '{for (i=1;i<=NF;i++) {if ($i ~ /-i/) {print $(i+1)}}}' 2>/dev/null)
fi
if [ -n "$wan6_ints" ]; then
ip6tables -t filter -N openclash_wan_input
ip6tables -t filter -F openclash_wan_input
@ -3061,7 +3138,12 @@ get_config()
fakeip_range=$(uci -q get openclash.config.fakeip_range)
fi
[ -z "$fakeip_range" ] && fakeip_range="198.18.0.1/16"
lan_ip=$(uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
lan_interface_name=$(uci -q get openclash.config.lan_interface_name || echo "0")
if [ "$lan_interface_name" = "0" ]; then
lan_ip=$(uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
else
lan_ip=$(ip address show $(uci -q -p $lan_interface_name) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}')
fi
wan_ip4s=$(/usr/share/openclash/openclash_get_network.lua "wanip" 2>/dev/null)
wan_ip6s=$(ifconfig | grep 'inet6 addr' | awk '{print $3}' 2>/dev/null)
disable_masq_cache=$(uci -q get openclash.config.disable_masq_cache)
@ -3101,6 +3183,7 @@ get_config()
enable_unified_delay=$(uci -q get openclash.config.enable_unified_delay || echo "0")
keep_alive_interval=$(uci -q get openclash.config.keep_alive_interval || echo "0")
proxy_dns_group=$(uci -q get openclash.config.proxy_dns_group || echo "Disable")
intranet_allowed_wan_name=$(uci -q get openclash.config.intranet_allowed_wan_name || echo "0")
[ -z "$dns_port" ] && dns_port=7874 && uci -q set openclash.config.dns_port=7874
uci -q set openclash.config.restricted_mode=0 && uci -q commit openclash
}

View File

@ -1,10 +1,12 @@
#!/bin/bash
. /lib/functions.sh
[ -e "/etc/config/ucitrack" ] && {
uci -q delete ucitrack.@openclash[-1]
uci -q add ucitrack openclash
uci -q set ucitrack.@openclash[-1].init=openclash
uci -q commit ucitrack
}
uci -q delete firewall.openclash
uci -q set firewall.openclash=include
uci -q set firewall.openclash.type=script
@ -196,28 +198,5 @@ sed -i '/.*kB maximum content size*/c\export let HTTP_MAX_CONTENT = 1024*10240;
/etc/init.d/uhttpd restart >/dev/null 2>&1
#set tun interface firewall rule
add_utun_firewall_zone()
{
local section="$1"
local name network
config_get "name" "$section" "name" ""
config_get "network" "$section" "network" ""
if [ "$name" = "lan" ] && [ -z "$(echo $network |grep utun)" ]; then
uci -q set firewall."$section".network="$network utun"
uci -q commit firewall
fi
}
uci -q set network.utun=interface
uci -q set network.utun.proto=none
uci -q set network.utun.ifname=utun
uci -q set network.utun.device=utun
uci -q set network.utun.auto='0'
uci -q commit network
config_load "firewall"
config_foreach add_utun_firewall_zone "zone"
rm -f /tmp/luci-indexcache
exit 0

View File

@ -15,6 +15,9 @@ CHTIME=$(date "+%Y-%m-%d-%H" -r "/tmp/clash_last_version" 2>/dev/null)
LAST_OPVER="/tmp/clash_last_version"
RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master")
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
if [ -n "$1" ]; then
github_address_mod="$1"
fi
LOG_FILE="/tmp/openclash.log"
set_lock

View File

@ -50,6 +50,7 @@ config_test()
{
if [ -f "$CLASH" ]; then
LOG_OUT "Config File Download Successful, Test If There is Any Errors..."
chmod o+w "$CFG_FILE" 2>/dev/null
test_info=$(nohup $CLASH -t -d $CLASH_CONFIG -f "$CFG_FILE")
local IFS=$'\n'
for i in $test_info; do

View File

@ -4,18 +4,28 @@
. /usr/share/openclash/log.sh
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
if [ "$github_address_mod" = "0" ] && [ "$1" != "one_key_update" ] && [ "$2" != "one_key_update" ]; then
if [ "$github_address_mod" = "0" ] && [ -z "$(echo $2 2>/dev/null |grep -E 'http|one_key_update')" ] && [ -z "$(echo $3 2>/dev/null |grep 'http')" ]; then
LOG_OUT "Tip: If the download fails, try setting the CDN in Overwrite Settings - General Settings - Github Address Modify Options"
fi
if [ -n "$3" ] && [ "$2" = "one_key_update" ]; then
github_address_mod="$3"
fi
if [ -n "$2" ] && [ "$2" != "one_key_update" ]; then
github_address_mod="$2"
fi
CORE_TYPE="$1"
C_CORE_TYPE=$(uci -q get openclash.config.core_type)
[ -z "$CORE_TYPE" ] || [ "$1" = "one_key_update" ] && CORE_TYPE="Dev"
[ -z "$CORE_TYPE" ] && CORE_TYPE="Dev"
small_flash_memory=$(uci -q get openclash.config.small_flash_memory)
CPU_MODEL=$(uci -q get openclash.config.core_version)
RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master")
LOG_FILE="/tmp/openclash.log"
[ ! -f "/tmp/clash_last_version" ] && /usr/share/openclash/clash_version.sh 2>/dev/null
if [ "$github_address_mod" != "0" ]; then
[ ! -f "/tmp/clash_last_version" ] && /usr/share/openclash/clash_version.sh "$github_address_mod" 2>/dev/null
else
[ ! -f "/tmp/clash_last_version" ] && /usr/share/openclash/clash_version.sh 2>/dev/null
fi
if [ ! -f "/tmp/clash_last_version" ]; then
LOG_OUT "Error: 【"$CORE_TYPE"】Core Version Check Error, Please Try Again Later..."
SLOG_CLEAN
@ -115,13 +125,14 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
if [ "$?" == "0" ]; then
LOG_OUT "【"$CORE_TYPE"】Core Download Successful, Start Update..."
case $CORE_TYPE in
case $CORE_TYPE in
"TUN")
[ -s "/tmp/clash_tun.gz" ] && {
gzip -d /tmp/clash_tun.gz >/dev/null 2>&1
rm -rf /tmp/clash_tun.gz >/dev/null 2>&1
rm -rf "$tun_core_path" >/dev/null 2>&1
chmod 4755 /tmp/clash_tun >/dev/null 2>&1
/tmp/clash_tun -v >/dev/null 2>&1
}
;;
"Meta")
@ -131,6 +142,7 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
mv /tmp/clash /tmp/clash_meta >/dev/null 2>&1
rm -rf /tmp/clash_meta.tar.gz >/dev/null 2>&1
chmod 4755 /tmp/clash_meta >/dev/null 2>&1
/tmp/clash_meta -v >/dev/null 2>&1
}
;;
*)
@ -139,10 +151,11 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
tar zxvf /tmp/clash.tar.gz -C /tmp
rm -rf /tmp/clash.tar.gz >/dev/null 2>&1
chmod 4755 /tmp/clash >/dev/null 2>&1
/tmp/clash -v >/dev/null 2>&1
}
esac
if [ "$?" != "0" ]; then
LOG_OUT "【"$CORE_TYPE"】Core Update Failed. Please Make Sure Enough Flash Memory Space And Try Again!"
LOG_OUT "【"$CORE_TYPE"】Core Update Failed. Please Make Sure Enough Flash Memory Space or Selected Correct Core Platform And Try Again!"
case $CORE_TYPE in
"TUN")
rm -rf /tmp/clash_tun >/dev/null 2>&1
@ -157,23 +170,23 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
exit 0
fi
case $CORE_TYPE in
case $CORE_TYPE in
"TUN")
mv /tmp/clash_tun "$tun_core_path" >/dev/null 2>&1
;;
mv /tmp/clash_tun "$tun_core_path" >/dev/null 2>&1
;;
"Meta")
mv /tmp/clash_meta "$meta_core_path" >/dev/null 2>&1
;;
mv /tmp/clash_meta "$meta_core_path" >/dev/null 2>&1
;;
*)
mv /tmp/clash "$dev_core_path" >/dev/null 2>&1
esac
mv /tmp/clash "$dev_core_path" >/dev/null 2>&1
esac
if [ "$?" == "0" ]; then
LOG_OUT "【"$CORE_TYPE"】Core Update Successful!"
if [ "$if_restart" -eq 1 ]; then
uci -q set openclash.config.config_reload=0
uci -q commit openclash
if [ -z "$2" ] && [ "$1" != "one_key_update" ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ] && [ "$(unify_ps_prevent)" -eq 0 ]; then
if ([ -z "$2" ] || ([ -n "$2" ] && [ "$2" != "one_key_update" ])) && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ] && [ "$(unify_ps_prevent)" -eq 0 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
fi
else
@ -188,7 +201,7 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
SLOG_CLEAN
fi
else
LOG_OUT "No Compiled Version Selected, Please Select In Global Settings And Try Again!"
LOG_OUT "No Compiled Version Selected, Please Select In Update Page And Try Again!"
SLOG_CLEAN
fi
else

View File

@ -45,7 +45,12 @@ router_self_proxy=$(uci -q get openclash.config.router_self_proxy)
core_type=$(uci -q get openclash.config.core_type || echo "Dev")
da_password=$(uci -q get openclash.config.dashboard_password)
cn_port=$(uci -q get openclash.config.cn_port)
lan_ip=$(uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
lan_interface_name=$(uci -q get openclash.config.lan_interface_name || echo "0")
if [ "$lan_interface_name" = "0" ]; then
lan_ip=$(uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
else
lan_ip=$(ip address show $(uci -q -p $lan_interface_name) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}')
fi
dnsmasq_default_resolvfile=$(uci -q get openclash.config.default_resolvfile)
if [ -z "$RAW_CONFIG_FILE" ] || [ ! -f "$RAW_CONFIG_FILE" ]; then

View File

@ -10,8 +10,13 @@ local addr = arg[1]
local resolve = arg[2]
local function debug_dns()
local info, ip, host
ip = luci.sys.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
local info, ip, host, lan_int_name
lan_int_name = uci:get("openclash", "config", "lan_interface_name") or "0"
if lan_int_name == "0" then
ip = luci.sys.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
else
ip = luci.sys.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name))
end
if not ip or ip == "" then
ip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'")
end
@ -22,61 +27,67 @@ local function debug_dns()
local passwd = uci:get("openclash", "config", "dashboard_password") or ""
if datatype.hostname(addr) and ip and port then
info = luci.sys.exec(string.format('curl -sL -m 3 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -XGET http://"%s":"%s"/dns/query?name="%s"', passwd, ip, port, addr))
if info then
info = json.parse(info)
info_v4 = luci.sys.exec(string.format('curl -sL -m 3 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -XGET http://"%s":"%s"/dns/query?name="%s"', passwd, ip, port, addr))
info_v6 = luci.sys.exec(string.format('curl -sL -m 3 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -XGET \"http://"%s":"%s"/dns/query?name="%s"&type=AAAA\"', passwd, ip, port, addr))
if info_v4 then
info_v4 = json.parse(info_v4)
end
if info and not resolve then
print("Status: "..(info.Status))
print("TC: "..tostring(info.TC))
print("RD: "..tostring(info.RD))
print("RA: "..tostring(info.RA))
print("AD: "..tostring(info.AD))
print("CD: "..tostring(info.CD))
print("")
print("Question: ")
for _, v in pairs(info.Question) do
print(" Name: "..(v.Name))
print(" Qtype: "..(v.Qtype))
print(" Qclass: "..(v.Qclass))
if info_v6 then
info_v6 = json.parse(info_v6)
end
for _, info in pairs({info_v4, info_v6}) do
if info and not resolve then
print("Status: "..(info.Status))
print("TC: "..tostring(info.TC))
print("RD: "..tostring(info.RD))
print("RA: "..tostring(info.RA))
print("AD: "..tostring(info.AD))
print("CD: "..tostring(info.CD))
print("")
end
if info.Answer then
print("Answer: ")
for _, v in pairs(info.Answer) do
print(" TTL: "..(v.TTL))
print(" data: "..(v.data:gsub("\n?", "")))
print(" name: "..(v.name))
print(" type: "..(v.type))
print("Question: ")
for _, v in pairs(info.Question) do
print(" Name: "..(v.Name))
print(" Qtype: "..(v.Qtype))
print(" Qclass: "..(v.Qclass))
print("")
end
end
if info.Additional then
print("Additional: ")
for _, v in pairs(info.Additional) do
print(" TTL: "..(v.TTL))
print(" data: "..(v.data:gsub("\n?", "")))
print(" name: "..(v.name))
print(" type: "..(v.type))
print("")
if info.Answer then
print("Answer: ")
for _, v in pairs(info.Answer) do
print(" TTL: "..(v.TTL))
print(" data: "..(v.data:gsub("\n?", "")))
print(" name: "..(v.name))
print(" type: "..(v.type))
print("")
end
end
if info.Additional then
print("Additional: ")
for _, v in pairs(info.Additional) do
print(" TTL: "..(v.TTL))
print(" data: "..(v.data:gsub("\n?", "")))
print(" name: "..(v.name))
print(" type: "..(v.type))
print("")
end
end
if info.Authority then
print("Authority: ")
for _, v in pairs(info.Authority) do
print(" TTL: "..(v.TTL))
print(" data: "..(v.data:gsub("\n?", "")))
print(" name: "..(v.name))
print(" type: "..(v.type))
print("")
end
end
end
if info.Authority then
print("Authority: ")
for _, v in pairs(info.Authority) do
print(" TTL: "..(v.TTL))
print(" data: "..(v.data:gsub("\n?", "")))
print(" name: "..(v.name))
print(" type: "..(v.type))
print("")
end
end
end
if info and resolve then
if info.Answer then
for _, v in pairs(info.Answer) do
if v.type == 1 then
print(v.data)
if info and resolve then
if info.Answer then
for _, v in pairs(info.Answer) do
if v.type == 1 or v.type == 28 then
print(v.data)
end
end
end
end
@ -85,4 +96,4 @@ local function debug_dns()
os.exit(0)
end
debug_dns()
debug_dns()

View File

@ -20,8 +20,13 @@ return string.format("%.1f",e)..a[t]
end
local function debug_getcon()
local info, ip, host, diag_info
ip = luci.sys.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
local info, ip, host, diag_info, lan_int_name
lan_int_name = uci:get("openclash", "config", "lan_interface_name") or "0"
if lan_int_name == "0" then
ip = luci.sys.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
else
ip = luci.sys.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name))
end
if not ip or ip == "" then
ip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'")
end

View File

@ -14,7 +14,12 @@ del_lock() {
close_all_conection() {
SECRET=$(uci -q get openclash.config.dashboard_password)
LAN_IP=$(uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
lan_interface_name=$(uci -q get openclash.config.lan_interface_name || echo "0")
if [ "$lan_interface_name" = "0" ]; then
LAN_IP=$(uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
else
LAN_IP=$(ip address show $(uci -q -p $lan_interface_name) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}')
fi
PORT=$(uci -q get openclash.config.cn_port)
curl -m 2 -H "Authorization: Bearer ${SECRET}" -H "Content-Type:application/json" -X DELETE http://"$LAN_IP":"$PORT"/connections >/dev/null 2>&1
}

View File

@ -11,7 +11,14 @@ del_lock() {
rm -rf "/tmp/lock/openclash_update.lock"
}
[ ! -f "/tmp/openclash_last_version" ] && /usr/share/openclash/openclash_version.sh 2>/dev/null
if [ -n "$1" ] && [ "$1" != "one_key_update" ]; then
[ ! -f "/tmp/openclash_last_version" ] && /usr/share/openclash/openclash_version.sh "$1" 2>/dev/null
elif [ -n "$2" ]; then
[ ! -f "/tmp/openclash_last_version" ] && /usr/share/openclash/openclash_version.sh "$2" 2>/dev/null
else
[ ! -f "/tmp/openclash_last_version" ] && /usr/share/openclash/openclash_version.sh 2>/dev/null
fi
if [ ! -f "/tmp/openclash_last_version" ]; then
LOG_OUT "Error: Failed to Get Version Information, Please Try Again Later..."
SLOG_CLEAN
@ -30,12 +37,20 @@ github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
if [ "$1" = "one_key_update" ]; then
uci -q set openclash.config.enable=1
uci -q commit openclash
if [ "$github_address_mod" = "0" ]; then
if [ "$github_address_mod" = "0" ] && [ -z "$2" ]; then
LOG_OUT "Tip: If the download fails, try setting the CDN in Overwrite Settings - General Settings - Github Address Modify Options"
fi
/usr/share/openclash/openclash_core.sh "$1" >/dev/null 2>&1 &
/usr/share/openclash/openclash_core.sh "TUN" "$1" >/dev/null 2>&1 &
/usr/share/openclash/openclash_core.sh "Meta" "$1" >/dev/null 2>&1 &
if [ -n "$2" ]; then
/usr/share/openclash/openclash_core.sh "Dev" "$1" "$2" >/dev/null 2>&1 &
/usr/share/openclash/openclash_core.sh "TUN" "$1" "$2" >/dev/null 2>&1 &
/usr/share/openclash/openclash_core.sh "Meta" "$1" "$2" >/dev/null 2>&1 &
github_address_mod="$2"
else
/usr/share/openclash/openclash_core.sh "Dev" "$1" >/dev/null 2>&1 &
/usr/share/openclash/openclash_core.sh "TUN" "$1" >/dev/null 2>&1 &
/usr/share/openclash/openclash_core.sh "Meta" "$1" >/dev/null 2>&1 &
fi
wait
else
if [ "$github_address_mod" = "0" ]; then

View File

@ -7,6 +7,9 @@ RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master")
OP_CV=$(rm -f /var/lock/opkg.lock && opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F '-' '{print $1}' |awk -F 'Version: ' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
OP_LV=$(sed -n 1p $LAST_OPVER 2>/dev/null |awk -F '-' '{print $1}' |awk -F 'v' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
if [ -n "$1" ]; then
github_address_mod="$1"
fi
LOG_FILE="/tmp/openclash.log"
if [ "$TIME" != "$CHTIME" ]; then

View File

@ -364,6 +364,10 @@ fi
path = i['path']
end;
if File::exist?(path) then
if YAML.load_file(path).class == String then
puts '${LOGTIME} Warning: Unsupported format, Proxies Address Skip Function Ignore Proxy-providers File【' + path + '】';
next
end;
if YAML.load_file(path).key?('proxies') and not YAML.load_file(path)['proxies'].nil? then
YAML.load_file(path)['proxies'].each do
|j|

View File

@ -312,8 +312,13 @@ yml_groups_set()
sed -i "/use: ${name}/d" $GROUP_FILE 2>/dev/null
fi
if [ "$set_group" -eq 0 ] && [ "$set_proxy_provider" -eq 0 ]; then
echo " proxies:" >>$GROUP_FILE
echo " - DIRECT" >>$GROUP_FILE
fi
[ -n "$test_url" ] && {
echo " url: $test_url" >>$GROUP_FILE
echo " url: $test_url" >>$GROUP_FILE
}
[ -n "$test_interval" ] && {
echo " interval: \"$test_interval\"" >>$GROUP_FILE

View File

@ -1027,7 +1027,8 @@ do
}.join
end;
if '$server_type' == 'hysteria' or '$server_type' == 'hysteria2' then
if '$server_type' == 'hysteria' then
#hysteria
Thread.new{
#hysteria_protocol
if Value['proxies'][$count].key?('protocol') then
@ -1035,7 +1036,21 @@ do
system(hysteria_protocol)
end
}.join
end;
if '$server_type' == 'hysteria2' then
#hysteria2
Thread.new{
#hysteria2_protocol
if Value['proxies'][$count].key?('protocol') then
hysteria2_protocol = '${uci_set}hysteria2_protocol=\"' + Value['proxies'][$count]['protocol'].to_s + '\"'
system(hysteria2_protocol)
end
}.join
end;
if '$server_type' == 'hysteria' or '$server_type' == 'hysteria2' then
#hysteria hysteria2
Thread.new{
#hysteria_up
if Value['proxies'][$count].key?('up') then
@ -1044,6 +1059,7 @@ do
end
}.join
#hysteria hysteria2
Thread.new{
#hysteria_down
if Value['proxies'][$count].key?('down') then
@ -1052,6 +1068,7 @@ do
end
}.join
#hysteria hysteria2
Thread.new{
#skip-cert-verify
if Value['proxies'][$count].key?('skip-cert-verify') then
@ -1060,6 +1077,7 @@ do
end
}.join
#hysteria hysteria2
Thread.new{
#sni
if Value['proxies'][$count].key?('sni') then
@ -1068,6 +1086,7 @@ do
end
}.join
#hysteria hysteria2
Thread.new{
#alpn
if Value['proxies'][$count].key?('alpn') then
@ -1085,6 +1104,7 @@ do
end;
}.join
#hysteria
Thread.new{
#recv_window_conn
if Value['proxies'][$count].key?('recv-window-conn') then
@ -1093,6 +1113,7 @@ do
end
}.join
#hysteria
Thread.new{
#recv_window
if Value['proxies'][$count].key?('recv-window') then
@ -1101,6 +1122,7 @@ do
end
}.join
#hysteria hysteria2
Thread.new{
#hysteria_obfs
if Value['proxies'][$count].key?('obfs') then
@ -1109,6 +1131,7 @@ do
end
}.join
#hysteria hysteria2
Thread.new{
#hysteria_obfs_password
if Value['proxies'][$count].key?('obfs-password') then
@ -1117,6 +1140,7 @@ do
end
}.join
#hysteria
Thread.new{
#hysteria_auth
if Value['proxies'][$count].key?('auth') then
@ -1125,6 +1149,7 @@ do
end
}.join
#hysteria
Thread.new{
#hysteria_auth_str
if Value['proxies'][$count].key?('auth-str') then
@ -1133,6 +1158,7 @@ do
end
}.join
#hysteria hysteria2
Thread.new{
#hysteria_ca
if Value['proxies'][$count].key?('ca') then
@ -1141,6 +1167,7 @@ do
end
}.join
#hysteria hysteria2
Thread.new{
#hysteria_ca_str
if Value['proxies'][$count].key?('ca-str') then
@ -1149,6 +1176,7 @@ do
end
}.join
#hysteria
Thread.new{
#disable_mtu_discovery
if Value['proxies'][$count].key?('disable-mtu-discovery') then
@ -1157,6 +1185,7 @@ do
end
}.join
#hysteria
Thread.new{
#fast_open
if Value['proxies'][$count].key?('fast-open') then
@ -1165,6 +1194,7 @@ do
end
}.join
#hysteria hysteria2
Thread.new{
#fingerprint
if Value['proxies'][$count].key?('fingerprint') then
@ -1173,6 +1203,7 @@ do
end
}.join
#hysteria hysteria2
Thread.new{
#ports
if Value['proxies'][$count].key?('ports') then
@ -1181,6 +1212,7 @@ do
end
}.join
#hysteria hysteria2
Thread.new{
#hop-interval
if Value['proxies'][$count].key?('hop-interval') then
@ -1573,4 +1605,4 @@ SLOG_CLEAN
rm -rf /tmp/match_servers.list 2>/dev/null
rm -rf /tmp/match_provider.list 2>/dev/null
rm -rf /tmp/yaml_other_group.yaml 2>/dev/null
del_lock
del_lock

View File

@ -246,6 +246,7 @@ yml_servers_set()
config_get "vless_flow" "$section" "vless_flow" ""
config_get "http_headers" "$section" "http_headers" ""
config_get "hysteria_protocol" "$section" "hysteria_protocol" ""
config_get "hysteria2_protocol" "$section" "hysteria2_protocol" ""
config_get "hysteria_up" "$section" "hysteria_up" ""
config_get "hysteria_down" "$section" "hysteria_down" ""
config_get "hysteria_alpn" "$section" "hysteria_alpn" ""
@ -977,6 +978,21 @@ EOF
if [ -n "$fingerprint" ]; then
cat >> "$SERVER_FILE" <<-EOF
fingerprint: "$fingerprint"
EOF
fi
if [ -n "$ports" ]; then
cat >> "$SERVER_FILE" <<-EOF
ports: $ports
EOF
fi
if [ -n "$hysteria2_protocol" ]; then
cat >> "$SERVER_FILE" <<-EOF
protocol: $hysteria2_protocol
EOF
fi
if [ -n "$hop_interval" ]; then
cat >> "$SERVER_FILE" <<-EOF
hop-interval: $hop_interval
EOF
fi
fi

View File

@ -0,0 +1,4 @@
{
"config": "openclash",
"init": "openclash"
}

View File

@ -250,6 +250,21 @@ function connect_status()
local e = {}
e.use_time = ""
local url = luci.http.formvalue("url")
local is_baidu = string.find(url, "baidu")
local pw_switch = uci:get(appname, "@global[0]", "enabled")
local chn_list = uci:get(appname, "@global[0]", "chn_list")
local socks_port = uci:get(appname, "@global[0]", "tcp_node_socks_port")
if pw_switch ~= 0 then
if chn_list == "proxy" then
if is_baidu ~= nil then
url = "--socks5 127.0.0.1:" .. socks_port .. " " .. url
end
else
if is_baidu == nil then
url = "--socks5 127.0.0.1:" .. socks_port .. " " .. url
end
end
end
local result = luci.sys.exec('curl --connect-timeout 3 -o /dev/null -I -sk -w "%{http_code}:%{time_appconnect}" ' .. url)
local code = tonumber(luci.sys.exec("echo -n '" .. result .. "' | awk -F ':' '{print $1}'") or "0")
if code ~= 0 then

View File

@ -317,6 +317,7 @@ o:value("1.1.1.2", "1.1.1.2 (CloudFlare-Security)")
o:value("8.8.4.4", "8.8.4.4 (Google)")
o:value("8.8.8.8", "8.8.8.8 (Google)")
o:value("9.9.9.9", "9.9.9.9 (Quad9-Recommended)")
o:value("149.112.112.112", "149.112.112.112 (Quad9-Recommended)")
o:value("208.67.220.220", "208.67.220.220 (OpenDNS)")
o:value("208.67.222.222", "208.67.222.222 (OpenDNS)")
o:depends({dns_mode = "dns2socks"})
@ -330,7 +331,8 @@ if has_singbox or has_xray then
o:value("https://1.1.1.2/dns-query", "CloudFlare-Security")
o:value("https://8.8.4.4/dns-query", "Google 8844")
o:value("https://8.8.8.8/dns-query", "Google 8888")
o:value("https://9.9.9.9/dns-query", "Quad9-Recommended")
o:value("https://9.9.9.9/dns-query", "Quad9-Recommended 9.9.9.9")
o:value("https://149.112.112.112/dns-query", "Quad9-Recommended 149.112.112.112")
o:value("https://208.67.222.222/dns-query", "OpenDNS")
o:value("https://dns.adguard.com/dns-query,176.103.130.130", "AdGuard")
o:value("https://doh.libredns.gr/dns-query,116.202.176.26", "LibreDNS")

View File

@ -330,6 +330,7 @@ o:value("1.1.1.2", "1.1.1.2 (CloudFlare-Security)")
o:value("8.8.4.4", "8.8.4.4 (Google)")
o:value("8.8.8.8", "8.8.8.8 (Google)")
o:value("9.9.9.9", "9.9.9.9 (Quad9-Recommended)")
o:value("149.112.112.112", "149.112.112.112 (Quad9-Recommended)")
o:value("208.67.220.220", "208.67.220.220 (OpenDNS)")
o:value("208.67.222.222", "208.67.222.222 (OpenDNS)")
o:depends({dns_mode = "dns2socks"})
@ -346,7 +347,8 @@ o:value("https://1.1.1.1/dns-query", "CloudFlare")
o:value("https://1.1.1.2/dns-query", "CloudFlare-Security")
o:value("https://8.8.4.4/dns-query", "Google 8844")
o:value("https://8.8.8.8/dns-query", "Google 8888")
o:value("https://9.9.9.9/dns-query", "Quad9-Recommended")
o:value("https://9.9.9.9/dns-query", "Quad9-Recommended 9.9.9.9")
o:value("https://149.112.112.112/dns-query", "Quad9-Recommended 149.112.112.112")
o:value("https://208.67.222.222/dns-query", "OpenDNS")
o:value("https://dns.adguard.com/dns-query,176.103.130.130", "AdGuard")
o:value("https://doh.libredns.gr/dns-query,116.202.176.26", "LibreDNS")