mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-08 10:23:47 +08:00
OpenClash: bump to 0.41.12
This commit is contained in:
parent
91b3428a14
commit
d17959e3a8
@ -1,7 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-openclash
|
||||
PKG_VERSION:=0.41.06
|
||||
PKG_VERSION:=0.41.12
|
||||
PKG_RELEASE:=beta
|
||||
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>
|
||||
|
||||
|
@ -39,7 +39,8 @@ function index()
|
||||
entry({"admin", "services", "openclash", "switch_mode"}, call("action_switch_mode"))
|
||||
entry({"admin", "services", "openclash", "op_mode"}, call("action_op_mode"))
|
||||
entry({"admin", "services", "openclash", "settings"},cbi("openclash/settings"),_("Global Settings"), 30).leaf = true
|
||||
entry({"admin", "services", "openclash", "servers"},cbi("openclash/servers"),_("Severs and Groups"), 40).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", "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
|
||||
|
@ -47,10 +47,8 @@ o.datatype = "or(host, string)"
|
||||
o.rmempty = false
|
||||
|
||||
---- subconverter
|
||||
o = s:option(ListValue, "sub_convert", translate("Subscribe Convert Online"))
|
||||
o = s:option(Flag, "sub_convert", translate("Subscribe Convert Online"))
|
||||
o.description = translate("Convert Subscribe Online With Template, Mix Proxies and Keep Settings options Will Not Effect")
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o.default=0
|
||||
|
||||
---- Template
|
||||
|
@ -21,10 +21,8 @@ s = m:section(TypedSection, "openclash")
|
||||
s.anonymous = true
|
||||
|
||||
---- update Settings
|
||||
o = s:option(ListValue, "auto_update", translate("Auto Update"))
|
||||
o = s:option(Flag, "auto_update", translate("Auto Update"))
|
||||
o.description = translate("Auto Update Server subscription")
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o.default=0
|
||||
|
||||
o = s:option(ListValue, "config_auto_update_mode", translate("Update Mode"))
|
||||
@ -131,7 +129,7 @@ o.write = function()
|
||||
function(s)
|
||||
if s.name ~= "" and s.name ~= nil and s.enabled == "1" then
|
||||
local back_cfg_path_yaml="/etc/openclash/backup/" .. s.name .. ".yaml"
|
||||
local back_cfg_path_yml="/etc/openclash/backup/" .. s.name .. ".yaml"
|
||||
local back_cfg_path_yml="/etc/openclash/backup/" .. s.name .. ".yml"
|
||||
fs.unlink(back_cfg_path_yaml)
|
||||
fs.unlink(back_cfg_path_yml)
|
||||
end
|
||||
|
@ -104,17 +104,6 @@ uci:foreach("openclash", "groups",
|
||||
end)
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
o:depends("type", "select")
|
||||
o:depends("type", "relay")
|
||||
o.rmempty = true
|
||||
|
||||
o = s:option(DynamicList, "other_group_dr", translate("Other Group"))
|
||||
o.description = font_red..bold_on..translate("The Added Proxy Groups Must Exist Except 'DIRECT' & 'REJECT'")..bold_off..font_off
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
o:depends("type", "url-test")
|
||||
o:depends("type", "fallback")
|
||||
o:depends("type", "load-balance")
|
||||
o.rmempty = true
|
||||
|
||||
local t = {
|
||||
|
@ -0,0 +1,270 @@
|
||||
|
||||
local m, s, o
|
||||
local openclash = "openclash"
|
||||
local uci = luci.model.uci.cursor()
|
||||
local fs = require "luci.openclash"
|
||||
local sys = require "luci.sys"
|
||||
local sid = arg[1]
|
||||
|
||||
font_red = [[<font color="red">]]
|
||||
font_green = [[<font color="green">]]
|
||||
font_off = [[</font>]]
|
||||
bold_on = [[<strong>]]
|
||||
bold_off = [[</strong>]]
|
||||
|
||||
function IsYamlFile(e)
|
||||
e=e or""
|
||||
local e=string.lower(string.sub(e,-5,-1))
|
||||
return e == ".yaml"
|
||||
end
|
||||
function IsYmlFile(e)
|
||||
e=e or""
|
||||
local e=string.lower(string.sub(e,-4,-1))
|
||||
return e == ".yml"
|
||||
end
|
||||
|
||||
m = Map(openclash, translate("Other Rules Edit"))
|
||||
m.pageaction = false
|
||||
m.redirect = luci.dispatcher.build_url("admin/services/openclash/settings")
|
||||
if m.uci:get(openclash, sid) ~= "other_rules" then
|
||||
luci.http.redirect(m.redirect)
|
||||
return
|
||||
end
|
||||
|
||||
-- [[ Other Rules Setting ]]--
|
||||
s = m:section(NamedSection, sid, "other_rules")
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
|
||||
o = s:option(ListValue, "config", translate("Config File"))
|
||||
local e,a={}
|
||||
local groupnames,filename
|
||||
for t,f in ipairs(fs.glob("/etc/openclash/config/*"))do
|
||||
a=fs.stat(f)
|
||||
if a then
|
||||
e[t]={}
|
||||
e[t].name=fs.basename(f)
|
||||
if IsYamlFile(e[t].name) or IsYmlFile(e[t].name) then
|
||||
o:value(e[t].name)
|
||||
end
|
||||
if e[t].name == m.uci:get(openclash, sid, "config") then
|
||||
filename = e[t].name
|
||||
groupnames = sys.exec(string.format('ruby -ryaml -E UTF-8 -e "YAML.load_file(\'%s\')[\'proxy-groups\'].each do |i| puts i[\'name\']+\'##\' end" 2>/dev/null',f))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
o = s:option(Button, translate("Get Group Names"))
|
||||
o.title = translate("Get Group Names")
|
||||
o.inputtitle = translate("Get Group Names")
|
||||
o.description = translate("Get Group Names After Select Config File")
|
||||
o.inputstyle = "reload"
|
||||
o.write = function()
|
||||
m.uci:commit("openclash")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin/services/openclash/other-rules-edit/%s") % sid)
|
||||
end
|
||||
|
||||
if groupnames ~= nil and filename ~= nil then
|
||||
o = s:option(ListValue, "rule_name", translate("Other Rules Name"))
|
||||
o.rmempty = true
|
||||
o:value("lhie1", translate("lhie1 Rules"))
|
||||
o:value("ConnersHua", translate("ConnersHua(Provider-type) Rules"))
|
||||
o:value("ConnersHua_return", translate("ConnersHua Return Rules"))
|
||||
|
||||
o = s:option(ListValue, "GlobalTV", translate("GlobalTV"))
|
||||
o:depends("rule_name", "lhie1")
|
||||
o:depends("rule_name", "ConnersHua")
|
||||
o.rmempty = true
|
||||
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
|
||||
if groupname ~= nil and groupname ~= "" then
|
||||
o:value(groupname)
|
||||
end
|
||||
end
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
|
||||
o = s:option(ListValue, "AsianTV", translate("AsianTV"))
|
||||
o:depends("rule_name", "lhie1")
|
||||
o:depends("rule_name", "ConnersHua")
|
||||
o.rmempty = true
|
||||
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
|
||||
if groupname ~= nil and groupname ~= "" then
|
||||
o:value(groupname)
|
||||
end
|
||||
end
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
|
||||
o = s:option(ListValue, "Proxy", translate("Proxy"))
|
||||
o:depends("rule_name", "lhie1")
|
||||
o:depends("rule_name", "ConnersHua")
|
||||
o:depends("rule_name", "ConnersHua_return")
|
||||
o.rmempty = true
|
||||
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
|
||||
if groupname ~= nil and groupname ~= "" then
|
||||
o:value(groupname)
|
||||
end
|
||||
end
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
|
||||
o = s:option(ListValue, "Youtube", translate("Youtube"))
|
||||
o:depends("rule_name", "lhie1")
|
||||
o.rmempty = true
|
||||
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
|
||||
if groupname ~= nil and groupname ~= "" then
|
||||
o:value(groupname)
|
||||
end
|
||||
end
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
|
||||
o = s:option(ListValue, "Apple", translate("Apple"))
|
||||
o:depends("rule_name", "lhie1")
|
||||
o.rmempty = true
|
||||
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
|
||||
if groupname ~= nil and groupname ~= "" then
|
||||
o:value(groupname)
|
||||
end
|
||||
end
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
|
||||
o = s:option(ListValue, "Microsoft", translate("Microsoft"))
|
||||
o:depends("rule_name", "lhie1")
|
||||
o.rmempty = true
|
||||
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
|
||||
if groupname ~= nil and groupname ~= "" then
|
||||
o:value(groupname)
|
||||
end
|
||||
end
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
|
||||
o = s:option(ListValue, "Netflix", translate("Netflix"))
|
||||
o:depends("rule_name", "lhie1")
|
||||
o.rmempty = true
|
||||
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
|
||||
if groupname ~= nil and groupname ~= "" then
|
||||
o:value(groupname)
|
||||
end
|
||||
end
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
|
||||
o = s:option(ListValue, "Spotify", translate("Spotify"))
|
||||
o:depends("rule_name", "lhie1")
|
||||
o.rmempty = true
|
||||
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
|
||||
if groupname ~= nil and groupname ~= "" then
|
||||
o:value(groupname)
|
||||
end
|
||||
end
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
|
||||
o = s:option(ListValue, "Steam", translate("Steam"))
|
||||
o:depends("rule_name", "lhie1")
|
||||
o.rmempty = true
|
||||
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
|
||||
if groupname ~= nil and groupname ~= "" then
|
||||
o:value(groupname)
|
||||
end
|
||||
end
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
|
||||
o = s:option(ListValue, "Speedtest", translate("Speedtest"))
|
||||
o:depends("rule_name", "lhie1")
|
||||
o.rmempty = true
|
||||
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
|
||||
if groupname ~= nil and groupname ~= "" then
|
||||
o:value(groupname)
|
||||
end
|
||||
end
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
|
||||
o = s:option(ListValue, "Telegram", translate("Telegram"))
|
||||
o:depends("rule_name", "lhie1")
|
||||
o.rmempty = true
|
||||
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
|
||||
if groupname ~= nil and groupname ~= "" then
|
||||
o:value(groupname)
|
||||
end
|
||||
end
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
|
||||
o = s:option(ListValue, "PayPal", translate("PayPal"))
|
||||
o:depends("rule_name", "lhie1")
|
||||
o.rmempty = true
|
||||
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
|
||||
if groupname ~= nil and groupname ~= "" then
|
||||
o:value(groupname)
|
||||
end
|
||||
end
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
|
||||
o = s:option(ListValue, "AdBlock", translate("AdBlock"))
|
||||
o:depends("rule_name", "lhie1")
|
||||
o.rmempty = true
|
||||
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
|
||||
if groupname ~= nil and groupname ~= "" then
|
||||
o:value(groupname)
|
||||
end
|
||||
end
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
|
||||
o = s:option(ListValue, "Domestic", translate("Domestic"))
|
||||
o:depends("rule_name", "lhie1")
|
||||
o:depends("rule_name", "ConnersHua")
|
||||
o.rmempty = true
|
||||
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
|
||||
if groupname ~= nil and groupname ~= "" then
|
||||
o:value(groupname)
|
||||
end
|
||||
end
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
|
||||
o = s:option(ListValue, "Others", translate("Others"))
|
||||
o:depends("rule_name", "lhie1")
|
||||
o:depends("rule_name", "ConnersHua")
|
||||
o:depends("rule_name", "ConnersHua_return")
|
||||
o.rmempty = true
|
||||
o.description = translate("Choose Proxy Groups, Base On Your Config File").." ( "..font_green..bold_on..filename..bold_off..font_off.." )"
|
||||
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
|
||||
if groupname ~= nil and groupname ~= "" then
|
||||
o:value(groupname)
|
||||
end
|
||||
end
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
|
||||
end
|
||||
|
||||
local t = {
|
||||
{Commit, Back}
|
||||
}
|
||||
a = m:section(Table, t)
|
||||
|
||||
o = a:option(Button,"Commit")
|
||||
o.inputtitle = translate("Commit Configurations")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
m.uci:commit(openclash)
|
||||
--luci.http.redirect(m.redirect)
|
||||
end
|
||||
|
||||
o = a:option(Button,"Back")
|
||||
o.inputtitle = translate("Back Configurations")
|
||||
o.inputstyle = "reset"
|
||||
o.write = function()
|
||||
m.uci:revert(openclash)
|
||||
luci.http.redirect(m.redirect)
|
||||
end
|
||||
|
||||
return m
|
@ -219,6 +219,7 @@ o.default = "none"
|
||||
o:value("none")
|
||||
o:value("websocket", translate("websocket (ws)"))
|
||||
o:value("http", translate("http"))
|
||||
o:value("h2", translate("h2"))
|
||||
o:depends("type", "vmess")
|
||||
|
||||
o = s:option(Value, "host", translate("obfs-hosts"))
|
||||
@ -236,6 +237,16 @@ o.rmempty = true
|
||||
o:depends("obfs", "websocket")
|
||||
o:depends("obfs_vmess", "websocket")
|
||||
|
||||
o = s:option(DynamicList, "h2_host", translate("host"))
|
||||
o.rmempty = true
|
||||
o.datatype = "host"
|
||||
o:depends("obfs_vmess", "h2")
|
||||
|
||||
o = s:option(Value, "h2_path", translate("path"))
|
||||
o.rmempty = true
|
||||
o.default = "/"
|
||||
o:depends("obfs_vmess", "h2")
|
||||
|
||||
o = s:option(DynamicList, "http_path", translate("path"))
|
||||
o.rmempty = true
|
||||
o:value("/")
|
||||
|
@ -15,10 +15,8 @@ m.pageaction = false
|
||||
s = m:section(TypedSection, "openclash")
|
||||
s.anonymous = true
|
||||
|
||||
o = s:option(ListValue, "create_config", translate("Create Config"))
|
||||
o = s:option(Flag, "create_config", translate("Create Config"))
|
||||
o.description = font_red .. bold_on .. translate("Create Config By One-Click Only Need Proxys") .. bold_off .. font_off
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o.default=0
|
||||
|
||||
o = s:option(ListValue, "rule_sources", translate("Choose Template For Create Config"))
|
||||
@ -28,17 +26,13 @@ o:value("lhie1", translate("lhie1 Rules"))
|
||||
o:value("ConnersHua", translate("ConnersHua(Provider-type) Rules"))
|
||||
o:value("ConnersHua_return", translate("ConnersHua Return Rules"))
|
||||
|
||||
o = s:option(ListValue, "mix_proxies", translate("Mix Proxies"))
|
||||
o = s:option(Flag, "mix_proxies", translate("Mix Proxies"))
|
||||
o.description = font_red .. bold_on .. translate("Mix This Page's Proxies") .. bold_off .. font_off
|
||||
o:depends("create_config", 1)
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o.default=0
|
||||
|
||||
o = s:option(ListValue, "servers_update", translate("Keep Settings"))
|
||||
o = s:option(Flag, "servers_update", translate("Keep Settings"))
|
||||
o.description = font_red .. bold_on .. translate("Only Update Servers Below When Subscription") .. bold_off .. font_off
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o.default=0
|
||||
|
||||
o = s:option(DynamicList, "new_servers_group", translate("New Servers Group"))
|
||||
@ -181,7 +175,7 @@ o.template="openclash/ping"
|
||||
o.width="10%"
|
||||
|
||||
local tt = {
|
||||
{Delete_Unused_Servers, Delete_Severs, Delete_Proxy_Provider, Delete_Groups}
|
||||
{Delete_Unused_Servers, Delete_Servers, Delete_Proxy_Provider, Delete_Groups}
|
||||
}
|
||||
|
||||
b = m:section(Table, tt)
|
||||
@ -196,8 +190,8 @@ o.write = function()
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "servers"))
|
||||
end
|
||||
|
||||
o = b:option(Button,"Delete_Severs")
|
||||
o.inputtitle = translate("Delete Severs")
|
||||
o = b:option(Button,"Delete_Servers")
|
||||
o.inputtitle = translate("Delete Servers")
|
||||
o.inputstyle = "reset"
|
||||
o.write = function()
|
||||
m.uci:set("openclash", "config", "enable", 0)
|
||||
|
@ -53,21 +53,19 @@ o:value("fake-ip-mix", translate("fake-ip-mix(tun mix mode)"))
|
||||
o.default = "fake-ip"
|
||||
end
|
||||
|
||||
o = s:taboption("op_mode", ListValue, "enable_udp_proxy", font_red..bold_on..translate("Proxy UDP Traffics")..bold_off..font_off)
|
||||
o = s:taboption("op_mode", Flag, "enable_udp_proxy", font_red..bold_on..translate("Proxy UDP Traffics")..bold_off..font_off)
|
||||
o.description = translate("Select Mode For UDP Traffics, The Servers Must Support UDP while Choose Proxy")
|
||||
o:depends("en_mode", "redir-host")
|
||||
o:depends("en_mode", "fake-ip")
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o.default = "1"
|
||||
|
||||
o = s:taboption("op_mode", ListValue, "stack_type", font_red..bold_on..translate("Select Stack Type")..bold_off..font_off)
|
||||
o = s:taboption("op_mode", ListValue, "stack_type", translate("Select Stack Type"))
|
||||
o.description = translate("Select Stack Type For Tun Mode, According To The Running Speed on Your Machine")
|
||||
o:depends("en_mode", "redir-host-tun")
|
||||
o:depends("en_mode", "fake-ip-tun")
|
||||
o:depends("en_mode", "redir-host-mix")
|
||||
o:depends("en_mode", "fake-ip-mix")
|
||||
o:value("system", translate("System"))
|
||||
o:value("system", translate("System "))
|
||||
o:value("gvisor", translate("Gvisor"))
|
||||
o.default = "system"
|
||||
|
||||
@ -79,20 +77,28 @@ o:value("direct", translate("Direct Proxy Mode"))
|
||||
o:value("script", translate("Script Proxy Mode (Tun Core Only)"))
|
||||
o.default = "rule"
|
||||
|
||||
o = s:taboption("op_mode", ListValue, "china_ip_route", font_red..bold_on..translate("China IP Route")..bold_off..font_off)
|
||||
o.description = translate("Bypass The China Network Flows, Improve Performance")
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o = s:taboption("op_mode", Flag, "enable_rule_proxy", font_red..bold_on..translate("Rule Match Proxy Mode")..bold_off..font_off)
|
||||
o.description = translate("Only Proxy Rules Match, Prevent BT/P2P Passing")
|
||||
o.default=0
|
||||
|
||||
o = s:taboption("op_mode", Flag, "common_ports", font_red..bold_on..translate("Common Ports Proxy Mode")..bold_off..font_off)
|
||||
o.description = translate("Only Common Ports, Prevent BT/P2P Passing")
|
||||
o.default = "0"
|
||||
o:depends("en_mode", "redir-host")
|
||||
o:depends("en_mode", "redir-host-tun")
|
||||
o:depends("en_mode", "redir-host-vpn")
|
||||
o:depends("en_mode", "redir-host-mix")
|
||||
|
||||
o = s:taboption("op_mode", ListValue, "small_flash_memory", font_red..bold_on..translate("Small Flash Memory")..bold_off..font_off)
|
||||
o = s:taboption("op_mode", Flag, "china_ip_route", translate("China IP Route"))
|
||||
o.description = translate("Bypass The China Network Flows, Improve Performance")
|
||||
o.default = "0"
|
||||
o:depends("en_mode", "redir-host")
|
||||
o:depends("en_mode", "redir-host-tun")
|
||||
o:depends("en_mode", "redir-host-vpn")
|
||||
o:depends("en_mode", "redir-host-mix")
|
||||
|
||||
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:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o.default = "0"
|
||||
|
||||
---- Operation Mode
|
||||
@ -118,12 +124,6 @@ o:value("linux-mipsle-hardfloat")
|
||||
o:value("0", translate("Not Set"))
|
||||
o.default=0
|
||||
|
||||
o = s:taboption("settings", ListValue, "enable_rule_proxy", font_red..bold_on..translate("Rule Match Proxy Mode")..bold_off..font_off)
|
||||
o.description = translate("Only Proxy Rules Match, Prevent BT Passing")
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o.default=0
|
||||
|
||||
o = s:taboption("settings", ListValue, "interface_name", font_red..bold_on..translate("Bind Network Interface")..bold_off..font_off)
|
||||
local de_int = SYS.exec("ip route |grep 'default' |awk '{print $5}' 2>/dev/null")
|
||||
o.description = translate("Default Interface Name:").." "..font_green..bold_on..de_int..bold_off..font_off..translate(",Try Enable If Network Loopback")
|
||||
@ -143,14 +143,8 @@ o:value("debug", translate("Debug Mode"))
|
||||
o:value("silent", translate("Silent Mode"))
|
||||
o.default = "silent"
|
||||
|
||||
o = s:taboption("settings", ListValue, "intranet_allowed", translate("Only intranet allowed"))
|
||||
o.description = translate("When Enabled, The Control Panel And The Connection Broker Port Will Not Be Accessible From The Public Network, TUN Not Support Yet")
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o:depends("en_mode", "redir-host")
|
||||
o:depends("en_mode", "fake-ip")
|
||||
o:depends("en_mode", "redir-host-vpn")
|
||||
o:depends("en_mode", "fake-ip-vpn")
|
||||
o = s:taboption("settings", Flag, "intranet_allowed", translate("Only intranet allowed"))
|
||||
o.description = translate("When Enabled, The Control Panel And The Connection Broker Port Will Not Be Accessible From The Public Network")
|
||||
o.default = 0
|
||||
|
||||
o = s:taboption("settings", Value, "proxy_port")
|
||||
@ -182,34 +176,24 @@ o.rmempty = false
|
||||
o.description = translate("Please Make Sure Ports Available")
|
||||
|
||||
---- DNS Settings
|
||||
o = s:taboption("dns", ListValue, "enable_redirect_dns", font_red..bold_on..translate("Redirect Local DNS Setting")..bold_off..font_off)
|
||||
o = s:taboption("dns", Flag, "enable_redirect_dns", font_red..bold_on..translate("Redirect Local DNS Setting")..bold_off..font_off)
|
||||
o.description = translate("Set Local DNS Redirect")
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o.default = 1
|
||||
|
||||
o = s:taboption("dns", ListValue, "enable_custom_dns", font_red..bold_on..translate("Custom DNS Setting")..bold_off..font_off)
|
||||
o = s:taboption("dns", Flag, "enable_custom_dns", font_red..bold_on..translate("Custom DNS Setting")..bold_off..font_off)
|
||||
o.description = font_red..bold_on..translate("Set OpenClash Upstream DNS Resolve Server")..bold_off..font_off
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o.default = 0
|
||||
|
||||
o = s:taboption("dns", ListValue, "ipv6_enable", translate("Enable ipv6 Resolve"))
|
||||
o = s:taboption("dns", Flag, "ipv6_enable", translate("Enable ipv6 Resolve"))
|
||||
o.description = font_red..bold_on..translate("Enable Clash to Resolve ipv6 DNS Requests")..bold_off..font_off
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o.default=0
|
||||
|
||||
o = s:taboption("dns", ListValue, "disable_masq_cache", translate("Disable Dnsmasq's DNS Cache"))
|
||||
o = s:taboption("dns", Flag, "disable_masq_cache", translate("Disable Dnsmasq's DNS Cache"))
|
||||
o.description = translate("Recommended Enabled For Avoiding Some Connection Errors")..font_red..bold_on..translate("(Maybe Incompatible For Your Firmware)")..bold_off..font_off
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o.default=0
|
||||
|
||||
o = s:taboption("dns", ListValue, "dns_advanced_setting", translate("Advanced Setting"))
|
||||
o = s:taboption("dns", Flag, "dns_advanced_setting", translate("Advanced Setting"))
|
||||
o.description = translate("DNS Advanced Settings")..font_red..bold_on..translate("(Please Don't Modify it at Will)")..bold_off..font_off
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o.default=0
|
||||
|
||||
if op_mode == "fake-ip" then
|
||||
@ -314,132 +298,61 @@ o.datatype = "ipaddr"
|
||||
o.description = translate("In The Fake-IP Mode, Only Pure IP Requests Are Supported")
|
||||
|
||||
---- Rules Settings
|
||||
if op_mode == "fake-ip" then
|
||||
o = s:taboption("rules", ListValue, "enable_custom_clash_rules", font_red..bold_on..translate("Custom Clash Rules(Access Control)")..bold_off..font_off)
|
||||
else
|
||||
o = s:taboption("rules", ListValue, "enable_custom_clash_rules", font_red..bold_on..translate("Custom Clash Rules")..bold_off..font_off)
|
||||
end
|
||||
o.description = translate("Use Custom Rules")
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o = s:taboption("rules", Flag, "rule_source", translate("Enable Other Rules"))
|
||||
o.description = translate("Use Other Rules")
|
||||
o.default = 0
|
||||
|
||||
o = s:taboption("rules", ListValue, "rule_source", translate("Enable Other Rules"))
|
||||
o.description = translate("Use Other Rules")
|
||||
o:value("0", translate("Disable Other Rules"))
|
||||
o:value("lhie1", translate("lhie1 Rules"))
|
||||
o:value("ConnersHua", translate("ConnersHua(Provider-type) Rules"))
|
||||
o:value("ConnersHua_return", translate("ConnersHua Return Rules"))
|
||||
|
||||
if not fs.isfile("/tmp/Proxy_Group") then
|
||||
SYS.call("/usr/share/openclash/yml_groups_name_get.sh 2>/dev/null")
|
||||
if op_mode == "fake-ip" then
|
||||
o = s:taboption("rules", Flag, "enable_custom_clash_rules", font_red..bold_on..translate("Custom Clash Rules(Access Control)")..bold_off..font_off)
|
||||
else
|
||||
o = s:taboption("rules", Flag, "enable_custom_clash_rules", font_red..bold_on..translate("Custom Clash Rules")..bold_off..font_off)
|
||||
end
|
||||
file = io.open("/tmp/Proxy_Group", "r");
|
||||
o.description = translate("Use Custom Rules")
|
||||
o.default = 0
|
||||
|
||||
o = s:taboption("rules", ListValue, "GlobalTV", translate("GlobalTV"))
|
||||
o:depends("rule_source", "lhie1")
|
||||
o:depends("rule_source", "ConnersHua")
|
||||
for l in file:lines() do
|
||||
o:value(l)
|
||||
end
|
||||
file:seek("set")
|
||||
o = s:taboption("rules", ListValue, "AsianTV", translate("AsianTV"))
|
||||
o:depends("rule_source", "lhie1")
|
||||
o:depends("rule_source", "ConnersHua")
|
||||
for l in file:lines() do
|
||||
o:value(l)
|
||||
end
|
||||
file:seek("set")
|
||||
o = s:taboption("rules", ListValue, "Proxy", translate("Proxy"))
|
||||
o:depends("rule_source", "lhie1")
|
||||
o:depends("rule_source", "ConnersHua")
|
||||
o:depends("rule_source", "ConnersHua_return")
|
||||
for l in file:lines() do
|
||||
o:value(l)
|
||||
end
|
||||
file:seek("set")
|
||||
o = s:taboption("rules", ListValue, "Youtube", translate("Youtube"))
|
||||
o:depends("rule_source", "lhie1")
|
||||
for l in file:lines() do
|
||||
o:value(l)
|
||||
end
|
||||
file:seek("set")
|
||||
o = s:taboption("rules", ListValue, "Apple", translate("Apple"))
|
||||
o:depends("rule_source", "lhie1")
|
||||
for l in file:lines() do
|
||||
o:value(l)
|
||||
end
|
||||
file:seek("set")
|
||||
o = s:taboption("rules", ListValue, "Microsoft", translate("Microsoft"))
|
||||
o:depends("rule_source", "lhie1")
|
||||
for l in file:lines() do
|
||||
o:value(l)
|
||||
end
|
||||
file:seek("set")
|
||||
o = s:taboption("rules", ListValue, "Netflix", translate("Netflix"))
|
||||
o:depends("rule_source", "lhie1")
|
||||
for l in file:lines() do
|
||||
o:value(l)
|
||||
end
|
||||
file:seek("set")
|
||||
o = s:taboption("rules", ListValue, "Spotify", translate("Spotify"))
|
||||
o:depends("rule_source", "lhie1")
|
||||
for l in file:lines() do
|
||||
o:value(l)
|
||||
end
|
||||
file:seek("set")
|
||||
o = s:taboption("rules", ListValue, "Steam", translate("Steam"))
|
||||
o:depends("rule_source", "lhie1")
|
||||
for l in file:lines() do
|
||||
o:value(l)
|
||||
end
|
||||
file:seek("set")
|
||||
o = s:taboption("rules", ListValue, "Speedtest", translate("Speedtest"))
|
||||
o:depends("rule_source", "lhie1")
|
||||
for l in file:lines() do
|
||||
o:value(l)
|
||||
end
|
||||
file:seek("set")
|
||||
o = s:taboption("rules", ListValue, "Telegram", translate("Telegram"))
|
||||
o:depends("rule_source", "lhie1")
|
||||
for l in file:lines() do
|
||||
o:value(l)
|
||||
end
|
||||
file:seek("set")
|
||||
o = s:taboption("rules", ListValue, "PayPal", translate("PayPal"))
|
||||
o:depends("rule_source", "lhie1")
|
||||
for l in file:lines() do
|
||||
o:value(l)
|
||||
end
|
||||
file:seek("set")
|
||||
o = s:taboption("rules", ListValue, "AdBlock", translate("AdBlock"))
|
||||
o:depends("rule_source", "lhie1")
|
||||
for l in file:lines() do
|
||||
o:value(l)
|
||||
end
|
||||
file:seek("set")
|
||||
o = s:taboption("rules", ListValue, "Domestic", translate("Domestic"))
|
||||
o:depends("rule_source", "lhie1")
|
||||
o:depends("rule_source", "ConnersHua")
|
||||
for l in file:lines() do
|
||||
o:value(l)
|
||||
end
|
||||
file:seek("set")
|
||||
o = s:taboption("rules", ListValue, "Others", translate("Others"))
|
||||
o:depends("rule_source", "lhie1")
|
||||
o:depends("rule_source", "ConnersHua")
|
||||
o:depends("rule_source", "ConnersHua_return")
|
||||
o.description = translate("Choose Proxy Group, Base On Your Servers Group in config.yaml")
|
||||
for l in file:lines() do
|
||||
o:value(l)
|
||||
end
|
||||
file:close()
|
||||
custom_rules = s:taboption("rules", Value, "custom_rules")
|
||||
custom_rules:depends("enable_custom_clash_rules", 1)
|
||||
custom_rules.template = "cbi/tvalue"
|
||||
custom_rules.description = translate("Custom Rules Here, For More Go Github:https://github.com/Dreamacro/clash/blob/master/README.md, IP To CIDR: http://ip2cidr.com")
|
||||
custom_rules.rows = 20
|
||||
custom_rules.wrap = "off"
|
||||
|
||||
function custom_rules.cfgvalue(self, section)
|
||||
return NXFS.readfile("/etc/openclash/custom/openclash_custom_rules.list") or ""
|
||||
end
|
||||
function custom_rules.write(self, section, value)
|
||||
if value then
|
||||
value = value:gsub("\r\n?", "\n")
|
||||
local old_value = NXFS.readfile("/etc/openclash/custom/openclash_custom_rules.list")
|
||||
if value ~= old_value then
|
||||
NXFS.writefile("/etc/openclash/custom/openclash_custom_rules.list", value)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
custom_rules_2 = s:taboption("rules", Value, "custom_rules_2")
|
||||
custom_rules_2:depends("enable_custom_clash_rules", 1)
|
||||
custom_rules_2.template = "cbi/tvalue"
|
||||
custom_rules_2.description = translate("Custom Rules 2 Here, For More Go Github:https://github.com/Dreamacro/clash/blob/master/README.md, IP To CIDR: http://ip2cidr.com")
|
||||
custom_rules_2.rows = 20
|
||||
custom_rules_2.wrap = "off"
|
||||
|
||||
function custom_rules_2.cfgvalue(self, section)
|
||||
return NXFS.readfile("/etc/openclash/custom/openclash_custom_rules_2.list") or ""
|
||||
end
|
||||
function custom_rules_2.write(self, section, value)
|
||||
if value then
|
||||
value = value:gsub("\r\n?", "\n")
|
||||
local old_value = NXFS.readfile("/etc/openclash/custom/openclash_custom_rules_2.list")
|
||||
if value ~= old_value then
|
||||
NXFS.writefile("/etc/openclash/custom/openclash_custom_rules_2.list", value)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---- update Settings
|
||||
o = s:taboption("rules_update", ListValue, "other_rule_auto_update", translate("Auto Update"))
|
||||
o = s:taboption("rules_update", Flag, "other_rule_auto_update", translate("Auto Update"))
|
||||
o.description = font_red..bold_on..translate("Auto Update Other Rules")..bold_off..font_off
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o.default=0
|
||||
|
||||
o = s:taboption("rules_update", ListValue, "other_rule_update_week_time", translate("Update Time (Every Week)"))
|
||||
@ -471,10 +384,8 @@ o.write = function()
|
||||
HTTP.redirect(DISP.build_url("admin", "services", "openclash"))
|
||||
end
|
||||
|
||||
o = s:taboption("geo_update", ListValue, "geo_auto_update", translate("Auto Update"))
|
||||
o = s:taboption("geo_update", Flag, "geo_auto_update", translate("Auto Update"))
|
||||
o.description = translate("Auto Update GEOIP Database")
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o.default=0
|
||||
|
||||
o = s:taboption("geo_update", ListValue, "geo_update_week_time", translate("Update Time (Every Week)"))
|
||||
@ -494,6 +405,16 @@ o:value(t, t..":00")
|
||||
end
|
||||
o.default=0
|
||||
|
||||
o = s:taboption("geo_update", Value, "geo_custom_url")
|
||||
o.title = translate("Custom GEOIP URL")
|
||||
o.rmempty = false
|
||||
o.description = translate("Custom GEOIP Data URL, Click Button Below To Refresh After Edit")
|
||||
o:value("http://www.ideame.top/mmdb/Country.mmdb", translate("Alecthw-Version")..translate("(Default)"))
|
||||
o:value("https://cdn.jsdelivr.net/gh/Hackl0us/GeoIP2-CN@release/Country.mmdb", translate("Hackl0us-Version")..translate("(Only CN)"))
|
||||
o:value("https://static.clash.to/GeoIP2/GeoIP2-Country.mmdb", translate("Static.clash.to"))
|
||||
o:value("https://geolite.clash.dev/Country.mmdb", translate("Geolite.clash.dev"))
|
||||
o.default = "http://www.ideame.top/mmdb/Country.mmdb"
|
||||
|
||||
o = s:taboption("geo_update", Button, translate("GEOIP Update"))
|
||||
o.title = translate("Update GEOIP Database")
|
||||
o.inputtitle = translate("Check And Update")
|
||||
@ -506,10 +427,8 @@ o.write = function()
|
||||
end
|
||||
|
||||
if op_mode == "redir-host" then
|
||||
o = s:taboption("chnr_update", ListValue, "chnr_auto_update", translate("Auto Update"))
|
||||
o = s:taboption("chnr_update", Flag, "chnr_auto_update", translate("Auto Update"))
|
||||
o.description = translate("Auto Update Chnroute Lists")
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o.default=0
|
||||
|
||||
o = s:taboption("chnr_update", ListValue, "chnr_update_week_time", translate("Update Time (Every Week)"))
|
||||
@ -529,6 +448,15 @@ o:value(t, t..":00")
|
||||
end
|
||||
o.default=0
|
||||
|
||||
o = s:taboption("chnr_update", Value, "chnr_custom_url")
|
||||
o.title = translate("Custom Chnroute Lists URL")
|
||||
o.rmempty = false
|
||||
o.description = translate("Custom Chnroute Lists URL, Click Button Below To Refresh After Edit")
|
||||
o:value("https://ispip.clang.cn/all_cn.txt", translate("Clang-CN")..translate("(Default)"))
|
||||
o:value("https://ispip.clang.cn/all_cn_cidr.txt", translate("Clang-CN-CIDR"))
|
||||
o:value("https://cdn.jsdelivr.net/gh/Hackl0us/GeoIP2-CN@release/CN-ip-cidr.txt", translate("Hackl0us-CN-CIDR")..translate("(Large Size)"))
|
||||
o.default = "https://ispip.clang.cn/all_cn.txt"
|
||||
|
||||
o = s:taboption("chnr_update", Button, translate("Chnroute Lists Update"))
|
||||
o.title = translate("Update Chnroute Lists")
|
||||
o.inputtitle = translate("Check And Update")
|
||||
@ -625,6 +553,46 @@ o:value("https", translate("HTTPS"))
|
||||
o.default = "udp"
|
||||
o.rempty = false
|
||||
|
||||
-- [[ Other Rules Manage ]]--
|
||||
ss = m:section(TypedSection, "other_rules", translate("Other Rules Edit")..translate("(Take Effect After Choose Above)"))
|
||||
ss.anonymous = true
|
||||
ss.addremove = true
|
||||
ss.sortable = true
|
||||
ss.template = "cbi/tblsection"
|
||||
ss.extedit = luci.dispatcher.build_url("admin/services/openclash/other-rules-edit/%s")
|
||||
function ss.create(...)
|
||||
local sid = TypedSection.create(...)
|
||||
if sid then
|
||||
luci.http.redirect(ss.extedit % sid)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
o = ss:option(Flag, "enabled", translate("Enable"))
|
||||
o.rmempty = false
|
||||
o.default = o.enabled
|
||||
o.cfgvalue = function(...)
|
||||
return Flag.cfgvalue(...) or "1"
|
||||
end
|
||||
|
||||
o = ss:option(DummyValue, "config", translate("Config File"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
o = ss:option(DummyValue, "rule_name", translate("Other Rules Name"))
|
||||
function o.cfgvalue(...)
|
||||
if Value.cfgvalue(...) == "lhie1" then
|
||||
return translate("lhie1 Rules")
|
||||
elseif Value.cfgvalue(...) == "ConnersHua" then
|
||||
return translate("ConnersHua(Provider-type) Rules")
|
||||
elseif Value.cfgvalue(...) == "ConnersHua_return" then
|
||||
return translate("ConnersHua Return Rules")
|
||||
else
|
||||
return translate("None")
|
||||
end
|
||||
end
|
||||
|
||||
-- [[ Edit Authentication ]] --
|
||||
s = m:section(TypedSection, "authentication", translate("Set Authentication of SOCKS5/HTTP(S)"))
|
||||
s.anonymous = true
|
||||
@ -651,47 +619,6 @@ o = s:option(Value, "password", translate("Password"))
|
||||
o.placeholder = translate("Not Null")
|
||||
o.rmempty = true
|
||||
|
||||
s = m:section(TypedSection, "openclash", translate("Set Custom Rules"))
|
||||
s.anonymous = true
|
||||
|
||||
custom_rules = s:option(Value, "custom_rules")
|
||||
custom_rules.template = "cbi/tvalue"
|
||||
custom_rules.description = translate("Custom Rules Here, For More Go Github:https://github.com/Dreamacro/clash/blob/master/README.md, IP To CIDR: http://ip2cidr.com")
|
||||
custom_rules.rows = 20
|
||||
custom_rules.wrap = "off"
|
||||
|
||||
function custom_rules.cfgvalue(self, section)
|
||||
return NXFS.readfile("/etc/openclash/custom/openclash_custom_rules.list") or ""
|
||||
end
|
||||
function custom_rules.write(self, section, value)
|
||||
if value then
|
||||
value = value:gsub("\r\n?", "\n")
|
||||
local old_value = NXFS.readfile("/etc/openclash/custom/openclash_custom_rules.list")
|
||||
if value ~= old_value then
|
||||
NXFS.writefile("/etc/openclash/custom/openclash_custom_rules.list", value)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
custom_rules_2 = s:option(Value, "custom_rules_2")
|
||||
custom_rules_2.template = "cbi/tvalue"
|
||||
custom_rules_2.description = translate("Custom Rules 2 Here, For More Go Github:https://github.com/Dreamacro/clash/blob/master/README.md, IP To CIDR: http://ip2cidr.com")
|
||||
custom_rules_2.rows = 20
|
||||
custom_rules_2.wrap = "off"
|
||||
|
||||
function custom_rules_2.cfgvalue(self, section)
|
||||
return NXFS.readfile("/etc/openclash/custom/openclash_custom_rules_2.list") or ""
|
||||
end
|
||||
function custom_rules_2.write(self, section, value)
|
||||
if value then
|
||||
value = value:gsub("\r\n?", "\n")
|
||||
local old_value = NXFS.readfile("/etc/openclash/custom/openclash_custom_rules_2.list")
|
||||
if value ~= old_value then
|
||||
NXFS.writefile("/etc/openclash/custom/openclash_custom_rules_2.list", value)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if op_mode == "redir-host" then
|
||||
s = m:section(TypedSection, "openclash", translate("Set Custom Hosts, Only Work with Redir-Host Mode"))
|
||||
s.anonymous = true
|
||||
|
@ -191,8 +191,8 @@ msgstr "选择内核日志的默认输出模式"
|
||||
msgid "Only intranet allowed"
|
||||
msgstr "仅允许内网"
|
||||
|
||||
msgid "When Enabled, The Control Panel And The Connection Broker Port Will Not Be Accessible From The Public Network, TUN Not Support Yet"
|
||||
msgstr "启用后将禁止从公网访问控制面板和连接代理端口,TUN模式下启用此项不会生效"
|
||||
msgid "When Enabled, The Control Panel And The Connection Broker Port Will Not Be Accessible From The Public Network"
|
||||
msgstr "启用后将禁止从公网访问控制面板和连接代理端口"
|
||||
|
||||
msgid "Redirect Local DNS Setting"
|
||||
msgstr "*本地DNS劫持"
|
||||
@ -213,13 +213,13 @@ msgid "Custom DNS Setting"
|
||||
msgstr "自定义上游DNS服务器"
|
||||
|
||||
msgid "Use Custom Rules"
|
||||
msgstr "启用后将把自定义规则增加到配置文件并优先匹配,规则请到下方文本框编辑"
|
||||
msgstr "启用后将把自定义规则增加到配置文件,规则请到下方文本框编辑"
|
||||
|
||||
msgid "Add Custom DNS Servers"
|
||||
msgstr "设置自定义上游DNS服务器"
|
||||
|
||||
msgid "(Take Effect After Choose Above)"
|
||||
msgstr "(在上方DNS设置中启用本功能后生效)"
|
||||
msgstr "(在上方设置中启用本功能后生效)"
|
||||
|
||||
msgid "Advanced Setting"
|
||||
msgstr "高级设置"
|
||||
@ -422,10 +422,7 @@ msgid "Enable Other Rules"
|
||||
msgstr "第三方规则"
|
||||
|
||||
msgid "Use Other Rules"
|
||||
msgstr "选择并启用第三方规则后将覆盖配置文件内的所有规则 (不包括自定义规则)"
|
||||
|
||||
msgid "Disable Other Rules"
|
||||
msgstr "不使用第三方规则"
|
||||
msgstr "将覆盖配置文件内的所有规则 (不包括自定义规则),启用前请先在此页面下方创建配置"
|
||||
|
||||
msgid "lhie1 Rules"
|
||||
msgstr "lhie1 规则"
|
||||
@ -520,8 +517,8 @@ msgstr "国内流量"
|
||||
msgid "Others"
|
||||
msgstr "未匹配到规则的流量"
|
||||
|
||||
msgid "Choose Proxy Group, Base On Your Servers Group in config.yaml"
|
||||
msgstr "指定流量(策略)的代理方式,只支持选择(服务器组),信息来源于您的配置文件"
|
||||
msgid "Choose Proxy Groups, Base On Your Config File"
|
||||
msgstr "指定流量(策略)的代理方式,只支持选择(策略组),信息来源于您的配置文件"
|
||||
|
||||
msgid "Custom Clash Rules"
|
||||
msgstr "自定义规则"
|
||||
@ -594,7 +591,7 @@ msgid "Only For IPK Install Type Or Not Release Memory"
|
||||
msgstr ""
|
||||
"只支持通过IPK安装的版本进行更新,因为随系统编译的版本更新后不会释放旧版本的闪存空间"
|
||||
|
||||
msgid "Severs and Groups"
|
||||
msgid "Servers and Groups"
|
||||
msgstr "服务器与策略组管理"
|
||||
|
||||
msgid "Load Config"
|
||||
@ -603,7 +600,7 @@ msgstr "读取配置"
|
||||
msgid "Delete Unused Servers"
|
||||
msgstr "删除未启用节点"
|
||||
|
||||
msgid "Delete Severs"
|
||||
msgid "Delete Servers"
|
||||
msgstr "清空服务器配置"
|
||||
|
||||
msgid "Delete Proxy Provider"
|
||||
@ -1020,8 +1017,14 @@ msgstr "在Fake-IP模式下,只支持过滤纯IP类型的请求"
|
||||
msgid "Rule Match Proxy Mode"
|
||||
msgstr "*仅代理命中规则流量"
|
||||
|
||||
msgid "Only Proxy Rules Match, Prevent BT Passing"
|
||||
msgstr "仅允许代理命中规则的流量,防止BT下载流量经过代理"
|
||||
msgid "Only Proxy Rules Match, Prevent BT/P2P Passing"
|
||||
msgstr "仅允许代理命中规则的流量,防止BT、P2P下载流量经过代理"
|
||||
|
||||
msgid "Common Ports Proxy Mode"
|
||||
msgstr "*仅允许常用端口流量"
|
||||
|
||||
msgid "Only Common Ports, Prevent BT/P2P Passing"
|
||||
msgstr "仅允许常用端口的流量经过Clash,防止BT、P2P下载流量经过代理"
|
||||
|
||||
msgid "Provider File Manage"
|
||||
msgstr "代理(规则)集文件管理"
|
||||
@ -1384,4 +1387,37 @@ msgid "Default Interface Name:"
|
||||
msgstr "当前系统默认接口:"
|
||||
|
||||
msgid ",Try Enable If Network Loopback"
|
||||
msgstr ", 如发生回环死机请尝试启用"
|
||||
msgstr ", 如发生回环死机请尝试启用"
|
||||
|
||||
msgid "Custom GEOIP URL"
|
||||
msgstr "GEOIP数据库更新URL"
|
||||
|
||||
msgid "Custom Chnroute Lists URL"
|
||||
msgstr "大陆IP段更新URL"
|
||||
|
||||
msgid "Custom GEOIP Data URL, Click Button Below To Refresh After Edit"
|
||||
msgstr "自定义GEOIP数据库的更新来源,编辑后点击下方按钮生效"
|
||||
|
||||
msgid "Custom Chnroute Lists URL, Click Button Below To Refresh After Edit"
|
||||
msgstr "自定义大陆IP段的更新来源,编辑后点击下方按钮生效"
|
||||
|
||||
msgid "(Default)"
|
||||
msgstr "(默认)"
|
||||
|
||||
msgid "(Only CN)"
|
||||
msgstr "(仅中国数据)"
|
||||
|
||||
msgid "(Large Size)"
|
||||
msgstr "(18MB大文件,请确保足够的剩余空间)"
|
||||
|
||||
msgid "Other Rules Edit"
|
||||
msgstr "设置第三方规则"
|
||||
|
||||
msgid "Get Group Names"
|
||||
msgstr "获取策略组"
|
||||
|
||||
msgid "Get Group Names After Select Config File"
|
||||
msgstr "选择配置文件后请点击以获取对应的策略组"
|
||||
|
||||
msgid "Other Rules Name"
|
||||
msgstr "第三方规则"
|
||||
|
@ -33,6 +33,9 @@ config openclash 'config'
|
||||
option redirect_dns '0'
|
||||
option small_flash_memory '0'
|
||||
option interface_name '0'
|
||||
option common_ports '0'
|
||||
option geo_custom_url 'http://www.ideame.top/mmdb/Country.mmdb'
|
||||
option chnr_custom_url 'https://ispip.clang.cn/all_cn.txt'
|
||||
|
||||
config dns_servers
|
||||
option group 'nameserver'
|
||||
@ -58,12 +61,6 @@ config dns_servers
|
||||
option ip '223.5.5.5'
|
||||
option enabled '1'
|
||||
|
||||
config dns_servers
|
||||
option enabled '1'
|
||||
option group 'nameserver'
|
||||
option ip 'doh.rixcloud.dev/dns-query'
|
||||
option type 'https'
|
||||
|
||||
config dns_servers
|
||||
option type 'https'
|
||||
option group 'fallback'
|
||||
|
@ -96,9 +96,18 @@ revert_dns() {
|
||||
}
|
||||
|
||||
[ "$1" -eq 1 ] && {
|
||||
if [ -s "/tmp/resolv.conf.d/resolv.conf.auto" ]; then
|
||||
if [ -s "/tmp/resolv.conf.d/resolv.conf.auto" ] && [ -n "$(grep "nameserver" /tmp/resolv.conf.d/resolv.conf.auto)" ]; then
|
||||
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.d/resolv.conf.auto >/dev/null 2>&1
|
||||
elif [ -s "/tmp/resolv.conf.auto" ]; then
|
||||
elif [ -s "/tmp/resolv.conf.auto" ] && [ -n "$(grep "nameserver" /tmp/resolv.conf.auto)" ]; then
|
||||
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto >/dev/null 2>&1
|
||||
else
|
||||
rm -rf /tmp/resolv.conf.auto 2>/dev/null
|
||||
touch /tmp/resolv.conf.auto 2>/dev/null
|
||||
cat >> "/tmp/resolv.conf.auto" <<-EOF
|
||||
# Interface lan
|
||||
nameserver 114.114.114.114
|
||||
nameserver 119.29.29.29
|
||||
EOF
|
||||
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto >/dev/null 2>&1
|
||||
fi
|
||||
uci set dhcp.@dnsmasq[0].noresolv=0 >/dev/null 2>&1
|
||||
@ -171,7 +180,7 @@ EOF
|
||||
if [ -n "$(ruby_read "$CONFIG_FILE" "['dns']['fallback']")" ] && [ -z "$(ruby_read "$CONFIG_FILE" "['dns']['fallback-filter']")" ]; then
|
||||
cat >> "$2" <<-EOF
|
||||
fallback-filter:
|
||||
geoip: true
|
||||
geoip: false
|
||||
ipcidr:
|
||||
- 0.0.0.0/8
|
||||
- 10.0.0.0/8
|
||||
@ -189,9 +198,14 @@ cat >> "$2" <<-EOF
|
||||
- 224.0.0.0/4
|
||||
- 240.0.0.0/4
|
||||
- 255.255.255.255/32
|
||||
domain:
|
||||
- '+.google.com'
|
||||
- '+.facebook.com'
|
||||
- '+.youtube.com'
|
||||
- '+.githubusercontent.com'
|
||||
EOF
|
||||
fi
|
||||
ruby_merge "$CONFIG_FILE" "['dns']" "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
#修改集路径
|
||||
@ -215,12 +229,18 @@ yml_provider_path()
|
||||
begin
|
||||
Value = YAML.load_file('$1');
|
||||
if Value.key?('$2') then
|
||||
Value['$2'].values.each{|x,v|
|
||||
unless x['path'].include? '$3' then
|
||||
v=File.basename(x['path']);
|
||||
x['path']='./$3/'+v; end};
|
||||
Value_1 = Marshal.load(Marshal.dump(Value['$2']));
|
||||
Value['$2'].values.each{
|
||||
|x,v|
|
||||
unless x['path'].include? '$3' then
|
||||
v=File.basename(x['path'])
|
||||
x['path']='./$3/'+v
|
||||
end
|
||||
};
|
||||
if not Value_1.eql?(Value['$2']) then
|
||||
File.open('$1','w') {|f| YAML.dump(Value, f)}
|
||||
end
|
||||
end
|
||||
end;
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Edit Provider Path Error: ' + e.message
|
||||
end
|
||||
@ -409,7 +429,6 @@ get_rule_file()
|
||||
GAME_RULE_PATH="/etc/openclash/game_rules/$GAME_RULE_FILE_NAME"
|
||||
|
||||
sed '/^#/d' "$GAME_RULE_PATH" 2>/dev/null |sed '/^ *$/d' |awk '{print "- IP-CIDR,"$0}' |awk -v tag="$2" '{print $0","'tag'""}' >> $GAME_RULE_FILE 2>/dev/null
|
||||
set_rule_file=1
|
||||
}
|
||||
|
||||
yml_game_rule_get()
|
||||
@ -463,7 +482,7 @@ yml_game_custom()
|
||||
#处理游戏规则
|
||||
config_load "openclash"
|
||||
config_foreach yml_game_rule_get "game_config"
|
||||
[ "$set_rule_file" = 1 ] && {
|
||||
[ -f "$GAME_RULE_FILE" ] && {
|
||||
ruby -ryaml -E UTF-8 -e "
|
||||
begin
|
||||
Value = YAML.load_file('$CONFIG_FILE');
|
||||
@ -488,6 +507,7 @@ end
|
||||
config_load "openclash"
|
||||
config_foreach yml_rule_group_get "rule_provider_config"
|
||||
config_foreach yml_rule_group_get "game_config"
|
||||
if [ -f "/tmp/yaml_groups.yaml" ] || [ -f "/tmp/yaml_servers.yaml" ] || [ -f "/tmp/yaml_provider.yaml" ]; then
|
||||
ruby -ryaml -E UTF-8 -e "
|
||||
begin
|
||||
Value = YAML.load_file('$CONFIG_FILE');
|
||||
@ -522,6 +542,7 @@ File.open('$CONFIG_FILE','w') {|f| YAML.dump(Value, f)}
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Game Proxy Merge Error: ' + e.message
|
||||
end" 2>/dev/null >> $LOG_FILE
|
||||
fi
|
||||
}
|
||||
|
||||
yml_rule_set_add()
|
||||
@ -719,7 +740,6 @@ if [ ! -f "$RAW_CONFIG_FILE" ]; then
|
||||
if [ -n "$subscribe_info" ]; then
|
||||
echo "配置文件不存在,您已设置订阅信息,准备开始下载..." >$START_LOG
|
||||
sleep 3
|
||||
kill_clash
|
||||
nohup /usr/share/openclash/openclash.sh &
|
||||
del_lock
|
||||
exit 0
|
||||
@ -735,19 +755,44 @@ fi
|
||||
#创建启动配置
|
||||
#rm -rf "/etc/openclash/*.y*" 2>/dev/null
|
||||
cp "$RAW_CONFIG_FILE" "$CONFIG_FILE"
|
||||
CONFIG_HASH=$(ruby -ryaml -E UTF-8 -e "puts YAML.load_file('$CONFIG_FILE')" 2>/dev/null)
|
||||
if [ -z "$CONFIG_HASH" ] || [ "$CONFIG_HASH" = "false" ]; then
|
||||
if [ -z "$CONFIG_HASH" ]; then
|
||||
ruby -ryaml -E UTF-8 -e "puts YAML.load_file('$CONFIG_FILE')" >> $LOG_FILE
|
||||
fi
|
||||
echo "配置文件校验失败,请检查配置文件后重试!" >$START_LOG
|
||||
echo "${LOGTIME} Error: Unable To Parse Config File, Please Check And Try Again!" >> $LOG_FILE
|
||||
rm -rf $CONFIG_FILE 2>/dev/null
|
||||
ruby -ryaml -E UTF-8 -e "
|
||||
begin
|
||||
YAML.load_file('$RAW_CONFIG_FILE');
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Error: Unable To Parse Config File ' + e.message
|
||||
system 'rm -rf ${CONFIG_FILE} 2>/dev/null'
|
||||
end
|
||||
" 2>/dev/null >> $LOG_FILE
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "${LOGTIME} Error: Ruby Works Abnormally, Please Check The Ruby Library Depends And Try Again!" >> $LOG_FILE
|
||||
echo "Ruby依赖异常,请确认ruby依赖工作正常后重试!" > $START_LOG
|
||||
sleep 3
|
||||
start_fail
|
||||
elif [ ! -f "$CONFIG_FILE" ] || [ ! -s "$CONFIG_FILE" ]; then
|
||||
echo "配置文件校验失败,请检查配置文件后重试!" > $START_LOG
|
||||
sleep 3
|
||||
start_fail
|
||||
fi
|
||||
}
|
||||
|
||||
yml_other_rules_get()
|
||||
{
|
||||
local section="$1"
|
||||
local enabled config
|
||||
config_get_bool "enabled" "$section" "enabled" "1"
|
||||
config_get "config" "$section" "config" ""
|
||||
|
||||
if [ "$enabled" = "0" ] || [ "$config" != "$2" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -n "$rule_name" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
config_get "rule_name" "$section" "rule_name" ""
|
||||
}
|
||||
|
||||
#运行模式处理
|
||||
do_run_mode()
|
||||
{
|
||||
@ -792,11 +837,17 @@ do_run_file()
|
||||
tun_core_path="/etc/openclash/core/clash_tun"
|
||||
game_core_path="/etc/openclash/core/clash_game"
|
||||
geoip_path="/etc/openclash/Country.mmdb"
|
||||
chnr_path="/etc/openclash/china_ip_route.ipset"
|
||||
rm -rf "/tmp/etc/openclash" 2>/dev/null
|
||||
else
|
||||
dev_core_path="/tmp/etc/openclash/core/clash"
|
||||
tun_core_path="/tmp/etc/openclash/core/clash_tun"
|
||||
game_core_path="/tmp/etc/openclash/core/clash_game"
|
||||
geoip_path="/tmp/etc/openclash/Country.mmdb"
|
||||
chnr_path="/tmp/etc/openclash/china_ip_route.ipset"
|
||||
rm -rf "/etc/openclash/Country.mmdb" 2>/dev/null
|
||||
rm -rf "/etc/openclash/china_ip_route.ipset" 2>/dev/null
|
||||
rm -rf "/etc/openclash/core" 2>/dev/null
|
||||
fi
|
||||
|
||||
rm -rf "/etc/openclash/clash" 2>/dev/null
|
||||
@ -812,12 +863,19 @@ do_run_file()
|
||||
core_type="Game"
|
||||
core_start_log="检测到配置了【Game】内核专属功能,调用【Game】内核启动..."
|
||||
fi
|
||||
|
||||
if [ "$rule_source" != "0" ]; then
|
||||
config_load "openclash"
|
||||
config_foreach yml_other_rules_get "other_rules" "$CONFIG_NAME"
|
||||
fi
|
||||
|
||||
if [ "$proxy_mode" = "script" ] || [ "$rule_source" = "ConnersHua" ] || [ "$rule_source" = "lhie1" ] || [ -n "$(ruby_read "$CONFIG_FILE" "['rules'].grep(/^RULE-SET,/)")" ]; then
|
||||
rm -rf "/etc/openclash/clash" 2>/dev/null
|
||||
ln -s "$tun_core_path" /etc/openclash/clash 2>/dev/null
|
||||
core_type="Tun"
|
||||
core_start_log="检测到配置了【Tun】内核专属功能,调用【Tun】内核启动..."
|
||||
if [ "$proxy_mode" = "script" ] || [ "$rule_name" = "ConnersHua" ] || [ "$rule_name" = "lhie1" ] || [ -n "$(ruby_read "$CONFIG_FILE" "['rules'].grep(/^RULE-SET,/)")" ]; then
|
||||
if [ "$en_mode_tun" != "2" ]; then
|
||||
rm -rf "/etc/openclash/clash" 2>/dev/null
|
||||
ln -s "$tun_core_path" /etc/openclash/clash 2>/dev/null
|
||||
core_type="Tun"
|
||||
core_start_log="检测到配置了【Tun】内核专属功能,调用【Tun】内核启动..."
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f "/etc/openclash/clash" ] && [ -f "$dev_core_path" ] && [ -z "$core_type" ]; then
|
||||
@ -841,31 +899,45 @@ do_run_file()
|
||||
[ ! -x "$tun_core_path" ] && chmod 4755 "$tun_core_path" 2>/dev/null
|
||||
[ ! -x "$game_core_path" ] && chmod 4755 "$game_core_path" 2>/dev/null
|
||||
[ ! -x "$dev_core_path" ] && chmod 4755 "$dev_core_path" 2>/dev/null
|
||||
|
||||
|
||||
#文件检查
|
||||
[ -f "$geoip_path" ] && [ "$small_flash_memory" = "1" ] && {
|
||||
rm -rf "/etc/openclash/Country.mmdb" 2>/dev/null
|
||||
ln -s "$geoip_path" /etc/openclash/Country.mmdb 2>/dev/null
|
||||
}
|
||||
|
||||
[ -f "$chnr_path" ] && [ "$small_flash_memory" = "1" ] && {
|
||||
ln -s "$chnr_path" /etc/openclash/china_ip_route.ipset 2>/dev/null
|
||||
}
|
||||
|
||||
[ ! -f "$geoip_path" ] && {
|
||||
echo "检测到GEOIP数据库文件不存在,准备开始下载..." >$START_LOG
|
||||
sleep 3
|
||||
kill_clash
|
||||
nofile=1
|
||||
nohup /usr/share/openclash/openclash_ipdb.sh &
|
||||
del_lock
|
||||
exit 0
|
||||
}
|
||||
|
||||
[ ! -f "$CLASH" ] && {
|
||||
echo "检测到内核文件不存在,准备开始下载..." >$START_LOG
|
||||
sleep 3
|
||||
nofile=1
|
||||
rm -rf "/tmp/clash_last_version" 2>/dev/null
|
||||
kill_clash
|
||||
nohup /usr/share/openclash/openclash_core.sh "$core_type" &
|
||||
del_lock
|
||||
exit 0
|
||||
}
|
||||
|
||||
if [ "$china_ip_route" = "1" ]; then
|
||||
if [ ! -f "$chnr_path" ]; then
|
||||
echo "检测到大陆白名单列表不存在,准备开始下载..." >$START_LOG
|
||||
nofile=1
|
||||
nohup /usr/share/openclash/openclash_chnroute.sh &
|
||||
else
|
||||
ipset -! flush china_ip_route 2>/dev/null
|
||||
ipset -! restore </etc/openclash/china_ip_route.ipset 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$nofile" = "1" ]; then
|
||||
del_lock
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! capsh --is-uid=0 >/dev/null || ! capsh --has-ambient >/dev/null; then
|
||||
echo "错误:Capsh异常,请尝试重新安装依赖【libcap】和相应的Capsh库,终止启动..." >$START_LOG
|
||||
echo "${LOGTIME} Error: Could Not Load The Capsh Library, Please Verify The Capsh Shell Library Work Well" >> $LOG_FILE
|
||||
@ -1130,7 +1202,7 @@ firewall_redirect_exclude()
|
||||
|
||||
set_firewall()
|
||||
{
|
||||
if [ "$(iptables -t nat -nL PREROUTING --line-number |grep "udp dpt:53" |grep "0.0.0.0/0 \{0,\}0.0.0.0/0" |wc -l)" -gt 1 ] && [ "$enable_redirect_dns" -eq "1" ]; then
|
||||
if [ "$(iptables -t nat -nL PREROUTING --line-number |grep "udp dpt:53" |grep "0.0.0.0/0 \{0,\}0.0.0.0/0" |wc -l)" -gt 1 ] && [ "$enable_redirect_dns" -eq 1 ]; then
|
||||
echo "发现53端口被劫持,清理防火墙规则..." >$START_LOG
|
||||
pre_lines=$(iptables -nvL PREROUTING -t nat |sed 1,2d |sed -n '/0.0.0.0\/0 \{0,\}0.0.0.0\/0 \{0,\}udp dpt:53/=' 2>/dev/null |sort -rn)
|
||||
for pre_line in $pre_lines; do
|
||||
@ -1138,6 +1210,9 @@ if [ "$(iptables -t nat -nL PREROUTING --line-number |grep "udp dpt:53" |grep "0
|
||||
done
|
||||
iptables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT --to-ports 53 >/dev/null 2>&1
|
||||
sleep 2
|
||||
elif [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(iptables -t nat -nL PREROUTING --line-number |grep "redir ports 53$")"]; then
|
||||
iptables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT --to-ports 53
|
||||
iptables -t nat -A PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports 53
|
||||
fi
|
||||
|
||||
if [ -z "$(uci get firewall.openclash 2>/dev/null)" ] || [ -z "$(uci get ucitrack.@openclash[-1].init 2>/dev/null)" ]; then
|
||||
@ -1163,21 +1238,6 @@ cat > "/var/etc/openclash.include" <<-EOF
|
||||
/etc/init.d/openclash reload >/dev/null 2>&1
|
||||
EOF
|
||||
|
||||
if [ "$china_ip_route" = "1" ]; then
|
||||
if [ ! -f "/usr/share/openclash/res/china_ip_route.ipset" ]; then
|
||||
cp /etc/openclash/rule_provider/ChinaIP.yaml /tmp/china_ip_route.list 2>/dev/null
|
||||
sed -i "s/'//g" /tmp/china_ip_route.list 2>/dev/null
|
||||
sed -i "s/^ \{0,\}- //g" /tmp/china_ip_route.list 2>/dev/null
|
||||
sed -i '/payload:/d' /tmp/china_ip_route.list 2>/dev/null
|
||||
sed -i '/^ \{0,\}#/d' /tmp/china_ip_route.list 2>/dev/null
|
||||
echo "create china_ip_route hash:net family inet hashsize 1024 maxelem 65536" >/usr/share/openclash/res/china_ip_route.ipset
|
||||
awk '!/^$/&&!/^#/{printf("add china_ip_route %s'" "'\n",$0)}' /tmp/china_ip_route.list >>/usr/share/openclash/res/china_ip_route.ipset
|
||||
rm -rf /tmp/china_ip_route.list 2>/dev/null
|
||||
fi
|
||||
ipset -! flush china_ip_route 2>/dev/null
|
||||
ipset -! restore </usr/share/openclash/res/china_ip_route.ipset 2>/dev/null
|
||||
fi
|
||||
|
||||
#lan_ac
|
||||
if [ "$operation_mode" = "redir-host" ] && [ "$en_mode" = "redir-host" ]; then
|
||||
if [ "$lan_ac_mode" = "0" ]; then
|
||||
@ -1229,6 +1289,13 @@ fi
|
||||
done
|
||||
fi
|
||||
|
||||
#common ports
|
||||
common_port="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"
|
||||
ipset create common_ports bitmap:port range 0-65535
|
||||
for i in $common_port; do
|
||||
ipset add common_ports $i
|
||||
done
|
||||
|
||||
if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 3 ]; then
|
||||
#tcp
|
||||
iptables -t nat -N openclash
|
||||
@ -1240,12 +1307,15 @@ if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 3 ]; then
|
||||
iptables -t nat -A openclash -m set ! --match-set lan_ac_white_macs src -j RETURN >/dev/null 2>&1
|
||||
iptables -t nat -A openclash -m set ! --match-set lan_ac_white_ips src -j RETURN >/dev/null 2>&1
|
||||
if [ "$en_mode" = "redir-host" ]; then
|
||||
if [ "$common_ports" = "1" ]; then
|
||||
iptables -t nat -A openclash -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
|
||||
fi
|
||||
iptables -t nat -A openclash -m set --match-set china_ip_route dst -j RETURN >/dev/null 2>&1
|
||||
fi
|
||||
iptables -t nat -A openclash -p tcp -j REDIRECT --to-ports "$proxy_port"
|
||||
if [ -z "$en_mode_tun" ]; then
|
||||
iptables -t nat -I PREROUTING -p tcp -d 8.8.8.8 -j REDIRECT --to-ports "$proxy_port"
|
||||
iptables -t nat -I PREROUTING -p tcp -d 8.8.4.4 -j REDIRECT --to-ports "$proxy_port"
|
||||
iptables -t nat -I PREROUTING -p tcp -d 8.8.8.8 --dport 53 -j REDIRECT --to-ports "$proxy_port"
|
||||
iptables -t nat -I PREROUTING -p tcp -d 8.8.4.4 --dport 53 -j REDIRECT --to-ports "$proxy_port"
|
||||
fi
|
||||
iptables -t nat -A PREROUTING -p tcp -j openclash
|
||||
if [ -z "$en_mode_tun" ]; then
|
||||
@ -1263,6 +1333,9 @@ if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 3 ]; then
|
||||
iptables -t mangle -A openclash -m set ! --match-set lan_ac_white_ips src -j RETURN >/dev/null 2>&1
|
||||
iptables -t mangle -A openclash -m set ! --match-set lan_ac_white_macs src -j RETURN >/dev/null 2>&1
|
||||
if [ "$en_mode" = "redir-host" ]; then
|
||||
if [ "$common_ports" = "1" ]; then
|
||||
iptables -t mangle -A openclash -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
|
||||
fi
|
||||
iptables -t mangle -A openclash -m set --match-set china_ip_route dst -j RETURN >/dev/null 2>&1
|
||||
fi
|
||||
iptables -t mangle -A openclash -p udp --dport 53 -j RETURN >/dev/null 2>&1
|
||||
@ -1271,17 +1344,26 @@ if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 3 ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
#if [ "$en_mode" = "fake-ip" ]; then
|
||||
iptables -t nat -N openclash_output
|
||||
iptables -t nat -F openclash_output
|
||||
iptables -t nat -A openclash_output -m set --match-set localnetwork dst -j RETURN
|
||||
#iptables -t nat -A openclash_output -p tcp -d 198.18.0.0/16 -j REDIRECT --to-ports "$proxy_port"
|
||||
iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -p tcp -m multiport --dport 80,443 -j REDIRECT --to-ports "$proxy_port"
|
||||
if [ "$en_mode" = "fake-ip" ]; then
|
||||
iptables -t nat -N openclash_output
|
||||
iptables -t nat -F openclash_output
|
||||
iptables -t nat -A openclash_output -m set --match-set localnetwork dst -j RETURN
|
||||
if [ "$en_mode" = "fake-ip" ]; then
|
||||
if [ "$intranet_allowed" -eq 1 ]; then
|
||||
iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -p tcp -d 198.18.0.0/16 -j DNAT --to-destination "$lan_ip:$proxy_port"
|
||||
else
|
||||
iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -p tcp -d 198.18.0.0/16 -j REDIRECT --to-ports "$proxy_port"
|
||||
fi
|
||||
iptables -t nat -I OUTPUT -j openclash_output
|
||||
#fi
|
||||
fi
|
||||
iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
|
||||
if [ "$en_mode" = "redir-host" ]; then
|
||||
iptables -t mangle -A openclash -m set --match-set china_ip_route dst -j RETURN >/dev/null 2>&1
|
||||
fi
|
||||
if [ "$intranet_allowed" -eq 1 ]; then
|
||||
iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -p tcp -j DNAT --to-destination "$lan_ip:$proxy_port"
|
||||
else
|
||||
iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -p tcp -j REDIRECT --to-ports "$proxy_port"
|
||||
fi
|
||||
iptables -t nat -I OUTPUT -j openclash_output
|
||||
|
||||
#if [ "$ipv6_enable" -eq 1 ]; then
|
||||
# #tcp
|
||||
@ -1333,17 +1415,20 @@ if [ -n "$en_mode_tun" ]; then
|
||||
iptables -t mangle -F openclash_output
|
||||
iptables -t mangle -A openclash_output -m set --match-set localnetwork dst -j RETURN
|
||||
if [ "$en_mode_tun" -ne 3 ]; then
|
||||
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -p tcp -m multiport --dport 80,443 -j MARK --set-mark "$PROXY_FWMARK"
|
||||
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -d 198.18.0.0/16 -j MARK --set-mark "$PROXY_FWMARK"
|
||||
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
|
||||
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -p tcp -j MARK --set-mark "$PROXY_FWMARK"
|
||||
else
|
||||
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -p udp -d 198.18.0.0/16 -j MARK --set-mark "$PROXY_FWMARK"
|
||||
fi
|
||||
fi
|
||||
iptables -t mangle -I OUTPUT -j openclash_output
|
||||
elif [ "$en_mode" = "redir-host" ] && [ "$en_mode_tun" -ne 3 ]; then
|
||||
iptables -t mangle -N openclash_output
|
||||
iptables -t mangle -F openclash_output
|
||||
iptables -t mangle -A openclash_output -m set --match-set localnetwork dst -j RETURN
|
||||
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -p tcp -m multiport --dport 80,443 -j MARK --set-mark "$PROXY_FWMARK"
|
||||
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
|
||||
iptables -t mangle -A openclash -m set --match-set china_ip_route dst -j RETURN >/dev/null 2>&1
|
||||
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -p tcp -j MARK --set-mark "$PROXY_FWMARK"
|
||||
iptables -t mangle -I OUTPUT -j openclash_output
|
||||
fi
|
||||
|
||||
@ -1359,6 +1444,9 @@ if [ -n "$en_mode_tun" ]; then
|
||||
iptables -t mangle -A openclash -m set ! --match-set lan_ac_white_ips src -j RETURN >/dev/null 2>&1
|
||||
iptables -t mangle -A openclash -m set ! --match-set lan_ac_white_macs src -j RETURN >/dev/null 2>&1
|
||||
if [ "$en_mode" = "redir-host" ]; then
|
||||
if [ "$common_ports" = "1" ]; then
|
||||
iptables -t mangle -A openclash -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
|
||||
fi
|
||||
iptables -t mangle -A openclash -m set --match-set china_ip_route dst -j RETURN >/dev/null 2>&1
|
||||
fi
|
||||
iptables -t mangle -A openclash -j MARK --set-mark "$PROXY_FWMARK"
|
||||
@ -1371,14 +1459,22 @@ if [ -n "$en_mode_tun" ]; then
|
||||
iptables -t mangle -A openclash_dns_hijack -d 8.8.8.8 -j MARK --set-mark "$PROXY_FWMARK"
|
||||
iptables -t mangle -A openclash_dns_hijack -d 8.8.4.4 -j MARK --set-mark "$PROXY_FWMARK"
|
||||
iptables -t mangle -I PREROUTING -p udp -j openclash
|
||||
iptables -t nat -I PREROUTING -p tcp -d 8.8.8.8 -j ACCEPT
|
||||
iptables -t nat -I PREROUTING -p tcp -d 8.8.4.4 -j ACCEPT
|
||||
iptables -t nat -I PREROUTING -p tcp --dport 53 -d 8.8.8.8 -j ACCEPT
|
||||
iptables -t nat -I PREROUTING -p tcp --dport 53 -d 8.8.4.4 -j ACCEPT
|
||||
fi
|
||||
|
||||
#ipv6
|
||||
# if [ "$ipv6_enable" -eq 1 ]; then
|
||||
# ip6tables -t mangle -I PREROUTING -j MARK --set-mark "$PROXY_FWMARK"
|
||||
# fi
|
||||
|
||||
#snat routerself for tun while bindaddress enable
|
||||
if [ "$en_mode_tun" -ne 3 ] && [ "$intranet_allowed" -eq 1 ]; 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
|
||||
fi
|
||||
fi
|
||||
|
||||
#端口转发
|
||||
@ -1436,6 +1532,10 @@ revert_firewall()
|
||||
|
||||
iptables -t nat -F openclash_output >/dev/null 2>&1
|
||||
iptables -t nat -X openclash_output >/dev/null 2>&1
|
||||
|
||||
iptables -t nat -F openclash_post >/dev/null 2>&1
|
||||
iptables -t nat -X openclash_post >/dev/null 2>&1
|
||||
iptables -t nat -D POSTROUTING -j openclash_post >/dev/null 2>&1
|
||||
|
||||
ip6tables -t nat -F openclash >/dev/null 2>&1
|
||||
ip6tables -t nat -D PREROUTING -p tcp -j openclash >/dev/null 2>&1
|
||||
@ -1468,6 +1568,7 @@ revert_firewall()
|
||||
ipset destroy lan_ac_white_macs >/dev/null 2>&1
|
||||
ipset destroy lan_ac_black_macs >/dev/null 2>&1
|
||||
ipset destroy wan_ac_black_ips >/dev/null 2>&1
|
||||
ipset destroy common_ports >/dev/null 2>&1
|
||||
}
|
||||
|
||||
get_config()
|
||||
@ -1498,6 +1599,7 @@ get_config()
|
||||
small_flash_memory=$(uci get openclash.config.small_flash_memory 2>/dev/null)
|
||||
mixed_port=$(uci get openclash.config.mixed_port 2>/dev/null)
|
||||
interface_name=$(uci get openclash.config.interface_name 2>/dev/null)
|
||||
common_ports=$(uci get openclash.config.common_ports 2>/dev/null)
|
||||
uci set openclash.config.restricted_mode=0 && uci commit openclash
|
||||
}
|
||||
|
||||
@ -1527,7 +1629,7 @@ start()
|
||||
yml_auth_custom "$CONFIG_FILE"
|
||||
yml_dns_custom "$enable_custom_dns" "$CONFIG_FILE"
|
||||
/usr/share/openclash/yml_change.sh 2>/dev/null "$LOGTIME" "$en_mode" "$enable_custom_dns" "$da_password" "$cn_port" "$proxy_port" "$CONFIG_FILE" "$ipv6_enable" "$http_port" "$socks_port" "$lan_ip" "$log_level" "$proxy_mode" "$intranet_allowed" "$en_mode_tun" "$stack_type" "$dns_port" "$core_type" "$mixed_port"
|
||||
/usr/share/openclash/yml_rules_change.sh 2>/dev/null "$LOGTIME" "$rule_source" "$enable_custom_clash_rules" "$CONFIG_FILE" "$set_rule_file" "$en_mode" "$enable_rule_proxy" "$RAW_CONFIG_FILE" "$RULE_PROVIDER_FILE"
|
||||
/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"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
{
|
||||
"files": {
|
||||
"main.css": "./static/css/main.e4724b81.chunk.css",
|
||||
"main.js": "./static/js/main.b9320252.chunk.js",
|
||||
"main.css": "./static/css/main.a3812757.chunk.css",
|
||||
"main.js": "./static/js/main.8e23a89d.chunk.js",
|
||||
"runtime-main.js": "./static/js/runtime-main.b905e4f3.js",
|
||||
"static/js/2.d14c2fca.chunk.js": "./static/js/2.d14c2fca.chunk.js",
|
||||
"index.html": "./index.html",
|
||||
@ -11,7 +11,7 @@
|
||||
"entrypoints": [
|
||||
"static/js/runtime-main.b905e4f3.js",
|
||||
"static/js/2.d14c2fca.chunk.js",
|
||||
"static/css/main.e4724b81.chunk.css",
|
||||
"static/js/main.b9320252.chunk.js"
|
||||
"static/css/main.a3812757.chunk.css",
|
||||
"static/js/main.8e23a89d.chunk.js"
|
||||
]
|
||||
}
|
@ -1 +1 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" type="image/x-icon" href="https://cdn.jsdelivr.net/gh/Dreamacro/clash/docs/logo.png"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"/><meta name="description" content="Clash web port"/><title>Clash</title><link href="./static/css/main.e4724b81.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,a,l=r[0],f=r[1],i=r[2],p=0,s=[];p<l.length;p++)a=l[p],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&s.push(o[a][0]),o[a]=0;for(n in f)Object.prototype.hasOwnProperty.call(f,n)&&(e[n]=f[n]);for(c&&c(r);s.length;)s.shift()();return u.push.apply(u,i||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,l=1;l<t.length;l++){var f=t[l];0!==o[f]&&(n=!1)}n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={1:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,function(r){return e[r]}.bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="./";var l=this["webpackJsonpclash-dashboard"]=this["webpackJsonpclash-dashboard"]||[],f=l.push.bind(l);l.push=r,l=l.slice();for(var i=0;i<l.length;i++)r(l[i]);var c=f;t()}([])</script><script src="./static/js/2.d14c2fca.chunk.js"></script><script src="./static/js/main.b9320252.chunk.js"></script></body></html>
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" type="image/x-icon" href="https://cdn.jsdelivr.net/gh/Dreamacro/clash/docs/logo.png"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"/><meta name="description" content="Clash web port"/><title>Clash</title><link href="./static/css/main.a3812757.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,a,l=r[0],f=r[1],i=r[2],p=0,s=[];p<l.length;p++)a=l[p],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&s.push(o[a][0]),o[a]=0;for(n in f)Object.prototype.hasOwnProperty.call(f,n)&&(e[n]=f[n]);for(c&&c(r);s.length;)s.shift()();return u.push.apply(u,i||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,l=1;l<t.length;l++){var f=t[l];0!==o[f]&&(n=!1)}n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={1:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,function(r){return e[r]}.bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="./";var l=this["webpackJsonpclash-dashboard"]=this["webpackJsonpclash-dashboard"]||[],f=l.push.bind(l);l.push=r,l=l.slice();for(var i=0;i<l.length;i++)r(l[i]);var c=f;t()}([])</script><script src="./static/js/2.d14c2fca.chunk.js"></script><script src="./static/js/main.8e23a89d.chunk.js"></script></body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -17,6 +17,7 @@ dns_port=$(uci get openclash.config.dns_port 2>/dev/null)
|
||||
enable_redirect_dns=$(uci get openclash.config.enable_redirect_dns 2>/dev/null)
|
||||
disable_masq_cache=$(uci get openclash.config.disable_masq_cache 2>/dev/null)
|
||||
if_restart=0
|
||||
only_download=0
|
||||
|
||||
urlencode() {
|
||||
local data
|
||||
@ -29,7 +30,6 @@ urlencode() {
|
||||
}
|
||||
|
||||
kill_watchdog() {
|
||||
|
||||
watchdog_pids=$(unify_ps_pids "openclash_watchdog.sh")
|
||||
for watchdog_pid in $watchdog_pids; do
|
||||
kill -9 "$watchdog_pid" >/dev/null 2>&1
|
||||
@ -57,7 +57,7 @@ config_cus_up()
|
||||
fi
|
||||
if [ -z "$subscribe_url_param" ]; then
|
||||
if [ "$servers_update" -eq 1 ] || [ ! -z "$keyword" ] || [ ! -z "$ex_keyword" ]; then
|
||||
echo "配置文件【$name】替换成功,开始挑选节点..." >$START_LOG
|
||||
echo "配置文件【$name】替换成功,开始挑选节点..." > $START_LOG
|
||||
uci set openclash.config.config_update_path="/etc/openclash/config/$name.yaml"
|
||||
uci set openclash.config.servers_if_update=1
|
||||
uci commit openclash
|
||||
@ -68,30 +68,30 @@ config_cus_up()
|
||||
if [ "$CONFIG_FILE" == "$CONFIG_PATH" ]; then
|
||||
if_restart=1
|
||||
fi
|
||||
echo "${LOGTIME} Config 【$name】 Update Successful" >>$LOG_FILE
|
||||
echo "配置文件【$name】更新成功!" >$START_LOG
|
||||
echo "${LOGTIME} Config 【$name】 Update Successful" >> $LOG_FILE
|
||||
echo "配置文件【$name】更新成功!" > $START_LOG
|
||||
sleep 3
|
||||
echo "" >$START_LOG
|
||||
echo "" > $START_LOG
|
||||
elif [ "$CONFIG_FILE" == "$CONFIG_PATH" ]; then
|
||||
echo "${LOGTIME} Config 【$name】 Update Successful" >>$LOG_FILE
|
||||
echo "配置文件【$name】更新成功!" >$START_LOG
|
||||
echo "${LOGTIME} Config 【$name】 Update Successful" >> $LOG_FILE
|
||||
echo "配置文件【$name】更新成功!" > $START_LOG
|
||||
sleep 3
|
||||
if_restart=1
|
||||
else
|
||||
echo "配置文件【$name】更新成功!" >$START_LOG
|
||||
echo "${LOGTIME} Config 【$name】 Update Successful" >>$LOG_FILE
|
||||
echo "配置文件【$name】更新成功!" > $START_LOG
|
||||
echo "${LOGTIME} Config 【$name】 Update Successful" >> $LOG_FILE
|
||||
sleep 3
|
||||
echo "" >$START_LOG
|
||||
echo "" > $START_LOG
|
||||
fi
|
||||
else
|
||||
if [ "$CONFIG_FILE" == "$CONFIG_PATH" ]; then
|
||||
echo "${LOGTIME} Config 【$name】 Update Successful" >>$LOG_FILE
|
||||
echo "配置文件【$name】更新成功!" >$START_LOG
|
||||
echo "${LOGTIME} Config 【$name】 Update Successful" >> $LOG_FILE
|
||||
echo "配置文件【$name】更新成功!" > $START_LOG
|
||||
sleep 3
|
||||
if_restart=1
|
||||
else
|
||||
echo "配置文件【$name】更新成功!" >$START_LOG
|
||||
echo "${LOGTIME} Config 【$name】 Update Successful" >>$LOG_FILE
|
||||
echo "配置文件【$name】更新成功!" > $START_LOG
|
||||
echo "${LOGTIME} Config 【$name】 Update Successful" >> $LOG_FILE
|
||||
sleep 3
|
||||
echo "" >$START_LOG
|
||||
fi
|
||||
@ -102,37 +102,51 @@ config_cus_up()
|
||||
|
||||
config_su_check()
|
||||
{
|
||||
echo "配置文件下载成功,检查是否有更新..." >$START_LOG
|
||||
echo "配置文件下载成功,检查是否有更新..." > $START_LOG
|
||||
sed -i 's/!<str> //g' "$CFG_FILE" >/dev/null 2>&1
|
||||
if [ -f "$CONFIG_FILE" ]; then
|
||||
cmp -s "$BACKPACK_FILE" "$CFG_FILE"
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo "配置文件【$name】有更新,开始替换..." >$START_LOG
|
||||
echo "配置文件【$name】有更新,开始替换..." > $START_LOG
|
||||
mv "$CFG_FILE" "$CONFIG_FILE" 2>/dev/null
|
||||
cp "$CONFIG_FILE" "$BACKPACK_FILE"
|
||||
config_cus_up
|
||||
if [ "$only_download" -eq 0 ]; then
|
||||
config_cus_up
|
||||
else
|
||||
echo "配置文件【$name】更新成功!" > $START_LOG
|
||||
echo "${LOGTIME} Config 【$name】 Update Successful" >> $LOG_FILE
|
||||
sleep 3
|
||||
echo "" > $START_LOG
|
||||
fi
|
||||
else
|
||||
echo "配置文件【$name】没有任何更新,停止继续操作..." >$START_LOG
|
||||
echo "配置文件【$name】没有任何更新,停止继续操作..." > $START_LOG
|
||||
rm -rf "$CFG_FILE"
|
||||
echo "${LOGTIME} Updated Config【$name】 No Change, Do Nothing" >>$LOG_FILE
|
||||
echo "${LOGTIME} Updated Config【$name】 No Change, Do Nothing" >> $LOG_FILE
|
||||
sleep 5
|
||||
echo "" >$START_LOG
|
||||
echo "" > $START_LOG
|
||||
fi
|
||||
else
|
||||
echo "配置文件下载成功,本地没有配置文件,开始创建 ..." >$START_LOG
|
||||
echo "配置文件下载成功,本地没有配置文件,开始创建 ..." > $START_LOG
|
||||
mv "$CFG_FILE" "$CONFIG_FILE" 2>/dev/null
|
||||
cp "$CONFIG_FILE" "$BACKPACK_FILE"
|
||||
config_cus_up
|
||||
if [ "$only_download" -eq 0 ]; then
|
||||
config_cus_up
|
||||
else
|
||||
echo "配置文件【$name】更新成功!" >$START_LOG
|
||||
echo "${LOGTIME} Config 【$name】 Update Successful" >> $LOG_FILE
|
||||
sleep 3
|
||||
echo "" > $START_LOG
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
config_error()
|
||||
{
|
||||
echo "配置文件【$name】下载失败,请检查网络或稍后再试!" >$START_LOG
|
||||
echo "${LOGTIME} Config 【$name】Update Error" >>$LOG_FILE
|
||||
echo "配置文件【$name】下载失败,请检查网络或稍后再试!" > $START_LOG
|
||||
echo "${LOGTIME} Error: Config 【$name】Update Error" >> $LOG_FILE
|
||||
rm -rf "$CFG_FILE" 2>/dev/null
|
||||
sleep 5
|
||||
echo "" >$START_LOG
|
||||
echo "" > $START_LOG
|
||||
}
|
||||
|
||||
change_dns()
|
||||
@ -158,12 +172,24 @@ change_dns()
|
||||
config_download_direct()
|
||||
{
|
||||
if pidof clash >/dev/null; then
|
||||
echo "配置文件【$name】订阅失败,尝试不使用代理下载配置文件..." >$START_LOG
|
||||
|
||||
kill_watchdog
|
||||
|
||||
uci del_list dhcp.@dnsmasq[0].server=127.0.0.1#"$dns_port" >/dev/null 2>&1
|
||||
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto >/dev/null 2>&1
|
||||
if [ -s "/tmp/resolv.conf.d/resolv.conf.auto" ] && [ -n "$(grep "nameserver" /tmp/resolv.conf.d/resolv.conf.auto)" ]; then
|
||||
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.d/resolv.conf.auto >/dev/null 2>&1
|
||||
elif [ -s "/tmp/resolv.conf.auto" ] && [ -n "$(grep "nameserver" /tmp/resolv.conf.auto)" ]; then
|
||||
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto >/dev/null 2>&1
|
||||
else
|
||||
rm -rf /tmp/resolv.conf.auto 2>/dev/null
|
||||
touch /tmp/resolv.conf.auto 2>/dev/null
|
||||
cat >> "/tmp/resolv.conf.auto" <<-EOF
|
||||
# Interface lan
|
||||
nameserver 114.114.114.114
|
||||
nameserver 119.29.29.29
|
||||
EOF
|
||||
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto >/dev/null 2>&1
|
||||
fi
|
||||
uci set dhcp.@dnsmasq[0].noresolv=0 >/dev/null 2>&1
|
||||
uci delete dhcp.@dnsmasq[0].cachesize >/dev/null 2>&1
|
||||
uci commit dhcp
|
||||
@ -176,8 +202,34 @@ config_download_direct()
|
||||
config_download
|
||||
|
||||
if [ "$?" -eq 0 ] && [ -s "$CFG_FILE" ]; then
|
||||
change_dns
|
||||
config_su_check
|
||||
ruby -ryaml -E UTF-8 -e "
|
||||
begin
|
||||
YAML.load_file('$CFG_FILE');
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Error: Unable To Parse Config File ' + e.message
|
||||
system 'rm -rf ${CFG_FILE} 2>/dev/null'
|
||||
end
|
||||
" 2>/dev/null >> $LOG_FILE
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "${LOGTIME} Error: Ruby Works Abnormally, Please Check The Ruby Library Depends!" >> $LOG_FILE
|
||||
echo "Ruby依赖异常,无法校验配置文件,请确认ruby依赖工作正常后重试!" > $START_LOG
|
||||
sleep 3
|
||||
only_download=1
|
||||
change_dns
|
||||
config_su_check
|
||||
elif [ ! -f "$CFG_FILE" ]; then
|
||||
echo "配置文件格式校验失败..." > $START_LOG
|
||||
sleep 3
|
||||
config_error
|
||||
elif ! "$(ruby_read "$CFG_FILE" ".key?('proxies')")" && ! "$(ruby_read "$CFG_FILE" ".key?('proxy-providers')")" ; then
|
||||
echo "${LOGTIME} Error: Updated Config 【$name】 Has No Proxy Field, Update Exit..." >> $LOG_FILE
|
||||
echo "配置文件节点部分校验失败..." > $START_LOG
|
||||
sleep 3
|
||||
config_error
|
||||
else
|
||||
change_dns
|
||||
config_su_check
|
||||
fi
|
||||
else
|
||||
change_dns
|
||||
config_error
|
||||
@ -286,19 +338,40 @@ sub_info_get()
|
||||
subscribe_url=$address
|
||||
fi
|
||||
|
||||
echo "开始更新配置文件【$name】..." >$START_LOG
|
||||
echo "开始更新配置文件【$name】..." > $START_LOG
|
||||
|
||||
config_download
|
||||
|
||||
if [ "$?" -eq 0 ] && [ -s "$CFG_FILE" ]; then
|
||||
if [ -n "$(ruby_read "$CFG_FILE" "['proxy-groups']")" ]; then
|
||||
config_su_check
|
||||
else
|
||||
echo "${LOGTIME} Config 【$name】 Grammar Check Faild" >>$LOG_FILE
|
||||
ruby -ryaml -E UTF-8 -e "
|
||||
begin
|
||||
YAML.load_file('$CFG_FILE');
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Error: Unable To Parse Config File ' + e.message
|
||||
system 'rm -rf ${CFG_FILE} 2>/dev/null'
|
||||
end
|
||||
" 2>/dev/null >> $LOG_FILE
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "${LOGTIME} Error: Ruby Works Abnormally, Please Check The Ruby Library Depends!" >> $LOG_FILE
|
||||
echo "Ruby依赖异常,无法校验配置文件,请确认ruby依赖工作正常后重试!" > $START_LOG
|
||||
sleep 3
|
||||
only_download=1
|
||||
config_su_check
|
||||
elif [ ! -f "$CFG_FILE" ]; then
|
||||
echo "配置文件格式校验失败,尝试不使用代理下载配置文件..." > $START_LOG
|
||||
sleep 3
|
||||
config_download_direct
|
||||
fi
|
||||
elif ! "$(ruby_read "$CFG_FILE" ".key?('proxies')")" && ! "$(ruby_read "$CFG_FILE" ".key?('proxy-providers')")" ; then
|
||||
echo "${LOGTIME} Error: Updated Config 【$name】 Has No Proxy Field" >> $LOG_FILE
|
||||
echo "配置文件节点部分校验失败,尝试不使用代理下载配置文件..." > $START_LOG
|
||||
sleep 3
|
||||
config_download_direct
|
||||
else
|
||||
config_su_check
|
||||
fi
|
||||
else
|
||||
echo "${LOGTIME} Config 【$name】 Download Faild" >>$LOG_FILE
|
||||
echo "配置文件【$name】订阅失败,尝试不使用代理下载配置文件..." > $START_LOG
|
||||
echo "${LOGTIME} Error: Config 【$name】 Download Faild" >> $LOG_FILE
|
||||
config_download_direct
|
||||
fi
|
||||
}
|
||||
|
@ -8,37 +8,50 @@
|
||||
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
LOG_FILE="/tmp/openclash.log"
|
||||
china_ip_route=$(uci get openclash.config.china_ip_route 2>/dev/null)
|
||||
CHNR_CUSTOM_URL=$(uci get openclash.config.chnr_custom_url 2>/dev/null)
|
||||
small_flash_memory=$(uci get openclash.config.small_flash_memory 2>/dev/null)
|
||||
|
||||
if [ "$small_flash_memory" != "1" ]; then
|
||||
chnr_path="/etc/openclash/china_ip_route.ipset"
|
||||
mkdir -p /etc/openclash
|
||||
else
|
||||
chnr_path="/tmp/etc/openclash/china_ip_route.ipset"
|
||||
mkdir -p /tmp/etc/openclash
|
||||
fi
|
||||
|
||||
echo "开始下载大陆IP白名单..." >$START_LOG
|
||||
if pidof clash >/dev/null; then
|
||||
curl -sL --connect-timeout 10 --retry 2 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/RuleSet/Extra/ChinaIP.yaml -o /tmp/ChinaIP.yaml >/dev/null 2>&1
|
||||
if [ -z "$CHNR_CUSTOM_URL" ]; then
|
||||
if pidof clash >/dev/null; then
|
||||
curl -sL --connect-timeout 10 --retry 2 https://ispip.clang.cn/all_cn.txt -o /tmp/china_ip_route.txt >/dev/null 2>&1
|
||||
fi
|
||||
if [ "$?" -ne "0" ] || ! pidof clash >/dev/null; then
|
||||
curl -sL --connect-timeout 10 --retry 2 https://ispip.clang.cn/all_cn_cidr.txt -o /tmp/china_ip_route.txt >/dev/null 2>&1
|
||||
fi
|
||||
else
|
||||
curl -sL --connect-timeout 10 --retry 2 "$CHNR_CUSTOM_URL" -o /tmp/china_ip_route.txt >/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/RuleSet/Extra/ChinaIP.yaml -o /tmp/ChinaIP.yaml >/dev/null 2>&1
|
||||
fi
|
||||
if [ "$?" -eq "0" ] && [ -s "/tmp/ChinaIP.yaml" ]; then
|
||||
if [ "$?" -eq "0" ] && [ -s "/tmp/china_ip_route.txt" ]; then
|
||||
echo "大陆IP白名单下载成功,检查版本是否更新..." >$START_LOG
|
||||
cmp -s /tmp/ChinaIP.yaml /etc/openclash/rule_provider/ChinaIP.yaml
|
||||
if [ "$?" -ne "0" ]; then
|
||||
echo "大陆IP白名单有更新,开始替换旧版本..." >$START_LOG
|
||||
mv /tmp/ChinaIP.yaml /etc/openclash/rule_provider/ChinaIP.yaml >/dev/null 2>&1
|
||||
echo "删除下载缓存..." >$START_LOG
|
||||
rm -rf /tmp/ChinaIP.yaml >/dev/null 2>&1
|
||||
rm -rf /usr/share/openclash/res/china_ip_route.ipset >/dev/null 2>&1
|
||||
[ "$china_ip_route" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ] && /etc/init.d/openclash restart >/dev/null 2>&1 &
|
||||
echo "大陆IP白名单更新成功!" >$START_LOG
|
||||
echo "${LOGTIME} Chnroute Lists Update Successful" >>$LOG_FILE
|
||||
sleep 5
|
||||
else
|
||||
echo "大陆IP白名单没有更新,停止继续操作..." >$START_LOG
|
||||
echo "${LOGTIME} Updated Chnroute Lists No Change, Do Nothing" >>$LOG_FILE
|
||||
rm -rf /tmp/ChinaIP.yaml >/dev/null 2>&1
|
||||
sleep 5
|
||||
fi
|
||||
#预处理
|
||||
echo "create china_ip_route hash:net family inet hashsize 1024 maxelem 65536" >/tmp/china_ip_route.list
|
||||
awk '!/^$/&&!/^#/{printf("add china_ip_route %s'" "'\n",$0)}' /tmp/china_ip_route.txt >>/tmp/china_ip_route.list
|
||||
cmp -s /tmp/china_ip_route.list "$chnr_path"
|
||||
if [ "$?" -ne "0" ]; then
|
||||
echo "大陆IP白名单有更新,开始替换旧版本..." >$START_LOG
|
||||
mv /tmp/china_ip_route.list "$chnr_path" >/dev/null 2>&1
|
||||
[ "$china_ip_route" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ] && /etc/init.d/openclash restart >/dev/null 2>&1 &
|
||||
echo "大陆IP白名单更新成功!" >$START_LOG
|
||||
echo "${LOGTIME} Chnroute Lists Update Successful" >>$LOG_FILE
|
||||
sleep 5
|
||||
else
|
||||
echo "大陆IP白名单没有更新,停止继续操作..." >$START_LOG
|
||||
echo "${LOGTIME} Updated Chnroute Lists No Change, Do Nothing" >>$LOG_FILE
|
||||
sleep 5
|
||||
fi
|
||||
else
|
||||
echo "大陆IP白名单下载失败,请检查网络或稍后再试!" >$START_LOG
|
||||
rm -rf /tmp/ChinaIP.yaml >/dev/null 2>&1
|
||||
echo "${LOGTIME} Chnroute Lists Update Error" >>$LOG_FILE
|
||||
sleep 10
|
||||
sleep 5
|
||||
fi
|
||||
rm -rf /tmp/china_ip_route* >/dev/null 2>&1
|
||||
echo "" >$START_LOG
|
@ -29,8 +29,10 @@ core_version=$(/etc/openclash/core/clash -v 2>/dev/null |awk -F ' ' '{print $2}'
|
||||
core_tun_version=$(/etc/openclash/core/clash_tun -v 2>/dev/null |awk -F ' ' '{print $2}' 2>/dev/null)
|
||||
core_game_version=$(/etc/openclash/core/clash_game -v 2>/dev/null |awk -F ' ' '{print $2}' 2>/dev/null)
|
||||
servers_update=$(uci get openclash.config.servers_update 2>/dev/null)
|
||||
mix_proxies=$(uci get openclash.config.mix_proxies 2>/dev/null)
|
||||
op_version=$(sed -n 1p /usr/share/openclash/res/openclash_version 2>/dev/null)
|
||||
china_ip_route=$(uci get openclash.config.china_ip_route 2>/dev/null)
|
||||
common_ports=$(uci get openclash.config.common_ports 2>/dev/null)
|
||||
|
||||
if [ -z "$RAW_CONFIG_FILE" ] || [ ! -f "$RAW_CONFIG_FILE" ]; then
|
||||
CONFIG_NAME=$(ls -lt /etc/openclash/config/ | grep -E '.yaml|.yml' | head -n 1 |awk '{print $9}')
|
||||
@ -211,7 +213,7 @@ cat >> "$DEBUG_LOG" <<-EOF
|
||||
启动配置文件: $CONFIG_FILE
|
||||
运行模式: $en_mode
|
||||
默认代理模式: $proxy_mode
|
||||
UDP流量转发: $(ts_cf "$enable_udp_proxy")
|
||||
UDP流量转发(tproxy): $(ts_cf "$enable_udp_proxy")
|
||||
DNS劫持: $(ts_cf "$enable_redirect_dns")
|
||||
自定义DNS: $(ts_cf "$enable_custom_dns")
|
||||
IPV6-DNS解析: $(ts_cf "$ipv6_enable")
|
||||
@ -219,43 +221,20 @@ IPV6-DNS解析: $(ts_cf "$ipv6_enable")
|
||||
自定义规则: $(ts_cf "$enable_custom_clash_rules")
|
||||
仅允许内网: $(ts_cf "$intranet_allowed")
|
||||
仅代理命中规则流量: $(ts_cf "$enable_rule_proxy")
|
||||
仅允许常用端口流量: $(ts_cf "$common_ports")
|
||||
绕过中国大陆IP: $(ts_cf "$china_ip_route")
|
||||
|
||||
#启动异常时建议关闭此项后重试
|
||||
混合节点: $(ts_cf "$mix_proxies")
|
||||
保留配置: $(ts_cf "$servers_update")
|
||||
EOF
|
||||
if [ "$rule_source" != "0" ]; then
|
||||
|
||||
cat >> "$DEBUG_LOG" <<-EOF
|
||||
|
||||
#启动异常时建议关闭此项后重试
|
||||
第三方规则: $rule_source
|
||||
第三方规则: $(ts_cf "$rule_source")
|
||||
EOF
|
||||
cat >> "$DEBUG_LOG" <<-EOF
|
||||
第三方规则策略组设置:
|
||||
GlobalTV: $(uci get openclash.config.GlobalTV 2>/dev/null)
|
||||
AsianTV: $(uci get openclash.config.AsianTV 2>/dev/null)
|
||||
Proxy: $(uci get openclash.config.Proxy 2>/dev/null)
|
||||
Apple: $(uci get openclash.config.Apple 2>/dev/null)
|
||||
Netflix: $(uci get openclash.config.Netflix 2>/dev/null)
|
||||
Spotify: $(uci get openclash.config.Spotify 2>/dev/null)
|
||||
Steam: $(uci get openclash.config.Steam 2>/dev/null)
|
||||
AdBlock: $(uci get openclash.config.AdBlock 2>/dev/null)
|
||||
Netease Music: $(uci get openclash.config.Netease_Music 2>/dev/null)
|
||||
Speedtest: $(uci get openclash.config.Speedtest 2>/dev/null)
|
||||
Telegram: $(uci get openclash.config.Telegram 2>/dev/null)
|
||||
Microsoft: $(uci get openclash.config.Microsoft 2>/dev/null)
|
||||
PayPal: $(uci get openclash.config.PayPal 2>/dev/null)
|
||||
Domestic: $(uci get openclash.config.Domestic 2>/dev/null)
|
||||
Others: $(uci get openclash.config.Others 2>/dev/null)
|
||||
|
||||
读取的配置文件策略组:
|
||||
EOF
|
||||
cat /tmp/Proxy_Group >> "$DEBUG_LOG"
|
||||
else
|
||||
cat >> "$DEBUG_LOG" <<-EOF
|
||||
第三方规则: 停用
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ "$enable_custom_clash_rules" -eq 1 ]; then
|
||||
cat >> "$DEBUG_LOG" <<-EOF
|
||||
|
@ -30,7 +30,7 @@ restore_history() {
|
||||
NOW_NAME=$(echo $line |awk -F '#*#' '{print $3}')
|
||||
GROUP_STATE=$(GROUP_STATE "$GROUP_NAME")
|
||||
GROUP_STATE_NUM=0
|
||||
while ( [ "$GROUP_STATE" != "200" ] && [ "$GROUP_STATE_NUM" -le 3 ] )
|
||||
while ( [ "$GROUP_STATE" != "200" ] && [ "$GROUP_STATE_NUM" -le 2 ] )
|
||||
do
|
||||
sleep 1
|
||||
GROUP_STATE_NUM=$(expr "$GROUP_STATE_NUM" + 1)
|
||||
|
@ -8,6 +8,7 @@
|
||||
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
LOG_FILE="/tmp/openclash.log"
|
||||
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)
|
||||
|
||||
if [ "$small_flash_memory" != "1" ]; then
|
||||
geoip_path="/etc/openclash/Country.mmdb"
|
||||
@ -17,34 +18,35 @@
|
||||
mkdir -p /tmp/etc/openclash
|
||||
fi
|
||||
echo "开始下载 GEOIP 数据库..." >$START_LOG
|
||||
if pidof clash >/dev/null; then
|
||||
curl -sL --connect-timeout 10 --retry 2 https://raw.githubusercontent.com/alecthw/mmdb_china_ip_list/release/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 http://www.ideame.top/mmdb/Country.mmdb -o /tmp/Country.mmdb >/dev/null 2>&1
|
||||
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/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 http://www.ideame.top/mmdb/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
|
||||
fi
|
||||
if [ "$?" -eq "0" ] && [ -s "/tmp/Country.mmdb" ]; then
|
||||
echo "GEOIP 数据库下载成功,检查数据库版本是否更新..." >$START_LOG
|
||||
cmp -s /tmp/Country.mmdb "$geoip_path"
|
||||
if [ "$?" -ne "0" ]; then
|
||||
echo "数据库版本有更新,开始替换数据库版本..." >$START_LOG
|
||||
mv /tmp/Country.mmdb "$geoip_path" >/dev/null 2>&1
|
||||
echo "删除下载缓存..." >$START_LOG
|
||||
rm -rf /tmp/Country.mmdb >/dev/null 2>&1
|
||||
echo "GEOIP 数据库更新成功!" >$START_LOG
|
||||
echo "${LOGTIME} GEOIP Database Update Successful" >>$LOG_FILE
|
||||
sleep 5
|
||||
[ "$(unify_ps_prevent)" -eq 0 ] && /etc/init.d/openclash restart >/dev/null 2>&1 &
|
||||
else
|
||||
echo "数据库版本没有更新,停止继续操作..." >$START_LOG
|
||||
echo "${LOGTIME} Updated GEOIP Database No Change, Do Nothing" >>$LOG_FILE
|
||||
rm -rf /tmp/Country.mmdb >/dev/null 2>&1
|
||||
sleep 5
|
||||
fi
|
||||
if [ "$?" -ne "0" ]; then
|
||||
echo "数据库版本有更新,开始替换数据库版本..." >$START_LOG
|
||||
mv /tmp/Country.mmdb "$geoip_path" >/dev/null 2>&1
|
||||
echo "GEOIP 数据库更新成功!" >$START_LOGS
|
||||
echo "${LOGTIME} GEOIP Database Update Successful" >>$LOG_FILE
|
||||
sleep 5
|
||||
[ "$(unify_ps_prevent)" -eq 0 ] && /etc/init.d/openclash restart >/dev/null 2>&1 &
|
||||
else
|
||||
echo "数据库版本没有更新,停止继续操作..." >$START_LOG
|
||||
echo "${LOGTIME} Updated GEOIP Database No Change, Do Nothing" >>$LOG_FILE
|
||||
sleep 5
|
||||
fi
|
||||
else
|
||||
echo "GEOIP 数据库下载失败,请检查网络或稍后再试!" >$START_LOG
|
||||
rm -rf /tmp/Country.mmdb >/dev/null 2>&1
|
||||
echo "${LOGTIME} GEOIP Database Update Error" >>$LOG_FILE
|
||||
sleep 10
|
||||
sleep 5
|
||||
fi
|
||||
rm -rf /tmp/Country.mmdb >/dev/null 2>&1
|
||||
echo "" >$START_LOG
|
@ -5,43 +5,79 @@
|
||||
|
||||
status=$(unify_ps_status "openclash_rule.sh")
|
||||
[ "$status" -gt 3 ] && exit 0
|
||||
|
||||
START_LOG="/tmp/openclash_start.log"
|
||||
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
LOG_FILE="/tmp/openclash.log"
|
||||
echo "开始获取使用中的第三方规则名称..." >$START_LOG
|
||||
RUlE_SOURCE=$(uci get openclash.config.rule_source 2>/dev/null)
|
||||
OTHER_RULE_FILE="/tmp/other_rule.yaml"
|
||||
|
||||
yml_other_rules_dl()
|
||||
{
|
||||
local section="$1"
|
||||
local enabled config
|
||||
config_get_bool "enabled" "$section" "enabled" "1"
|
||||
config_get "config" "$section" "config" ""
|
||||
|
||||
if [ "$enabled" = "0" ] || [ "$config" != "$2" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -n "$rule_name" ]; then
|
||||
echo "${LOGTIME} Warrning: Multiple Other-Rules-Configurations Enabled, Ignore..." >> $LOG_FILE
|
||||
return
|
||||
fi
|
||||
|
||||
config_get "rule_name" "$section" "rule_name" ""
|
||||
|
||||
echo "开始下载使用中的第三方规则..." >$START_LOG
|
||||
if [ "$RUlE_SOURCE" = "lhie1" ]; then
|
||||
if pidof clash >/dev/null; then
|
||||
curl -sL --connect-timeout 10 --retry 2 https://raw.githubusercontent.com/lhie1/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/lhie1/Rules@master/Clash/Rule.yaml -o /tmp/rules.yaml >/dev/null 2>&1
|
||||
fi
|
||||
sed -i '1i rules:' /tmp/rules.yaml
|
||||
elif [ "$RUlE_SOURCE" = "ConnersHua" ]; then
|
||||
if pidof clash >/dev/null; then
|
||||
curl -sL --connect-timeout 10 --retry 2 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/Global.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/Global.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_SOURCE" = "ConnersHua_return" ]; then
|
||||
if pidof clash >/dev/null; then
|
||||
curl -sL --connect-timeout 10 --retry 2 https://raw.githubusercontent.com/ConnersHua/Profiles/master/Clash/China.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/China.yaml -o /tmp/rules.yaml >/dev/null 2>&1
|
||||
fi
|
||||
if [ "$rule_name" = "lhie1" ]; then
|
||||
if pidof clash >/dev/null; then
|
||||
curl -sL --connect-timeout 10 --retry 2 https://raw.githubusercontent.com/lhie1/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/lhie1/Rules@master/Clash/Rule.yaml -o /tmp/rules.yaml >/dev/null 2>&1
|
||||
fi
|
||||
if [ "$?" -eq "0" ] && [ "$RUlE_SOURCE" != 0 ] && [ -s "/tmp/rules.yaml" ]; then
|
||||
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
|
||||
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
|
||||
fi
|
||||
fi
|
||||
if [ "$?" -eq "0" ] && [ -s "/tmp/rules.yaml" ]; then
|
||||
echo "下载成功,开始预处理规则文件..." >$START_LOG
|
||||
|
||||
ruby -ryaml -E UTF-8 -e "
|
||||
begin
|
||||
YAML.load_file('/tmp/rules.yaml');
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Error: Unable To Parse Updated ${rule_name} Rules File ' + e.message
|
||||
system 'rm -rf /tmp/rules.yaml 2>/dev/null'
|
||||
end
|
||||
" 2>/dev/null >> $LOG_FILE
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "${LOGTIME} Error: Ruby Works Abnormally, Please Check The Ruby Library Depends!" >> $LOG_FILE
|
||||
echo "Ruby依赖异常,无法校验配置文件,请确认ruby依赖工作正常后重试!" > $START_LOG
|
||||
rm -rf /tmp/rules.yaml >/dev/null 2>&1
|
||||
sleep 3
|
||||
exit 0
|
||||
elif [ ! -f "/tmp/rules.yaml" ]; then
|
||||
echo "$rule_name 规则文件格式校验失败,请稍后再试..." > $START_LOG
|
||||
rm -rf /tmp/rules.yaml >/dev/null 2>&1
|
||||
sleep 3
|
||||
exit 0
|
||||
elif ! "$(ruby_read "/tmp/rules.yaml" ".key?('rules')")" ; then
|
||||
echo "${LOGTIME} Error: Updated Others Rules 【$rule_name】 Has No Rules Field, Update Exit..." >> $LOG_FILE
|
||||
echo "$rule_name 规则文件规则部分校验失败,请稍后再试..." > $START_LOG
|
||||
rm -rf /tmp/rules.yaml >/dev/null 2>&1
|
||||
sleep 3
|
||||
exit 0
|
||||
fi
|
||||
#取出规则部分
|
||||
ruby_read "/tmp/rules.yaml" ".select {|x| 'rule-providers' == x or 'script' == x or 'rules' == x }.to_yaml" > "$OTHER_RULE_FILE"
|
||||
#合并
|
||||
@ -49,28 +85,59 @@
|
||||
rm -rf /tmp/other_rule* 2>/dev/null
|
||||
|
||||
echo "检查下载的规则文件是否有更新..." >$START_LOG
|
||||
cmp -s /usr/share/openclash/res/"$RUlE_SOURCE".yaml /tmp/rules.yaml
|
||||
cmp -s /usr/share/openclash/res/"$rule_name".yaml /tmp/rules.yaml
|
||||
if [ "$?" -ne "0" ]; then
|
||||
echo "检测到下载的规则文件有更新,开始替换..." >$START_LOG
|
||||
mv /tmp/rules.yaml /usr/share/openclash/res/"$RUlE_SOURCE".yaml >/dev/null 2>&1
|
||||
echo "替换成功,重新加载 OpenClash 应用新规则..." >$START_LOG
|
||||
echo "${LOGTIME} Other Rules 【$RUlE_SOURCE】 Update Successful" >>$LOG_FILE
|
||||
[ "$(unify_ps_prevent)" -eq 0 ] && /etc/init.d/openclash restart >/dev/null 2>&1 &
|
||||
mv /tmp/rules.yaml /usr/share/openclash/res/"$rule_name".yaml >/dev/null 2>&1
|
||||
echo "${LOGTIME} Other Rules 【$rule_name】 Update Successful" >>$LOG_FILE
|
||||
ifrestart=1
|
||||
else
|
||||
echo "检测到下载的规则文件没有更新,停止继续操作..." >$START_LOG
|
||||
rm -rf /tmp/rules.yaml >/dev/null 2>&1
|
||||
echo "${LOGTIME} Updated Other Rules 【$RUlE_SOURCE】 No Change, Do Nothing" >>$LOG_FILE
|
||||
echo "${LOGTIME} Updated Other Rules 【$rule_name】 No Change, Do Nothing" >>$LOG_FILE
|
||||
sleep 5
|
||||
fi
|
||||
elif [ "$RUlE_SOURCE" = 0 ]; then
|
||||
else
|
||||
echo "第三方规则下载失败,请检查网络或稍后再试!" >$START_LOG
|
||||
echo "${LOGTIME} Other Rules 【$rule_name】 Update Error" >>$LOG_FILE
|
||||
sleep 5
|
||||
fi
|
||||
}
|
||||
|
||||
START_LOG="/tmp/openclash_start.log"
|
||||
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
LOG_FILE="/tmp/openclash.log"
|
||||
RUlE_SOURCE=$(uci get openclash.config.rule_source 2>/dev/null)
|
||||
|
||||
if [ "$RUlE_SOURCE" = "0" ]; then
|
||||
echo "未启用第三方规则,更新程序终止!" >$START_LOG
|
||||
rm -rf /tmp/rules.yaml >/dev/null 2>&1
|
||||
echo "${LOGTIME} Other Rules Not Enable, Update Stop" >>$LOG_FILE
|
||||
sleep 5
|
||||
else
|
||||
echo "第三方规则下载失败,请检查网络或稍后再试!" >$START_LOG
|
||||
rm -rf /tmp/rules.yaml >/dev/null 2>&1
|
||||
echo "${LOGTIME} Other Rules 【$RUlE_SOURCE】 Update Error" >>$LOG_FILE
|
||||
sleep 5
|
||||
OTHER_RULE_FILE="/tmp/other_rule.yaml"
|
||||
CONFIG_FILE=$(uci get openclash.config.config_path 2>/dev/null)
|
||||
CONFIG_NAME=$(echo "$CONFIG_FILE" |awk -F '/' '{print $5}' 2>/dev/null)
|
||||
ifrestart=0
|
||||
|
||||
if [ -z "$CONFIG_FILE" ]; then
|
||||
CONFIG_FILE="/etc/openclash/config/$(ls -lt /etc/openclash/config/ | grep -E '.yaml|.yml' | head -n 1 |awk '{print $9}')"
|
||||
CONFIG_NAME=$(echo "$CONFIG_FILE" |awk -F '/' '{print $5}' 2>/dev/null)
|
||||
fi
|
||||
|
||||
if [ -z "$CONFIG_NAME" ]; then
|
||||
CONFIG_FILE="/etc/openclash/config/config.yaml"
|
||||
CONFIG_NAME="config.yaml"
|
||||
fi
|
||||
|
||||
config_load "openclash"
|
||||
config_foreach yml_other_rules_dl "other_rules" "$CONFIG_NAME"
|
||||
if [ -z "$rule_name" ]; then
|
||||
echo "未找到第三方规则配置,更新程序终止!" >$START_LOG
|
||||
echo "${LOGTIME} Get Other Rules Settings Faild, Update Stop" >>$LOG_FILE
|
||||
sleep 5
|
||||
fi
|
||||
if [ "$ifrestart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ]; then
|
||||
/etc/init.d/openclash restart >/dev/null 2>&1 &
|
||||
fi
|
||||
fi
|
||||
echo "" >$START_LOG
|
||||
rm -rf /tmp/rules.yaml >/dev/null 2>&1
|
||||
echo "" >$START_LOG
|
@ -1,87 +1,54 @@
|
||||
rule-providers:
|
||||
# name: # Provider 名称
|
||||
# type: http # http 或 file
|
||||
# behavior: classical # 或 ipcidr、domain
|
||||
# path: # 文件路径
|
||||
# url: # 只有当类型为 HTTP 时才可用,您不需要在本地空间中创建新文件。
|
||||
# interval: # 自动更新间隔,仅在类型为 HTTP 时可用
|
||||
|
||||
Unbreak:
|
||||
type: http
|
||||
behavior: classical
|
||||
path: ./RuleSet/Unbreak.yaml
|
||||
path: "./RuleSet/Unbreak.yaml"
|
||||
url: https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/RuleSet/Unbreak.yaml
|
||||
interval: 86400
|
||||
|
||||
Streaming:
|
||||
type: http
|
||||
behavior: classical
|
||||
path: ./RuleSet/StreamingMedia/Streaming.yaml
|
||||
path: "./RuleSet/StreamingMedia/Streaming.yaml"
|
||||
url: https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Streaming.yaml
|
||||
interval: 86400
|
||||
|
||||
StreamingSE:
|
||||
type: http
|
||||
behavior: classical
|
||||
path: ./RuleSet/StreamingMedia/StreamingSE.yaml
|
||||
path: "./RuleSet/StreamingMedia/StreamingSE.yaml"
|
||||
url: https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/StreamingSE.yaml
|
||||
interval: 86400
|
||||
|
||||
Global:
|
||||
type: http
|
||||
behavior: classical
|
||||
path: ./RuleSet/Global.yaml
|
||||
path: "./RuleSet/Global.yaml"
|
||||
url: https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/RuleSet/Global.yaml
|
||||
interval: 86400
|
||||
|
||||
China:
|
||||
type: http
|
||||
behavior: classical
|
||||
path: ./RuleSet/China.yaml
|
||||
path: "./RuleSet/China.yaml"
|
||||
url: https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/RuleSet/China.yaml
|
||||
interval: 86400
|
||||
|
||||
ChinaIP:
|
||||
type: http
|
||||
behavior: ipcidr
|
||||
path: ./RuleSet/Extra/ChinaIP.yaml
|
||||
path: "./RuleSet/Extra/ChinaIP.yaml"
|
||||
url: https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/RuleSet/Extra/ChinaIP.yaml
|
||||
interval: 86400
|
||||
|
||||
# 规则
|
||||
rules:
|
||||
##source:ConnersHua
|
||||
# Unbreak
|
||||
- RULE-SET,Unbreak,DIRECT
|
||||
|
||||
# Global Area Network
|
||||
|
||||
# (Streaming Media)
|
||||
- RULE-SET,Streaming,Streaming
|
||||
|
||||
# (StreamingSE)
|
||||
- RULE-SET,StreamingSE,StreamingSE
|
||||
|
||||
# (DNS Cache Pollution) / (IP Blackhole) / (Region-Restricted Access Denied) / (Network Jitter)
|
||||
- RULE-SET,Global,PROXY
|
||||
|
||||
# China Area Network
|
||||
- RULE-SET,China,DIRECT
|
||||
|
||||
# Local Area Network
|
||||
- IP-CIDR,192.168.0.0/16,DIRECT
|
||||
- IP-CIDR,10.0.0.0/8,DIRECT
|
||||
- IP-CIDR,172.16.0.0/12,DIRECT
|
||||
- IP-CIDR,127.0.0.0/8,DIRECT
|
||||
- IP-CIDR,100.64.0.0/10,DIRECT
|
||||
- IP-CIDR,224.0.0.0/4,DIRECT
|
||||
|
||||
# (可选)使用来自 ipipdotnet 的 ChinaIP 以解决数据不准确的问题,使用 ChinaIP.yaml 时可禁用下列直至(包括)「GEOIP,CN」规则
|
||||
- RULE-SET,ChinaIP,DIRECT
|
||||
# Tencent
|
||||
- IP-CIDR,119.28.28.28/32,DIRECT
|
||||
- IP-CIDR,182.254.116.0/24,DIRECT
|
||||
# GeoIP China
|
||||
#- GEOIP,CN,DIRECT
|
||||
|
||||
- MATCH,MATCH
|
||||
- RULE-SET,Unbreak,DIRECT
|
||||
- RULE-SET,Streaming,Streaming
|
||||
- RULE-SET,StreamingSE,StreamingSE
|
||||
- RULE-SET,Global,PROXY
|
||||
- RULE-SET,China,DIRECT
|
||||
- IP-CIDR,192.168.0.0/16,DIRECT
|
||||
- IP-CIDR,10.0.0.0/8,DIRECT
|
||||
- IP-CIDR,172.16.0.0/12,DIRECT
|
||||
- IP-CIDR,127.0.0.0/8,DIRECT
|
||||
- IP-CIDR,100.64.0.0/10,DIRECT
|
||||
- IP-CIDR,224.0.0.0/4,DIRECT
|
||||
- IP-CIDR,fe80::/10,DIRECT
|
||||
- RULE-SET,ChinaIP,DIRECT
|
||||
- IP-CIDR,119.28.28.28/32,DIRECT
|
||||
- IP-CIDR,182.254.116.0/24,DIRECT
|
||||
- MATCH,MATCH
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,292 +1,53 @@
|
||||
rule-providers:
|
||||
Reject:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Reject.yaml'
|
||||
path: ./Rules/Reject
|
||||
interval: 86400
|
||||
Special:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Special.yaml'
|
||||
path: ./Rules/Special
|
||||
interval: 86400
|
||||
Netflix:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Netflix.yaml'
|
||||
path: ./Rules/Media/Netflix
|
||||
interval: 86400
|
||||
Spotify:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Spotify.yaml'
|
||||
path: ./Rules/Media/Spotify
|
||||
interval: 86400
|
||||
# YouTube Music:
|
||||
# type: http
|
||||
# behavior: classical
|
||||
# url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/YouTube%20Music.yaml'
|
||||
# path: ./Rules/Media/YouTube_Music
|
||||
# interval: 86400
|
||||
YouTube:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/YouTube.yaml'
|
||||
path: ./Rules/Media/YouTube
|
||||
interval: 86400
|
||||
Bilibili:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Bilibili.yaml'
|
||||
path: ./Rules/Media/Bilibili
|
||||
interval: 86400
|
||||
iQiyi:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/iQiyi.yaml'
|
||||
path: ./Rules/Media/iQiyi
|
||||
interval: 86400
|
||||
Letv:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Letv.yaml'
|
||||
path: ./Rules/Media/Letv
|
||||
interval: 86400
|
||||
# MOO:
|
||||
# type: http
|
||||
# behavior: classical
|
||||
# url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/MOO.yaml'
|
||||
# path: ./Rules/Media/MOO
|
||||
# interval: 86400
|
||||
Netease Music:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Netease%20Music.yaml'
|
||||
path: ./Rules/Media/Netease_Music
|
||||
interval: 86400
|
||||
Tencent Video:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Tencent%20Video.yaml'
|
||||
path: ./Rules/Media/Tencent_Video
|
||||
interval: 86400
|
||||
Youku:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Youku.yaml'
|
||||
path: ./Rules/Media/Youku
|
||||
interval: 86400
|
||||
ABC:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/ABC.yaml'
|
||||
path: ./Rules/Media/ABC
|
||||
interval: 86400
|
||||
Abema TV:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Abema%20TV.yaml'
|
||||
path: ./Rules/Media/Abema_TV
|
||||
interval: 86400
|
||||
Amazon:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Amazon.yaml'
|
||||
path: ./Rules/Media/Amazon
|
||||
interval: 86400
|
||||
Apple News:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Apple%20News.yaml'
|
||||
path: ./Rules/Media/Apple_News
|
||||
interval: 86400
|
||||
Apple TV:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Apple%20TV.yaml'
|
||||
path: ./Rules/Media/Apple_TV
|
||||
interval: 86400
|
||||
Bahamut:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Bahamut.yaml'
|
||||
path: ./Rules/Media/Bahamut
|
||||
interval: 86400
|
||||
BBC iPlayer:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/BBC%20iPlayer.yaml'
|
||||
path: ./Rules/Media/BBC_iPlayer
|
||||
interval: 86400
|
||||
DAZN:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/DAZN.yaml'
|
||||
path: ./Rules/Media/DAZN
|
||||
interval: 86400
|
||||
Disney Plus:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Disney%20Plus.yaml'
|
||||
path: ./Rules/Media/Disney_Plus
|
||||
interval: 86400
|
||||
encoreTVB:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/encoreTVB.yaml'
|
||||
path: ./Rules/Media/encoreTVB
|
||||
interval: 86400
|
||||
Fox Now:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Fox%20Now.yaml'
|
||||
path: ./Rules/Media/Fox_Now
|
||||
interval: 86400
|
||||
Fox+:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Fox%2B.yaml'
|
||||
path: ./Rules/Media/Fox+
|
||||
interval: 86400
|
||||
HBO:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/HBO.yaml'
|
||||
path: ./Rules/Media/HBO
|
||||
interval: 86400
|
||||
Hulu Japan:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Hulu%20Japan.yaml'
|
||||
path: ./Rules/Media/Hulu_Japan
|
||||
interval: 86400
|
||||
Hulu:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Hulu.yaml'
|
||||
path: ./Rules/Media/Hulu
|
||||
interval: 86400
|
||||
Japonx:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Japonx.yaml'
|
||||
path: ./Rules/Media/Japonx
|
||||
interval: 86400
|
||||
JOOX:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/JOOX.yaml'
|
||||
path: ./Rules/Media/JOOX
|
||||
interval: 86400
|
||||
KKBOX:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/KKBOX.yaml'
|
||||
path: ./Rules/Media/KKBOX
|
||||
interval: 86400
|
||||
KKTV:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/KKTV.yaml'
|
||||
path: ./Rules/Media/KKTV
|
||||
interval: 86400
|
||||
Line TV:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Line%20TV.yaml'
|
||||
path: ./Rules/Media/Line_TV
|
||||
interval: 86400
|
||||
myTV SUPER:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/myTV%20SUPER.yaml'
|
||||
path: ./Rules/Media/myTV_SUPER
|
||||
interval: 86400
|
||||
Pandora:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Pandora.yaml'
|
||||
path: ./Rules/Media/Pandora
|
||||
interval: 86400
|
||||
PBS:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/PBS.yaml'
|
||||
path: ./Rules/Media/PBS
|
||||
interval: 86400
|
||||
Pornhub:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Pornhub.yaml'
|
||||
path: ./Rules/Media/Pornhub
|
||||
interval: 86400
|
||||
Soundcloud:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/Soundcloud.yaml'
|
||||
path: ./Rules/Media/Soundcloud
|
||||
interval: 86400
|
||||
ViuTV:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Media/ViuTV.yaml'
|
||||
path: ./Rules/Media/ViuTV
|
||||
interval: 86400
|
||||
Telegram:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Telegram.yaml'
|
||||
path: ./Rules/Telegram
|
||||
interval: 86400
|
||||
Steam:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Steam.yaml'
|
||||
path: ./Rules/Steam
|
||||
interval: 86400
|
||||
Speedtest:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Speedtest.yaml'
|
||||
path: ./Rules/Speedtest
|
||||
interval: 86400
|
||||
PayPal:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/PayPal.yaml'
|
||||
path: ./Rules/PayPal
|
||||
interval: 86400
|
||||
Microsoft:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Microsoft.yaml'
|
||||
path: ./Rules/Microsoft
|
||||
interval: 86400
|
||||
PROXY:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Proxy.yaml'
|
||||
path: ./Rules/Proxy
|
||||
interval: 86400
|
||||
Domestic:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Domestic.yaml'
|
||||
path: ./Rules/Domestic
|
||||
interval: 86400
|
||||
Apple:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Apple.yaml'
|
||||
path: ./Rules/Apple
|
||||
interval: 86400
|
||||
Domestic IPs:
|
||||
type: http
|
||||
behavior: ipcidr
|
||||
url: 'https://gitee.com/lhie1/Rules/raw/master/Clash/Provider/Domestic%20IPs.yaml'
|
||||
path: ./Rules/Domestic_IPs
|
||||
interval: 86400
|
||||
rules:
|
||||
- RULE-SET,Reject,AdBlock
|
||||
- RULE-SET,Special,DIRECT
|
||||
- RULE-SET,Netflix,Netflix
|
||||
- RULE-SET,Spotify,Spotify
|
||||
- RULE-SET,YouTube,YouTube
|
||||
- RULE-SET,Bilibili,AsianTV
|
||||
- RULE-SET,iQiyi,AsianTV
|
||||
- RULE-SET,Letv,AsianTV
|
||||
- RULE-SET,Netease Music,AsianTV
|
||||
- RULE-SET,Tencent Video,AsianTV
|
||||
- RULE-SET,Youku,AsianTV
|
||||
- RULE-SET,ABC,GlobalTV
|
||||
- RULE-SET,Abema TV,GlobalTV
|
||||
- RULE-SET,Amazon,GlobalTV
|
||||
- RULE-SET,Apple News,GlobalTV
|
||||
- RULE-SET,Apple TV,GlobalTV
|
||||
- RULE-SET,Bahamut,GlobalTV
|
||||
- RULE-SET,BBC iPlayer,GlobalTV
|
||||
- RULE-SET,DAZN,GlobalTV
|
||||
- RULE-SET,Disney Plus,GlobalTV
|
||||
- RULE-SET,encoreTVB,GlobalTV
|
||||
- RULE-SET,Fox Now,GlobalTV
|
||||
- RULE-SET,Fox+,GlobalTV
|
||||
- RULE-SET,HBO,GlobalTV
|
||||
- RULE-SET,Hulu Japan,GlobalTV
|
||||
- RULE-SET,Hulu,GlobalTV
|
||||
- RULE-SET,Japonx,GlobalTV
|
||||
- RULE-SET,JOOX,GlobalTV
|
||||
- RULE-SET,KKBOX,GlobalTV
|
||||
- RULE-SET,KKTV,GlobalTV
|
||||
- RULE-SET,Line TV,GlobalTV
|
||||
- RULE-SET,myTV SUPER,GlobalTV
|
||||
- RULE-SET,Pandora,GlobalTV
|
||||
- RULE-SET,PBS,GlobalTV
|
||||
- RULE-SET,Pornhub,GlobalTV
|
||||
- RULE-SET,Soundcloud,GlobalTV
|
||||
- RULE-SET,ViuTV,GlobalTV
|
||||
- RULE-SET,Telegram,Telegram
|
||||
- RULE-SET,Steam,Steam
|
||||
- RULE-SET,Speedtest,Speedtest
|
||||
- RULE-SET,PayPal,PayPal
|
||||
- RULE-SET,Microsoft,Microsoft
|
||||
- RULE-SET,PROXY,Proxy
|
||||
- RULE-SET,Apple,Apple
|
||||
- RULE-SET,Domestic,Domestic
|
||||
- RULE-SET,Domestic IPs,Domestic
|
||||
- RULE-SET,LAN,DIRECT
|
||||
- GEOIP,CN,Domestic
|
||||
- MATCH,Others
|
||||
script:
|
||||
code: |
|
||||
def main(ctx, metadata):
|
||||
@ -336,7 +97,8 @@ script:
|
||||
"PROXY": "Proxy",
|
||||
"Apple": "Apple",
|
||||
"Domestic": "Domestic",
|
||||
"Domestic IPs": "Domestic"
|
||||
"Domestic IPs": "Domestic",
|
||||
"LAN": "DIRECT"
|
||||
}
|
||||
port = int(metadata["dst_port"])
|
||||
|
||||
@ -353,73 +115,291 @@ script:
|
||||
return "DIRECT"
|
||||
|
||||
code = ctx.geoip(ip)
|
||||
if code == "LAN":
|
||||
return "DIRECT"
|
||||
|
||||
if code == "CN":
|
||||
return "Domestic"
|
||||
|
||||
return "Others"
|
||||
|
||||
rules:
|
||||
##source:lhie1
|
||||
- RULE-SET,Reject,AdBlock
|
||||
- RULE-SET,Special,DIRECT
|
||||
|
||||
- RULE-SET,Netflix,Netflix
|
||||
- RULE-SET,Spotify,Spotify
|
||||
|
||||
# - RULE-SET,YouTube Music,YouTube
|
||||
- RULE-SET,YouTube,YouTube
|
||||
|
||||
- RULE-SET,Bilibili,AsianTV
|
||||
- RULE-SET,iQiyi,AsianTV
|
||||
- RULE-SET,Letv,AsianTV
|
||||
# - RULE-SET,MOO,AsianTV
|
||||
- RULE-SET,Netease Music,AsianTV
|
||||
- RULE-SET,Tencent Video,AsianTV
|
||||
- RULE-SET,Youku,AsianTV
|
||||
|
||||
- RULE-SET,ABC,GlobalTV
|
||||
- RULE-SET,Abema TV,GlobalTV
|
||||
- RULE-SET,Amazon,GlobalTV
|
||||
- RULE-SET,Apple News,GlobalTV
|
||||
- RULE-SET,Apple TV,GlobalTV
|
||||
- RULE-SET,Bahamut,GlobalTV
|
||||
- RULE-SET,BBC iPlayer,GlobalTV
|
||||
- RULE-SET,DAZN,GlobalTV
|
||||
- RULE-SET,Disney Plus,GlobalTV
|
||||
- RULE-SET,encoreTVB,GlobalTV
|
||||
- RULE-SET,Fox Now,GlobalTV
|
||||
- RULE-SET,Fox+,GlobalTV
|
||||
- RULE-SET,HBO,GlobalTV
|
||||
- RULE-SET,Hulu Japan,GlobalTV
|
||||
- RULE-SET,Hulu,GlobalTV
|
||||
- RULE-SET,Japonx,GlobalTV
|
||||
- RULE-SET,JOOX,GlobalTV
|
||||
- RULE-SET,KKBOX,GlobalTV
|
||||
- RULE-SET,KKTV,GlobalTV
|
||||
- RULE-SET,Line TV,GlobalTV
|
||||
- RULE-SET,myTV SUPER,GlobalTV
|
||||
- RULE-SET,Pandora,GlobalTV
|
||||
- RULE-SET,PBS,GlobalTV
|
||||
- RULE-SET,Pornhub,GlobalTV
|
||||
- RULE-SET,Soundcloud,GlobalTV
|
||||
- RULE-SET,ViuTV,GlobalTV
|
||||
|
||||
- RULE-SET,Telegram,Telegram
|
||||
- RULE-SET,Steam,Steam
|
||||
- RULE-SET,Speedtest,Speedtest
|
||||
- RULE-SET,PayPal,PayPal
|
||||
- RULE-SET,Microsoft,Microsoft
|
||||
|
||||
- RULE-SET,PROXY,Proxy
|
||||
|
||||
- RULE-SET,Apple,Apple
|
||||
|
||||
- RULE-SET,Domestic,Domestic
|
||||
- RULE-SET,Domestic IPs,Domestic
|
||||
|
||||
- GEOIP,CN,Domestic
|
||||
- MATCH,Others
|
||||
|
||||
rule-providers:
|
||||
Reject:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Reject.yaml
|
||||
path: "./Rules/Reject"
|
||||
interval: 86400
|
||||
Special:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Special.yaml
|
||||
path: "./Rules/Special"
|
||||
interval: 86400
|
||||
Netflix:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Netflix.yaml
|
||||
path: "./Rules/Media/Netflix"
|
||||
interval: 86400
|
||||
Spotify:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Spotify.yaml
|
||||
path: "./Rules/Media/Spotify"
|
||||
interval: 86400
|
||||
YouTube:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/YouTube.yaml
|
||||
path: "./Rules/Media/YouTube"
|
||||
interval: 86400
|
||||
Bilibili:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Bilibili.yaml
|
||||
path: "./Rules/Media/Bilibili"
|
||||
interval: 86400
|
||||
iQiyi:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/iQiyi.yaml
|
||||
path: "./Rules/Media/iQiyi"
|
||||
interval: 86400
|
||||
Letv:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Letv.yaml
|
||||
path: "./Rules/Media/Letv"
|
||||
interval: 86400
|
||||
Netease Music:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Netease%20Music.yaml
|
||||
path: "./Rules/Media/Netease_Music"
|
||||
interval: 86400
|
||||
Tencent Video:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Tencent%20Video.yaml
|
||||
path: "./Rules/Media/Tencent_Video"
|
||||
interval: 86400
|
||||
Youku:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Youku.yaml
|
||||
path: "./Rules/Media/Youku"
|
||||
interval: 86400
|
||||
ABC:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/ABC.yaml
|
||||
path: "./Rules/Media/ABC"
|
||||
interval: 86400
|
||||
Abema TV:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Abema%20TV.yaml
|
||||
path: "./Rules/Media/Abema_TV"
|
||||
interval: 86400
|
||||
Amazon:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Amazon.yaml
|
||||
path: "./Rules/Media/Amazon"
|
||||
interval: 86400
|
||||
Apple News:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Apple%20News.yaml
|
||||
path: "./Rules/Media/Apple_News"
|
||||
interval: 86400
|
||||
Apple TV:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Apple%20TV.yaml
|
||||
path: "./Rules/Media/Apple_TV"
|
||||
interval: 86400
|
||||
Bahamut:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Bahamut.yaml
|
||||
path: "./Rules/Media/Bahamut"
|
||||
interval: 86400
|
||||
BBC iPlayer:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/BBC%20iPlayer.yaml
|
||||
path: "./Rules/Media/BBC_iPlayer"
|
||||
interval: 86400
|
||||
DAZN:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/DAZN.yaml
|
||||
path: "./Rules/Media/DAZN"
|
||||
interval: 86400
|
||||
Disney Plus:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Disney%20Plus.yaml
|
||||
path: "./Rules/Media/Disney_Plus"
|
||||
interval: 86400
|
||||
encoreTVB:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/encoreTVB.yaml
|
||||
path: "./Rules/Media/encoreTVB"
|
||||
interval: 86400
|
||||
Fox Now:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Fox%20Now.yaml
|
||||
path: "./Rules/Media/Fox_Now"
|
||||
interval: 86400
|
||||
Fox+:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Fox%2B.yaml
|
||||
path: "./Rules/Media/Fox+"
|
||||
interval: 86400
|
||||
HBO:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/HBO.yaml
|
||||
path: "./Rules/Media/HBO"
|
||||
interval: 86400
|
||||
Hulu Japan:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Hulu%20Japan.yaml
|
||||
path: "./Rules/Media/Hulu_Japan"
|
||||
interval: 86400
|
||||
Hulu:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Hulu.yaml
|
||||
path: "./Rules/Media/Hulu"
|
||||
interval: 86400
|
||||
Japonx:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Japonx.yaml
|
||||
path: "./Rules/Media/Japonx"
|
||||
interval: 86400
|
||||
JOOX:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/JOOX.yaml
|
||||
path: "./Rules/Media/JOOX"
|
||||
interval: 86400
|
||||
KKBOX:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/KKBOX.yaml
|
||||
path: "./Rules/Media/KKBOX"
|
||||
interval: 86400
|
||||
KKTV:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/KKTV.yaml
|
||||
path: "./Rules/Media/KKTV"
|
||||
interval: 86400
|
||||
Line TV:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Line%20TV.yaml
|
||||
path: "./Rules/Media/Line_TV"
|
||||
interval: 86400
|
||||
myTV SUPER:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/myTV%20SUPER.yaml
|
||||
path: "./Rules/Media/myTV_SUPER"
|
||||
interval: 86400
|
||||
Pandora:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Pandora.yaml
|
||||
path: "./Rules/Media/Pandora"
|
||||
interval: 86400
|
||||
PBS:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/PBS.yaml
|
||||
path: "./Rules/Media/PBS"
|
||||
interval: 86400
|
||||
Pornhub:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Pornhub.yaml
|
||||
path: "./Rules/Media/Pornhub"
|
||||
interval: 86400
|
||||
Soundcloud:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Soundcloud.yaml
|
||||
path: "./Rules/Media/Soundcloud"
|
||||
interval: 86400
|
||||
ViuTV:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/ViuTV.yaml
|
||||
path: "./Rules/Media/ViuTV"
|
||||
interval: 86400
|
||||
Telegram:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Telegram.yaml
|
||||
path: "./Rules/Telegram"
|
||||
interval: 86400
|
||||
Steam:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Steam.yaml
|
||||
path: "./Rules/Steam"
|
||||
interval: 86400
|
||||
Speedtest:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Speedtest.yaml
|
||||
path: "./Rules/Speedtest"
|
||||
interval: 86400
|
||||
PayPal:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/PayPal.yaml
|
||||
path: "./Rules/PayPal"
|
||||
interval: 86400
|
||||
Microsoft:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Microsoft.yaml
|
||||
path: "./Rules/Microsoft"
|
||||
interval: 86400
|
||||
PROXY:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Proxy.yaml
|
||||
path: "./Rules/Proxy"
|
||||
interval: 86400
|
||||
Domestic:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Domestic.yaml
|
||||
path: "./Rules/Domestic"
|
||||
interval: 86400
|
||||
Apple:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Apple.yaml
|
||||
path: "./Rules/Apple"
|
||||
interval: 86400
|
||||
Domestic IPs:
|
||||
type: http
|
||||
behavior: ipcidr
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Domestic%20IPs.yaml
|
||||
path: "./Rules/Domestic_IPs"
|
||||
interval: 86400
|
||||
LAN:
|
||||
type: http
|
||||
behavior: classical
|
||||
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/LAN.yaml
|
||||
path: "./Rules/LAN"
|
||||
interval: 86400
|
||||
|
File diff suppressed because one or more lines are too long
@ -107,6 +107,7 @@ ViuTV,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingM
|
||||
ViuTV(By lhie1),lhie1,classical,lhie1/Rules/master/Clash/Provider/Media/,ViuTV.yaml,ViuTV-lhie1.yaml
|
||||
YouTube Music,lhie1,classical,lhie1/Rules/master/Clash/Provider/Media/,YouTube%20Music.yaml,YouTube Music.yaml
|
||||
YouTube,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,YouTube.yaml
|
||||
YouTubeMusic,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Music/,YouTubeMusic.yaml
|
||||
YouTube(By lhie1),lhie1,classical,lhie1/Rules/master/Clash/Provider/Media/,YouTube.yaml,YouTube-lhie1.yaml
|
||||
Youku,lhie1,classical,lhie1/Rules/master/Clash/Provider/Media/,Youku.yaml
|
||||
encoreTVB,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,encoreTVB.yaml
|
||||
|
@ -1,7 +1,8 @@
|
||||
默认(附带用于Clash的AdGuard DNS),default_with_clash_adg.yml,https://gist.githubusercontent.com/tindy2013/1fa08640a9088ac8652dbd40c5d2715b/raw/default_with_clash_adg.yml
|
||||
无Urltest,no_urltest.ini,https://gist.githubusercontent.com/tindy2013/1fa08640a9088ac8652dbd40c5d2715b/raw/no_urltest.ini
|
||||
带Urltest,urltest.ini,https://gist.githubusercontent.com/tindy2013/1fa08640a9088ac8652dbd40c5d2715b/raw/urltest.ini
|
||||
ConnersHua 神机规则 Basic,connershua_basic.ini,https://gist.githubusercontent.com/tindy2013/1fa08640a9088ac8652dbd40c5d2715b/raw/connershua_basic.ini
|
||||
ConnersHua 神机规则 Pro,connershua_pro.ini,https://gist.githubusercontent.com/tindy2013/1fa08640a9088ac8652dbd40c5d2715b/raw/connershua_pro.ini
|
||||
ConnersHua 神机规则 Pro,connershua_pro.ini,https://gist.githubusercontent.com/tindy2013/1fa08640a9088ac8652dbd40c5d2715b/raw/connershua_new.ini
|
||||
ConnersHua 神机规则 BacktoCN 回国专用,connershua_backtocn.ini,https://gist.githubusercontent.com/tindy2013/1fa08640a9088ac8652dbd40c5d2715b/raw/connershua_backtocn.ini
|
||||
lhie1 洞主规则(使用 Clash 分组规则),lhie1_clash.ini,https://gist.githubusercontent.com/tindy2013/1fa08640a9088ac8652dbd40c5d2715b/raw/lhie1_clash.ini
|
||||
lhie1 洞主规则完整版,lhie1_dler.ini,https://gist.githubusercontent.com/tindy2013/1fa08640a9088ac8652dbd40c5d2715b/raw/lhie1_dler.ini
|
||||
|
@ -8,14 +8,9 @@ LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
if [ "$14" != "1" ]; then
|
||||
controller_address="0.0.0.0"
|
||||
bind_address="*"
|
||||
elif [ "$18" != "Tun" ] && [ "$14" = "1" ]; then
|
||||
else
|
||||
controller_address=$11
|
||||
bind_address=$11
|
||||
elif [ "$18" = "Tun" ] && [ "$14" = "1" ]; then
|
||||
echo "Warning: Stop Set The Bind Address Option In TUN Mode, Because The Router Will Not Be Able To Connect To The Internet" >> $LOG_FILE
|
||||
echo "警告: 在TUN内核下启用仅允许内网会导致路由器无法联网,已忽略此项修改!" >$START_LOG
|
||||
controller_address="0.0.0.0"
|
||||
bind_address="*"
|
||||
fi
|
||||
|
||||
if [ -n "$(ruby_read "$7" "['tun']")" ]; then
|
||||
|
@ -175,7 +175,7 @@ do
|
||||
Thread.new{
|
||||
#test_url
|
||||
if Value['proxy-groups'][$count].key?('url') then
|
||||
group_test_url = '${uci_set}test_url=' + Value['proxy-groups'][$count]['url'].to_s
|
||||
group_test_url = '${uci_set}test_url=\"' + Value['proxy-groups'][$count]['url'].to_s + '\"'
|
||||
system(group_test_url)
|
||||
end
|
||||
}.join;
|
||||
@ -203,13 +203,8 @@ do
|
||||
Value['proxy-groups'][$count]['proxies'].each{
|
||||
|x|
|
||||
if Value_1.include?(x) then
|
||||
if '$group_type' == 'select' or '$group_type' == 'relay' then
|
||||
uci = '${uci_add}other_group=\"' + x.to_s + '\"'
|
||||
system(uci)
|
||||
elsif x == 'DIRECT' or x == 'REJECT' then
|
||||
uci = '${uci_add}other_group_dr=' + x.to_s
|
||||
system(uci)
|
||||
end
|
||||
uci = '${uci_add}other_group=\"' + x.to_s + '\"'
|
||||
system(uci)
|
||||
end
|
||||
}
|
||||
end
|
||||
|
@ -33,7 +33,6 @@ cfg_groups_set()
|
||||
sed -i "s/old_name_cfg \'${old_name_cfg}\'/old_name_cfg \'${name}\'/g" $CFG_FILE 2>/dev/null
|
||||
sed -i "s/groups \'${old_name_cfg}/groups \'${name}/g" $CFG_FILE 2>/dev/null
|
||||
sed -i "s/other_group \'${old_name_cfg}/other_group \'${name}/g" $CFG_FILE 2>/dev/null
|
||||
sed -i "s/other_group_dr \'${old_name_cfg}/other_group_dr \'${name}/g" $CFG_FILE 2>/dev/null
|
||||
sed -i "s/new_servers_group \'${old_name_cfg}/new_servers_group \'${name}/g" $CFG_FILE 2>/dev/null
|
||||
sed -i "s/relay_groups \'${old_name_cfg}/relay_groups \'${name}/g" $CFG_FILE 2>/dev/null
|
||||
#第三方规则处理
|
||||
|
@ -205,12 +205,7 @@ yml_groups_set()
|
||||
set_group=0
|
||||
set_proxy_provider=0
|
||||
|
||||
if [ "$type" = "select" ] || [ "$type" = "relay" ]; then
|
||||
config_list_foreach "$section" "other_group" set_other_groups #加入其他策略组
|
||||
else
|
||||
config_list_foreach "$section" "other_group_dr" set_other_groups #仅加入direct/reject其他策略组
|
||||
fi
|
||||
|
||||
config_list_foreach "$section" "other_group" set_other_groups #加入其他策略组
|
||||
config_foreach yml_servers_add "servers" "$name" "$type" #加入服务器节点
|
||||
|
||||
if [ "$type" = "relay" ] && [ -s "/tmp/relay_server" ]; then
|
||||
|
@ -190,7 +190,7 @@ do
|
||||
if '$provider_type' == 'http' then
|
||||
provider_path = '${uci_set}path=./proxy_provider/${provider_name}.yaml'
|
||||
else
|
||||
provider_path = '${uci_set}path=' + Value['proxy-providers'].values[$provider_count]['path'].to_s
|
||||
provider_path = '${uci_set}path=\"' + Value['proxy-providers'].values[$provider_count]['path'].to_s + '\"'
|
||||
end
|
||||
system(provider_path)
|
||||
end
|
||||
@ -199,7 +199,7 @@ do
|
||||
Thread.new{
|
||||
#gen_url
|
||||
if Value['proxy-providers'].values[$provider_count].key?('url') then
|
||||
provider_gen_url = '${uci_set}provider_url=' + Value['proxy-providers'].values[$provider_count]['url'].to_s
|
||||
provider_gen_url = '${uci_set}provider_url=\"' + Value['proxy-providers'].values[$provider_count]['url'].to_s + '\"'
|
||||
system(provider_gen_url)
|
||||
end
|
||||
}.join;
|
||||
@ -226,7 +226,7 @@ do
|
||||
#che_url
|
||||
if Value['proxy-providers'].values[$provider_count].key?('health-check') then
|
||||
if Value['proxy-providers'].values[$provider_count]['health-check'].key?('url') then
|
||||
provider_che_url = '${uci_set}health_check_url=' + Value['proxy-providers'].values[$provider_count]['health-check']['url'].to_s
|
||||
provider_che_url = '${uci_set}health_check_url=\"' + Value['proxy-providers'].values[$provider_count]['health-check']['url'].to_s + '\"'
|
||||
system(provider_che_url)
|
||||
end
|
||||
end
|
||||
@ -504,7 +504,7 @@ do
|
||||
Thread.new{
|
||||
#server
|
||||
if Value['proxies'][$count].key?('server') then
|
||||
server = '${uci_set}server=' + Value['proxies'][$count]['server'].to_s
|
||||
server = '${uci_set}server=\"' + Value['proxies'][$count]['server'].to_s + '\"'
|
||||
system(server)
|
||||
end
|
||||
}.join;
|
||||
@ -547,13 +547,13 @@ do
|
||||
end
|
||||
#host:
|
||||
if Value['proxies'][$count]['plugin-opts'].key?('host') then
|
||||
host = '${uci_set}host=' + Value['proxies'][$count]['plugin-opts']['host'].to_s
|
||||
host = '${uci_set}host=\"' + Value['proxies'][$count]['plugin-opts']['host'].to_s + '\"'
|
||||
system(host)
|
||||
end
|
||||
if Value['proxies'][$count]['plugin'].to_s == 'v2ray-plugin' then
|
||||
#path
|
||||
if Value['proxies'][$count]['plugin-opts'].key?('path') then
|
||||
path = '${uci_set}path=' + Value['proxies'][$count]['plugin-opts']['path'].to_s
|
||||
path = '${uci_set}path=\"' + Value['proxies'][$count]['plugin-opts']['path'].to_s + '\"'
|
||||
system(path)
|
||||
end
|
||||
#mux
|
||||
@ -564,7 +564,7 @@ do
|
||||
#headers
|
||||
if Value['proxies'][$count]['plugin-opts'].key?('headers') then
|
||||
if Value['proxies'][$count]['plugin-opts']['headers'].key?('custom') then
|
||||
custom = '${uci_set}custom=' + Value['proxies'][$count]['plugin-opts']['headers']['custom'].to_s
|
||||
custom = '${uci_set}custom=\"' + Value['proxies'][$count]['plugin-opts']['headers']['custom'].to_s + '\"'
|
||||
system(custom)
|
||||
end
|
||||
end
|
||||
@ -610,7 +610,7 @@ do
|
||||
Thread.new{
|
||||
#obfs-param
|
||||
if Value['proxies'][$count].key?('obfs-param') then
|
||||
obfs_param = '${uci_set}obfs_param=' + Value['proxies'][$count]['obfs-param'].to_s
|
||||
obfs_param = '${uci_set}obfs_param=\"' + Value['proxies'][$count]['obfs-param'].to_s + '\"'
|
||||
system(obfs_param)
|
||||
end
|
||||
}.join
|
||||
@ -618,7 +618,7 @@ do
|
||||
Thread.new{
|
||||
#protocol-param
|
||||
if Value['proxies'][$count].key?('protocol-param') then
|
||||
protocol_param = '${uci_set}protocol_param=' + Value['proxies'][$count]['protocol-param'].to_s
|
||||
protocol_param = '${uci_set}protocol_param=\"' + Value['proxies'][$count]['protocol-param'].to_s + '\"'
|
||||
system(protocol_param)
|
||||
end
|
||||
}.join
|
||||
@ -667,7 +667,7 @@ do
|
||||
Thread.new{
|
||||
#servername
|
||||
if Value['proxies'][$count].key?('servername') then
|
||||
servername = '${uci_set}servername=' + Value['proxies'][$count]['servername'].to_s
|
||||
servername = '${uci_set}servername=\"' + Value['proxies'][$count]['servername'].to_s + '\"'
|
||||
system(servername)
|
||||
end
|
||||
}.join
|
||||
@ -679,26 +679,26 @@ do
|
||||
system '${uci_set}obfs_vmess=websocket'
|
||||
#ws-path:
|
||||
if Value['proxies'][$count].key?('ws-path') then
|
||||
path = '${uci_set}path=' + Value['proxies'][$count]['ws-path'].to_s
|
||||
path = '${uci_set}path=\"' + Value['proxies'][$count]['ws-path'].to_s + '\"'
|
||||
system(path)
|
||||
end
|
||||
#Host:
|
||||
if Value['proxies'][$count].key?('ws-headers') then
|
||||
if Value['proxies'][$count]['ws-headers'].key?('Host') then
|
||||
custom = '${uci_set}custom=' + Value['proxies'][$count]['ws-headers']['Host'].to_s
|
||||
custom = '${uci_set}custom=\"' + Value['proxies'][$count]['ws-headers']['Host'].to_s + '\"'
|
||||
system(custom)
|
||||
end
|
||||
end
|
||||
elsif Value['proxies'][$count]['network'].to_s == 'http'
|
||||
system '${uci_set}obfs_vmess=http'
|
||||
if Value['proxies'][$count].key?('http-opts') then
|
||||
if Value['proxies'][$count]['http-opts'].key?('path') then
|
||||
system '${uci_del}http_path >/dev/null 2>&1'
|
||||
Value['proxies'][$count]['http-opts']['path'].each{
|
||||
|x|
|
||||
http_path = '${uci_add}http_path=' + x.to_s
|
||||
system(http_path)
|
||||
}
|
||||
elsif Value['proxies'][$count]['network'].to_s == 'http'
|
||||
system '${uci_set}obfs_vmess=http'
|
||||
if Value['proxies'][$count].key?('http-opts') then
|
||||
if Value['proxies'][$count]['http-opts'].key?('path') then
|
||||
system '${uci_del}http_path >/dev/null 2>&1'
|
||||
Value['proxies'][$count]['http-opts']['path'].each{
|
||||
|x|
|
||||
http_path = '${uci_add}http_path=\"' + x.to_s + '\"'
|
||||
system(http_path)
|
||||
}
|
||||
end
|
||||
if Value['proxies'][$count]['http-opts'].key?('headers') then
|
||||
if Value['proxies'][$count]['http-opts']['headers'].key?('Connection') then
|
||||
@ -711,9 +711,25 @@ do
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
system '${uci_set}obfs_vmess=none'
|
||||
end
|
||||
elsif Value['proxies'][$count]['network'].to_s == 'h2'
|
||||
system '${uci_set}obfs_vmess=h2'
|
||||
if Value['proxies'][$count].key?('h2-opts') then
|
||||
if Value['proxies'][$count]['h2-opts'].key?('host') then
|
||||
system '${uci_del}h2_host >/dev/null 2>&1'
|
||||
Value['proxies'][$count]['h2-opts']['host'].each{
|
||||
|x|
|
||||
h2_host = '${uci_add}h2_host=\"' + x.to_s + '\"'
|
||||
system(h2_host)
|
||||
}
|
||||
end
|
||||
if Value['proxies'][$count]['h2-opts'].key?('path') then
|
||||
h2_path = '${uci_set}h2_path=\"' + Value['proxies'][$count]['h2-opts']['host'].to_s + '\"'
|
||||
system(h2_path)
|
||||
end
|
||||
end
|
||||
else
|
||||
system '${uci_set}obfs_vmess=none'
|
||||
end
|
||||
end
|
||||
}.join
|
||||
end;
|
||||
@ -727,7 +743,7 @@ do
|
||||
system '${uci_set}obfs_snell=none'
|
||||
end
|
||||
if Value['proxies'][$count]['obfs-opts'].key?('host') then
|
||||
host = '${uci_set}host=' + Value['proxies'][$count]['obfs-opts']['host'].to_s
|
||||
host = '${uci_set}host=\"' + Value['proxies'][$count]['obfs-opts']['host'].to_s + '\"'
|
||||
system(host)
|
||||
end
|
||||
end
|
||||
@ -781,7 +797,7 @@ do
|
||||
if '$server_type' == 'http' or '$server_type' == 'trojan' then
|
||||
Thread.new{
|
||||
if Value['proxies'][$count].key?('sni') then
|
||||
sni = '${uci_set}sni=' + Value['proxies'][$count]['sni'].to_s
|
||||
sni = '${uci_set}sni=\"' + Value['proxies'][$count]['sni'].to_s + '\"'
|
||||
system(sni)
|
||||
end
|
||||
}.join
|
||||
@ -793,7 +809,7 @@ do
|
||||
system '${uci_del}alpn >/dev/null 2>&1'
|
||||
Value['proxies'][$count]['alpn'].each{
|
||||
|x|
|
||||
alpn = '${uci_add}alpn=' + x.to_s
|
||||
alpn = '${uci_add}alpn=\"' + x.to_s + '\"'
|
||||
system(alpn)
|
||||
}
|
||||
end
|
||||
|
@ -37,6 +37,20 @@ if [ -z "$CONFIG_NAME" ]; then
|
||||
CONFIG_NAME="config.yaml"
|
||||
fi
|
||||
|
||||
yml_other_rules_del()
|
||||
{
|
||||
local section="$1"
|
||||
local enabled config
|
||||
config_get_bool "enabled" "$section" "enabled" "1"
|
||||
config_get "config" "$section" "config" ""
|
||||
config_get "rule_name" "$section" "rule_name" ""
|
||||
|
||||
if [ "$enabled" = "0" ] || [ "$config" != "$2" ] || [ "$rule_name" != "$3" ]; then
|
||||
return
|
||||
else
|
||||
uci delete openclash."$section" 2>/dev/null
|
||||
fi
|
||||
}
|
||||
#写入代理集到配置文件
|
||||
yml_proxy_provider_set()
|
||||
{
|
||||
@ -135,6 +149,15 @@ cat >> "$SERVER_FILE" <<-EOF
|
||||
EOF
|
||||
}
|
||||
|
||||
set_h2_host()
|
||||
{
|
||||
if [ -z "$1" ]; then
|
||||
return
|
||||
fi
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- '$1'
|
||||
EOF
|
||||
}
|
||||
|
||||
#写入服务器节点到配置文件
|
||||
yml_servers_set()
|
||||
@ -175,6 +198,8 @@ yml_servers_set()
|
||||
config_get "http_path" "$section" "http_path" ""
|
||||
config_get "keep_alive" "$section" "keep_alive" ""
|
||||
config_get "servername" "$section" "servername" ""
|
||||
config_get "h2_path" "$section" "h2_path" ""
|
||||
config_get "h2_host" "$section" "h2_host" ""
|
||||
|
||||
if [ "$enabled" = "0" ]; then
|
||||
return
|
||||
@ -245,6 +270,10 @@ yml_servers_set()
|
||||
obfs_vmess="network: http"
|
||||
fi
|
||||
|
||||
if [ "$obfs_vmess" = "h2" ]; then
|
||||
obfs_vmess="network: h2"
|
||||
fi
|
||||
|
||||
if [ ! -z "$custom" ] && [ "$type" = "vmess" ]; then
|
||||
custom="Host: $custom"
|
||||
fi
|
||||
@ -402,6 +431,20 @@ cat >> "$SERVER_FILE" <<-EOF
|
||||
headers:
|
||||
Connection:
|
||||
- keep-alive
|
||||
EOF
|
||||
fi
|
||||
|
||||
#h2
|
||||
if [ ! -z "$h2_host" ] && [ "$obfs_vmess" = "network: h2" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
h2-opts:
|
||||
host:
|
||||
EOF
|
||||
config_list_foreach "$section" "h2_host" set_h2_host
|
||||
fi
|
||||
if [ ! -z "$h2_path" ] && [ "$obfs_vmess" = "network: h2" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
path: $h2_path
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
@ -677,13 +720,21 @@ cat >> "$SERVER_FILE" <<-EOF
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
${UCI_SET}rule_source="ConnersHua"
|
||||
${UCI_SET}GlobalTV="GlobalTV"
|
||||
${UCI_SET}AsianTV="AsianTV"
|
||||
${UCI_SET}Proxy="Proxy"
|
||||
${UCI_SET}AdBlock="AdBlock"
|
||||
${UCI_SET}Domestic="Domestic"
|
||||
${UCI_SET}Others="Others"
|
||||
config_load "openclash"
|
||||
config_foreach yml_other_rules_del "other_rules" "$CONFIG_NAME" "ConnersHua"
|
||||
uci_name_tmp=$(uci add openclash other_rules)
|
||||
uci_set="uci -q set openclash.$uci_name_tmp."
|
||||
${UCI_SET}rule_source="1"
|
||||
${uci_set}enable="1"
|
||||
${uci_set}rule_name="ConnersHua"
|
||||
${uci_set}config="$CONFIG_NAME"
|
||||
${uci_set}GlobalTV="GlobalTV"
|
||||
${uci_set}AsianTV="AsianTV"
|
||||
${uci_set}Proxy="Proxy"
|
||||
${uci_set}AdBlock="AdBlock"
|
||||
${uci_set}Domestic="Domestic"
|
||||
${uci_set}Others="Others"
|
||||
|
||||
[ "$config_auto_update" -eq 1 ] && [ "$new_servers_group_set" -eq 1 ] && {
|
||||
${UCI_SET}servers_update="1"
|
||||
${UCI_DEL_LIST}="Auto - UrlTest" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Auto - UrlTest" >/dev/null 2>&1
|
||||
@ -881,22 +932,30 @@ cat >> "$SERVER_FILE" <<-EOF
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
${UCI_SET}rule_source="lhie1"
|
||||
${UCI_SET}GlobalTV="GlobalTV"
|
||||
${UCI_SET}AsianTV="AsianTV"
|
||||
${UCI_SET}Proxy="Proxy"
|
||||
${UCI_SET}Youtube="Youtube"
|
||||
${UCI_SET}Apple="Apple"
|
||||
${UCI_SET}Microsoft="Microsoft"
|
||||
${UCI_SET}Netflix="Netflix"
|
||||
${UCI_SET}Spotify="Spotify"
|
||||
${UCI_SET}Steam="Steam"
|
||||
${UCI_SET}AdBlock="AdBlock"
|
||||
${UCI_SET}Speedtest="Speedtest"
|
||||
${UCI_SET}Telegram="Telegram"
|
||||
${UCI_SET}PayPal="PayPal"
|
||||
${UCI_SET}Domestic="Domestic"
|
||||
${UCI_SET}Others="Others"
|
||||
config_load "openclash"
|
||||
config_foreach yml_other_rules_del "other_rules" "$CONFIG_NAME" "lhie1"
|
||||
uci_name_tmp=$(uci add openclash other_rules)
|
||||
uci_set="uci -q set openclash.$uci_name_tmp."
|
||||
${UCI_SET}rule_source="1"
|
||||
${uci_set}enable="1"
|
||||
${uci_set}rule_name="lhie1"
|
||||
${uci_set}config="$CONFIG_NAME"
|
||||
${uci_set}GlobalTV="GlobalTV"
|
||||
${uci_set}AsianTV="AsianTV"
|
||||
${uci_set}Proxy="Proxy"
|
||||
${uci_set}Youtube="Youtube"
|
||||
${uci_set}Apple="Apple"
|
||||
${uci_set}Microsoft="Microsoft"
|
||||
${uci_set}Netflix="Netflix"
|
||||
${uci_set}Spotify="Spotify"
|
||||
${uci_set}Steam="Steam"
|
||||
${uci_set}AdBlock="AdBlock"
|
||||
${uci_set}Speedtest="Speedtest"
|
||||
${uci_set}Telegram="Telegram"
|
||||
${uci_set}PayPal="PayPal"
|
||||
${uci_set}Domestic="Domestic"
|
||||
${uci_set}Others="Others"
|
||||
|
||||
[ "$config_auto_update" -eq 1 ] && [ "$new_servers_group_set" -eq 1 ] && {
|
||||
${UCI_SET}servers_update="1"
|
||||
${UCI_DEL_LIST}="Auto - UrlTest" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Auto - UrlTest" >/dev/null 2>&1
|
||||
@ -954,9 +1013,16 @@ cat >> "$SERVER_FILE" <<-EOF
|
||||
- Proxy
|
||||
- DIRECT
|
||||
EOF
|
||||
${UCI_SET}rule_source="ConnersHua_return"
|
||||
${UCI_SET}Proxy="Proxy"
|
||||
${UCI_SET}Others="Others"
|
||||
config_load "openclash"
|
||||
config_foreach yml_other_rules_del "other_rules" "$CONFIG_NAME" "ConnersHua_return"
|
||||
uci_name_tmp=$(uci add openclash other_rules)
|
||||
uci_set="uci -q set openclash.$uci_name_tmp."
|
||||
${UCI_SET}rule_source="1"
|
||||
${uci_set}enable="1"
|
||||
${uci_set}rule_name="ConnersHua_return"
|
||||
${uci_set}config="$CONFIG_NAME"
|
||||
${uci_set}Proxy="Proxy"
|
||||
${uci_set}Others="Others"
|
||||
[ "$config_auto_update" -eq 1 ] && [ "$new_servers_group_set" -eq 1 ] && {
|
||||
${UCI_SET}servers_update="1"
|
||||
${UCI_DEL_LIST}="Auto - UrlTest" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Auto - UrlTest" >/dev/null 2>&1
|
||||
|
@ -63,10 +63,8 @@ yml_other_set()
|
||||
puts '${LOGTIME} Set Custom Rules Error: ' + e.message
|
||||
end
|
||||
begin
|
||||
if $7 == 1 and Value.has_key?('rules') then
|
||||
ruby_add_index = Value['rules'].index(Value['rules'].grep(/(GEOIP|MATCH|FINAL)/).first)
|
||||
ruby_add_index ||= -1
|
||||
Value['rules']=Value['rules'].to_a.insert(ruby_add_index,
|
||||
if $5 == 1 then
|
||||
Value['rules']=Value['rules'].to_a.insert(0,
|
||||
'DOMAIN-KEYWORD,tracker,DIRECT',
|
||||
'DOMAIN-KEYWORD,announce.php?passkey=,DIRECT',
|
||||
'DOMAIN-KEYWORD,torrent,DIRECT',
|
||||
@ -77,16 +75,37 @@ yml_other_set()
|
||||
'DOMAIN-KEYWORD,BitTorrent,DIRECT',
|
||||
'DOMAIN-KEYWORD,announce_peer,DIRECT'
|
||||
)
|
||||
begin
|
||||
match_group=Value['rules'].grep(/(MATCH|FINAL)/)[0]
|
||||
if not match_group.empty? and not match_group.nil? then
|
||||
common_port_group=match_group.split(',')[2] or common_port_group=match_group.split(',')[1]
|
||||
if not common_port_group.empty? and not common_port_group.nil? then
|
||||
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,
|
||||
'DST-PORT,80,' + common_port_group,
|
||||
'DST-PORT,443,' + common_port_group,
|
||||
'DST-PORT,22,' + common_port_group
|
||||
)
|
||||
end
|
||||
end
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Set BT/P2P Common Port Rules Error: ' + e.message
|
||||
end
|
||||
Value['rules'].to_a.collect!{|x|x.to_s.gsub(/(^MATCH.*|^FINAL.*)/, 'MATCH,DIRECT')}
|
||||
end;
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Set Bt DIRECT Rules Error: ' + e.message
|
||||
puts '${LOGTIME} Set BT/P2P DIRECT Rules Error: ' + e.message
|
||||
end
|
||||
begin
|
||||
if Value.has_key?('rules') and Value['rules'].to_a.grep(/(?=.*198.18)(?=.*REJECT)/).empty? then
|
||||
ruby_add_index = Value['rules'].index(Value['rules'].grep(/(GEOIP|MATCH|FINAL)/).first)
|
||||
ruby_add_index ||= -1
|
||||
Value['rules']=Value['rules'].to_a.insert(ruby_add_index,'IP-CIDR,198.18.0.1/16,REJECT,no-resolve')
|
||||
if Value.has_key?('rules') and not Value['rules'].to_a.empty? then
|
||||
if Value['rules'].to_a.grep(/(?=.*198.18)(?=.*REJECT)/).empty? then
|
||||
ruby_add_index = Value['rules'].index(Value['rules'].grep(/(GEOIP|MATCH|FINAL)/).first)
|
||||
ruby_add_index ||= -1
|
||||
Value['rules']=Value['rules'].to_a.insert(ruby_add_index,'IP-CIDR,198.18.0.1/16,REJECT,no-resolve')
|
||||
end
|
||||
else
|
||||
Value['rules']=%w(IP-CIDR,198.18.0.1/16,REJECT,no-resolve)
|
||||
end;
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Set 198.18.0.1/16 REJECT Rule Error: ' + e.message
|
||||
@ -95,42 +114,66 @@ yml_other_set()
|
||||
end" 2>/dev/null >> $LOG_FILE
|
||||
}
|
||||
|
||||
if [ "$2" != 0 ]; then
|
||||
yml_other_rules_get()
|
||||
{
|
||||
local section="$1"
|
||||
local enabled config
|
||||
config_get_bool "enabled" "$section" "enabled" "1"
|
||||
config_get "config" "$section" "config" ""
|
||||
|
||||
if [ "$enabled" = "0" ] || [ "$config" != "$2" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -n "$rule_name" ]; then
|
||||
echo "${LOGTIME} Warrning: Multiple Other-Rules-Configurations Enabled, Ignore..." >> $LOG_FILE
|
||||
return
|
||||
fi
|
||||
|
||||
config_get "rule_name" "$section" "rule_name" ""
|
||||
config_get "GlobalTV" "$section" "GlobalTV" ""
|
||||
config_get "AsianTV" "$section" "AsianTV" ""
|
||||
config_get "Proxy" "$section" "Proxy" ""
|
||||
config_get "Youtube" "$section" "Youtube" ""
|
||||
config_get "Apple" "$section" "Apple" ""
|
||||
config_get "Netflix" "$section" "Netflix" ""
|
||||
config_get "Spotify" "$section" "Spotify" ""
|
||||
config_get "Steam" "$section" "Steam" ""
|
||||
config_get "AdBlock" "$section" "AdBlock" ""
|
||||
config_get "Netease_Music" "$section" "Netease_Music" ""
|
||||
config_get "Speedtest" "$section" "Speedtest" ""
|
||||
config_get "Telegram" "$section" "Telegram" ""
|
||||
config_get "Microsoft" "$section" "Microsoft" ""
|
||||
config_get "PayPal" "$section" "PayPal" ""
|
||||
config_get "Domestic" "$section" "Domestic" ""
|
||||
config_get "Others" "$section" "Others" ""
|
||||
}
|
||||
|
||||
if [ "$2" != "0" ]; then
|
||||
config_load "openclash"
|
||||
config_foreach yml_other_rules_get "other_rules" "$6"
|
||||
if [ -z "$rule_name" ]; then
|
||||
yml_other_set "$1" "$2" "$3" "$4" "$5"
|
||||
exit 0
|
||||
#判断策略组是否存在
|
||||
GlobalTV=$(uci get openclash.config.GlobalTV 2>/dev/null)
|
||||
AsianTV=$(uci get openclash.config.AsianTV 2>/dev/null)
|
||||
Proxy=$(uci get openclash.config.Proxy 2>/dev/null)
|
||||
Youtube=$(uci get openclash.config.Youtube 2>/dev/null)
|
||||
Apple=$(uci get openclash.config.Apple 2>/dev/null)
|
||||
Netflix=$(uci get openclash.config.Netflix 2>/dev/null)
|
||||
Spotify=$(uci get openclash.config.Spotify 2>/dev/null)
|
||||
Steam=$(uci get openclash.config.Steam 2>/dev/null)
|
||||
AdBlock=$(uci get openclash.config.AdBlock 2>/dev/null)
|
||||
Netease_Music=$(uci get openclash.config.Netease_Music 2>/dev/null)
|
||||
Speedtest=$(uci get openclash.config.Speedtest 2>/dev/null)
|
||||
Telegram=$(uci get openclash.config.Telegram 2>/dev/null)
|
||||
Microsoft=$(uci get openclash.config.Microsoft 2>/dev/null)
|
||||
PayPal=$(uci get openclash.config.PayPal 2>/dev/null)
|
||||
Domestic=$(uci get openclash.config.Domestic 2>/dev/null)
|
||||
Others=$(uci get openclash.config.Others 2>/dev/null)
|
||||
if [ "$2" = "ConnersHua_return" ]; then
|
||||
elif [ "$rule_name" = "ConnersHua_return" ]; then
|
||||
if [ -z "$(grep -F "$Proxy" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$Others" /tmp/Proxy_Group)" ];then
|
||||
echo "${1} Warning: Because of The Different Porxy-Group's Name, Stop Setting The Other Rules!" >>/tmp/openclash.log
|
||||
yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7"
|
||||
echo "${1} Warning: Because of The Different Porxy-Group's Name, Stop Setting The Other Rules!" >> $LOG_FILE
|
||||
yml_other_set "$1" "$2" "$3" "$4" "$5"
|
||||
exit 0
|
||||
fi
|
||||
elif [ "$2" = "ConnersHua" ]; then
|
||||
elif [ "$rule_name" = "ConnersHua" ]; then
|
||||
if [ -z "$(grep "$GlobalTV" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$AsianTV" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$Proxy" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$Others" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$Domestic" /tmp/Proxy_Group)" ]; then
|
||||
echo "${1} Warning: Because of The Different Porxy-Group's Name, Stop Setting The Other Rules!" >>/tmp/openclash.log
|
||||
yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7"
|
||||
echo "${1} Warning: Because of The Different Porxy-Group's Name, Stop Setting The Other Rules!" >> $LOG_FILE
|
||||
yml_other_set "$1" "$2" "$3" "$4" "$5"
|
||||
exit 0
|
||||
fi
|
||||
elif [ "$2" = "lhie1" ]; then
|
||||
elif [ "$rule_name" = "lhie1" ]; then
|
||||
if [ -z "$(grep -F "$GlobalTV" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$AsianTV" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$Proxy" /tmp/Proxy_Group)" ]\
|
||||
@ -146,14 +189,14 @@ if [ "$2" != 0 ]; then
|
||||
|| [ -z "$(grep -F "$PayPal" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$Others" /tmp/Proxy_Group)" ]\
|
||||
|| [ -z "$(grep -F "$Domestic" /tmp/Proxy_Group)" ]; then
|
||||
echo "${1} Warning: Because of The Different Porxy-Group's Name, Stop Setting The Other Rules!" >>/tmp/openclash.log
|
||||
yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7"
|
||||
echo "${1} Warning: Because of The Different Porxy-Group's Name, Stop Setting The Other Rules!" >> $LOG_FILE
|
||||
yml_other_set "$1" "$2" "$3" "$4" "$5"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
if [ "$Proxy" = "读取错误,配置文件异常!" ]; then
|
||||
echo "${1} Warning: Can not Get The Porxy-Group's Name, Stop Setting The Other Rules!" >>/tmp/openclash.log
|
||||
yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7"
|
||||
if [ -z "$Proxy" ]; then
|
||||
echo "${1} Error: Missing Porxy-Group's Name, Stop Setting The Other Rules!" >> $LOG_FILE
|
||||
yml_other_set "$1" "$2" "$3" "$4" "$5"
|
||||
exit 0
|
||||
else
|
||||
#删除原有的部分,防止冲突
|
||||
@ -163,7 +206,7 @@ if [ "$2" != 0 ]; then
|
||||
if [ -n "$(ruby_read "$4" "['rules']")" ]; then
|
||||
ruby_edit "$4" "['rules'].clear"
|
||||
fi
|
||||
if [ "$2" = "lhie1" ]; then
|
||||
if [ "$rule_name" = "lhie1" ]; then
|
||||
ruby -ryaml -E UTF-8 -e "
|
||||
begin
|
||||
Value = YAML.load_file('$4');
|
||||
@ -216,7 +259,7 @@ if [ "$2" != 0 ]; then
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Set lhie1 Rules Error: ' + e.message
|
||||
end" 2>/dev/null >> $LOG_FILE
|
||||
elif [ "$2" = "ConnersHua" ]; then
|
||||
elif [ "$rule_name" = "ConnersHua" ]; then
|
||||
ruby -ryaml -E UTF-8 -e "
|
||||
begin
|
||||
Value = YAML.load_file('$4');
|
||||
@ -241,7 +284,7 @@ if [ "$2" != 0 ]; then
|
||||
};
|
||||
File.open('$4','w') {|f| YAML.dump(Value, f)};
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Set lhie1 Rules Error: ' + e.message
|
||||
puts '${LOGTIME} Set ConnersHua Rules Error: ' + e.message
|
||||
end" 2>/dev/null >> $LOG_FILE
|
||||
else
|
||||
ruby -ryaml -E UTF-8 -e "
|
||||
@ -256,10 +299,10 @@ if [ "$2" != 0 ]; then
|
||||
};
|
||||
File.open('$4','w') {|f| YAML.dump(Value, f)};
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Set lhie1 Rules Error: ' + e.message
|
||||
puts '${LOGTIME} Set ConnersHua Return Rules Error: ' + e.message
|
||||
end" 2>/dev/null >> $LOG_FILE
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7"
|
||||
yml_other_set "$1" "$2" "$3" "$4" "$5"
|
||||
|
Loading…
x
Reference in New Issue
Block a user