update 2022-05-28 20:15:16
@ -10,11 +10,11 @@ include $(TOPDIR)/rules.mk
|
||||
PKG_ARCH_DDNSTO:=$(ARCH)
|
||||
|
||||
PKG_NAME:=ddnsto
|
||||
PKG_VERSION:=0.3.1
|
||||
PKG_VERSION:=0.3.3
|
||||
PKG_RELEASE:=2
|
||||
PKG_SOURCE:=$(PKG_NAME)-binary-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://fw.koolcenter.com/binary/ddnsto/
|
||||
PKG_HASH:=2f066540cad16e1ccdaad626937578bfb5c1a13479bd54f36373c479eb4b02d6
|
||||
PKG_HASH:=8a51602f8849db96d4c57dca27064ec5e68c0b7169510041500f016d354427cb
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-binary-$(PKG_VERSION)
|
||||
|
||||
@ -58,6 +58,7 @@ define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ddnsto.$(PKG_ARCH_DDNSTO) $(1)/usr/sbin/ddnsto
|
||||
$(INSTALL_CONF) ./files/ddnsto.config $(1)/etc/config/ddnsto
|
||||
$(INSTALL_BIN) ./files/ddnsto.init $(1)/etc/init.d/ddnsto
|
||||
$(INSTALL_BIN) ./files/ddnsto-monitor.sh $(1)/usr/sbin/ddnsto-monitor.sh
|
||||
$(INSTALL_BIN) ./files/ddnsto.uci-default $(1)/etc/uci-defaults/ddnsto
|
||||
endef
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-openclash
|
||||
PKG_VERSION:=0.45.16
|
||||
PKG_VERSION:=0.45.22
|
||||
PKG_RELEASE:=beta
|
||||
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>
|
||||
|
||||
@ -98,8 +98,8 @@ define Package/$(PKG_NAME)/postrm
|
||||
rm -rf /tmp/rule_providers_name >/dev/null 2>&1
|
||||
rm -rf /tmp/clash_last_version >/dev/null 2>&1
|
||||
rm -rf /usr/share/openclash/backup >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash_fake_filter.list >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash_servers_fake_filter.conf >/dev/null 2>&1
|
||||
rm -rf /tmp/dnsmasq.d/dnsmasq_openclash.conf >/dev/null 2>&1
|
||||
rm -rf /tmp/dnsmasq.d/dnsmasq_openclash_custom_domain.conf >/dev/null 2>&1
|
||||
rm -rf /tmp/dler* >/dev/null 2>&1
|
||||
rm -rf /tmp/etc/openclash >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash_edit_file_name >/dev/null 2>&1
|
||||
|
@ -185,6 +185,10 @@ local function db_foward_port()
|
||||
return uci:get("openclash", "config", "dashboard_forward_port")
|
||||
end
|
||||
|
||||
local function db_foward_ssl()
|
||||
return uci:get("openclash", "config", "dashboard_forward_ssl") or 0
|
||||
end
|
||||
|
||||
local function check_lastversion()
|
||||
luci.sys.exec("sh /usr/share/openclash/openclash_version.sh 2>/dev/null")
|
||||
return luci.sys.exec("sed -n '/^https:/,$p' /tmp/openclash_last_version 2>/dev/null")
|
||||
@ -568,7 +572,7 @@ function action_switch_config()
|
||||
end
|
||||
|
||||
function sub_info_get()
|
||||
local filename, sub_url, sub_info, info, upload, download, total, expire, http_code, len
|
||||
local filename, sub_url, sub_info, info, upload, download, total, expire, http_code, len, percent
|
||||
filename = luci.http.formvalue("filename")
|
||||
sub_info = ""
|
||||
if filename and not is_start() then
|
||||
@ -590,9 +594,12 @@ function sub_info_get()
|
||||
info = luci.sys.exec("echo '%s' |grep 'subscription-userinfo'" %info)
|
||||
upload = string.sub(string.match(info, "upload=%d+"), 8, -1) or nil
|
||||
download = string.sub(string.match(info, "download=%d+"), 10, -1) or nil
|
||||
total = fs.filesize(string.sub(string.match(info, "total=%d+"), 7, -1)) or nil
|
||||
total = string.sub(string.match(info, "total=%d+"), 7, -1) or nil
|
||||
expire = os.date("%Y-%m-%d %H:%M:%S", string.sub(string.match(info, "expire=%d+"), 8, -1)) or nil
|
||||
used = fs.filesize(upload + download) or nil
|
||||
used = (upload + download) or nil
|
||||
percent = string.format("%g",string.format("%.1f",(tonumber(used)/tonumber(total))*100)) or nil
|
||||
total = fs.filesize(total) or nil
|
||||
used = fs.filesize(used) or nil
|
||||
sub_info = "Successful"
|
||||
else
|
||||
sub_info = "No Sub Info Found"
|
||||
@ -612,6 +619,7 @@ function sub_info_get()
|
||||
sub_info = sub_info,
|
||||
used = used,
|
||||
total = total,
|
||||
percent = percent,
|
||||
expire = expire;
|
||||
})
|
||||
end
|
||||
@ -756,8 +764,8 @@ function action_toolbar_show_sys()
|
||||
mem = tonumber(luci.sys.exec(string.format("cat /proc/%s/status 2>/dev/null |grep -w VmRSS |awk '{print $2}'", pid)))
|
||||
cpu = luci.sys.exec(string.format("top -b -n1 |grep -E '%s' 2>/dev/null |grep -v grep |awk '{for (i=1;i<=NF;i++) {if ($i ~ /clash/) break; else cpu=i}}; {print $cpu}' 2>/dev/null", pid))
|
||||
if mem and cpu then
|
||||
mem = fs.filesize(mem*1024)
|
||||
cpu = string.match(cpu, "%d+")
|
||||
mem = fs.filesize(mem*1024) or "0 KB"
|
||||
cpu = string.match(cpu, "%d+") or "0"
|
||||
else
|
||||
mem = "0 KB"
|
||||
cpu = "0"
|
||||
@ -798,8 +806,8 @@ function action_toolbar_show()
|
||||
mem = tonumber(luci.sys.exec(string.format("cat /proc/%s/status 2>/dev/null |grep -w VmRSS |awk '{print $2}'", pid)))
|
||||
cpu = luci.sys.exec(string.format("top -b -n1 |grep -E '%s' 2>/dev/null |grep -v grep |awk '{for (i=1;i<=NF;i++) {if ($i ~ /clash/) break; else cpu=i}}; {print $cpu}' 2>/dev/null", pid))
|
||||
if mem and cpu then
|
||||
mem = fs.filesize(mem*1024)
|
||||
cpu = string.match(cpu, "%d+")
|
||||
mem = fs.filesize(mem*1024) or "0 KB"
|
||||
cpu = string.match(cpu, "%d+") or "0"
|
||||
else
|
||||
mem = "0 KB"
|
||||
cpu = "0"
|
||||
@ -911,6 +919,7 @@ function action_status()
|
||||
dase = dase(),
|
||||
db_foward_port = db_foward_port(),
|
||||
db_foward_domain = db_foward_domain(),
|
||||
db_forward_ssl = db_foward_ssl(),
|
||||
web = is_web(),
|
||||
cn_port = cn_port(),
|
||||
restricted_mode = restricted_mode();
|
||||
|
@ -90,7 +90,7 @@ o:value("script", translate("Script Proxy Mode (Tun Core Only)"))
|
||||
o.default = "rule"
|
||||
|
||||
o = s:taboption("op_mode", Flag, "router_self_proxy", font_red..bold_on..translate("Router-Self Proxy")..bold_off..font_off)
|
||||
o.description = font_red..bold_on..translate("Only Supported for Rule Mode, ALL Functions In Stream Enhance Tag Will Not Work After Disable")..bold_off..font_off
|
||||
o.description = translate("Only Supported for Rule Mode")..", "..font_red..bold_on..translate("ALL Functions In Stream Enhance Tag Will Not Work After Disable")..bold_off..font_off
|
||||
o.default = 1
|
||||
o:depends("proxy_mode", "rule")
|
||||
|
||||
@ -163,8 +163,8 @@ o.default = "0"
|
||||
o = s:taboption("settings", Value, "github_address_mod", font_red..bold_on..translate("Github Address Modify")..bold_off..font_off)
|
||||
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:value("0", translate("Disable"))
|
||||
o:value("https://cdn.jsdelivr.net/")
|
||||
o:value("https://fastly.jsdelivr.net/")
|
||||
o:value("https://cdn.jsdelivr.net/")
|
||||
o.default = "0"
|
||||
|
||||
o = s:taboption("settings", Value, "delay_start", translate("Delay Start (s)"))
|
||||
@ -240,6 +240,7 @@ if op_mode == "redir-host" then
|
||||
o = s:taboption("dns", Flag, "dns_remote", font_red..bold_on..translate("DNS Remote")..bold_off..font_off)
|
||||
o.description = font_red..bold_on..translate("Add DNS Remote Support For Redir-Host")..bold_off..font_off
|
||||
o.default = 1
|
||||
o:depends("enable_meta_core", 0)
|
||||
end
|
||||
|
||||
o = s:taboption("dns", Flag, "append_wan_dns", font_red..bold_on..translate("Append Upstream DNS")..bold_off..font_off)
|
||||
@ -291,17 +292,6 @@ o.description = translate("DNS Advanced Settings")..font_red..bold_on..translate
|
||||
o.default = 0
|
||||
|
||||
if op_mode == "fake-ip" then
|
||||
o = s:taboption("dns", Button, translate("Fake-IP-Filter List Update"))
|
||||
o.title = translate("Fake-IP-Filter List Update")
|
||||
o:depends("dns_advanced_setting", "1")
|
||||
o.inputtitle = translate("Check And Update")
|
||||
o.inputstyle = "reload"
|
||||
o.write = function()
|
||||
m.uci:set("openclash", "config", "enable", 1)
|
||||
m.uci:commit("openclash")
|
||||
SYS.call("rm -rf /tmp/openclash_fake_filter.list >/dev/null 2>&1 && /etc/init.d/openclash restart >/dev/null 2>&1 &")
|
||||
HTTP.redirect(DISP.build_url("admin", "services", "openclash"))
|
||||
end
|
||||
|
||||
custom_fake_black = s:taboption("dns", Value, "custom_fake_filter")
|
||||
custom_fake_black.template = "cbi/tvalue"
|
||||
@ -656,6 +646,10 @@ end
|
||||
o = s:taboption("stream_enhance", Flag, "stream_domains_prefetch", font_red..bold_on..translate("Prefetch Netflix, Disney Plus Domains")..bold_off..font_off)
|
||||
o.description = translate("Prevent Some Devices From Directly Using IP Access To Cause Unlocking Failure, Recommend Use meta Sniffer Function")
|
||||
o.default = 0
|
||||
o:depends({router_self_proxy = "1", proxy_mode = "rule"})
|
||||
o:depends("proxy_mode", "global")
|
||||
o:depends("proxy_mode", "direct")
|
||||
o:depends("proxy_mode", "script")
|
||||
|
||||
o = s:taboption("stream_enhance", Value, "stream_domains_prefetch_interval", translate("Domains Prefetch Interval(min)"))
|
||||
o.default = "1440"
|
||||
@ -670,6 +664,10 @@ o.template = "openclash/download_stream_domains"
|
||||
o = s:taboption("stream_enhance", Flag, "stream_auto_select", font_red..bold_on..translate("Auto Select Unlock Proxy")..bold_off..font_off)
|
||||
o.description = translate("Auto Select Proxy For Streaming Unlock, Support Netflix, Disney Plus, HBO And YouTube Premium, etc")
|
||||
o.default = 0
|
||||
o:depends({router_self_proxy = "1", proxy_mode = "rule"})
|
||||
o:depends("proxy_mode", "global")
|
||||
o:depends("proxy_mode", "direct")
|
||||
o:depends("proxy_mode", "script")
|
||||
|
||||
o = s:taboption("stream_enhance", Value, "stream_auto_select_interval", translate("Auto Select Interval(min)"))
|
||||
o.default = "30"
|
||||
@ -1020,6 +1018,7 @@ end
|
||||
o = s:taboption("geo_update", Flag, "geo_auto_update", translate("Auto Update"))
|
||||
o.description = translate("Auto Update GEOIP Database")
|
||||
o.default = 0
|
||||
o:depends("enable_geoip_dat", 0)
|
||||
|
||||
o = s:taboption("geo_update", ListValue, "geo_update_week_time", translate("Update Time (Every Week)"))
|
||||
o:value("*", translate("Every Day"))
|
||||
@ -1031,22 +1030,25 @@ o:value("5", translate("Every Friday"))
|
||||
o:value("6", translate("Every Saturday"))
|
||||
o:value("0", translate("Every Sunday"))
|
||||
o.default = "1"
|
||||
o:depends("enable_geoip_dat", 0)
|
||||
|
||||
o = s:taboption("geo_update", ListValue, "geo_update_day_time", translate("Update time (every day)"))
|
||||
for t = 0,23 do
|
||||
o:value(t, t..":00")
|
||||
end
|
||||
o.default = "0"
|
||||
o:depends("enable_geoip_dat", 0)
|
||||
|
||||
o = s:taboption("geo_update", Value, "geo_custom_url")
|
||||
o.title = translate("Custom GEOIP URL")
|
||||
o.rmempty = false
|
||||
o.rmempty = true
|
||||
o.description = translate("Custom GEOIP Data URL, Click Button Below To Refresh After Edit")
|
||||
o:value("https://cdn.jsdelivr.net/gh/alecthw/mmdb_china_ip_list@release/lite/Country.mmdb", translate("Alecthw-lite-Version")..translate("(Default mmdb)"))
|
||||
o:value("https://cdn.jsdelivr.net/gh/alecthw/mmdb_china_ip_list@release/Country.mmdb", translate("Alecthw-Version")..translate("(All Info mmdb)"))
|
||||
o:value("https://cdn.jsdelivr.net/gh/Hackl0us/GeoIP2-CN@release/Country.mmdb", translate("Hackl0us-Version")..translate("(Only CN)"))
|
||||
o:value("https://geolite.clash.dev/Country.mmdb", translate("Geolite.clash.dev"))
|
||||
o.default = "http://www.ideame.top/mmdb/Country.mmdb"
|
||||
o:depends("enable_geoip_dat", 0)
|
||||
|
||||
o = s:taboption("geo_update", Button, translate("GEOIP Update"))
|
||||
o.title = translate("Update GEOIP Database")
|
||||
@ -1058,6 +1060,7 @@ o.write = function()
|
||||
SYS.call("/usr/share/openclash/openclash_ipdb.sh >/dev/null 2>&1 &")
|
||||
HTTP.redirect(DISP.build_url("admin", "services", "openclash"))
|
||||
end
|
||||
o:depends("enable_geoip_dat", 0)
|
||||
|
||||
o = s:taboption("chnr_update", Flag, "chnr_auto_update", translate("Auto Update"))
|
||||
o.description = translate("Auto Update Chnroute Lists")
|
||||
@ -1135,7 +1138,7 @@ o.title = translate("Dashboard Port")
|
||||
o.default = "9090"
|
||||
o.datatype = "port"
|
||||
o.rmempty = false
|
||||
o.description = translate("Dashboard Address Example:").." "..font_green..bold_on..lan_ip.."/luci-static/openclash、"..lan_ip..':'..cn_port..'/ui'..bold_off..font_off
|
||||
o.description = translate("Dashboard Address Example:").." "..font_green..bold_on..lan_ip..':'..cn_port..'/ui/yacd'..'、'..lan_ip..':'..cn_port..'/ui/dashboard'..bold_off..font_off
|
||||
|
||||
o = s:taboption("dashboard", Value, "dashboard_password")
|
||||
o.title = translate("Dashboard Secret")
|
||||
@ -1155,6 +1158,11 @@ o.datatype = "port"
|
||||
o.rmempty = true
|
||||
o.description = translate("Port For Dashboard Login From Public Network")
|
||||
|
||||
o = s:taboption("dashboard", Flag, "dashboard_forward_ssl")
|
||||
o.title = translate("Public Dashboard SSL enabled")
|
||||
o.default = 0
|
||||
o.description = translate("Is SSL enabled For Dashboard Login From Public Network")
|
||||
|
||||
---- version update
|
||||
core_update = s:taboption("version_update", DummyValue, "", nil)
|
||||
core_update.template = "openclash/update"
|
||||
|
@ -63,7 +63,7 @@ local diag_host = "www.instagram.com"
|
||||
|
||||
img.onerror = () => {
|
||||
clearTimeout(timeout);
|
||||
show_diag_info(addr);
|
||||
show_diag_info(addr);
|
||||
}
|
||||
|
||||
img.onload = () => {
|
||||
@ -77,7 +77,7 @@ local diag_host = "www.instagram.com"
|
||||
HTTP.checker(addr);
|
||||
}
|
||||
};
|
||||
HTTP.runcheck();
|
||||
HTTP.runcheck();
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,7 +70,7 @@
|
||||
<b><%:Tip: after started, please wait patiently until the connection is normal%></b>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td width="25%"><%:Main Program%></td><td width="25%" align="left"><span id="_clash"><%:Collecting data...%></span><span id="_watchdog">></span></td><td width="25%"><%:Control Panel Login IP%></td><td width="25%" align="left" id="_daip"><%:Collecting data...%></td></tr>
|
||||
<tr><td width="25%"><%:Main Program%></td><td width="25%" align="left"><span id="_clash"><%:Collecting data...%></span><span id="_watchdog"></span></td><td width="25%"><%:Control Panel Login IP%></td><td width="25%" align="left" id="_daip"><%:Collecting data...%></td></tr>
|
||||
<tr><td width="20%"><%:Running Mode%></td><td width="30%" align="left"><span id="_mode"><%:Collecting data...%></span><span id="radio-ru-mode" class="radio-button">
|
||||
<input type="radio" id="normal" name="radios-ru" value="" checked onclick="return switch_run_mode(this.value)"/>
|
||||
<label for="normal" id="run_normal"><%:Compatible%></label>
|
||||
@ -577,9 +577,12 @@
|
||||
else if (status.cpu >= 50 && status.cpu <= 80) {
|
||||
document.getElementById("cpu_t").innerHTML = "<font style=\"color:orange\">"+status.cpu+" %</font>";
|
||||
}
|
||||
else {
|
||||
else if (status.cpu <= 100) {
|
||||
document.getElementById("cpu_t").innerHTML = "<font style=\"color:red\">"+status.cpu+" %</font>";
|
||||
}
|
||||
else {
|
||||
document.getElementById("cpu_t").innerHTML = "<font style=\"color:green\">0 %</font>";
|
||||
}
|
||||
}
|
||||
else {
|
||||
document.getElementById("upload_").innerHTML = "<font style=\"color:green\">0 B/S</font>";
|
||||
@ -603,9 +606,12 @@
|
||||
else if (status.cpu >= 50 && status.cpu <= 80) {
|
||||
document.getElementById("cpu_t").innerHTML = "<font style=\"color:orange\">"+status.cpu+" %</font>";
|
||||
}
|
||||
else {
|
||||
else if (status.cpu <= 100) {
|
||||
document.getElementById("cpu_t").innerHTML = "<font style=\"color:red\">"+status.cpu+" %</font>";
|
||||
}
|
||||
else {
|
||||
document.getElementById("cpu_t").innerHTML = "<font style=\"color:green\">0 %</font>";
|
||||
}
|
||||
}
|
||||
else {
|
||||
document.getElementById("mem_t").innerHTML = "<font style=\"color:green\">0 KB</font>";
|
||||
@ -801,13 +807,14 @@
|
||||
btn.disabled = true;
|
||||
btn.value = '<%:Open Panel%>';
|
||||
if (status.daip && window.location.hostname == status.daip) {
|
||||
url1='<%="http://'+window.location.hostname+':'+window.location.port+'/luci-static/openclash?hostname='+ window.location.hostname + '&port=' + status.cn_port + '&secret=' + status.dase +'"%>';
|
||||
url1='<%="http://'+window.location.hostname+':'+status.cn_port+'/ui/yacd/?hostname='+ window.location.hostname + '&port=' + status.cn_port + '&secret=' + status.dase +'"%>';
|
||||
}
|
||||
else if (status.daip && window.location.hostname != status.daip && status.db_foward_domain && status.db_foward_port) {
|
||||
url1='<%="http://'+window.location.hostname+':'+window.location.port+'/luci-static/openclash?hostname='+ status.db_foward_domain + '&port=' + status.db_foward_port + '&secret=' + status.dase +'"%>';
|
||||
var ui_proto = status.db_forward_ssl == 0 ? 'http://' : 'https://';
|
||||
url1='<%="'+ui_proto+window.location.hostname+':'+status.cn_port+'/ui/yacd/?hostname='+ status.db_foward_domain + '&port=' + status.db_foward_port + '&secret=' + status.dase +'"%>';
|
||||
}
|
||||
else {
|
||||
url1='<%="http://'+window.location.hostname+':'+window.location.port+'/luci-static/openclash"%>';
|
||||
url1='<%="http://'+window.location.hostname+':'+status.cn_port+'/ui/yacd/"%>';
|
||||
}
|
||||
winOpen(url1);
|
||||
return false;
|
||||
@ -820,13 +827,14 @@
|
||||
btn.disabled = true;
|
||||
btn.value = '<%:Open Panel%>';
|
||||
if (status.daip && window.location.hostname == status.daip) {
|
||||
url2='<%="http://'+window.location.hostname+':'+status.cn_port+'/ui/#/?host='+ window.location.hostname + '&port=' + status.cn_port + '&secret=' + status.dase +'"%>';
|
||||
url2='<%="http://'+window.location.hostname+':'+status.cn_port+'/ui/dashboard/#/?host='+ window.location.hostname + '&port=' + status.cn_port + '&secret=' + status.dase +'"%>';
|
||||
}
|
||||
else if (status.daip && window.location.hostname != status.daip && status.db_foward_domain && status.db_foward_port) {
|
||||
url2='<%="http://'+status.db_foward_domain+':'+status.db_foward_port+'/ui/#/?host='+ status.db_foward_domain + '&port=' + status.db_foward_port + '&secret=' + status.dase +'"%>';
|
||||
var ui_proto = status.db_forward_ssl == 0 ? 'http://' : 'https://';
|
||||
url2='<%="'+ui_proto+status.db_foward_domain+':'+status.db_foward_port+'/ui/dashboard/#/?host='+ status.db_foward_domain + '&port=' + status.db_foward_port + '&secret=' + status.dase +'"%>';
|
||||
}
|
||||
else {
|
||||
url2='<%="http://'+window.location.hostname+':'+status.cn_port+'/ui/"%>';
|
||||
url2='<%="http://'+window.location.hostname+':'+status.cn_port+'/ui/dashboard/"%>';
|
||||
}
|
||||
winOpen(url2);
|
||||
return false;
|
||||
|
@ -4,8 +4,7 @@
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
font-size: 12px;
|
||||
text-align: left;
|
||||
margin-top: 5px;
|
||||
margin: 0 auto;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
@ -13,8 +12,7 @@
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
font-size: 12px;
|
||||
margin-top: 5px;
|
||||
text-align: left;
|
||||
margin: 0 auto;
|
||||
-webkit-transition: all 1.5s;
|
||||
-moz-transition: all 1.5s;
|
||||
-ms-transition: all 1.5s;
|
||||
@ -40,6 +38,19 @@ var retry_<%=idname%> = 0;
|
||||
var s_<%=idname%>;
|
||||
sub_info_get_<%=idname%>();
|
||||
|
||||
function progressbar_<%=idname%>(v, m, pc, np, f, t) {
|
||||
return String.format(
|
||||
'<div style="width:200px; max-width:500px; position:relative; border:1px solid #999999; border-radius: 6px">' +
|
||||
(pc <= 50 ? '<div style="background-color:#9edd9e; width:%d%%; height:35px; border-radius: 6px">' : (pc > 50 && pc <= 80 ? '<div style="background-color:#fffa9f; width:%d%%; height:35px">' : '<div style="background-color:#ffb9b9; width:%d%%; height:35px">')) +
|
||||
'<div style="position:absolute; left:0; top:0; text-align:center; width:100%%">' +
|
||||
'<small>%s '+(f ? f : '/')+' %s ' + (np ? "" : '(%d%%)') + '<br/>' + '%s</small>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>', pc, v, m, pc, t
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
function sub_info_get_<%=idname%>()
|
||||
{
|
||||
|
||||
@ -50,7 +61,8 @@ function sub_info_get_<%=idname%>()
|
||||
document.getElementById('<%=idname%>').innerHTML = "<span><%:No Sub Info Found%></span>";
|
||||
}
|
||||
else {
|
||||
document.getElementById('<%=idname%>').innerHTML = "<%:Plan Traffic%>" + ": " + "<span style=color:green>" + save_info.used + "</span> | <span style=color:green>" + save_info.total + "</span> <br/> <%:Plan Expiration Time%>: " + "<span style=color:green>" + save_info.expire + "</span>";
|
||||
//document.getElementById('<%=idname%>').innerHTML = "<%:Plan Traffic%>" + ": " + "<span style=color:green>" + save_info.used + "</span> | <span style=color:green>" + save_info.total + "</span> <br/> <%:Plan Expiration Time%>: " + "<span style=color:green>" + save_info.expire + "</span>";
|
||||
document.getElementById('<%=idname%>').innerHTML = progressbar_<%=idname%>((save_info.used), (save_info.total), (save_info.percent ? save_info.percent : 0), false, false, (save_info.expire));
|
||||
}
|
||||
};
|
||||
|
||||
@ -61,7 +73,8 @@ function sub_info_get_<%=idname%>()
|
||||
retry_<%=idname%> = 0;
|
||||
localStorage.setItem("<%=filename%>",JSON.stringify(status));
|
||||
document.getElementById('<%=idname%>').className = "sub_tab_show";
|
||||
document.getElementById('<%=idname%>').innerHTML = "<%:Plan Traffic%>" + ": " + "<span style=color:green>" + status.used + "</span> | <span style=color:green>" + status.total + "</span> <br/> <%:Plan Expiration Time%>: " + "<span style=color:green>" + status.expire + "</span>";
|
||||
document.getElementById('<%=idname%>').innerHTML = progressbar_<%=idname%>((status.used), (status.total), (status.percent), false, false, (status.expire));
|
||||
//document.getElementById('<%=idname%>').innerHTML = "<%:Plan Traffic%>" + ": " + "<span style=color:green>" + status.used + "</span> | <span style=color:green>" + status.total + "</span> <br/> <%:Plan Expiration Time%>: " + "<span style=color:green>" + status.expire + "</span>";
|
||||
}
|
||||
else if ( x && x.status == 200 && status.sub_info == "No Sub Info Found" ) {
|
||||
retry_<%=idname%> = 0;
|
||||
|
@ -249,9 +249,6 @@ msgstr "每行请只填写一个域名,列表中的域名将使用上方指定
|
||||
msgid "Domain Names In The List Use The Custom DNS Server, But Still Return Fake-IP Results, One rule per line"
|
||||
msgstr "每行请只填写一个规则,列表中的域名将使用指定的 DNS 进行查询,但 Fake-IP 模式下仍将返回保留地址"
|
||||
|
||||
msgid "Fake-IP-Filter List Update"
|
||||
msgstr "更新 Fake-IP 域名黑名单"
|
||||
|
||||
msgid "Set OpenClash Upstream DNS Resolve Server"
|
||||
msgstr "启用将覆盖配置文件内的设置,请先在下方配置好服务器"
|
||||
|
||||
@ -429,6 +426,12 @@ msgstr "管理页面映射端口"
|
||||
msgid "Port For Dashboard Login From Public Network"
|
||||
msgstr "设置映射端口,便于从公网访问时自动登录"
|
||||
|
||||
msgid "Public Dashboard SSL enabled"
|
||||
msgstr "管理页面公网SSL访问"
|
||||
|
||||
msgid "Is SSL enabled For Dashboard Login From Public Network"
|
||||
msgstr "设置公网协议是否开启了SSL,便于从公网访问时自动登录"
|
||||
|
||||
msgid "GEO Update"
|
||||
msgstr "GEO 数据库订阅"
|
||||
|
||||
@ -1855,9 +1858,6 @@ msgstr "的信息读取失败,无法进行修改,请选择一键创建配置
|
||||
msgid "Setting Secondary DNS Server List..."
|
||||
msgstr "正在设置第二 DNS 服务器列表..."
|
||||
|
||||
msgid "Setting Fake IP Filter..."
|
||||
msgstr "正在设置 Fake-IP 黑名单..."
|
||||
|
||||
msgid "Deleting"
|
||||
msgstr "删除"
|
||||
|
||||
@ -1993,17 +1993,14 @@ msgstr "第五步: 检查内核启动状态..."
|
||||
msgid "Step 6: Wait For The File Downloading..."
|
||||
msgstr "第六步: 等待主程序下载外部文件..."
|
||||
|
||||
msgid "Step 7: Set Control Panel..."
|
||||
msgstr "第七步: 设置控制面板..."
|
||||
msgid "Step 7: Set Firewall Rules..."
|
||||
msgstr "第七步: 设置防火墙规则..."
|
||||
|
||||
msgid "Step 8: Set Firewall Rules..."
|
||||
msgstr "第八步: 设置防火墙规则..."
|
||||
msgid "Step 8: Restart Dnsmasq..."
|
||||
msgstr "第八步: 重启 Dnsmasq 程序..."
|
||||
|
||||
msgid "Step 9: Restart Dnsmasq..."
|
||||
msgstr "第九步: 重启 Dnsmasq 程序..."
|
||||
|
||||
msgid "Step 10: Add Cron Rules, Start Daemons..."
|
||||
msgstr "第十步: 添加计划任务,启动进程守护程序..."
|
||||
msgid "Step 9: Add Cron Rules, Start Daemons..."
|
||||
msgstr "第九步: 添加计划任务,启动进程守护程序..."
|
||||
|
||||
msgid "OpenClash Start Successful!"
|
||||
msgstr "OpenClash 启动成功,请等待服务器上线!"
|
||||
@ -2801,10 +2798,13 @@ msgid "Sub Info Get Error"
|
||||
msgstr "订阅信息获取失败"
|
||||
|
||||
msgid "Router-Self Proxy"
|
||||
msgstr "路由本机代理"
|
||||
msgstr "*路由本机代理"
|
||||
|
||||
msgid "Only Supported for Rule Mode, ALL Functions In Stream Enhance Tag Will Not Work After Disable"
|
||||
msgstr "仅支持规则(Rule)模式,其他模式默认分流,禁用后将无法使用流媒体增强标签中的所有功能"
|
||||
msgid "Only Supported for Rule Mode"
|
||||
msgstr "仅支持规则(Rule)模式,其他模式默认分流"
|
||||
|
||||
msgid "ALL Functions In Stream Enhance Tag Will Not Work After Disable"
|
||||
msgstr "禁用后将无法使用流媒体增强标签中的所有功能"
|
||||
|
||||
msgid "Error: Set Router Self Proxy Rule Failed,"
|
||||
msgstr "错误:修改路由自身代理规则失败,"
|
||||
|
@ -13,6 +13,7 @@ config openclash 'config'
|
||||
option auto_update_time '0'
|
||||
option cn_port '9090'
|
||||
option dashboard_password '123456'
|
||||
option dashboard_forward_ssl '0'
|
||||
option rule_source '0'
|
||||
option enable_custom_dns '0'
|
||||
option ipv6_enable '0'
|
||||
@ -54,9 +55,9 @@ config openclash 'config'
|
||||
option router_self_proxy '1'
|
||||
option release_branch 'master'
|
||||
option enable_meta_core '0'
|
||||
option geo_custom_url 'https://cdn.jsdelivr.net/gh/alecthw/mmdb_china_ip_list@release/lite/Country.mmdb'
|
||||
option geosite_custom_url 'https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat'
|
||||
option geoip_custom_url 'https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat'
|
||||
option geo_custom_url 'https://fastly.jsdelivr.net/gh/alecthw/mmdb_china_ip_list@release/lite/Country.mmdb'
|
||||
option geosite_custom_url 'https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat'
|
||||
option geoip_custom_url 'https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat'
|
||||
option chnr_custom_url 'https://ispip.clang.cn/all_cn.txt'
|
||||
option chnr6_custom_url 'https://ispip.clang.cn/all_cn_ipv6.txt'
|
||||
|
||||
|
@ -118,7 +118,7 @@ change_dns() {
|
||||
|
||||
if [ "$ipv6_dns" == 1 ] && [ -n "$(ip6tables -t mangle -L 2>&1 | grep -o 'Chain')" ]; then
|
||||
#dnsmasq answer ipv6
|
||||
uci -q set openclash.config.dnsmasq_filter_aaaa="$(uci -q get dhcp.@dnsmasq[0].filter_aaaa)"
|
||||
uci -q set openclash.config.dnsmasq_filter_aaaa="$(uci -q get dhcp.@dnsmasq[0].filter_aaaa)"
|
||||
uci -q set dhcp.@dnsmasq[0].filter_aaaa=0
|
||||
uci -q set openclash.config.filter_aaaa_dns=1
|
||||
else
|
||||
@ -127,8 +127,6 @@ change_dns() {
|
||||
|
||||
uci -q commit dhcp
|
||||
uci -q commit openclash
|
||||
|
||||
/usr/share/openclash/openclash_custom_domain_dns.sh >/dev/null 2>&1
|
||||
}
|
||||
|
||||
revert_dns() {
|
||||
@ -366,7 +364,7 @@ yml_other_rules_get()
|
||||
check_run_quick()
|
||||
{
|
||||
quick_start=true
|
||||
check_file="$RAW_CONFIG_FILE /etc/openclash/custom/openclash_custom_domain_dns.list /etc/openclash/custom/openclash_custom_domain_dns_policy.list /etc/openclash/custom/openclash_custom_fake_filter.list /etc/openclash/custom/openclash_custom_fallback_filter.yaml /etc/openclash/custom/openclash_custom_hosts.list /etc/openclash/custom/openclash_custom_rules.list /etc/openclash/custom/openclash_custom_rules_2.list $dev_core_path $tun_core_path $meta_core_path $ipdb_path $geosite_path $geoip_path $chnr_path $chnr6_path /usr/share/openclash/res/ConnersHua.yaml /usr/share/openclash/res/ConnersHua_return.yaml /usr/share/openclash/res/lhie1.yaml /usr/share/openclash/res/openclash_version /tmp/openclash_fake_filter.list /etc/openclash/custom/openclash_force_sniffing_domain.list /etc/openclash/custom/openclash_sniffing_domain_filter.list /etc/openclash/custom/openclash_sniffing_port_filter.yaml"
|
||||
check_file="$RAW_CONFIG_FILE /etc/openclash/custom/openclash_custom_domain_dns.list /etc/openclash/custom/openclash_custom_domain_dns_policy.list /etc/openclash/custom/openclash_custom_fake_filter.list /etc/openclash/custom/openclash_custom_fallback_filter.yaml /etc/openclash/custom/openclash_custom_hosts.list /etc/openclash/custom/openclash_custom_rules.list /etc/openclash/custom/openclash_custom_rules_2.list $dev_core_path $tun_core_path $meta_core_path $ipdb_path $geosite_path $geoip_path $chnr_path $chnr6_path /usr/share/openclash/res/ConnersHua.yaml /usr/share/openclash/res/ConnersHua_return.yaml /usr/share/openclash/res/lhie1.yaml /usr/share/openclash/res/openclash_version /etc/openclash/custom/openclash_force_sniffing_domain.list /etc/openclash/custom/openclash_sniffing_domain_filter.list /etc/openclash/custom/openclash_sniffing_port_filter.yaml"
|
||||
if [ ! -f "$CONFIG_FILE" ] || [ ! -f "/tmp/openclash_config.tmp" ] || [ ! -f "/tmp/openclash.change" ]; then
|
||||
quick_start=false
|
||||
return
|
||||
@ -589,17 +587,6 @@ do_run_file()
|
||||
[ ! -x "$tun_core_path" ] && chmod 4755 "$tun_core_path" 2>/dev/null
|
||||
[ ! -x "$dev_core_path" ] && chmod 4755 "$dev_core_path" 2>/dev/null
|
||||
[ ! -x "$meta_core_path" ] && chmod 4755 "$meta_core_path" 2>/dev/null
|
||||
|
||||
#fake_ip_filter
|
||||
if [ "$3" = "fake-ip" ]; then
|
||||
if [ ! -f "/tmp/openclash_fake_filter.list" ] || [ -n "$(grep "config servers" /etc/config/openclash 2>/dev/null)" ]; then
|
||||
/usr/share/openclash/openclash_fake_filter.sh
|
||||
fi
|
||||
if [ -s "/tmp/openclash_servers_fake_filter.conf" ]; then
|
||||
mkdir -p /tmp/dnsmasq.d
|
||||
cp /tmp/openclash_servers_fake_filter.conf /tmp/dnsmasq.d/dnsmasq_openclash.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
[ -f "$ipdb_path" ] && [ "$small_flash_memory" = "1" ] && {
|
||||
ln -s "$ipdb_path" /etc/openclash/Country.mmdb 2>/dev/null
|
||||
@ -1115,13 +1102,11 @@ fi
|
||||
ipset create localnetwork hash:net
|
||||
ipset add localnetwork 0.0.0.0/8
|
||||
ipset add localnetwork 127.0.0.0/8
|
||||
ipset add localnetwork 10.0.0.0/8
|
||||
ipset add localnetwork 169.254.0.0/16
|
||||
ipset add localnetwork 192.168.0.0/16
|
||||
ipset add localnetwork 224.0.0.0/4
|
||||
ipset add localnetwork 240.0.0.0/4
|
||||
ipset add localnetwork 169.254.0.0/16
|
||||
ipset add localnetwork 172.16.0.0/12
|
||||
ipset add localnetwork 100.64.0.0/10
|
||||
ipset add localnetwork 240.0.0.0/4
|
||||
|
||||
if [ -n "$lan_ip_cidrs" ]; then
|
||||
for lan_ip_cidr in $lan_ip_cidrs; do
|
||||
@ -1287,7 +1272,6 @@ if [ -n "$en_mode_tun" ]; then
|
||||
if [ "$en_mode" = "fake-ip" ]; then
|
||||
iptables -t mangle -N openclash_output
|
||||
iptables -t mangle -F openclash_output
|
||||
iptables -t mangle -A openclash_output -i utun -j RETURN >/dev/null 2>&1
|
||||
iptables -t mangle -A openclash_output -m set --match-set localnetwork dst -j RETURN
|
||||
if [ "$en_mode_tun" -eq 1 ]; then
|
||||
if [ -z "$_koolshare" ]; then
|
||||
@ -1320,7 +1304,6 @@ if [ -n "$en_mode_tun" ]; then
|
||||
iptables -t mangle -N openclash_dns_hijack
|
||||
iptables -t mangle -F openclash_dns_hijack
|
||||
#其他流量
|
||||
iptables -t mangle -A openclash -i utun -j RETURN >/dev/null 2>&1
|
||||
iptables -t mangle -A openclash -m set --match-set localnetwork dst -j RETURN >/dev/null 2>&1
|
||||
iptables -t mangle -A openclash -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1
|
||||
iptables -t mangle -A openclash -m set --match-set lan_ac_black_ips src -j RETURN >/dev/null 2>&1
|
||||
@ -1382,6 +1365,12 @@ if [ "$ipv6_enable" -eq 1 ] && [ -n "$(ip6tables -t mangle -L 2>&1 | grep -o 'Ch
|
||||
ipset add localnetwork6 fe80::/10
|
||||
ipset add localnetwork6 ff00::/8
|
||||
|
||||
if [ -n "$lan_ip6_cidrs" ]; then
|
||||
for lan_ip6_cidr in $lan_ip6_cidrs; do
|
||||
ipset add localnetwork6 "$lan_ip6_cidr" 2>/dev/null
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "$wan_ip6s" ]; then
|
||||
for wan_ip6 in $wan_ip6s; do
|
||||
ipset add localnetwork6 "$wan_ip6"
|
||||
@ -1410,7 +1399,7 @@ if [ "$ipv6_enable" -eq 1 ] && [ -n "$(ip6tables -t mangle -L 2>&1 | grep -o 'Ch
|
||||
if [ "$china_ip6_route" = "1" ]; then
|
||||
ip6tables -t mangle -A openclash -m set --match-set china_ip6_route dst -j RETURN >/dev/null 2>&1
|
||||
fi
|
||||
ip6tables -t mangle -A openclash -p tcp -m comment --comment "OpenClash TCP Mark" -j TPROXY --on-port "$tproxy_port" --tproxy-mark "$PROXY_FWMARK"
|
||||
ip6tables -t mangle -A openclash -p tcp -m comment --comment "OpenClash TCP Tproxy" -j TPROXY --on-port "$tproxy_port" --tproxy-mark "$PROXY_FWMARK"
|
||||
ip6tables -t mangle -A PREROUTING -j openclash
|
||||
|
||||
if [ -z "$_koolshare" ]; then
|
||||
@ -1429,7 +1418,7 @@ if [ "$ipv6_enable" -eq 1 ] && [ -n "$(ip6tables -t mangle -L 2>&1 | grep -o 'Ch
|
||||
#udp
|
||||
if [ "$enable_udp_proxy" -eq 1 ] || [ -n "$en_mode_tun" ]; then
|
||||
ip6tables -t mangle -A openclash_output -p udp -m owner ! --uid-owner 65534 -j MARK --set-xmark "$PROXY_FWMARK"
|
||||
ip6tables -t mangle -A openclash -p udp -m comment --comment "OpenClash" -j TPROXY --on-port "$tproxy_port" --tproxy-mark "$PROXY_FWMARK"
|
||||
ip6tables -t mangle -A openclash -p udp -m comment --comment "OpenClash TCP Tproxy" -j TPROXY --on-port "$tproxy_port" --tproxy-mark "$PROXY_FWMARK"
|
||||
fi
|
||||
|
||||
#quic
|
||||
@ -1543,6 +1532,7 @@ get_config()
|
||||
enable_redirect_dns=$(uci -q get openclash.config.enable_redirect_dns)
|
||||
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) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
|
||||
lan_ip_cidrs=$(ip route | grep "/" | awk '{print $1}' | grep -vE "^198.18" 2>/dev/null)
|
||||
lan_ip6_cidrs=$(ip -6 route | grep "/" | awk '{print $1}' | grep -vE "^unreachable" 2>/dev/null)
|
||||
wan_ip4s=$(ifconfig | grep 'inet addr' | awk '{print $2}' | cut -d: -f2 | grep -vE "(^198.18|^192.168|^127.0)" 2>/dev/null)
|
||||
wan_ip6s=$(ifconfig | grep 'inet6 addr' | awk '{print $3}' 2>/dev/null)
|
||||
disable_masq_cache=$(uci -q get openclash.config.disable_masq_cache)
|
||||
@ -1563,7 +1553,7 @@ get_config()
|
||||
dns_port=$(uci -q get openclash.config.dns_port)
|
||||
stream_domains_prefetch=$(uci -q get openclash.config.stream_domains_prefetch || echo 0)
|
||||
store_fakeip=$(uci -q get openclash.config.store_fakeip || echo 1)
|
||||
dns_remote=$(uci -q get openclash.config.dns_remote || echo 1)
|
||||
dns_remote=$(uci -q get openclash.config.dns_remote || echo 0)
|
||||
bypass_gateway_compatible=$(uci -q get openclash.config.bypass_gateway_compatible || echo 0)
|
||||
core_version=$(uci -q get openclash.config.core_version || echo 0)
|
||||
router_self_proxy=$(uci -q get openclash.config.router_self_proxy || echo 1)
|
||||
@ -1593,7 +1583,7 @@ start()
|
||||
|
||||
LOG_OUT "Step 2: Check The Components..."
|
||||
#检查文件是否存在
|
||||
do_run_file "$RAW_CONFIG_FILE" "$BACKUP_FILE" "$en_mode"
|
||||
do_run_file "$RAW_CONFIG_FILE" "$BACKUP_FILE"
|
||||
|
||||
#快速启动判断
|
||||
check_run_quick
|
||||
@ -1603,6 +1593,8 @@ start()
|
||||
config_check
|
||||
/usr/share/openclash/yml_change.sh 2>/dev/null "$en_mode" "$da_password" "$cn_port" "$proxy_port" "$TMP_CONFIG_FILE" "$ipv6_enable" "$http_port" "$socks_port" "$log_level" "$proxy_mode" "$en_mode_tun" "$stack_type" "$dns_port" "$mixed_port" "$tproxy_port" "$ipv6_dns" "$store_fakeip" "$stream_domains_prefetch" "$dns_remote" "$enable_meta_core" "$enable_meta_sniffer" "$enable_geoip_dat" "$geodata_loader" "$enable_meta_sniffer_custom" "$interface_name" "$enable_tcp_concurrent"
|
||||
/usr/share/openclash/yml_rules_change.sh 2>/dev/null "$rule_source" "$enable_custom_clash_rules" "$TMP_CONFIG_FILE" "$enable_rule_proxy" "$CONFIG_NAME" "$router_self_proxy" "$lan_ip" "$proxy_port" "$tproxy_port"
|
||||
/usr/share/openclash/openclash_server_fake_filter.sh >/dev/null 2>&1
|
||||
/usr/share/openclash/openclash_custom_domain_dns.sh >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
LOG_OUT "Step 4: Start Running The Clash Core..."
|
||||
@ -1613,21 +1605,20 @@ start()
|
||||
|
||||
#检测proxy_provider配置文件状态
|
||||
LOG_OUT "Step 6: Wait For The File Downloading..."
|
||||
yml_provider_check "$CONFIG_FILE" "proxy-providers" "proxies"
|
||||
yml_provider_check "$CONFIG_FILE" "rule-providers" "payload"
|
||||
if [ "$enable_meta_core" != "1" ]; then
|
||||
yml_provider_check "$CONFIG_FILE" "proxy-providers" "proxies"
|
||||
yml_provider_check "$CONFIG_FILE" "rule-providers" "payload"
|
||||
fi
|
||||
try_restore_start
|
||||
|
||||
LOG_OUT "Step 7: Set Control Panel..."
|
||||
ln -s /usr/share/openclash/yacd /www/luci-static/openclash 2>/dev/null
|
||||
|
||||
LOG_OUT "Step 8: Set Firewall Rules..."
|
||||
LOG_OUT "Step 7: Set Firewall Rules..."
|
||||
set_firewall
|
||||
|
||||
LOG_OUT "Step 9: Restart Dnsmasq..."
|
||||
LOG_OUT "Step 8: Restart Dnsmasq..."
|
||||
change_dns "$enable_redirect_dns" "$disable_masq_cache"
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||
|
||||
LOG_OUT "Step 10: Add Cron Rules, Start Daemons..."
|
||||
LOG_OUT "Step 9: Add Cron Rules, Start Daemons..."
|
||||
add_cron
|
||||
if [ "$(uci -q get openclash.config.restricted_mode)" != "1" ]; then
|
||||
if [ -z "$(uci -q get dhcp.lan.dhcpv6)" ] || [ "$(uci -q get dhcp.lan.dhcpv6)" == "disabled" ]; then
|
||||
@ -1693,13 +1684,12 @@ stop()
|
||||
|
||||
LOG_OUT "Step 6: Delete OpenClash Residue File..."
|
||||
if [ "$enable" != "1" ]; then
|
||||
rm -rf /www/luci-static/openclash >/dev/null 2>&1
|
||||
rm -rf /tmp/clash_last_version >/dev/null 2>&1
|
||||
rm -rf /tmp/Proxy_Group >/dev/null 2>&1
|
||||
rm -rf /tmp/rules_name >/dev/null 2>&1
|
||||
rm -rf /tmp/rule_providers_name >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash_fake_filter.list >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash_servers_fake_filter.conf >/dev/null 2>&1
|
||||
rm -rf /tmp/dnsmasq.d/dnsmasq_openclash.conf >/dev/null 2>&1
|
||||
rm -rf /tmp/dnsmasq.d/dnsmasq_openclash_custom_domain.conf >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash_last_version >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash_config.tmp >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash.change >/dev/null 2>&1
|
||||
@ -1754,4 +1744,4 @@ boot()
|
||||
sleep "$delay_start"
|
||||
fi
|
||||
restart
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ time.*.com
|
||||
time.*.gov
|
||||
time.*.edu.cn
|
||||
time.*.apple.com
|
||||
time-ios.apple.com
|
||||
time1.*.com
|
||||
time2.*.com
|
||||
time3.*.com
|
||||
|
@ -5,10 +5,8 @@ en_mode=$(uci get openclash.config.en_mode 2>/dev/null)
|
||||
|
||||
if pidof clash >/dev/null && [ -z "$(echo "$en_mode" |grep "redir-host")" ]; then
|
||||
rm -rf /tmp/dnsmasq.d/dnsmasq_openclash.conf >/dev/null 2>&1
|
||||
/usr/share/openclash/openclash_fake_filter.sh
|
||||
if [ -s "/etc/openclash/servers_fake_filter.conf" ]; then
|
||||
mkdir -p /tmp/dnsmasq.d
|
||||
cp /etc/openclash/servers_fake_filter.conf /tmp/dnsmasq.d/dnsmasq_openclash.conf >/dev/null 2>&1
|
||||
/usr/share/openclash/openclash_server_fake_filter.sh
|
||||
if [ -s "/tmp/dnsmasq.d/dnsmasq_openclash.conf" ]; then
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||
fi
|
||||
echo "" >$START_LOG
|
||||
|
@ -61,7 +61,7 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
|
||||
if [ "$github_address_mod" != "0" ]; then
|
||||
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then
|
||||
curl -sL -m 30 --speed-time 15 --speed-limit 1 https://cdn.jsdelivr.net/gh/vernesong/OpenClash@"$RELEASE_BRANCH"/core-lateset/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz >/dev/null 2>&1
|
||||
elif [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ]; then
|
||||
elif [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ]; then
|
||||
curl -sL -m 30 --speed-time 15 --speed-limit 1 https://fastly.jsdelivr.net/gh/vernesong/OpenClash@"$RELEASE_BRANCH"/core-lateset/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz >/dev/null 2>&1
|
||||
else
|
||||
curl -sL -m 30 --speed-time 15 --speed-limit 1 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz >/dev/null 2>&1
|
||||
|
@ -1,49 +0,0 @@
|
||||
#!/bin/bash
|
||||
. /lib/functions.sh
|
||||
. /usr/share/openclash/log.sh
|
||||
|
||||
CUSTOM_FILE="/etc/openclash/custom/openclash_custom_fake_filter.list"
|
||||
FAKE_FILTER_FILE="/tmp/openclash_fake_filter.list"
|
||||
SER_FAKE_FILTER_FILE="/tmp/openclash_servers_fake_filter.conf"
|
||||
|
||||
LOG_OUT "Setting Fake IP Filter..."
|
||||
|
||||
rm -rf "$FAKE_FILTER_FILE" 2>/dev/null
|
||||
if [ -s "$CUSTOM_FILE" ]; then
|
||||
cat "$CUSTOM_FILE" |while read -r line || [[ -n ${line} ]];
|
||||
do
|
||||
if [ -z "$(echo $line |grep '^ \{0,\}#' 2>/dev/null)" ]; then
|
||||
echo " - '$line'" >> "$FAKE_FILTER_FILE"
|
||||
else
|
||||
continue
|
||||
fi
|
||||
done 2>/dev/null
|
||||
if [ -s "$FAKE_FILTER_FILE" ]; then
|
||||
sed -i '1i\fake-ip-filter:' "$FAKE_FILTER_FILE"
|
||||
else
|
||||
rm -rf "$FAKE_FILTER_FILE" 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
cfg_server_address()
|
||||
{
|
||||
local section="$1"
|
||||
config_get "server" "$section" "server" ""
|
||||
|
||||
IFIP=$(echo $server |grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" 2>/dev/null)
|
||||
if [ -z "$IFIP" ] && [ ! -z "$server" ] && [ -z "$(grep "/$server/" "$SER_FAKE_FILTER_FILE" 2>/dev/null)" ]; then
|
||||
echo "server=/$server/$custom_domain_dns_server" >> "$SER_FAKE_FILTER_FILE"
|
||||
else
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
#Fake下正确检测节点延迟及获取真实地址
|
||||
|
||||
rm -rf "$SER_FAKE_FILTER_FILE" 2>/dev/null
|
||||
custom_domain_dns_server=$(uci get openclash.config.custom_domain_dns_server 2>/dev/null)
|
||||
[ -z "$custom_domain_dns_server" ] && {
|
||||
custom_domain_dns_server="114.114.114.114"
|
||||
}
|
||||
config_load "openclash"
|
||||
config_foreach cfg_server_address "servers"
|
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
. /lib/functions.sh
|
||||
. /usr/share/openclash/log.sh
|
||||
|
||||
SER_FAKE_FILTER_FILE="/tmp/dnsmasq.d/dnsmasq_openclash.conf"
|
||||
en_mode=$(uci get openclash.config.en_mode 2>/dev/null)
|
||||
|
||||
cfg_server_address()
|
||||
{
|
||||
local section="$1"
|
||||
config_get "server" "$section" "server" ""
|
||||
|
||||
IFIP=$(echo "$server" |grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" 2>/dev/null)
|
||||
IFIP6=$(echo "$server" |grep -E "^([\da-fA-F]{1,4}:){7}[\da-fA-F]{1,4}|:((:[\da−fA−F]1,4)1,6|:)|:((:[\da−fA−F]1,4)1,6|:)|^[\da-fA-F]{1,4}:((:[\da-fA-F]{1,4}){1,5}|:)|([\da−fA−F]1,4:)2((:[\da−fA−F]1,4)1,4|:)|([\da−fA−F]1,4:)2((:[\da−fA−F]1,4)1,4|:)|^([\da-fA-F]{1,4}:){3}((:[\da-fA-F]{1,4}){1,3}|:)|([\da−fA−F]1,4:)4((:[\da−fA−F]1,4)1,2|:)|([\da−fA−F]1,4:)4((:[\da−fA−F]1,4)1,2|:)|^([\da-fA-F]{1,4}:){5}:([\da-fA-F]{1,4})?|([\da−fA−F]1,4:)6:|([\da−fA−F]1,4:)6:" 2>/dev/null)
|
||||
if [ -z "$IFIP" ] && [ -z "$IFIP6" ] && [ -n "$server" ] && [ -z "$(grep "/$server/" "$SER_FAKE_FILTER_FILE" 2>/dev/null)" ]; then
|
||||
echo "server=/$server/$custom_domain_dns_server" >> "$SER_FAKE_FILTER_FILE"
|
||||
else
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
#Fake下正确检测节点延迟及获取真实地址
|
||||
if [ -z "$(echo "$en_mode" |grep "redir-host")" ]; then
|
||||
rm -rf "$SER_FAKE_FILTER_FILE" 2>/dev/null
|
||||
mkdir -p /tmp/dnsmasq.d
|
||||
custom_domain_dns_server=$(uci get openclash.config.custom_domain_dns_server 2>/dev/null)
|
||||
[ -z "$custom_domain_dns_server" ] && {
|
||||
custom_domain_dns_server="114.114.114.114"
|
||||
}
|
||||
config_load "openclash"
|
||||
config_foreach cfg_server_address "servers"
|
||||
fi
|
@ -52,7 +52,7 @@ external-controller: 0.0.0.0:9090
|
||||
# directory in which you put some static web resource. Clash core will then
|
||||
# serve it at `http://{{external-controller}}/ui`.
|
||||
# 此项将被接管
|
||||
external-ui: "/usr/share/openclash/dashboard"
|
||||
external-ui: "/usr/share/openclash/ui"
|
||||
|
||||
# Secret for the RESTful API (optional)
|
||||
# Authenticate by spedifying HTTP header `Authorization: Bearer ${secret}`
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
@ -276,7 +276,7 @@ Thread.new{
|
||||
Value['external-controller']='0.0.0.0:$3';
|
||||
Value['secret']='$2';
|
||||
Value['bind-address']='*';
|
||||
Value['external-ui']='/usr/share/openclash/dashboard';
|
||||
Value['external-ui']='/usr/share/openclash/ui';
|
||||
if $6 == 1 then
|
||||
Value['ipv6']=true;
|
||||
else
|
||||
@ -471,16 +471,26 @@ end;
|
||||
begin
|
||||
Thread.new{
|
||||
if '$1' == 'fake-ip' then
|
||||
if File::exist?('/tmp/openclash_fake_filter.list') then
|
||||
Value_4 = YAML.load_file('/tmp/openclash_fake_filter.list');
|
||||
if Value_4 != false and not Value_4['fake-ip-filter'].to_a.empty? then
|
||||
if Value['dns'].has_key?('fake-ip-filter') and not Value['dns']['fake-ip-filter'].to_a.empty? then
|
||||
Value_5 = Value_4['fake-ip-filter'].reverse!;
|
||||
Value_5.each{|x| Value['dns']['fake-ip-filter'].insert(-1,x)};
|
||||
else
|
||||
Value['dns']['fake-ip-filter']=Value_4['fake-ip-filter'];
|
||||
if File::exist?('/etc/openclash/custom/openclash_custom_fake_filter.list') then
|
||||
begin
|
||||
Value_4 = YAML.load_file('/etc/openclash/custom/openclash_custom_fake_filter.list');
|
||||
if Value_4 != false and not Value_4['fake-ip-filter'].to_a.empty? then
|
||||
if Value['dns'].has_key?('fake-ip-filter') and not Value['dns']['fake-ip-filter'].to_a.empty? then
|
||||
Value['dns']['fake-ip-filter'] = Value['dns']['fake-ip-filter'] | Value_4;
|
||||
else
|
||||
Value['dns']['fake-ip-filter'] = Value_4['fake-ip-filter'];
|
||||
end;
|
||||
end;
|
||||
rescue
|
||||
Value_4 = IO.readlines('/etc/openclash/custom/openclash_custom_fake_filter.list');
|
||||
if not Value_4.empty? then
|
||||
Value_4 = Value_4.map!{|x| x.gsub(/#.*$/,'').strip} - ['', nil];
|
||||
if Value['dns'].has_key?('fake-ip-filter') and not Value['dns']['fake-ip-filter'].to_a.empty? then
|
||||
Value['dns']['fake-ip-filter'] = Value['dns']['fake-ip-filter'] | Value_4;
|
||||
else
|
||||
Value['dns']['fake-ip-filter'] = Value_4;
|
||||
end;
|
||||
end;
|
||||
Value['dns']['fake-ip-filter']=Value['dns']['fake-ip-filter'].uniq;
|
||||
end;
|
||||
end;
|
||||
if ${18} == 1 then
|
||||
|
@ -269,154 +269,11 @@ yml_other_set()
|
||||
config_foreach yml_rule_group_get "game_config" "$3"
|
||||
ruby -ryaml -E UTF-8 -e "
|
||||
begin
|
||||
Value = YAML.load_file('$3');
|
||||
Value = YAML.load_file('$3');
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Error: Load File Failed,【' + e.message + '】'
|
||||
end
|
||||
begin
|
||||
Thread.new{
|
||||
if $2 == 1 then
|
||||
#script
|
||||
for i in ['/etc/openclash/custom/openclash_custom_rules.list','/etc/openclash/custom/openclash_custom_rules_2.list'] do
|
||||
if File::exist?(i) then
|
||||
Value_1 = YAML.load_file(i)
|
||||
if Value_1 != false then
|
||||
if Value_1.class.to_s == 'Hash' then
|
||||
if Value_1['script'] and Value_1['script'].class.to_s != 'Array' then
|
||||
if Value.key?('script') and not Value_1['script'].to_a.empty? then
|
||||
if Value['script'].key?('code') and Value_1['script'].key?('code') then
|
||||
if not Value['script']['code'].include?('def main(ctx, metadata):') then
|
||||
Value['script']['code'] = Value_1['script']['code']
|
||||
else
|
||||
if i == '/etc/openclash/custom/openclash_custom_rules.list' then
|
||||
if not Value_1['script']['code'].include?('def main(ctx, metadata):') then
|
||||
Value['script']['code'].gsub!('def main(ctx, metadata):', \"def main(ctx, metadata):\n\" + Value_1['script']['code'])
|
||||
else
|
||||
Value['script']['code'].gsub!('def main(ctx, metadata):', Value_1['script']['code'])
|
||||
end
|
||||
else
|
||||
insert_index = Value['script']['code'].index(/ctx.geoip/)
|
||||
insert_index ||= Value['script']['code'].rindex(/return/)
|
||||
insert_index ||= -1
|
||||
if insert_index != -1 then
|
||||
insert_index = Value['script']['code'].rindex(\"\n\", insert_index) + 1
|
||||
end
|
||||
if not Value_1['script']['code'].include?('def main(ctx, metadata):') then
|
||||
Value['script']['code'].insert(insert_index, Value_1['script']['code'])
|
||||
else
|
||||
Value['script']['code'].insert(insert_index, Value_1['script']['code'].gsub('def main(ctx, metadata):', ''))
|
||||
end
|
||||
end
|
||||
end
|
||||
elsif Value_1['script'].key?('code') then
|
||||
Value['script']['code'] = Value_1['script']['code']
|
||||
end
|
||||
if Value['script'].key?('shortcuts') and Value_1['script'].key?('shortcuts') and not Value_1['script']['shortcuts'].to_a.empty? then
|
||||
Value['script']['shortcuts'].merge!(Value_1['script']['shortcuts']).uniq
|
||||
elsif Value_1['script'].key?('shortcuts') and not Value_1['script']['shortcuts'].to_a.empty? then
|
||||
Value['script']['shortcuts'] = Value_1['script']['shortcuts']
|
||||
end
|
||||
else
|
||||
Value['script'] = Value_1['script']
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end;
|
||||
#rules
|
||||
if Value.has_key?('rules') and not Value['rules'].to_a.empty? then
|
||||
if File::exist?('/etc/openclash/custom/openclash_custom_rules.list') then
|
||||
Value_1 = YAML.load_file('/etc/openclash/custom/openclash_custom_rules.list')
|
||||
if Value_1 != false then
|
||||
if Value_1.class.to_s == 'Hash' then
|
||||
if not Value_1['rules'].to_a.empty? and Value_1['rules'].class.to_s == 'Array' then
|
||||
Value_2 = Value_1['rules'].to_a.reverse!
|
||||
end
|
||||
elsif Value_1.class.to_s == 'Array'
|
||||
Value_2 = Value_1.reverse!
|
||||
end
|
||||
if defined? Value_2 then
|
||||
Value_2.each{|x| Value['rules'].insert(0,x)}
|
||||
Value['rules'] = Value['rules'].uniq
|
||||
end
|
||||
end
|
||||
end
|
||||
if File::exist?('/etc/openclash/custom/openclash_custom_rules_2.list') then
|
||||
Value_3 = YAML.load_file('/etc/openclash/custom/openclash_custom_rules_2.list')
|
||||
if Value_3 != false then
|
||||
ruby_add_index = Value['rules'].index(Value['rules'].grep(/(GEOIP|MATCH|FINAL)/).first)
|
||||
ruby_add_index ||= -1
|
||||
if Value_3.class.to_s == 'Hash' then
|
||||
if not Value_3['rules'].to_a.empty? and Value_3['rules'].class.to_s == 'Array' then
|
||||
Value_4 = Value_3['rules'].to_a.reverse!
|
||||
end
|
||||
elsif Value_3.class.to_s == 'Array'
|
||||
Value_4 = Value_3.reverse!
|
||||
end
|
||||
if defined? Value_4 then
|
||||
if ruby_add_index == -1 then
|
||||
Value_4 = Value_4.reverse!
|
||||
end
|
||||
Value_4.each{|x| Value['rules'].insert(ruby_add_index,x)}
|
||||
Value['rules'] = Value['rules'].uniq
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
if File::exist?('/etc/openclash/custom/openclash_custom_rules.list') then
|
||||
Value_1 = YAML.load_file('/etc/openclash/custom/openclash_custom_rules.list')
|
||||
if Value_1 != false then
|
||||
if Value_1.class.to_s == 'Hash' then
|
||||
if not Value_1['rules'].to_a.empty? and Value_1['rules'].class.to_s == 'Array' then
|
||||
Value['rules'] = Value_1['rules']
|
||||
Value['rules'] = Value['rules'].uniq
|
||||
end
|
||||
elsif Value_1.class.to_s == 'Array'
|
||||
Value['rules'] = Value_1
|
||||
Value['rules'] = Value['rules'].uniq
|
||||
end
|
||||
end
|
||||
end
|
||||
if File::exist?('/etc/openclash/custom/openclash_custom_rules_2.list') then
|
||||
Value_2 = YAML.load_file('/etc/openclash/custom/openclash_custom_rules_2.list')
|
||||
if Value_2 != false then
|
||||
if Value['rules'].to_a.empty? then
|
||||
if Value_2.class.to_s == 'Hash' then
|
||||
if not Value_2['rules'].to_a.empty? and Value_2['rules'].class.to_s == 'Array' then
|
||||
Value['rules'] = Value_2['rules']
|
||||
Value['rules'] = Value['rules'].uniq
|
||||
end
|
||||
elsif Value_2.class.to_s == 'Array'
|
||||
Value['rules'] = Value_2
|
||||
Value['rules'] = Value['rules'].uniq
|
||||
end
|
||||
else
|
||||
ruby_add_index = Value['rules'].index(Value['rules'].grep(/(GEOIP|MATCH|FINAL)/).first)
|
||||
ruby_add_index ||= -1
|
||||
if Value_2.class.to_s == 'Hash' then
|
||||
if not Value_2['rules'].to_a.empty? and Value_2['rules'].class.to_s == 'Array' then
|
||||
Value_3 = Value_2['rules'].to_a.reverse!
|
||||
end
|
||||
elsif Value_2.class.to_s == 'Array'
|
||||
Value_3 = Value_2.reverse!
|
||||
end
|
||||
if defined? Value_3 then
|
||||
if ruby_add_index == -1 then
|
||||
Value_3 = Value_3.reverse!
|
||||
end
|
||||
Value_3.each{|x| Value['rules'].insert(ruby_add_index,x)}
|
||||
Value['rules'] = Value['rules'].uniq
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
puts '${LOGTIME} Error: Load File Failed,【' + e.message + '】';
|
||||
end;
|
||||
}.join;
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Error: Set Custom Rules Failed,【' + e.message + '】'
|
||||
end
|
||||
|
||||
begin
|
||||
Thread.new{
|
||||
if $4 == 1 then
|
||||
@ -444,104 +301,84 @@ yml_other_set()
|
||||
'DOMAIN-SUFFIX,springsunday.net,DIRECT',
|
||||
'DOMAIN-SUFFIX,tjupt.org,DIRECT',
|
||||
'DOMAIN-SUFFIX,totheglory.im,DIRECT',
|
||||
'DOMAIN-SUFFIX,smtp,DIRECT',
|
||||
'DOMAIN-KEYWORD,announce,DIRECT',
|
||||
'DOMAIN-KEYWORD,torrent,DIRECT',
|
||||
'DOMAIN-KEYWORD,tracker,DIRECT',
|
||||
'PROCESS-NAME,aria2c,DIRECT',
|
||||
'PROCESS-NAME,BitComet,DIRECT',
|
||||
'PROCESS-NAME,fdm,DIRECT',
|
||||
'PROCESS-NAME,NetTransport,DIRECT',
|
||||
'PROCESS-NAME,qbittorrent,DIRECT',
|
||||
'PROCESS-NAME,Thunder,DIRECT',
|
||||
'PROCESS-NAME,transmission-daemon,DIRECT',
|
||||
'PROCESS-NAME,transmission-qt,DIRECT',
|
||||
'PROCESS-NAME,uTorrent,DIRECT',
|
||||
'PROCESS-NAME,WebTorrent,DIRECT',
|
||||
'PROCESS-NAME,aria2c,DIRECT',
|
||||
'PROCESS-NAME,fdm,DIRECT',
|
||||
'PROCESS-NAME,Folx,DIRECT',
|
||||
'PROCESS-NAME,NetTransport,DIRECT',
|
||||
'PROCESS-NAME,qbittorrent,DIRECT',
|
||||
'PROCESS-NAME,Thunder,DIRECT',
|
||||
'PROCESS-NAME,Transmission,DIRECT',
|
||||
'PROCESS-NAME,transmission,DIRECT',
|
||||
'PROCESS-NAME,uTorrent,DIRECT',
|
||||
'PROCESS-NAME,WebTorrent,DIRECT',
|
||||
'PROCESS-NAME,WebTorrent Helper,DIRECT',
|
||||
'PROCESS-NAME,v2ray,DIRECT',
|
||||
'PROCESS-NAME,ss-local,DIRECT',
|
||||
'PROCESS-NAME,ssr-local,DIRECT',
|
||||
'PROCESS-NAME,ss-redir,DIRECT',
|
||||
'PROCESS-NAME,ssr-redir,DIRECT',
|
||||
'PROCESS-NAME,ss-server,DIRECT',
|
||||
'PROCESS-NAME,trojan-go,DIRECT',
|
||||
'PROCESS-NAME,xray,DIRECT',
|
||||
'PROCESS-NAME,hysteria,DIRECT',
|
||||
'PROCESS-NAME,UUBooster,DIRECT',
|
||||
'PROCESS-NAME,uugamebooster,DIRECT',
|
||||
'DOMAIN-SUFFIX,smtp,DIRECT'
|
||||
)
|
||||
match_group=Value['rules'].grep(/(MATCH|FINAL)/)[0]
|
||||
'DOMAIN-KEYWORD,tracker,DIRECT'
|
||||
);
|
||||
match_group=Value['rules'].grep(/(MATCH|FINAL)/)[0];
|
||||
if not match_group.nil? then
|
||||
common_port_group=match_group.split(',')[2] or common_port_group=match_group.split(',')[1]
|
||||
common_port_group=match_group.split(',')[2] or common_port_group=match_group.split(',')[1];
|
||||
if not common_port_group.nil? then
|
||||
ruby_add_index = Value['rules'].index(Value['rules'].grep(/(MATCH|FINAL)/).first)
|
||||
ruby_add_index ||= -1
|
||||
ruby_add_index = Value['rules'].index(Value['rules'].grep(/(MATCH|FINAL)/).first);
|
||||
ruby_add_index ||= -1;
|
||||
Value['rules']=Value['rules'].to_a.insert(ruby_add_index,
|
||||
'PROCESS-NAME,aria2c,DIRECT',
|
||||
'PROCESS-NAME,BitComet,DIRECT',
|
||||
'PROCESS-NAME,fdm,DIRECT',
|
||||
'PROCESS-NAME,NetTransport,DIRECT',
|
||||
'PROCESS-NAME,qbittorrent,DIRECT',
|
||||
'PROCESS-NAME,Thunder,DIRECT',
|
||||
'PROCESS-NAME,transmission-daemon,DIRECT',
|
||||
'PROCESS-NAME,transmission-qt,DIRECT',
|
||||
'PROCESS-NAME,uTorrent,DIRECT',
|
||||
'PROCESS-NAME,WebTorrent,DIRECT',
|
||||
'PROCESS-NAME,aria2c,DIRECT',
|
||||
'PROCESS-NAME,fdm,DIRECT',
|
||||
'PROCESS-NAME,Folx,DIRECT',
|
||||
'PROCESS-NAME,NetTransport,DIRECT',
|
||||
'PROCESS-NAME,qbittorrent,DIRECT',
|
||||
'PROCESS-NAME,Thunder,DIRECT',
|
||||
'PROCESS-NAME,Transmission,DIRECT',
|
||||
'PROCESS-NAME,transmission,DIRECT',
|
||||
'PROCESS-NAME,uTorrent,DIRECT',
|
||||
'PROCESS-NAME,WebTorrent,DIRECT',
|
||||
'PROCESS-NAME,WebTorrent Helper,DIRECT',
|
||||
'PROCESS-NAME,v2ray,DIRECT',
|
||||
'PROCESS-NAME,ss-local,DIRECT',
|
||||
'PROCESS-NAME,ssr-local,DIRECT',
|
||||
'PROCESS-NAME,ss-redir,DIRECT',
|
||||
'PROCESS-NAME,ssr-redir,DIRECT',
|
||||
'PROCESS-NAME,ss-server,DIRECT',
|
||||
'PROCESS-NAME,trojan-go,DIRECT',
|
||||
'PROCESS-NAME,xray,DIRECT',
|
||||
'PROCESS-NAME,hysteria,DIRECT',
|
||||
'PROCESS-NAME,UUBooster,DIRECT',
|
||||
'PROCESS-NAME,uugamebooster,DIRECT',
|
||||
'DST-PORT,80,' + common_port_group,
|
||||
'DST-PORT,443,' + common_port_group,
|
||||
'DST-PORT,22,' + common_port_group
|
||||
)
|
||||
end
|
||||
);
|
||||
end;
|
||||
end
|
||||
Value['rules'].to_a.collect!{|x|x.to_s.gsub(/(^MATCH.*|^FINAL.*)/, 'MATCH,DIRECT')}
|
||||
Value['rules'].to_a.collect!{|x|x.to_s.gsub(/(^MATCH.*|^FINAL.*)/, 'MATCH,DIRECT')};
|
||||
end;
|
||||
}.join;
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Error: Set BT/P2P DIRECT Rules Failed,【' + e.message + '】'
|
||||
end
|
||||
puts '${LOGTIME} Error: Set BT/P2P DIRECT Rules Failed,【' + e.message + '】';
|
||||
end;
|
||||
|
||||
begin
|
||||
Thread.new{
|
||||
if $6 == 0 then
|
||||
if Value.has_key?('rules') and not Value['rules'].to_a.empty? then
|
||||
if Value['rules'].to_a.grep(/(?=.*SRC-IP-CIDR,198.18.0.1)/).empty? then
|
||||
Value['rules']=Value['rules'].to_a.insert(0,'SRC-IP-CIDR,198.18.0.1/32,DIRECT')
|
||||
Value['rules']=Value['rules'].to_a.insert(0,'SRC-IP-CIDR,198.18.0.1/32,DIRECT');
|
||||
end
|
||||
if Value['rules'].to_a.grep(/(?=.*SRC-IP-CIDR,'$7')/).empty? and not '$7'.empty? then
|
||||
Value['rules']=Value['rules'].to_a.insert(0,'SRC-IP-CIDR,$7/32,DIRECT')
|
||||
end
|
||||
Value['rules']=Value['rules'].to_a.insert(0,'SRC-IP-CIDR,$7/32,DIRECT');
|
||||
end;
|
||||
else
|
||||
Value['rules']=%w('SRC-IP-CIDR,198.18.0.1/32,DIRECT','SRC-IP-CIDR,$7/32,DIRECT')
|
||||
Value['rules']=%w('SRC-IP-CIDR,198.18.0.1/32,DIRECT','SRC-IP-CIDR,$7/32,DIRECT');
|
||||
end;
|
||||
elsif Value.has_key?('rules') and not Value['rules'].to_a.empty? then
|
||||
Value['rules'].delete('SRC-IP-CIDR,198.18.0.1/32,DIRECT')
|
||||
Value['rules'].delete('SRC-IP-CIDR,$7/32,DIRECT')
|
||||
Value['rules'].delete('SRC-IP-CIDR,198.18.0.1/32,DIRECT');
|
||||
Value['rules'].delete('SRC-IP-CIDR,$7/32,DIRECT');
|
||||
end;
|
||||
}.join;
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Error: Set Router Self Proxy Rule Failed,【' + e.message + '】'
|
||||
puts '${LOGTIME} Error: Set Router Self Proxy Rule Failed,【' + e.message + '】';
|
||||
end
|
||||
|
||||
begin
|
||||
Thread.new{
|
||||
if Value.has_key?('rules') and not Value['rules'].to_a.empty? then
|
||||
if Value['rules'].to_a.grep(/(?=.*198.18.0)(?=.*REJECT)/).empty? then
|
||||
Value['rules']=Value['rules'].to_a.insert(0,'IP-CIDR,198.18.0.1/16,REJECT,no-resolve')
|
||||
end
|
||||
if Value['rules'].to_a.grep(/(?=.*DST-PORT,'$8',REJECT)/).empty? then
|
||||
Value['rules']=Value['rules'].to_a.insert(0,'DST-PORT,$8,REJECT')
|
||||
end
|
||||
if Value['rules'].to_a.grep(/(?=.*DST-PORT,'$9',REJECT)/).empty? then
|
||||
Value['rules']=Value['rules'].to_a.insert(0,'DST-PORT,$9,REJECT')
|
||||
end
|
||||
else
|
||||
Value['rules']=['IP-CIDR,198.18.0.1/16,REJECT,no-resolve','DST-PORT,$8,REJECT','DST-PORT,$9,REJECT']
|
||||
end;
|
||||
}.join;
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Error: Set Loop Protect Rules Failed,【' + e.message + '】'
|
||||
end;
|
||||
|
||||
#处理规则集
|
||||
begin
|
||||
@ -644,6 +481,172 @@ yml_other_set()
|
||||
puts '${LOGTIME} Error: Game Proxy Merge Failed,【' + e.message + '】';
|
||||
end;
|
||||
|
||||
begin
|
||||
Thread.new{
|
||||
if $2 == 1 then
|
||||
#script
|
||||
for i in ['/etc/openclash/custom/openclash_custom_rules.list','/etc/openclash/custom/openclash_custom_rules_2.list'] do
|
||||
if File::exist?(i) then
|
||||
Value_1 = YAML.load_file(i);
|
||||
if Value_1 != false then
|
||||
if Value_1.class.to_s == 'Hash' then
|
||||
if Value_1['script'] and Value_1['script'].class.to_s != 'Array' then
|
||||
if Value.key?('script') and not Value_1['script'].to_a.empty? then
|
||||
if Value['script'].key?('code') and Value_1['script'].key?('code') then
|
||||
if not Value['script']['code'].include?('def main(ctx, metadata):') then
|
||||
Value['script']['code'] = Value_1['script']['code'];
|
||||
else
|
||||
if i == '/etc/openclash/custom/openclash_custom_rules.list' then
|
||||
if not Value_1['script']['code'].include?('def main(ctx, metadata):') then
|
||||
Value['script']['code'].gsub!('def main(ctx, metadata):', \"def main(ctx, metadata):\n\" + Value_1['script']['code']);
|
||||
else
|
||||
Value['script']['code'].gsub!('def main(ctx, metadata):', Value_1['script']['code']);
|
||||
end;
|
||||
else
|
||||
insert_index = Value['script']['code'].index(/ctx.geoip/);
|
||||
insert_index ||= Value['script']['code'].rindex(/return/);
|
||||
insert_index ||= -1;
|
||||
if insert_index != -1 then
|
||||
insert_index = Value['script']['code'].rindex(\"\n\", insert_index) + 1;
|
||||
end
|
||||
if not Value_1['script']['code'].include?('def main(ctx, metadata):') then
|
||||
Value['script']['code'].insert(insert_index, Value_1['script']['code']);
|
||||
else
|
||||
Value['script']['code'].insert(insert_index, Value_1['script']['code'].gsub('def main(ctx, metadata):', ''));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
elsif Value_1['script'].key?('code') then
|
||||
Value['script']['code'] = Value_1['script']['code'];
|
||||
end;
|
||||
if Value['script'].key?('shortcuts') and Value_1['script'].key?('shortcuts') and not Value_1['script']['shortcuts'].to_a.empty? then
|
||||
Value['script']['shortcuts'].merge!(Value_1['script']['shortcuts']).uniq;
|
||||
elsif Value_1['script'].key?('shortcuts') and not Value_1['script']['shortcuts'].to_a.empty? then
|
||||
Value['script']['shortcuts'] = Value_1['script']['shortcuts'];
|
||||
end;
|
||||
else
|
||||
Value['script'] = Value_1['script'];
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
#rules
|
||||
if Value.has_key?('rules') and not Value['rules'].to_a.empty? then
|
||||
if File::exist?('/etc/openclash/custom/openclash_custom_rules.list') then
|
||||
Value_1 = YAML.load_file('/etc/openclash/custom/openclash_custom_rules.list');
|
||||
if Value_1 != false then
|
||||
if Value_1.class.to_s == 'Hash' then
|
||||
if not Value_1['rules'].to_a.empty? and Value_1['rules'].class.to_s == 'Array' then
|
||||
Value_2 = Value_1['rules'].to_a.reverse!;
|
||||
end;
|
||||
elsif Value_1.class.to_s == 'Array' then
|
||||
Value_2 = Value_1.reverse!;
|
||||
end;
|
||||
if defined? Value_2 then
|
||||
Value_2.each{|x| Value['rules'].insert(0,x)};
|
||||
Value['rules'] = Value['rules'].uniq;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
if File::exist?('/etc/openclash/custom/openclash_custom_rules_2.list') then
|
||||
Value_3 = YAML.load_file('/etc/openclash/custom/openclash_custom_rules_2.list');
|
||||
if Value_3 != false then
|
||||
ruby_add_index = Value['rules'].index(Value['rules'].grep(/(GEOIP|MATCH|FINAL)/).first);
|
||||
ruby_add_index ||= -1;
|
||||
if Value_3.class.to_s == 'Hash' then
|
||||
if not Value_3['rules'].to_a.empty? and Value_3['rules'].class.to_s == 'Array' then
|
||||
Value_4 = Value_3['rules'].to_a.reverse!;
|
||||
end;
|
||||
elsif Value_3.class.to_s == 'Array' then
|
||||
Value_4 = Value_3.reverse!;
|
||||
end;
|
||||
if defined? Value_4 then
|
||||
if ruby_add_index == -1 then
|
||||
Value_4 = Value_4.reverse!;
|
||||
end;
|
||||
Value_4.each{|x| Value['rules'].insert(ruby_add_index,x)};
|
||||
Value['rules'] = Value['rules'].uniq;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
else
|
||||
if File::exist?('/etc/openclash/custom/openclash_custom_rules.list') then
|
||||
Value_1 = YAML.load_file('/etc/openclash/custom/openclash_custom_rules.list');
|
||||
if Value_1 != false then
|
||||
if Value_1.class.to_s == 'Hash' then
|
||||
if not Value_1['rules'].to_a.empty? and Value_1['rules'].class.to_s == 'Array' then
|
||||
Value['rules'] = Value_1['rules'];
|
||||
Value['rules'] = Value['rules'].uniq;
|
||||
end;
|
||||
elsif Value_1.class.to_s == 'Array' then
|
||||
Value['rules'] = Value_1;
|
||||
Value['rules'] = Value['rules'].uniq;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
if File::exist?('/etc/openclash/custom/openclash_custom_rules_2.list') then
|
||||
Value_2 = YAML.load_file('/etc/openclash/custom/openclash_custom_rules_2.list');
|
||||
if Value_2 != false then
|
||||
if Value['rules'].to_a.empty? then
|
||||
if Value_2.class.to_s == 'Hash' then
|
||||
if not Value_2['rules'].to_a.empty? and Value_2['rules'].class.to_s == 'Array' then
|
||||
Value['rules'] = Value_2['rules'];
|
||||
Value['rules'] = Value['rules'].uniq;
|
||||
end;
|
||||
elsif Value_2.class.to_s == 'Array' then
|
||||
Value['rules'] = Value_2;
|
||||
Value['rules'] = Value['rules'].uniq;
|
||||
end;
|
||||
else
|
||||
ruby_add_index = Value['rules'].index(Value['rules'].grep(/(GEOIP|MATCH|FINAL)/).first);
|
||||
ruby_add_index ||= -1;
|
||||
if Value_2.class.to_s == 'Hash' then
|
||||
if not Value_2['rules'].to_a.empty? and Value_2['rules'].class.to_s == 'Array' then
|
||||
Value_3 = Value_2['rules'].to_a.reverse!;
|
||||
end;
|
||||
elsif Value_2.class.to_s == 'Array' then
|
||||
Value_3 = Value_2.reverse!;
|
||||
end;
|
||||
if defined? Value_3 then
|
||||
if ruby_add_index == -1 then
|
||||
Value_3 = Value_3.reverse!;
|
||||
end
|
||||
Value_3.each{|x| Value['rules'].insert(ruby_add_index,x)};
|
||||
Value['rules'] = Value['rules'].uniq;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
}.join;
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Error: Set Custom Rules Failed,【' + e.message + '】';
|
||||
end;
|
||||
|
||||
#loop prevent
|
||||
begin
|
||||
Thread.new{
|
||||
if Value.has_key?('rules') and not Value['rules'].to_a.empty? then
|
||||
if Value['rules'].to_a.grep(/(?=.*198.18.0)(?=.*REJECT)/).empty? then
|
||||
Value['rules']=Value['rules'].to_a.insert(0,'IP-CIDR,198.18.0.1/16,REJECT,no-resolve');
|
||||
end;
|
||||
if Value['rules'].to_a.grep(/(?=.*DST-PORT,'$8',REJECT)/).empty? then
|
||||
Value['rules']=Value['rules'].to_a.insert(0,'DST-PORT,$8,REJECT');
|
||||
end;
|
||||
if Value['rules'].to_a.grep(/(?=.*DST-PORT,'$9',REJECT)/).empty? then
|
||||
Value['rules']=Value['rules'].to_a.insert(0,'DST-PORT,$9,REJECT');
|
||||
end;
|
||||
else
|
||||
Value['rules']=['IP-CIDR,198.18.0.1/16,REJECT,no-resolve','DST-PORT,$8,REJECT','DST-PORT,$9,REJECT'];
|
||||
end;
|
||||
}.join;
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Error: Set Loop Protect Rules Failed,【' + e.message + '】';
|
||||
end;
|
||||
|
||||
#修改集路径
|
||||
begin
|
||||
Thread.new{
|
||||
@ -662,7 +665,7 @@ yml_other_set()
|
||||
if x['url'] and x['url'] =~ /^https:\/\/raw.githubusercontent.com/ then
|
||||
x['url'] = 'https://cdn.jsdelivr.net/gh/' + x['url'].split('/')[3] + '/' + x['url'].split('/')[4] + '@' + x['url'].split(x['url'].split('/')[2] + '/' + x['url'].split('/')[3] + '/' + x['url'].split('/')[4] + '/')[1];
|
||||
end;
|
||||
elif '$github_address_mod' == 'https://fastly.jsdelivr.net/' then
|
||||
elsif '$github_address_mod' == 'https://fastly.jsdelivr.net/' then
|
||||
if x['url'] and x['url'] =~ /^https:\/\/raw.githubusercontent.com/ then
|
||||
x['url'] = 'https://fastly.jsdelivr.net/gh/' + x['url'].split('/')[3] + '/' + x['url'].split('/')[4] + '@' + x['url'].split(x['url'].split('/')[2] + '/' + x['url'].split('/')[3] + '/' + x['url'].split('/')[4] + '/')[1];
|
||||
end;
|
||||
|
@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="186" height="20" role="img" aria-label="Current Version: v0.45.16-beta"><title>Current Version: v0.45.16-beta</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="186" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="97" height="20" fill="#555"/><rect x="97" width="89" height="20" fill="#007ec6"/><rect width="186" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="495" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="870">Current Version</text><text x="495" y="140" transform="scale(.1)" fill="#fff" textLength="870">Current Version</text><text aria-hidden="true" x="1405" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="790">v0.45.16-beta</text><text x="1405" y="140" transform="scale(.1)" fill="#fff" textLength="790">v0.45.16-beta</text></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="186" height="20" role="img" aria-label="Current Version: v0.45.22-beta"><title>Current Version: v0.45.22-beta</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="186" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="97" height="20" fill="#555"/><rect x="97" width="89" height="20" fill="#007ec6"/><rect width="186" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="495" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="870">Current Version</text><text x="495" y="140" transform="scale(.1)" fill="#fff" textLength="870">Current Version</text><text aria-hidden="true" x="1405" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="790">v0.45.22-beta</text><text x="1405" y="140" transform="scale(.1)" fill="#fff" textLength="790">v0.45.22-beta</text></g></svg>
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |