update-02.14

This commit is contained in:
github-actions[bot] 2022-02-14 09:03:59 +08:00
parent e58ea69468
commit 39c17da13e
36 changed files with 10577 additions and 10210 deletions

File diff suppressed because one or more lines are too long

View File

@ -58,6 +58,7 @@
080120.com
080644.com
0817zfbj.xyz
0819837.com
0824xfh.xyz
0851ok.com
0898hhh.com
@ -580,6 +581,7 @@
3e787c93af8de.com
3ec9b1217d.com
3f9f440ecad916.com
3fakaixi.xyz
3fish.store
3g.990.net
3gmtr.com
@ -1128,6 +1130,7 @@
978655.online
979067.com
97d73lsi.com
97shang.wang
97wanle.com
98158.com
9860775.com
@ -1146,6 +1149,7 @@
99mc.xyz
99pps.com
99tianxin.com
99zan.site
9a24a1b3dcd5f4.com
9a2a0fe656.com
9a9j.cn
@ -1404,6 +1408,7 @@ abhabh.club
abi.run
abjjsc.cn
ablatesgascon.cam
ableaborah.com
ablebodiedcool.com
ablerivetdoubted.com
ablesasme.co
@ -1799,6 +1804,7 @@ adeimptrck.com
adelazanna.com
ademails.com
adengage.com
adenza.dev
adequality.xyz
adequalitys.xyz
aderstono.one
@ -3980,6 +3986,7 @@ awtks.com
awtvnrgwxletd.com
awwlcx.cn
awwlfb.cn
awwlib.cn
awwlrd.cn
awxoddnhl.xyz
awxqiujkhrf.top
@ -4549,6 +4556,7 @@ beakdragon.com
beakedpissod.com
beam-ws.giraffe360.com
beam.giraffe360.com
beamedshipwreck.com
beamfuloakwood.com
beamincrease.com
beamingworked.com
@ -5553,6 +5561,7 @@ calculatingtoothbrush.com
calculatorcamera.com
calculatorconceivenonetheless.com
call-ad-network-api.marchex.com
callalelel.info
callcreateabash.com
callelundotre.xyz
callousbrake.com
@ -6973,6 +6982,7 @@ cshwhy.cn
csiasvapqrccq.com
csjs.ltd
csjwawe.top
cslgcomputer.club
cspb1.5w5w.com
csqiulong.com
csqywhcb.com
@ -13522,6 +13532,7 @@ kanglaijd.cn
kangxifan.com
kaniang.top
kanjiaqun.cn
kankingwith.com
kanoodle.com
kantarmedia.com
kantv.pub
@ -13599,6 +13610,7 @@ kelpmetorealiu.xyz
kelt-195b.com
kemperare.club
kenduktur.com
kenmwqdfiq.com
kennetting.club
kenskitscurt.com
kenxn.com
@ -14847,6 +14859,7 @@ m2track.co
m30w.net
m32.media
m3bnqqqw.com
m4aqwrl.cn
m4clicks.com
m4n.nl
m5xy0v.cn
@ -14994,6 +15007,7 @@ margarinedifferencequick.com
margaritabusiness.com
mariabrowseattending.com
marial.pro
marijuanaturf.com
marimedia.com
marinsm.com
maritalglancing.com
@ -16011,6 +16025,7 @@ mzlscqarnm.com
mzokqm.cn
mzol7lbm.com
mzwfu.xyz
mzwfw.club
mzya5718.xyz
n.baminw.com.cn
n12qga4ld3zk.com
@ -17118,6 +17133,7 @@ oplo.org
oplwseln.com
opmnstr.com
opoapibs.net
opoew.top
opotey.com
opoxv.com
oppaid.com
@ -17570,9 +17586,11 @@ pazashevy.com
pazppsim.cn
pb.s3wfg.com
pb.shuxigua.com
pbaucpamdtnarz.com
pbbgfsm.cn
pbcde.com
pbhrxxcuobz.com
pbkqidejmes.ru
pbnet.ru
pbterra.com
pbtxt.win
@ -20130,6 +20148,7 @@ ryrkscj.cn
ryshekeha.com
rysubmission.biz
ryturtviaqcana.xyz
rywnvzd.cn
rywoments.info
ryxfyjvcdugdf.com
ryynoljdarrw.com
@ -21145,6 +21164,7 @@ solarmosa.com
solderplumboverreact.com
solelylounge.com
solepresumablystrangle.com
soliads.net
solideaved.com
solihullah.info
solitudeelection.com
@ -22046,6 +22066,7 @@ taiquandao1.cn
taishijian.com
taisowhu.com
taixuan.net.cn
taiztf.cn
tajs.qq.com
tajxgs.com
takethatad.com
@ -22154,6 +22175,7 @@ tdcbvxxhss.xyz
tdedqqv.cn
tdjc.shop
tdtsd.com
tdtxjhel.com
teads.tv
teakreese.com
tealeaf.com
@ -25228,6 +25250,7 @@ xiaotaowangluo.com
xiaoxiangmovie.com
xiaoxiaoyd.cn
xiaoyaunbao.club
xiaozhige.xyz
xiarikui08.com
xiayk.cn
xibadupty.com
@ -25302,6 +25325,7 @@ xknnubcqaa.com
xkpbcd.com
xkqpco.com
xkunjfkb.com
xkzjq.cn
xl4z7.cn
xldcdnd.com
xlgqy.com
@ -26041,6 +26065,7 @@ yuyinqs.com
yuyue008.cn
yvatswzotstdve.com
yvebbtqvqvhufs.com
yvfnb.cn
yvgqtrnncvearx.xyz
yvmads.com
yvoria.com
@ -26177,6 +26202,7 @@ zdovrb.cn
zdrcnx.cn
zdryg.com
zdsfnagupwkztl.com
zdwsh.tech
zdyldoijanx.com
zdzk0371.cn
zeads.com
@ -26259,6 +26285,7 @@ zhangjinfei.vip
zhangjuan.love
zhangjunying.top
zhangkc.com
zhangshen.club
zhangshiyuan.com
zhangtiantian.cc
zhangyiqian.top

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-openclash
PKG_VERSION:=0.44.16
PKG_VERSION:=0.44.25
PKG_RELEASE:=beta
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>
@ -75,20 +75,22 @@ endef
define Package/$(PKG_NAME)/postrm
#!/bin/sh
rm -rf /etc/openclash
rm -rf /tmp/openclash.log
rm -rf /tmp/openclash_start.log
rm -rf /tmp/openclash_last_version
rm -rf /tmp/openclash_config.tmp
rm -rf /tmp/openclash.change
rm -rf /tmp/Proxy_Group
rm -rf /tmp/rules_name
rm -rf /tmp/rule_providers_name
rm -rf /tmp/clash_last_version
rm -rf /usr/share/openclash/backup
rm -rf /tmp/openclash_fake_filter.list
rm -rf /tmp/openclash_servers_fake_filter.conf
rm -rf /tmp/dler*
rm -rf /etc/openclash >/dev/null 2>&1
rm -rf /tmp/openclash.log >/dev/null 2>&1
rm -rf /tmp/openclash_start.log >/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
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/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/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
uci -q delete firewall.openclash
uci -q commit firewall
uci -q delete ucitrack.@openclash[-1]

View File

@ -60,9 +60,11 @@ function index()
entry({"admin", "services", "openclash", "switch_rule_mode"}, call("action_switch_rule_mode"))
entry({"admin", "services", "openclash", "switch_run_mode"}, call("action_switch_run_mode"))
entry({"admin", "services", "openclash", "get_run_mode"}, call("action_get_run_mode"))
entry({"admin", "services", "openclash", "create_file"}, call("create_file"))
entry({"admin", "services", "openclash", "settings"},cbi("openclash/settings"),_("Global Settings"), 30).leaf = true
entry({"admin", "services", "openclash", "servers"},cbi("openclash/servers"),_("Servers and Groups"), 40).leaf = true
entry({"admin", "services", "openclash", "other-rules-edit"},cbi("openclash/other-rules-edit"), nil).leaf = true
entry({"admin", "services", "openclash", "other-file-edit"},cbi("openclash/other-file-edit"), nil).leaf = true
entry({"admin", "services", "openclash", "rule-providers-settings"},cbi("openclash/rule-providers-settings"),_("Rule Providers and Groups"), 50).leaf = true
entry({"admin", "services", "openclash", "game-rules-manage"},form("openclash/game-rules-manage"), nil).leaf = true
entry({"admin", "services", "openclash", "rule-providers-manage"},form("openclash/rule-providers-manage"), nil).leaf = true
@ -307,8 +309,8 @@ end
local function historychecktime()
local CONFIG_FILE = uci:get("openclash", "config", "config_path")
if not CONFIG_FILE then return "0" end
local HISTORY_PATH_OLD = "/etc/openclash/history/" .. fs.filename(fs.basename(CONFIG_FILE))
local HISTORY_PATH = "/etc/openclash/history/" .. fs.filename(fs.basename(CONFIG_FILE)) .. ".db"
local HISTORY_PATH_OLD = "/etc/openclash/history/" .. fs.filename(fs.basename(CONFIG_FILE))
local HISTORY_PATH = "/etc/openclash/history/" .. fs.filename(fs.basename(CONFIG_FILE)) .. ".db"
if not nixio.fs.access(HISTORY_PATH) and not nixio.fs.access(HISTORY_PATH_OLD) then
return "0"
else
@ -1245,4 +1247,15 @@ function ltn12_popen(command)
fdo:close()
nixio.exec("/bin/sh", "-c", command)
end
end
function create_file()
local file_name = luci.http.formvalue("filename")
local file_path = luci.http.formvalue("filepath")..file_name
fs.writefile(file_path, "")
if fs.isfile(file_path) then
return
else
luci.http.status(500, "Create File Faild")
end
end

View File

@ -202,6 +202,17 @@ uci:commit("openclash")
HTTP.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "config"))
end
btned=tb:option(Button,"edit",translate("Edit"))
btned.render=function(o,t,a)
o.inputstyle="apply"
Button.render(o,t,a)
end
btned.write=function(a,t)
local file_path = "etc/openclash/config/" .. fs.basename(e[t].name)
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "other-file-edit", "config", "%s") %file_path)
end
btncp=tb:option(Button,"copy",translate("Copy Config"))
btncp.template="openclash/other_button"
btncp.render=function(o,t,a)
@ -398,7 +409,7 @@ def.write = function(self, section, value)
end
local t = {
{Commit, Apply}
{Commit, Create, Apply}
}
a = m:section(Table, t)
@ -411,6 +422,11 @@ o.write = function()
uci:commit("openclash")
end
o = a:option(DummyValue, "Create", " ")
o.rawhtml = true
o.template = "openclash/input_file_name"
o.value = "/etc/openclash/config/"
o = a:option(Button, "Apply", " ")
o.inputtitle = translate("Apply Settings")
o.inputstyle = "apply"

View File

@ -30,6 +30,16 @@ nm2=tb2:option(DummyValue,"name",translate("File Name"))
mt2=tb2:option(DummyValue,"mtime",translate("Update Time"))
sz2=tb2:option(DummyValue,"size",translate("Size"))
btned1=tb2:option(Button,"edit",translate("Edit"))
btned1.render=function(g,n,h)
g.inputstyle="apply"
Button.render(g,n,h)
end
btned1.write=function(h,n)
local file_path = "etc/openclash/game_rules/" .. fs.basename(g[n].name)
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "other-file-edit", "game-rules-file-manage", "%s") %file_path)
end
btndl2 = tb2:option(Button,"download2",translate("Download Config"))
btndl2.template="openclash/other_button"
btndl2.render=function(m,n,h)
@ -75,7 +85,7 @@ return h
end
local t = {
{Refresh, Delete_all, Apply}
{Refresh, Create, Delete_all, Apply}
}
a = rule_form:section(Table, t)
@ -87,6 +97,11 @@ o.write = function()
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "game-rules-file-manage"))
end
o = a:option(DummyValue, "Create", " ")
o.rawhtml = true
o.template = "openclash/input_file_name"
o.value = "/etc/openclash/game_rules/"
o = a:option(Button, "Delete_all", " ")
o.inputtitle = translate("Delete All File")
o.inputstyle = "remove"

View File

@ -0,0 +1,68 @@
local NXFS = require "nixio.fs"
local SYS = require "luci.sys"
local HTTP = require "luci.http"
local fs = require "luci.openclash"
local file_path = ""
local edit_file_name = "/tmp/openclash_edit_file_name"
for i = 2, #(arg) do
file_path = file_path .. "/" .. arg[i]
end
if NXFS.readfile(edit_file_name) ~= file_path and fs.isfile(file_path) then
NXFS.writefile(edit_file_name, file_path)
else
if not fs.isfile(file_path) then
file_path = NXFS.readfile(edit_file_name)
fs.unlink(edit_file_name)
end
end
m = Map("openclash", translate("File Edit"))
m.pageaction = false
m.redirect = luci.dispatcher.build_url("admin/services/openclash/"..arg[1])
s = m:section(TypedSection, "openclash")
s.anonymous = true
s.addremove=false
o = s:option(TextValue, "edit_file")
o.rows = 50
o.wrap = "off"
function o.write(self, section, value)
if value then
value = value:gsub("\r\n?", "\n")
local old_value = NXFS.readfile(file_path)
if value ~= old_value then
NXFS.writefile(file_path, value)
end
end
end
function o.cfgvalue(self, section)
return NXFS.readfile(file_path) or ""
end
local t = {
{Commit, Back}
}
a = m:section(Table, t)
o = a:option(Button, "Commit", " ")
o.inputtitle = translate("Commit Settings")
o.inputstyle = "apply"
o.write = function()
luci.http.redirect(m.redirect)
end
o = a:option(Button,"Back", " ")
o.inputtitle = translate("Back Settings")
o.inputstyle = "reset"
o.write = function()
luci.http.redirect(m.redirect)
end
m:append(Template("openclash/config_editor"))
return m

View File

@ -30,6 +30,16 @@ nm1=tb1:option(DummyValue,"name",translate("File Name"))
mt1=tb1:option(DummyValue,"mtime",translate("Update Time"))
sz1=tb1:option(DummyValue,"size",translate("Size"))
btned1=tb1:option(Button,"edit",translate("Edit"))
btned1.render=function(p,x,r)
p.inputstyle="apply"
Button.render(p,x,r)
end
btned1.write=function(r,x)
local file_path = "etc/openclash/proxy_provider/" .. fs.basename(p[x].name)
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "other-file-edit", "proxy-provider-file-manage", "%s") %file_path)
end
btndl1 = tb1:option(Button,"download1",translate("Download Config"))
btndl1.template="openclash/other_button"
btndl1.render=function(y,x,r)
@ -75,7 +85,7 @@ return r
end
local t = {
{Refresh, Delete_all, Apply}
{Refresh, Create, Delete_all, Apply}
}
a = proxy_form:section(Table, t)
@ -87,6 +97,11 @@ o.write = function()
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "proxy-provider-file-manage"))
end
o = a:option(DummyValue, "Create", " ")
o.rawhtml = true
o.template = "openclash/input_file_name"
o.value = "/etc/openclash/proxy_provider/"
o = a:option(Button, "Delete_all", " ")
o.inputtitle = translate("Delete All File")
o.inputstyle = "remove"

View File

@ -30,6 +30,16 @@ nm2=tb2:option(DummyValue,"name",translate("File Name"))
mt2=tb2:option(DummyValue,"mtime",translate("Update Time"))
sz2=tb2:option(DummyValue,"size",translate("Size"))
btned1=tb2:option(Button,"edit",translate("Edit"))
btned1.render=function(g,n,h)
g.inputstyle="apply"
Button.render(g,n,h)
end
btned1.write=function(h,n)
local file_path = "etc/openclash/rule_provider/" .. fs.basename(g[n].name)
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "other-file-edit", "rule-providers-file-manage", "%s") %file_path)
end
btndl2 = tb2:option(Button,"download2",translate("Download Config"))
btndl2.template="openclash/other_button"
btndl2.render=function(m,n,h)
@ -75,7 +85,7 @@ return h
end
local t = {
{Refresh, Delete_all, Apply}
{Refresh, Create, Delete_all, Apply}
}
a = rule_form:section(Table, t)
@ -87,6 +97,11 @@ o.write = function()
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "rule-providers-file-manage"))
end
o = a:option(DummyValue, "Create", " ")
o.rawhtml = true
o.template = "openclash/input_file_name"
o.value = "/etc/openclash/rule_provider/"
o = a:option(Button, "Delete_all", " ")
o.inputtitle = translate("Delete All File")
o.inputstyle = "remove"

View File

@ -83,7 +83,7 @@ o:value("script", translate("Script Proxy Mode (Tun Core Only)"))
o.default = "rule"
o = s:taboption("op_mode", Flag, "ipv6_enable", font_red..bold_on..translate("Proxy IPv6 Traffic")..bold_off..font_off)
o.description = font_red..bold_on..translate("Disable IPv6 DHCP To Avoid Abnormal Connection If You Do Not Use")..bold_off..font_off
o.description = font_red..bold_on..translate("The Gateway and DNS of The Connected Device Must be The Router IP, Disable IPv6 DHCP To Avoid Abnormal Connection If You Do Not Use")..bold_off..font_off
o.default=0
o = s:taboption("op_mode", Flag, "china_ip6_route", translate("China IPv6 Route"))
@ -113,6 +113,10 @@ o:depends("en_mode", "redir-host")
o:depends("en_mode", "redir-host-tun")
o:depends("en_mode", "redir-host-mix")
o = s:taboption("op_mode", Flag, "bypass_gateway_compatible", translate("Bypass Gateway Compatible"))
o.description = translate("If The Ntwork Cannot be Connected in Bypass Gateway Mode, Please Try to Enable.")..font_red..bold_on..translate("Suggestion: If The Device Does Not Have WLAN, Please Disable The Lan Interface's Bridge Option")..bold_off..font_off
o.default=0
o = s:taboption("op_mode", Flag, "small_flash_memory", translate("Small Flash Memory"))
o.description = translate("Move Core And GEOIP Data File To /tmp/etc/openclash For Small Flash Memory Device")
o.default=0
@ -140,6 +144,17 @@ o:value("150")
o.datatype = "uinteger"
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.default = "0"
o = s:taboption("settings", Value, "delay_start", translate("Delay Start (s)"))
o.description = translate("Delay Start On Boot")
o.default = "0"
o.datatype = "uinteger"
o = s:taboption("settings", ListValue, "log_level", translate("Log Level"))
o.description = translate("Select Core's Log Level")
o:value("info", translate("Info Mode"))
@ -571,7 +586,7 @@ o.placeholder = "HBO|HBOGO|HBO GO"
o.description = translate("It Will Be Searched According To The Regex When Auto Search Group Fails")
o:depends("stream_auto_select_hbo_go_asia", "1")
o = s:taboption("stream_enhance", Value, "stream_auto_select_region_key_hbo_go_asia", translate("HBO Max Unlock Region Filter"))
o = s:taboption("stream_enhance", Value, "stream_auto_select_region_key_hbo_go_asia", translate("HBO GO Asia Unlock Region Filter"))
o.default = ""
o.placeholder = "HK|SG|TW"
o.description = translate("It Will Be Selected Region According To The Regex")
@ -587,7 +602,7 @@ o.placeholder = "TVB"
o.description = translate("It Will Be Searched According To The Regex When Auto Search Group Fails")
o:depends("stream_auto_select_tvb_anywhere", "1")
o = s:taboption("stream_enhance", Value, "stream_auto_select_region_key_tvb_anywhere", translate("HBO Max Unlock Region Filter"))
o = s:taboption("stream_enhance", Value, "stream_auto_select_region_key_tvb_anywhere", translate("TVB Anywhere+ Unlock Region Filter"))
o.default = ""
o.placeholder = "HK|SG|TW"
o.description = translate("It Will Be Selected Region According To The Regex")

View File

@ -124,11 +124,16 @@ var myEditor_name_cus_r1 = document.getElementById("cbid.openclash.config.custom
var myEditor_name_cus_r2 = document.getElementById("cbid.openclash.config.custom_rules");
var myEditor_fake_filter = document.getElementById("cbid.openclash.config.custom_fake_filter");
var myEditor_custom_domain_dns = document.getElementById("cbid.openclash.config.custom_domain_dns");
var myEditor_edit_file = document.getElementById("cbid.openclash.config.edit_file");
if (myEditor_hosts) {
editor(myEditor_hosts, 'false');
}
if (myEditor_edit_file) {
editor(myEditor_edit_file, 'false', "auto", '700px');
}
if (myEditor_fall_fil) {
editor(myEditor_fall_fil, 'false');
editor(myEditor_name_pol, 'false');

View File

@ -0,0 +1,19 @@
<%+cbi/valueheader%>
<script type="text/javascript">
//<![CDATA[
function import_file_name(btn, option, file_path) {
var file_name = prompt("<%:Paste the name of the new file (including the extension) here%>", "");
if (file_name == null || file_name == "") {
return false;
}
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "create_file")%>', {filename: file_name, filepath: file_path}, function(x, status) {
if (x && x.status == 200)
{
location.reload();
}
});
}
//]]>
</script>
<input type="button" class="btn cbi-button cbi-button-apply" value="<%:Create File%>" onclick="return import_file_name(this, '<%=self.option%>', '<%=self.value%>')" />
<%+cbi/valuefooter%>

View File

@ -33,14 +33,14 @@
<td width="25%"><%:CPU Architecture%></td><td width="25%" align="left" id="CPU_MODEL"><%:Collecting data...%></td></tr>
<tr><td width="100%" colspan="4">
<p align="center">
<b><%:Core path:%> /etc/openclash/core/clash</b>
<b><%:Core path:%>/etc/openclash/core/clash</b>
</p>
</td></tr>
<tr><td width="25%">[dev] <%:Current Core%></td><td width="25%" align="left" id="CORE_CV"><%:Collecting data...%></td><td width="25%">[dev] <%:Latest Core%></td><td width="25%" align="left" id="CORE_LV"><%:Collecting data...%></td></tr>
<tr><td width="25%"><%:Update Core%></td><td width="25%" align="left" id="core_up"><%:Collecting data...%></td><td width="25%"><%:Download Latest Core%></td><td width="25%" align="left" id="ma_core_up"><%:Collecting data...%></td></tr>
<tr><td width="100%" colspan="4">
<p align="center">
<b><%:Core path:%>/etc/openclash/core/clash_tun </b>
<b><%:Core path:%>/etc/openclash/core/clash_tun</b>
</p>
</td></tr>
<tr><td width="25%">[TUN] <%:Current Core%></td><td width="25%" align="left" id="CORE_TUN_CV"><%:Collecting data...%></td><td width="25%">[TUN] <%:Latest Core%></td><td width="25%" align="left" id="CORE_TUN_LV"><%:Collecting data...%></td></tr>

View File

@ -285,8 +285,8 @@ msgstr "(通讯协议)"
msgid "Proxy IPv6 Traffic"
msgstr "IPv6 流量代理"
msgid "Disable IPv6 DHCP To Avoid Abnormal Connection If You Do Not Use"
msgstr "如果您不使用请禁用IPv6的DHCP以避免连接异常"
msgid "The Gateway and DNS of The Connected Device Must be The Router IP, Disable IPv6 DHCP To Avoid Abnormal Connection If You Do Not Use"
msgstr "连接设备的网关和DNS须为路由器IP如果您不使用请禁用IPv6的DHCP以避免连接异常"
msgid "IPv6 DNS Resolve"
msgstr "允许IPv6类型DNS解析"
@ -2640,4 +2640,40 @@ msgid "DNS Remote"
msgstr "*远程域名解析"
msgid "Add DNS Remote Support For Redir-Host"
msgstr "Redir-Host模式强制进行远程域名解析"
msgstr "Redir-Host模式强制进行远程域名解析"
msgid "Bypass Gateway Compatible"
msgstr "旁路网关(旁路由)兼容"
msgid "If The Ntwork Cannot be Connected in Bypass Gateway Mode, Please Try to Enable."
msgstr "旁路网关(旁路由)模式下网络无法连接时请尝试启用。"
msgid "Suggestion: If The Device Does Not Have WLAN, Please Disable The Lan Interface's Bridge Option"
msgstr "建议如果设备没有WLAN请禁用Lan接口的桥接接口选项"
msgid "Github Address Modify"
msgstr "Github 地址修改"
msgid "Modify The Github Address In The Config And OpenClash With Proxy(CDN) To Prevent File Download Faild. Format Reference:"
msgstr "使用指定代理CDN反代插件和配置文件中的Github地址以防止文件下载失败格式参考"
msgid "File Edit"
msgstr "文件编辑"
msgid "Create File"
msgstr "新建文件"
msgid "Paste the name of the new file (including the extension) here"
msgstr "请在此输入要新建的文件名称(含扩展名)"
msgid "Delay Start (s)"
msgstr "延迟启动(秒)"
msgid "Delay Start On Boot"
msgstr "系统重启时延迟启动"
msgid "Enable Delay Start, OpenClash Will Start After"
msgstr "延迟启动已启用OpenClash 将在"
msgid "Secends..."
msgstr "秒后开始启动..."

View File

@ -46,6 +46,9 @@ config openclash 'config'
option stream_domains_prefetch '0'
option stream_auto_select '0'
option dns_remote '1'
option bypass_gateway_compatible '0'
option github_address_mod '0'
option delay_start '0'
option release_branch 'master'
option geo_custom_url 'https://cdn.jsdelivr.net/gh/alecthw/mmdb_china_ip_list@release/lite/Country.mmdb'
option chnr_custom_url 'https://ispip.clang.cn/all_cn.txt'
@ -139,7 +142,7 @@ config dns_servers
option group 'fallback'
option ip '2001:da8::666'
option port '53'
option enabled '1'
option enabled '0'
config dns_servers
option group 'fallback'

View File

@ -300,8 +300,16 @@ yml_provider_path()
x['path']='./$3/'+v
end
#CDN Replace
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]
if '$4' != '0' then
if '$4' == 'https://cdn.jsdelivr.net/' then
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
else
if x['url'] and x['url'] =~ /^https:\/\/(raw.|gist.)(githubusercontent.com|github.com)/ then
x['url'] = '$4' + x['url']
end
end
end
};
if not Value_1.eql?(Value['$2']) then
@ -434,7 +442,7 @@ yml_dns_get()
return
fi
if [[ $ip =~ $regex ]]; then
if [[ "$ip" =~ "$regex" ]]; then
ip="[${ip}]"
fi
@ -756,7 +764,16 @@ yml_gen_rule_provider_file()
RULE_PROVIDER_FILE_BEHAVIOR=$(grep ",$RULE_PROVIDER_FILE_NAME$" /usr/share/openclash/res/rule_providers.list |awk -F ',' '{print $3}' 2>/dev/null)
RULE_PROVIDER_FILE_PATH="/etc/openclash/rule_provider/$RULE_PROVIDER_FILE_NAME"
RULE_PROVIDER_FILE_URL_PATH="$(grep ",$RULE_PROVIDER_FILE_NAME$" /usr/share/openclash/res/rule_providers.list |awk -F ',' '{print $4$5}' 2>/dev/null)"
RULE_PROVIDER_FILE_URL="https://cdn.jsdelivr.net/gh/"$(echo "$RULE_PROVIDER_FILE_URL_PATH" |awk -F '/master' '{print $1}' 2>/dev/null)"@master"$(echo "$RULE_PROVIDER_FILE_URL_PATH" |awk -F 'master' '{print $2}')""
if [ "$github_address_mod" -eq 0 ]; then
RULE_PROVIDER_FILE_URL="https://raw.githubusercontent.com/${RULE_PROVIDER_FILE_URL_PATH}"
else
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then
RULE_PROVIDER_FILE_URL="https://cdn.jsdelivr.net/gh/"$(echo "$RULE_PROVIDER_FILE_URL_PATH" |awk -F '/master' '{print $1}' 2>/dev/null)"@master"$(echo "$RULE_PROVIDER_FILE_URL_PATH" |awk -F 'master' '{print $2}')""
else
RULE_PROVIDER_FILE_URL="${github_address_mod}https://raw.githubusercontent.com/${RULE_PROVIDER_FILE_URL_PATH}"
fi
fi
if [ -n "$(grep "$RULE_PROVIDER_FILE_URL" $RULE_PROVIDER_FILE 2>/dev/null)" ]; then
return
fi
@ -1166,6 +1183,9 @@ do_run_mode()
do_run_file()
{
#Some MIPS devices file system cound not use db
source "/etc/openwrt_release"
[ "$small_flash_memory" == "1" ] || [ -n "$(echo $core_version |grep mips)" ] || [ -n "$(echo $DISTRIB_ARCH |grep mips)" ] || [ -n "$(opkg status libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' |grep mips)" ] && mkdir -p /tmp/etc/openclash && CACHE_PATH="/tmp/etc/openclash/cache.db"
if [ "$small_flash_memory" != "1" ]; then
dev_core_path="/etc/openclash/core/clash"
tun_core_path="/etc/openclash/core/clash_tun"
@ -1176,23 +1196,22 @@ do_run_file()
mv "/tmp/etc/openclash/china_ip_route.ipset" "$chnr_path" 2>/dev/null
mv "/tmp/etc/openclash/china_ip6_route.ipset" "$chnr6_path" 2>/dev/null
mv "/tmp/etc/openclash/core/" "/etc/openclash" 2>/dev/null
mv "/tmp/etc/openclash/cache.db" "/etc/openclash/cache.db" 2>/dev/null
rm -rf "/tmp/etc/openclash" 2>/dev/null
if [ "$CACHE_PATH" != "/tmp/etc/openclash/cache.db" ]; then
rm -rf "/tmp/etc/openclash" 2>/dev/null
fi
else
dev_core_path="/tmp/etc/openclash/core/clash"
tun_core_path="/tmp/etc/openclash/core/clash_tun"
geoip_path="/tmp/etc/openclash/Country.mmdb"
chnr_path="/tmp/etc/openclash/china_ip_route.ipset"
chnr6_path="/tmp/etc/openclash/china_ip6_route.ipset"
CACHE_PATH="/tmp/etc/openclash/cache.db"
mkdir -p /tmp/etc/openclash
[ ! -h "/etc/openclash/Country.mmdb" ] && mv "/etc/openclash/Country.mmdb" "$geoip_path" 2>/dev/null
[ ! -h "/etc/openclash/china_ip_route.ipset" ] && mv "/etc/openclash/china_ip_route.ipset" "$chnr_path" 2>/dev/null
[ ! -h "/etc/openclash/china_ip6_route.ipset" ] && mv "/etc/openclash/china_ip6_route.ipset" "$chnr6_path" 2>/dev/null
mv "/etc/openclash/core/" "/tmp/etc/openclash" 2>/dev/null
[ ! -h "/etc/openclash/cache.db" ] && mv "/etc/openclash/cache.db" "$CACHE_PATH" 2>/dev/null
fi
rm -rf "/etc/openclash/cache.db" 2>/dev/null
rm -rf "/etc/openclash/clash" 2>/dev/null
if [ -n "$en_mode_tun" ]; then
@ -1292,12 +1311,16 @@ do_run_file()
ln -s "$chnr6_path" /etc/openclash/china_ip6_route.ipset 2>/dev/null
}
#Resore history cache
#Restore history cache
if [ -f "$HISTORY_PATH" ] && [ -f "$HISTORY_PATH_OLD" ]; then
if [ "$(date -r $HISTORY_PATH +%s)" -ge "$(date -r $HISTORY_PATH_OLD +%s)" ]; then
cmp -s "$CACHE_PATH" "$HISTORY_PATH"
if [ "$?" -ne "0" ]; then
cp "$HISTORY_PATH" "$CACHE_PATH" 2>/dev/null
if [ "$CACHE_PATH" != "/tmp/etc/openclash/cache.db" ]; then
ln -s "$HISTORY_PATH" "$CACHE_PATH" 2>/dev/null
else
cp "$HISTORY_PATH" "$CACHE_PATH" 2>/dev/null
fi
fi
else
cmp -s "$CACHE_PATH_OLD" "$HISTORY_PATH_OLD"
@ -1305,11 +1328,15 @@ do_run_file()
cp "$HISTORY_PATH_OLD" "$CACHE_PATH_OLD" 2>/dev/null
fi
fi
else
else
if [ -f "$HISTORY_PATH" ]; then
cmp -s "$CACHE_PATH" "$HISTORY_PATH"
if [ "$?" -ne "0" ]; then
cp "$HISTORY_PATH" "$CACHE_PATH" 2>/dev/null
if [ "$CACHE_PATH" != "/tmp/etc/openclash/cache.db" ]; then
ln -s "$HISTORY_PATH" "$CACHE_PATH" 2>/dev/null
else
cp "$HISTORY_PATH" "$CACHE_PATH" 2>/dev/null
fi
fi
fi
if [ -f "$HISTORY_PATH_OLD" ]; then
@ -1319,10 +1346,15 @@ do_run_file()
fi
fi
fi
[ -f "$CACHE_PATH" ] && [ "$small_flash_memory" = "1" ] && {
ln -s "$CACHE_PATH" /etc/openclash/cache.db 2>/dev/null
}
if [ "$CACHE_PATH" == "/tmp/etc/openclash/cache.db" ]; then
[ ! -f "$CACHE_PATH" ] && touch "$CACHE_PATH"
ln -s "$CACHE_PATH" /etc/openclash/cache.db 2>/dev/null
else
[ ! -f "$CACHE_PATH" ] && touch "$HISTORY_PATH"
ln -s "$HISTORY_PATH" "$CACHE_PATH" 2>/dev/null
fi
if [ -z "$_koolshare" ]; then
if ! capsh --is-uid=0 >/dev/null || ! capsh --has-ambient >/dev/null; then
LOG_OUT "Error: Could Not Load The Capsh Library, Please Verify The Capsh Shell Library Work Well"
@ -1704,13 +1736,19 @@ if [ "$china_ip_route" = "1" ] || [ "$disable_udp_quic" = "1" ]; then
ipset -! restore </etc/openclash/china_ip_route.ipset 2>/dev/null
fi
if [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(iptables -t nat -nL PREROUTING --line-number |grep 'DNS Hijack')"]; then
if [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(iptables -t nat -nL PREROUTING --line-number |grep 'OpenClash DNS Hijack')"]; then
DNSPORT=$(uci -q get dhcp.@dnsmasq[0].port)
if [ -z "$DNSPORT" ]; then
DNSPORT=$(netstat -nlp |grep -E '127.0.0.1:.*dnsmasq' |awk -F '127.0.0.1:' '{print $2}' |awk '{print $1}' |head -1 || echo "$dns_port")
fi
iptables -t nat -I PREROUTING -p udp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "DNS Hijack"
iptables -t nat -I PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "DNS Hijack"
iptables -t nat -I PREROUTING -p udp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack"
iptables -t nat -I PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack"
fi
#Bypass Gateway Compatible
if [ "$bypass_gateway_compatible" -eq 1 ]; then
iptables -t nat -I POSTROUTING -m addrtype ! --src-type LOCAL -m owner ! --uid-owner 65534 -m comment --comment "OpenClash Bypass Gateway Compatible" -j MASQUERADE
iptables -t nat -I POSTROUTING -m mark --mark "$PROXY_FWMARK" -m comment --comment "OpenClash Bypass Gateway Compatible" -j ACCEPT
fi
#lan_ac
@ -1876,9 +1914,9 @@ if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 2 ]; then
if [ "$en_mode" = "fake-ip" ]; then
iptables -t nat -N openclash_output
iptables -t nat -F openclash_output
if [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(iptables -t nat -nL OUTPUT --line-number |grep 'DNS Hijack')"]; then
iptables -t nat -I OUTPUT -p udp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "DNS Hijack"
iptables -t nat -I OUTPUT -p tcp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "DNS Hijack"
if [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(iptables -t nat -nL OUTPUT --line-number |grep 'OpenClash DNS Hijack')"]; then
iptables -t nat -I OUTPUT -p udp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack"
iptables -t nat -I OUTPUT -p tcp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack"
fi
iptables -t nat -A openclash_output -m set --match-set localnetwork dst -j RETURN
if [ "$intranet_allowed" -eq 1 ]; then
@ -1940,6 +1978,7 @@ 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
@ -1973,12 +2012,12 @@ if [ -n "$en_mode_tun" ]; then
iptables -t nat -N openclash_post
iptables -t nat -F openclash_post
iptables -t nat -A openclash_post -m owner ! --uid-owner 65534 -i lo -d 127.0.0.1 -j SNAT --to-source "$lan_ip"
iptables -t nat -A POSTROUTING -j openclash_post
iptables -t nat -I POSTROUTING -j openclash_post
elif [ "$en_mode" = "fake-ip" ]; then
iptables -t nat -N openclash_post
iptables -t nat -F openclash_post
iptables -t nat -A openclash_post -i lo -d 127.0.0.1 -j SNAT --to-source "$lan_ip"
iptables -t nat -A POSTROUTING -j openclash_post
iptables -t nat -I POSTROUTING -j openclash_post
fi
fi
@ -1991,13 +2030,11 @@ if [ -n "$en_mode_tun" ]; then
fi
fi
#ipv6
if [ "$ipv6_enable" -eq 1 ] && [ -n "$(ip6tables -t mangle -L 2>&1 | grep -o 'Chain')" ]; then
if [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(ip6tables -t nat -nL PREROUTING --line-number |grep 'dns_hijack')"]; then
ip6tables -t nat -I PREROUTING -p udp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "DNS Hijack"
ip6tables -t nat -I PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "DNS Hijack"
ip6tables -t nat -I PREROUTING -p udp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack"
ip6tables -t nat -I PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack"
fi
if [ "$china_ip6_route" = "1" ] || [ "$disable_udp_quic" = "1" ]; then
@ -2049,7 +2086,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" -j TPROXY --on-port "$tproxy_port" --tproxy-mark "$PROXY_FWMARK"
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 PREROUTING -j openclash
if [ -z "$_koolshare" ]; then
@ -2076,6 +2113,10 @@ if [ "$ipv6_enable" -eq 1 ] && [ -n "$(ip6tables -t mangle -L 2>&1 | grep -o 'Ch
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
if [ "$bypass_gateway_compatible" -eq 1 ]; then
ip6tables -t nat -I POSTROUTING -m addrtype ! --src-type LOCAL -m owner ! --uid-owner 65534 -m comment --comment "OpenClash Bypass Gateway Compatible" -j MASQUERADE
ip6tables -t nat -I POSTROUTING -m mark --mark "$PROXY_FWMARK" -m comment --comment "OpenClash Bypass Gateway Compatible" -j ACCEPT
fi
fi 2>/dev/null
#端口转发
@ -2101,7 +2142,7 @@ revert_firewall()
ip tuntap del utun mode tun >/dev/null 2>&1
for ipt in "iptables -nvL INPUT" "iptables -nvL FORWARD" "iptables -nvL POSTROUTING -t nat" "iptables -nvL OUTPUT -t nat" "iptables -nvL OUTPUT -t mangle" "iptables -nvL PREROUTING -t nat" "iptables -nvL PREROUTING -t mangle" "ip6tables -nvL PREROUTING -t mangle" "ip6tables -nvL OUTPUT -t mangle" "ip6tables -nvL PREROUTING -t nat" "ip6tables -nvL INPUT"; do
for comment in "openclash" "DNS Hijack" "OpenClash"; do
for comment in "openclash" "OpenClash"; do
local lines=$($ipt |sed 1,2d |sed -n "/${comment}/=" 2>/dev/null |sort -rn)
if [ -n "$lines" ]; then
for line in $lines; do
@ -2177,6 +2218,9 @@ get_config()
append_wan_dns=$(uci -q get openclash.config.append_wan_dns || echo 1)
store_fakeip=$(uci -q get openclash.config.store_fakeip || echo 1)
dns_remote=$(uci -q get openclash.config.dns_remote || echo 1)
bypass_gateway_compatible=$(uci -q get openclash.config.bypass_gateway_compatible || echo 0)
core_version=$(uci -q get openclash.config.core_version || echo 0)
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
_koolshare=$(cat /usr/lib/os-release 2>/dev/null |grep OPENWRT_RELEASE 2>/dev/null |grep -i koolshare 2>/dev/null)
[ -z "$dns_port" ] && dns_port=7874 && uci -q set openclash.config.dns_port=7874
[ "$ipv6_enable" -eq 1 ] && [ "$intranet_allowed" -eq 1 ] && intranet_allowed=0 && uci -q set openclash.config.intranet_allowed=0
@ -2214,8 +2258,8 @@ start()
/usr/share/openclash/yml_rules_change.sh 2>/dev/null "$LOGTIME" "$rule_source" "$enable_custom_clash_rules" "$CONFIG_FILE" "$enable_rule_proxy" "$CONFIG_NAME"
yml_custom_rule_provider
yml_game_custom
yml_provider_path "$CONFIG_FILE" "proxy-providers" "proxy_provider"
yml_provider_path "$CONFIG_FILE" "rule-providers" "rule_provider"
yml_provider_path "$CONFIG_FILE" "proxy-providers" "proxy_provider" "$github_address_mod"
yml_provider_path "$CONFIG_FILE" "rule-providers" "rule_provider" "$github_address_mod"
yml_vmess_compatible "$CONFIG_FILE" "proxies"
yml_dns_check "$CONFIG_FILE" "$FALLBACK_FILTER_FILE"
yml_tolerance_set "$CONFIG_FILE" "$tolerance"
@ -2300,17 +2344,19 @@ stop()
LOG_OUT "Step 6: Delete OpenClash Residue File..."
if [ "$enable" != "1" ]; then
rm -rf /www/luci-static/openclash
rm -rf /tmp/clash_last_version
rm -rf /tmp/Proxy_Group
rm -rf /tmp/rules_name
rm -rf /tmp/rule_providers_name
rm -rf /tmp/openclash_fake_filter.list
rm -rf /tmp/openclash_servers_fake_filter.conf
rm -rf /tmp/openclash_last_version
rm -rf /tmp/openclash_config.tmp
rm -rf /tmp/openclash.change
rm -rf /tmp/openclash_debug.log
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/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
rm -rf /tmp/openclash_debug.log >/dev/null 2>&1
rm -rf /tmp/etc/openclash >/dev/null 2>&1
rm -rf /tmp/openclash_edit_file_name >/dev/null 2>&1
del_lock
LOG_OUT "OpenClash Already Stop!"
sleep 3
@ -2318,8 +2364,8 @@ stop()
fi
del_cron
rm -rf /tmp/yaml_*
rm -rf $START_LOG
rm -rf /tmp/yaml_* >/dev/null 2>&1
rm -rf $START_LOG >/dev/null 2>&1
echo "OpenClash Already Stop!"
}
@ -2349,3 +2395,14 @@ reload()
del_lock
fi
}
boot()
{
delay_start=$(uci -q get openclash.config.delay_start || echo 0)
enable=$(uci -q get openclash.config.enable)
if [ "$delay_start" -gt 0 ] && [ "$enable" == "1" ]; then
LOG_OUT "Enable Delay Start, OpenClash Will Start After【$delay_start】Secends..."
sleep "$delay_start"
fi
restart
}

View File

@ -72,9 +72,12 @@ localhost.sec.qq.com
#Game
#Nintendo Switch
+.srv.nintendo.net
*.n.n.srv.nintendo.net
#Sony PlayStation
+.stun.playstation.net
#Microsoft Xbox
xbox.*.*.microsoft.com
*.*.xboxlive.com
xbox.*.microsoft.com
xnotify.xboxlive.com
#Wotgame
@ -91,6 +94,7 @@ stun.*.*.*
+.stun.*.*
+.stun.*.*.*
+.stun.*.*.*.*
+.stun.*.*.*.*.*
#Linksys Router
heartbeat.belkin.com
*.linksys.com

View File

@ -35,4 +35,8 @@ fallback-filter:
- "+.facebook.com"
- "+.youtube.com"
- "+.githubusercontent.com"
- "+.googlevideo.com"
- "+.googlevideo.com"
- "+.msftconnecttest.com"
- "+.msftncsi.com"
- msftconnecttest.com
- msftncsi.com

View File

@ -4,6 +4,14 @@ script:
## time-limit: in_cidr(src_ip,'192.168.1.2/32') and time.now().hour < 20 or time.now().hour > 21
## time-limit: src_ip == '192.168.1.2' and time.now().hour < 20 or time.now().hour > 21
## code: |
## def main(ctx, metadata):
## directkeywordlist = ["baidu"]
## for directkeyword in directkeywordlist:
## if directkeyword in metadata["host"]:
## ctx.log('[Script] matched keyword %s use direct' % directkeyword)
## return "DIRECT"
rules:
##- SCRIPT,quic,REJECT #shortcuts rule
##- SCRIPT,time-limit,REJECT #shortcuts rule

View File

@ -2,6 +2,14 @@ script:
## shortcuts:
## common_port: dst_port not in [21, 22, 23, 53, 80, 123, 143, 194, 443, 465, 587, 853, 993, 995, 998, 2052, 2053, 2082, 2083, 2086, 2095, 2096, 5222, 5228, 5229, 5230, 8080, 8443, 8880, 8888, 8889]
## code: |
## def main(ctx, metadata):
## directkeywordlist = ["baidu"]
## for directkeyword in directkeywordlist:
## if directkeyword in metadata["host"]:
## ctx.log('[Script] matched keyword %s use direct' % directkeyword)
## return "DIRECT"
rules:
##- SCRIPT,common_port,DIRECT #shortcuts rule

View File

@ -47,10 +47,10 @@ if [ -f "/tmp/openclash.bak" ]; then
mv -f "/tmp/openclash_custom_hosts.list.bak" "/etc/openclash/custom/openclash_custom_hosts.list" >/dev/null 2>&1
mv -f "/tmp/openclash_custom_fake_filter.list.bak" "/etc/openclash/custom/openclash_custom_fake_filter.list" >/dev/null 2>&1
mv -f "/tmp/openclash_custom_domain_dns.list.bak" "/etc/openclash/custom/openclash_custom_domain_dns.list" >/dev/null 2>&1
rm -rf "/etc/openclash/openclash"
rm -rf "/etc/openclash/fake_filter.list"
rm -rf "/etc/openclash/openclash_servers_fake_filter.conf"
rm -rf /tmp/openclash*
rm -rf "/etc/openclash/openclash" >/dev/null 2>&1
rm -rf "/etc/openclash/fake_filter.list" >/dev/null 2>&1
rm -rf "/etc/openclash/openclash_servers_fake_filter.conf" >/dev/null 2>&1
rm -rf "/tmp/openclash*" >/dev/null 2>&1
fi
source "/etc/openwrt_release"

View File

@ -13,15 +13,20 @@ del_lock() {
CKTIME=$(date "+%Y-%m-%d-%H")
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)
set_lock
if [ "$CKTIME" != "$(grep "CheckTime" $LAST_OPVER 2>/dev/null |awk -F ':' '{print $2}')" ]; then
if pidof clash >/dev/null; then
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then
curl -sL --connect-timeout 5 --retry 2 https://cdn.jsdelivr.net/gh/vernesong/OpenClash@"$RELEASE_BRANCH"/core_version -o $LAST_OPVER >/dev/null 2>&1
else
curl -sL --connect-timeout 5 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core_version -o $LAST_OPVER >/dev/null 2>&1
fi
else
curl -sL --connect-timeout 5 --retry 2 https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core_version -o $LAST_OPVER >/dev/null 2>&1
fi
if [ "$?" -ne "0" ] || ! pidof clash >/dev/null; then
curl -sL --connect-timeout 5 --retry 2 https://cdn.jsdelivr.net/gh/vernesong/OpenClash@"$RELEASE_BRANCH"/core_version -o $LAST_OPVER >/dev/null 2>&1
fi
if [ "$?" -eq "0" ] && [ -s "$LAST_OPVER" ]; then
echo "CheckTime:$CKTIME" >>$LAST_OPVER
else

View File

@ -43,6 +43,11 @@ kill_watchdog() {
for watchdog_pid in $watchdog_pids; do
kill -9 "$watchdog_pid" >/dev/null 2>&1
done
streaming_unlock_pids=$(unify_ps_pids "openclash_streaming_unlock.lua")
for streaming_unlock_pid in $streaming_unlock_pids; do
kill -9 "$streaming_unlock_pid" >/dev/null 2>&1
done >/dev/null 2>&1
}
config_download()
@ -462,7 +467,7 @@ sub_info_get()
template_path_encode=$(urlencode "$template_path")
[ -n "$key_match_param" ] && key_match_param="(?i)$(urlencode "$key_match_param")"
[ -n "$key_ex_match_param" ] && key_ex_match_param="(?i)$(urlencode "$key_ex_match_param")"
subscribe_url_param="?target=clash&new_name=true&url=$subscribe_url&config=$template_path_encode&include=$key_match_param&exclude=$key_ex_match_param&emoji=$emoji&list=false&sort=$sort&$udp&scv=$skip_cert_verify&append_type=$node_type&fdn=true&expand=false"
subscribe_url_param="?target=clash&new_name=true&url=$subscribe_url&config=$template_path_encode&include=$key_match_param&exclude=$key_ex_match_param&emoji=$emoji&list=false&sort=$sort&$udp&scv=$skip_cert_verify&append_type=$node_type&fdn=true&expand=false&classic=true"
c_address="$convert_address"
else
subscribe_url=$address

View File

@ -9,6 +9,7 @@ C_CORE_TYPE=$(uci get openclash.config.core_type 2>/dev/null)
small_flash_memory=$(uci get openclash.config.small_flash_memory 2>/dev/null)
CPU_MODEL=$(uci get openclash.config.core_version 2>/dev/null)
RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master")
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
[ ! -f "/tmp/clash_last_version" ] && /usr/share/openclash/clash_version.sh 2>/dev/null
if [ ! -f "/tmp/clash_last_version" ]; then
@ -49,41 +50,32 @@ esac
if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
if [ "$CPU_MODEL" != 0 ]; then
if [ "$RELEASE_BRANCH" = "dev" ]; then
case $CORE_TYPE in
"TUN")
LOG_OUT "【Tun】Core Downloading, Please Try to Download and Upload Manually If Fails"
curl -sL -m 10 --retry 2 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
;;
*)
LOG_OUT "【Dev】Core Downloading, Please Try to Download and Upload Manually If Fails"
curl -sL -m 10 --retry 2 https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz >/dev/null 2>&1
esac
else
if pidof clash >/dev/null; then
case $CORE_TYPE in
"TUN")
LOG_OUT "【Tun】Core Downloading, Please Try to Download and Upload Manually If Fails"
curl -sL -m 10 --retry 2 https://github.com/vernesong/OpenClash/releases/download/TUN-Premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz >/dev/null 2>&1
;;
*)
LOG_OUT "【Dev】Core Downloading, Please Try to Download and Upload Manually If Fails"
curl -sL -m 10 --retry 2 https://github.com/vernesong/OpenClash/releases/download/Clash/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz >/dev/null 2>&1
esac
fi
fi
if [ "$?" -ne "0" ] || ! pidof clash >/dev/null; then
case $CORE_TYPE in
case $CORE_TYPE in
"TUN")
LOG_OUT "【Tun】Core Downloading, Please Try to Download and Upload Manually If Fails"
curl -sL -m 10 --retry 2 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
;;
*)
LOG_OUT "【Dev】Core Downloading, Please Try to Download and Upload Manually If Fails"
curl -sL -m 10 --retry 2 https://cdn.jsdelivr.net/gh/vernesong/OpenClash@"$RELEASE_BRANCH"/core-lateset/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz >/dev/null 2>&1
esac
fi
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then
curl -sL -m 5 --retry 2 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
else
curl -sL -m 5 --retry 2 "$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
fi
else
curl -sL -m 5 --retry 2 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
fi
;;
*)
LOG_OUT "【Dev】Core Downloading, Please Try to Download and Upload Manually If Fails"
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then
curl -sL -m 10 --retry 2 https://cdn.jsdelivr.net/gh/vernesong/OpenClash@"$RELEASE_BRANCH"/core-lateset/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz >/dev/null 2>&1
else
curl -sL -m 10 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz >/dev/null 2>&1
fi
else
curl -sL -m 10 --retry 2 https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz >/dev/null 2>&1
fi
esac
if [ "$?" -eq "0" ]; then
LOG_OUT "【"$CORE_TYPE"】Core Download Successful, Start Update..."
case $CORE_TYPE in

View File

@ -14,15 +14,30 @@ urlencode() {
RULE_FILE_NAME="$1"
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 [ "$1" == "netflix_domains" ]; then
DOWNLOAD_PATH="https://raw.githubusercontent.com/vernesong/OpenClash/$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Netflix_Domains.list"
DOWNLOAD_PATH2="https://cdn.jsdelivr.net/gh/vernesong/OpenClash@$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Netflix_Domains.list"
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then
DOWNLOAD_PATH="https://cdn.jsdelivr.net/gh/vernesong/OpenClash@$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Netflix_Domains.list"
else
DOWNLOAD_PATH="${github_address_mod}https://raw.githubusercontent.com/vernesong/OpenClash/$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Netflix_Domains.list"
fi
else
DOWNLOAD_PATH="https://raw.githubusercontent.com/vernesong/OpenClash/$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Netflix_Domains.list"
fi
RULE_FILE_DIR="/usr/share/openclash/res/Netflix_Domains.list"
RULE_FILE_NAME="Netflix_Domains"
RULE_TYPE="netflix"
elif [ "$1" == "disney_domains" ]; then
DOWNLOAD_PATH="https://raw.githubusercontent.com/vernesong/OpenClash/$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Disney_Plus_Domains.list"
DOWNLOAD_PATH2="https://cdn.jsdelivr.net/gh/vernesong/OpenClash@$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Disney_Plus_Domains.list"
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then
DOWNLOAD_PATH="https://cdn.jsdelivr.net/gh/vernesong/OpenClash@$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Disney_Plus_Domains.list"
else
DOWNLOAD_PATH="${github_address_mod}https://raw.githubusercontent.com/vernesong/OpenClash/$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Disney_Plus_Domains.list"
fi
else
DOWNLOAD_PATH="https://raw.githubusercontent.com/vernesong/OpenClash/$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Disney_Plus_Domains.list"
fi
RULE_FILE_DIR="/usr/share/openclash/res/Disney_Plus_Domains.list"
RULE_FILE_NAME="Disney_Plus_Domains"
RULE_TYPE="disney"
@ -48,27 +63,27 @@ urlencode() {
if [ "$RULE_TYPE" = "netflix" ]; then
curl -sL --connect-timeout 5 --retry 2 "$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1
if [ "$?" -ne "0" ]; then
curl -sL --connect-timeout 5 --retry 2 "$DOWNLOAD_PATH2" -o "$TMP_RULE_DIR" >/dev/null 2>&1
fi
elif [ "$RULE_TYPE" = "disney" ]; then
curl -sL --connect-timeout 5 --retry 2 "$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1
if [ "$?" -ne "0" ]; then
curl -sL --connect-timeout 5 --retry 2 "$DOWNLOAD_PATH2" -o "$TMP_RULE_DIR" >/dev/null 2>&1
fi
elif [ "$RULE_TYPE" = "game" ]; then
if pidof clash >/dev/null; then
curl -sL --connect-timeout 5 --retry 2 https://raw.githubusercontent.com/FQrabbit/SSTap-Rule/master/rules/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1
fi
if [ "$?" -ne "0" ] || ! pidof clash >/dev/null; then
curl -sL --connect-timeout 5 --retry 2 https://cdn.jsdelivr.net/gh/FQrabbit/SSTap-Rule@master/rules/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then
curl -sL --connect-timeout 5 --retry 2 https://cdn.jsdelivr.net/gh/FQrabbit/SSTap-Rule@master/rules/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1
else
curl -sL --connect-timeout 5 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/FQrabbit/SSTap-Rule/master/rules/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1
fi
else
curl -sL --connect-timeout 5 --retry 2 https://raw.githubusercontent.com/FQrabbit/SSTap-Rule/master/rules/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1
fi
elif [ "$RULE_TYPE" = "provider" ]; then
if pidof clash >/dev/null; then
curl -sL --connect-timeout 5 --retry 2 https://raw.githubusercontent.com/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1
fi
if [ "$?" -ne "0" ] || ! pidof clash >/dev/null; then
curl -sL --connect-timeout 5 --retry 2 https://cdn.jsdelivr.net/gh/"$(echo "$DOWNLOAD_PATH" |awk -F '/master' '{print $1}' 2>/dev/null)"@master"$(echo "$DOWNLOAD_PATH" |awk -F 'master' '{print $2}')" -o "$TMP_RULE_DIR" >/dev/null 2>&1
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then
curl -sL --connect-timeout 5 --retry 2 https://cdn.jsdelivr.net/gh/"$(echo "$DOWNLOAD_PATH" |awk -F '/master' '{print $1}' 2>/dev/null)"@master"$(echo "$DOWNLOAD_PATH" |awk -F 'master' '{print $2}')" -o "$TMP_RULE_DIR" >/dev/null 2>&1
else
curl -sL --connect-timeout 5 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1
fi
else
curl -sL --connect-timeout 5 --retry 2 https://raw.githubusercontent.com/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1
fi
fi

View File

@ -29,12 +29,10 @@ CONFIG_NAME=$(echo "$CONFIG_FILE" |awk -F '/' '{print $4}' 2>/dev/null)
small_flash_memory=$(uci -q get openclash.config.small_flash_memory)
HISTORY_PATH_OLD="/etc/openclash/history/${CONFIG_NAME%.*}"
HISTORY_PATH="/etc/openclash/history/${CONFIG_NAME%.*}.db"
core_version=$(uci -q get openclash.config.core_version || echo 0)
CACHE_PATH_OLD="/etc/openclash/.cache"
if [ "$small_flash_memory" != "1" ]; then
CACHE_PATH="/etc/openclash/cache.db"
else
CACHE_PATH="/tmp/etc/openclash/cache.db"
fi
source "/etc/openwrt_release"
set_lock
if [ -z "$CONFIG_FILE" ] || [ ! -f "$CONFIG_FILE" ]; then
@ -45,10 +43,13 @@ if [ -z "$CONFIG_FILE" ] || [ ! -f "$CONFIG_FILE" ]; then
fi
if [ -n "$(pidof clash)" ] && [ -f "$CONFIG_FILE" ]; then
if [ -f "$CACHE_PATH" ]; then
cmp -s "$CACHE_PATH" "$HISTORY_PATH"
if [ "$?" -ne "0" ]; then
cp "$CACHE_PATH" "$HISTORY_PATH" 2>/dev/null
if [ "$small_flash_memory" == "1" ] || [ -n "$(echo $core_version |grep mips)" ] || [ -n "$(echo $DISTRIB_ARCH |grep mips)" ] || [ -n "$(opkg status libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' |grep mips)" ]; then
CACHE_PATH="/tmp/etc/openclash/cache.db"
if [ -f "$CACHE_PATH" ]; then
cmp -s "$CACHE_PATH" "$HISTORY_PATH"
if [ "$?" -ne "0" ]; then
cp "$CACHE_PATH" "$HISTORY_PATH" 2>/dev/null
fi
fi
fi
if [ -f "$CACHE_PATH_OLD" ]; then

View File

@ -14,6 +14,7 @@
small_flash_memory=$(uci get openclash.config.small_flash_memory 2>/dev/null)
GEOIP_CUSTOM_URL=$(uci get openclash.config.geo_custom_url 2>/dev/null)
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
set_lock
if [ "$small_flash_memory" != "1" ]; then
@ -25,14 +26,17 @@
fi
LOG_OUT "Start Downloading Geoip Database..."
if [ -z "$GEOIP_CUSTOM_URL" ]; then
if pidof clash >/dev/null; then
curl -sL --connect-timeout 10 --retry 2 https://raw.githubusercontent.com/alecthw/mmdb_china_ip_list/release/lite/Country.mmdb -o /tmp/Country.mmdb >/dev/null 2>&1
fi
if [ "$?" -ne "0" ] || ! pidof clash >/dev/null; then
curl -sL --connect-timeout 10 --retry 2 https://cdn.jsdelivr.net/gh/alecthw/mmdb_china_ip_list@release/lite/Country.mmdb -o /tmp/Country.mmdb >/dev/null 2>&1
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then
curl -sL --connect-timeout 5 --retry 2 https://cdn.jsdelivr.net/gh/alecthw/mmdb_china_ip_list@release/lite/Country.mmdb -o /tmp/Country.mmdb >/dev/null 2>&1
else
curl -sL --connect-timeout 5 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/alecthw/mmdb_china_ip_list/release/lite/Country.mmdb -o /tmp/Country.mmdb >/dev/null 2>&1
fi
else
curl -sL --connect-timeout 5 --retry 2 https://raw.githubusercontent.com/alecthw/mmdb_china_ip_list/release/lite/Country.mmdb -o /tmp/Country.mmdb >/dev/null 2>&1
fi
else
curl -sL --connect-timeout 10 --retry 2 "$GEOIP_CUSTOM_URL" -o /tmp/Country.mmdb >/dev/null 2>&1
curl -sL --connect-timeout 5 --retry 2 "$GEOIP_CUSTOM_URL" -o /tmp/Country.mmdb >/dev/null 2>&1
fi
if [ "$?" -eq "0" ] && [ -s "/tmp/Country.mmdb" ]; then
LOG_OUT "Geoip Database Download Success, Check Updated..."

View File

@ -34,28 +34,37 @@
LOG_OUT "Start Downloading Third Party Rules in Use..."
if [ "$rule_name" = "lhie1" ]; then
if pidof clash >/dev/null; then
curl -sL --connect-timeout 10 --retry 2 https://raw.githubusercontent.com/dler-io/Rules/master/Clash/Rule.yaml -o /tmp/rules.yaml >/dev/null 2>&1
fi
if [ "$?" -ne "0" ] || ! pidof clash >/dev/null; then
curl -sL --connect-timeout 10 --retry 2 https://cdn.jsdelivr.net/gh/dler-io/Rules@master/Clash/Rule.yaml -o /tmp/rules.yaml >/dev/null 2>&1
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then
curl -sL -m 5 --retry 2 https://cdn.jsdelivr.net/gh/dler-io/Rules@master/Clash/Rule.yaml -o /tmp/rules.yaml >/dev/null 2>&1
else
curl -sL -m 5 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/dler-io/Rules/master/Clash/Rule.yaml -o /tmp/rules.yaml >/dev/null 2>&1
fi
else
curl -sL -m 5 --retry 2 https://raw.githubusercontent.com/dler-io/Rules/master/Clash/Rule.yaml -o /tmp/rules.yaml >/dev/null 2>&1
fi
sed -i '1i rules:' /tmp/rules.yaml
elif [ "$rule_name" = "ConnersHua" ]; then
if pidof clash >/dev/null; then
curl -sL --connect-timeout 10 --retry 2 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/Outbound.yaml -o /tmp/rules.yaml >/dev/null 2>&1
fi
if [ "$?" -ne "0" ] || ! pidof clash >/dev/null; then
curl -sL --connect-timeout 10 --retry 2 https://cdn.jsdelivr.net/gh/DivineEngine/Profiles@master/Clash/Outbound.yaml -o /tmp/rules.yaml >/dev/null 2>&1
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then
curl -sL -m 5 --retry 2 https://cdn.jsdelivr.net/gh/DivineEngine/Profiles@master/Clash/Outbound.yaml -o /tmp/rules.yaml >/dev/null 2>&1
else
curl -sL -m 5 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/Outbound.yaml -o /tmp/rules.yaml >/dev/null 2>&1
fi
else
curl -sL -m 5 --retry 2 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/Outbound.yaml -o /tmp/rules.yaml >/dev/null 2>&1
fi
sed -i "s/# - RULE-SET,ChinaIP,DIRECT/- RULE-SET,ChinaIP,DIRECT/g" /tmp/rules.yaml 2>/dev/null
sed -i "s/- GEOIP,/#- GEOIP,/g" /tmp/rules.yaml 2>/dev/null
elif [ "$rule_name" = "ConnersHua_return" ]; then
if pidof clash >/dev/null; then
curl -sL --connect-timeout 10 --retry 2 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/Inbound.yaml -o /tmp/rules.yaml >/dev/null 2>&1
fi
if [ "$?" -ne "0" ] || ! pidof clash >/dev/null; then
curl -sL --connect-timeout 10 --retry 2 https://cdn.jsdelivr.net/gh/DivineEngine/Profiles@master/Clash/Inbound.yaml -o /tmp/rules.yaml >/dev/null 2>&1
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then
curl -sL -m 5 --retry 2 https://cdn.jsdelivr.net/gh/DivineEngine/Profiles@master/Clash/Inbound.yaml -o /tmp/rules.yaml >/dev/null 2>&1
else
curl -sL -m 5 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/Inbound.yaml -o /tmp/rules.yaml >/dev/null 2>&1
fi
else
curl -sL -m 5 --retry 2 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/Inbound.yaml -o /tmp/rules.yaml >/dev/null 2>&1
fi
fi
if [ "$?" -eq "0" ] && [ -s "/tmp/rules.yaml" ]; then
@ -131,6 +140,7 @@
LOGTIME=$(echo $(date "+%Y-%m-%d %H:%M:%S"))
LOG_FILE="/tmp/openclash.log"
RUlE_SOURCE=$(uci get openclash.config.rule_source 2>/dev/null)
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
set_lock
if [ "$RUlE_SOURCE" = "0" ]; then

View File

@ -11,7 +11,7 @@ local UA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (
local filmId = 70143836
local type = arg[1]
local enable = tonumber(uci:get("openclash", "config", "stream_auto_select")) or 0
local now_name, group_name, group_type, group_show, status
local now_name, group_name, group_type, group_show, status, ip, port, passwd, group_match_name
local groups = {}
local proxies = {}
@ -19,9 +19,6 @@ if enable == 0 or not type then os.exit(0) end
function unlock_auto_select()
local key_group, region, now, proxy, group_match, proxy_default, auto_get_group, info, group_now
local port = uci:get("openclash", "config", "cn_port")
local passwd = uci:get("openclash", "config", "dashboard_password") or ""
local ip = luci.sys.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
local original = {}
local other_region_unlock = {}
local tested_proxy = {}
@ -48,12 +45,8 @@ function unlock_auto_select()
local other_region_unlock_no_select = "but not match the regex! the type of group is not select, auto select could not work!"
local other_region_unlock_test_start = "full support but not match the regex! start auto select unlock proxy..."
if not ip or ip == "" then
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
if not ip or not port then
os.exit(0)
end
--Get ip port and password
get_auth_info()
info = luci.sys.exec(string.format('curl -sL -m 3 --retry 2 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -XGET http://%s:%s/proxies', passwd, ip, port))
if info then
@ -107,6 +100,7 @@ function unlock_auto_select()
break
else
--get groups info
group_match_name = value.name
get_proxy(info, value.name, value.name)
table.insert(tested_proxy, now_name)
group_match = true
@ -254,6 +248,7 @@ function unlock_auto_select()
break
end
if status == 2 then
close_connections()
break
elseif i == #(value.all) and (#original > 0 or #other_region_unlock > 0) then
if #other_region_unlock > 0 then
@ -265,6 +260,7 @@ function unlock_auto_select()
luci.sys.exec(string.format("curl -sL -m 3 --retry 2 -w %%{http_code} -o /dev/null -H 'Authorization: Bearer %s' -H 'Content-Type:application/json' -X PUT -d '{\"name\":\"%s\"}' http://%s:%s/proxies/%s", passwd, v[1], ip, port, urlencode(value.name)))
luci.sys.exec(string.format("curl -sL -m 3 --retry 2 -w %%{http_code} -o /dev/null -H 'Authorization: Bearer %s' -H 'Content-Type:application/json' -X PUT -d '{\"name\":\"%s\"}' http://%s:%s/proxies/%s", passwd, v[3], ip, port, urlencode(v[2])))
if #other_region_unlock > 0 then
close_connections()
print(os.date("%Y-%m-%d %H:%M:%S").." "..type.." "..gorup_i18..""..value.name..""..select_faild_other_region..""..v[3].."")
else
print(os.date("%Y-%m-%d %H:%M:%S").." "..type.." "..gorup_i18..""..value.name..""..select_faild..""..v[3].."")
@ -310,6 +306,41 @@ function unlock_auto_select()
end
end
function get_auth_info()
port = uci:get("openclash", "config", "cn_port")
passwd = uci:get("openclash", "config", "dashboard_password") or ""
ip = luci.sys.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
if not ip or ip == "" then
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
if not ip or not port then
os.exit(0)
end
end
function close_connections()
local con
local group_cons_id = {}
con = luci.sys.exec(string.format('curl -sL -m 5 --retry 2 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -XGET http://%s:%s/connections', passwd, ip, port))
if con then
con = json.parse(con)
end
if con then
for i = 1, #(con.connections) do
if con.connections[i].chains[#(con.connections[i].chains)] == group_match_name then
table.insert(group_cons_id, (con.connections[i].id))
end
end
--close connections
if #(group_cons_id) > 0 then
for i = 1, #(group_cons_id) do
luci.sys.exec(string.format('curl -sL -m 5 --retry 2 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -X DELETE http://%s:%s/connections/%s >/dev/null 2>&1', passwd, ip, port, group_cons_id[i]))
end
end
end
end
function proxy_unlock_test()
if type == "Netflix" then
region = netflix_unlock_test()
@ -536,6 +567,8 @@ function datamatch(data, regex)
if result == "true" then return true else return false end
end
-- Thanks https://github.com/lmc999/RegionRestrictionCheck --
function netflix_unlock_test()
status = 0
local url = "https://www.netflix.com/title/"..filmId
@ -566,33 +599,55 @@ end
function disney_unlock_test()
status = 0
local url = "https://global.edge.bamgrid.com/token"
local url2 = "https://www.disneyplus.com"
local headers = '-H "Accept-Language: en" -H "authorization: Bearer ZGlzbmV5JmJyb3dzZXImMS4wLjA.Cu56AgSfBTDag5NiRA81oLHkDZfu5L3CKadnefEAY84" -H "Content-Type: application/x-www-form-urlencoded"'
local auth = '"grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&latitude=0&longitude=0&platform=browser&subject_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJiNDAzMjU0NS0yYmE2LTRiZGMtOGFlOS04ZWI3YTY2NzBjMTIiLCJhdWQiOiJ1cm46YmFtdGVjaDpzZXJ2aWNlOnRva2VuIiwibmJmIjoxNjIyNjM3OTE2LCJpc3MiOiJ1cm46YmFtdGVjaDpzZXJ2aWNlOmRldmljZSIsImV4cCI6MjQ4NjYzNzkxNiwiaWF0IjoxNjIyNjM3OTE2LCJqdGkiOiI0ZDUzMTIxMS0zMDJmLTQyNDctOWQ0ZC1lNDQ3MTFmMzNlZjkifQ.g-QUcXNzMJ8DwC9JqZbbkYUSKkB1p4JGW77OON5IwNUcTGTNRLyVIiR8mO6HFyShovsR38HRQGVa51b15iAmXg&subject_token_type=urn%3Abamtech%3Aparams%3Aoauth%3Atoken-type%3Adevice"'
local httpcode = luci.sys.exec(string.format("curl -sL -m 3 --retry 2 -o /dev/null -w %%{http_code} %s -H 'User-Agent: %s' -d %s -XPOST %s", headers, UA, auth, url))
local region
local url = "https://global.edge.bamgrid.com/devices"
local url2 = "https://global.edge.bamgrid.com/token"
local url3 = "https://disney.api.edge.bamgrid.com/graph/v1/device/graphql"
local headers = '-H "Accept-Language: en" -H "Content-Type: application/json" -H "authorization: ZGlzbmV5JmJyb3dzZXImMS4wLjA.Cu56AgSfBTDag5NiRA81oLHkDZfu5L3CKadnefEAY84"'
local auth = '-H "authorization: Bearer ZGlzbmV5JmJyb3dzZXImMS4wLjA.Cu56AgSfBTDag5NiRA81oLHkDZfu5L3CKadnefEAY84"'
local body = '{"query":"mutation registerDevice($input: RegisterDeviceInput!) { registerDevice(registerDevice: $input) { grant { grantType assertion } } }","variables":{"input":{"deviceFamily":"browser","applicationRuntime":"chrome","deviceProfile":"windows","deviceLanguage":"en","attributes":{"osDeviceIds":[],"manufacturer":"microsoft","model":null,"operatingSystem":"windows","operatingSystemVersion":"10.0","browserName":"chrome","browserVersion":"96.0.4606"}}}}'
local region, assertion, data, preassertion, disneycookie, tokencontent
local regex = uci:get("openclash", "config", "stream_auto_select_region_key_disney") or ""
if tonumber(httpcode) == 200 then
status = 1
local url_effective = luci.sys.exec(string.format("curl -sL -m 3 --retry 2 -o /dev/null -w %%{url_effective} -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url2))
if url_effective == "https://disneyplus.disney.co.jp/" then
status = 2
region = "JP"
if not datamatch(region, regex) then
status = 3
end
return region
elseif string.find(url_effective,"hotstar") then
preassertion = luci.sys.exec(string.format("curl -sL -m 3 --retry 2 %s -H 'User-Agent: %s' -H 'content-type: application/json; charset=UTF-8' -d '{\"deviceFamily\":\"browser\",\"applicationRuntime\":\"chrome\",\"deviceProfile\":\"windows\",\"attributes\":{}}' -XPOST %s", auth, UA, url))
if preassertion and json.parse(preassertion) then
assertion = json.parse(preassertion).assertion
end
if not assertion then return end
disneycookie = "grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&latitude=0&longitude=0&platform=browser&subject_token="..assertion.."&subject_token_type=urn%3Abamtech%3Aparams%3Aoauth%3Atoken-type%3Adevice"
tokencontent = luci.sys.exec(string.format("curl -sL -m 3 --retry 2 %s -H 'User-Agent: %s' -d '%s' -XPOST %s", auth, UA, disneycookie, url2))
if tokencontent and json.parse(tokencontent) then
if json.parse(tokencontent).error_description then
status = 1
return
end
local region = luci.sys.exec(string.format("curl -sL -m 3 --retry 2 -H 'Content-Type: application/json' -H 'User-Agent: %s' %s |grep 'Region: ' |awk '{print $2}' |tr -d '\n'", UA, url2))
if region and region ~= "" then
status = 2
if not datamatch(region, regex) then
status = 3
end
data = luci.sys.exec(string.format("curl -sL -m 3 --retry 2 %s -H 'User-Agent: %s' -d '%s' -XPOST %s", headers, UA, body, url3))
if data and json.parse(data) then
status = 1
if json.parse(data).extensions and json.parse(data).extensions.sdk and json.parse(data).extensions.sdk.session then
region = json.parse(data).extensions.sdk.session.location.countryCode or ""
inSupportedLocation = json.parse(data).extensions.sdk.session.inSupportedLocation or ""
if region == "JP" then
status = 2
if not datamatch(region, regex) then
status = 3
end
return region
end
if region and region ~= "" and inSupportedLocation then
status = 2
if not datamatch(region, regex) then
status = 3
end
return region
end
return region
end
end
return

View File

@ -25,22 +25,20 @@ LAST_VER=$(sed -n 1p "$LAST_OPVER" 2>/dev/null |sed "s/^v//g" |tr -d "\n")
OP_CV=$(sed -n 1p /usr/share/openclash/res/openclash_version 2>/dev/null |awk -F '-' '{print $1}' |awk -F 'v' '{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)
RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master")
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
set_lock
if [ "$(expr "$OP_LV" \> "$OP_CV")" -eq 1 ] && [ -f "$LAST_OPVER" ]; then
LOG_OUT "Start Downloading【OpenClash - v$LAST_VER】..."
if [ "$RELEASE_BRANCH" = "dev" ]; then
curl -sL -m 10 --retry 2 https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk >/dev/null 2>&1
else
if pidof clash >/dev/null; then
curl -sL -m 10 --retry 2 https://github.com/vernesong/OpenClash/releases/download/v"$LAST_VER"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk >/dev/null 2>&1
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then
curl -sL -m 5 --retry 2 https://cdn.jsdelivr.net/gh/vernesong/OpenClash@"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk >/dev/null 2>&1
else
curl -sL -m 5 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk >/dev/null 2>&1
fi
else
curl -sL -m 5 --retry 2 https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk >/dev/null 2>&1
fi
if [ "$?" -ne "0" ] || ! pidof clash >/dev/null; then
curl -sL -m 10 --retry 2 https://cdn.jsdelivr.net/gh/vernesong/OpenClash@"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk >/dev/null 2>&1
fi
if [ "$?" -eq "0" ] && [ -s "/tmp/openclash.ipk" ]; then
LOG_OUT "【OpenClash - v$LAST_VER】Download Successful, Start Pre Update Test..."
opkg install /tmp/openclash.ipk --noaction >>$LOG_FILE

View File

@ -4,14 +4,19 @@ LAST_OPVER="/tmp/openclash_last_version"
RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master")
OP_CV=$(sed -n 1p /usr/share/openclash/res/openclash_version 2>/dev/null |awk -F '-' '{print $1}' |awk -F 'v' '{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 [ "$CKTIME" != "$(grep "CheckTime" $LAST_OPVER 2>/dev/null |awk -F ':' '{print $2}')" ]; then
if pidof clash >/dev/null; then
curl -sL --connect-timeout 5 --retry 2 https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/version -o $LAST_OPVER >/dev/null 2>&1
fi
if [ "$?" -ne "0" ] || ! pidof clash >/dev/null; then
curl -sL --connect-timeout 5 --retry 2 https://cdn.jsdelivr.net/gh/vernesong/OpenClash@"$RELEASE_BRANCH"/version -o $LAST_OPVER >/dev/null 2>&1
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ]; then
curl -sL -m 5 --retry 2 https://cdn.jsdelivr.net/gh/vernesong/OpenClash@"$RELEASE_BRANCH"/version -o $LAST_OPVER >/dev/null 2>&1
else
curl -sL -m 5 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/version -o $LAST_OPVER >/dev/null 2>&1
fi
else
curl -sL -m 5 --retry 2 https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/version -o $LAST_OPVER >/dev/null 2>&1
fi
if [ "$?" -eq "0" ] && [ -s "$LAST_OPVER" ]; then
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)
if [ "$(expr "$OP_CV" \>= "$OP_LV")" -eq 1 ]; then

File diff suppressed because one or more lines are too long

View File

@ -25,7 +25,29 @@ yml_other_set()
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
Value['script']['code'].merge!(Value_1['script']['code']).uniq
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

View File

@ -82,6 +82,11 @@ CodeMirror.defineMode("lua", function(config, parserConfig) {
stream.skipToEnd();
return "comment";
}
if (ch == "【") {
stream.eatWhile(/[^】]/);
stream.eat("】");
return "string";
}
if (ch == "\"" || ch == "'")
return (state.cur = string(ch))(stream, state);
if (ch == "[" && /[\[=]/.test(stream.peek()))
@ -131,11 +136,11 @@ CodeMirror.defineMode("lua", function(config, parserConfig) {
if (stream.eatSpace()) return null;
var style = state.cur(stream, state);
var word = stream.current();
if (style == "variable") {
if (keywords.test(word)) style = "keyword";
else if (builtins.test(word)) style = "builtin";
else if (specials.test(word)) style = "variable-2";
}
//if (style == "variable") {
// if (keywords.test(word)) style = "keyword";
// if (builtins.test(word)) style = "builtin";
// else if (specials.test(word)) style = "variable-2";
//}
if ((style != "comment") && (style != "string")){
if (indentTokens.test(word)) ++state.indentDepth;
else if (dedentTokens.test(word)) --state.indentDepth;

View File

@ -1,53 +0,0 @@
#
# Copyright (C) 2014 OpenWrt-dist
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=redsocks2
PKG_VERSION:=0.67
PKG_RELEASE:=4
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/semigodking/redsocks.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=d94c245ea47859cda5b4b7373308589206b97bdc
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MAINTAINER:=semigodking <semigodking@gmail.com>
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
define Package/redsocks2
SECTION:=net
CATEGORY:=Network
SUBMENU:=Web Servers/Proxies
TITLE:=Redirect any TCP connection to a SOCKS or HTTPS proxy server
URL:=https://github.com/semigodking/redsocks
DEPENDS:=+libevent2 +libopenssl
endef
define Package/redsocks2/description
This is a modified version of original redsocks. \
The name is changed to be REDSOCKS2 since this release to distinguish with original redsocks. \
This variant is useful for anti-GFW (Great Fire Wall).
endef
define Package/redsocks2/conffiles
/etc/config/redsocks2
endef
define Build/Compile
$(call Build/Compile/Default,DISABLE_SHADOWSOCKS=true)
endef
define Package/redsocks2/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/redsocks2 $(1)/usr/sbin
endef
$(eval $(call BuildPackage,redsocks2))

View File

@ -1,38 +0,0 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=tcpping
PKG_VERSION:=0.2
PKG_RELEASE=$(PKG_SOURCE_VERSION)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/coolsnowwolf/tcping
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=d890cc1bd8e3951390ceeff1ccb092a5d802850c
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
include $(INCLUDE_DIR)/package.mk
define Package/tcpping
SECTION:=net
CATEGORY:=Network
DEPENDS:=+libnet-1.2.x
TITLE:=Ping look-alike that uses TCP SYN packets to get around firewalls and ICMP blackholes
endef
define Package/tcpping/description
Ping look-alike that uses TCP SYN packets to get around firewalls and ICMP blackholes
endef
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
$(TARGET_CONFIGURE_OPTS) \
CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/lib/libnet-1.2.x/include -L$(STAGING_DIR)/usr/lib/libnet-1.2.x/lib" \
INSTALL_PROG=":"
endef
define Package/tcpping/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tcpping $(1)/usr/bin/tcpping
endef
$(eval $(call BuildPackage,tcpping))