🎁 Sync 2023-05-19 23:35

This commit is contained in:
github-actions[bot] 2023-05-19 23:35:09 +08:00
parent dd2a100e62
commit d92bf12d5a
161 changed files with 29113 additions and 1 deletions

77
aliyundrive-fuse/Makefile Normal file
View File

@ -0,0 +1,77 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=aliyundrive-fuse
PKG_VERSION:=0.1.14
PKG_RELEASE:=1
PKG_LICENSE:=MIT
PKG_MAINTAINER:=messense <messense@icloud.com>
PKG_LIBC:=musl
ifeq ($(ARCH),arm)
PKG_LIBC:=musleabi
ARM_CPU_FEATURES:=$(word 2,$(subst +,$(space),$(call qstrip,$(CONFIG_CPU_TYPE))))
ifneq ($(filter $(ARM_CPU_FEATURES),vfp vfpv2),)
PKG_LIBC:=musleabihf
endif
endif
PKG_ARCH=$(ARCH)
ifeq ($(ARCH),i386)
PKG_ARCH:=i686
endif
PKG_SOURCE:=aliyundrive-fuse-v$(PKG_VERSION).$(PKG_ARCH)-unknown-linux-$(PKG_LIBC).tar.gz
PKG_SOURCE_URL:=https://github.com/messense/aliyundrive-fuse/releases/download/v$(PKG_VERSION)/
PKG_HASH:=skip
include $(INCLUDE_DIR)/package.mk
define Package/aliyundrive-fuse
SECTION:=multimedia
CATEGORY:=Multimedia
DEPENDS:=+fuse-utils
TITLE:=FUSE for AliyunDrive
URL:=https://github.com/messense/aliyundrive-fuse
endef
define Package/aliyundrive-fuse/description
FUSE for AliyunDrive.
endef
define Package/aliyundrive-fuse/conffiles
/etc/config/aliyundrive-fuse
endef
define Download/sha256sum
FILE:=$(PKG_SOURCE).sha256
URL_FILE:=$(FILE)
URL:=$(PKG_SOURCE_URL)
HASH:=skip
endef
$(eval $(call Download,sha256sum))
define Build/Prepare
mv $(DL_DIR)/$(PKG_SOURCE).sha256 .
cp $(DL_DIR)/$(PKG_SOURCE) .
shasum -a 256 -c $(PKG_SOURCE).sha256
rm $(PKG_SOURCE).sha256 $(PKG_SOURCE)
tar -C $(PKG_BUILD_DIR)/ -zxf $(DL_DIR)/$(PKG_SOURCE)
endef
define Build/Compile
echo "aliyundrive-fuse using precompiled binary."
endef
define Package/aliyundrive-fuse/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/aliyundrive-fuse $(1)/usr/bin/aliyundrive-fuse
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/aliyundrive-fuse.init $(1)/etc/init.d/aliyundrive-fuse
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/aliyundrive-fuse.config $(1)/etc/config/aliyundrive-fuse
endef
$(eval $(call BuildPackage,aliyundrive-fuse))

View File

@ -0,0 +1,7 @@
config default
option enable '0'
option debug '0'
option refresh_token ''
option mount_point '/mnt/aliyundrive'
option read_buffer_size '10485760'
option allow_other '1'

View File

@ -0,0 +1,48 @@
#!/bin/sh /etc/rc.common
USE_PROCD=1
START=99
STOP=15
NAME=aliyundrive-fuse
uci_get_by_type() {
local ret=$(uci get $NAME.@$1[0].$2 2>/dev/null)
echo ${ret:=$3}
}
start_service() {
local enable=$(uci_get_by_type default enable)
case "$enable" in
1|on|true|yes|enabled)
local refresh_token=$(uci_get_by_type default refresh_token)
local mount_point=$(uci_get_by_type default mount_point)
local read_buf_size=$(uci_get_by_type default read_buffer_size 10485760)
local allow_other=$(uci_get_by_type default allow_other 0)
local extra_options=""
if [ "$allow_other" = "1" ]; then
extra_options="$extra_options --allow-other"
fi
mkdir -p "$mount_point"
procd_open_instance
procd_set_param command /bin/sh -c "/usr/bin/$NAME $extra_options -S $read_buf_size --workdir /var/run/$NAME $mount_point >>/var/log/$NAME.log 2>&1"
procd_set_param pidfile /var/run/$NAME.pid
procd_set_param env REFRESH_TOKEN="$refresh_token"
case $(uci_get_by_type default debug) in
1|on|true|yes|enabled)
procd_append_param env RUST_LOG="aliyundrive_fuse=debug" ;;
*) ;;
esac
procd_close_instance ;;
*)
stop_service ;;
esac
}
service_triggers() {
procd_add_reload_trigger "aliyundrive-fuse"
}

View File

@ -0,0 +1,17 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-aliyundrive-fuse
PKG_VERSION:=0.1.14
PKG_RELEASE:=1
PKG_PO_VERSION:=$(PKG_VERSION)-$(PKG_RELEASE)
PKG_LICENSE:=MIT
PKG_MAINTAINER:=messense <messense@icloud.com>
LUCI_TITLE:=LuCI Support for aliyundrive-fuse
LUCI_PKGARCH:=all
LUCI_DEPENDS:=+aliyundrive-fuse
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,40 @@
module("luci.controller.aliyundrive-fuse", package.seeall)
function index()
if not nixio.fs.access("/etc/config/aliyundrive-fuse") then
return
end
local page
page = entry({"admin", "services", "aliyundrive-fuse"}, alias("admin", "services", "aliyundrive-fuse", "client"), _("AliyunDrive FUSE"), 10) -- 首页
page.dependent = true
page.acl_depends = { "luci-app-aliyundrive-fuse" }
entry({"admin", "services", "aliyundrive-fuse", "client"}, cbi("aliyundrive-fuse/client"), _("Settings"), 10).leaf = true -- 客户端配置
entry({"admin", "services", "aliyundrive-fuse", "log"}, form("aliyundrive-fuse/log"), _("Log"), 30).leaf = true -- 日志页面
entry({"admin", "services", "aliyundrive-fuse", "status"}, call("action_status")).leaf = true
entry({"admin", "services", "aliyundrive-fuse", "logtail"}, call("action_logtail")).leaf = true
end
function action_status()
local e = {}
e.running = luci.sys.call("pidof aliyundrive-fuse >/dev/null") == 0
e.application = luci.sys.exec("aliyundrive-fuse --version")
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end
function action_logtail()
local fs = require "nixio.fs"
local log_path = "/var/log/aliyundrive-fuse.log"
local e = {}
e.running = luci.sys.call("pidof aliyundrive-fuse >/dev/null") == 0
if fs.access(log_path) then
e.log = luci.sys.exec("tail -n 100 %s | sed 's/\\x1b\\[[0-9;]*m//g'" % log_path)
else
e.log = ""
end
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end

View File

@ -0,0 +1,30 @@
m = Map("aliyundrive-fuse")
m.title = translate("AliyunDrive FUSE")
m.description = translate("<a href=\"https://github.com/messense/aliyundrive-fuse\" target=\"_blank\">Project GitHub URL</a>")
m:section(SimpleSection).template = "aliyundrive-fuse/aliyundrive-fuse_status"
e = m:section(TypedSection, "default")
e.anonymous = true
enable = e:option(Flag, "enable", translate("Enable"))
enable.rmempty = false
refresh_token = e:option(Value, "refresh_token", translate("Refresh Token"))
refresh_token.description = translate("<a href=\"https://github.com/messense/aliyundrive-webdav#%E8%8E%B7%E5%8F%96-refresh_token\" target=\"_blank\">How to get refresh token</a>")
mount_point = e:option(Value, "mount_point", translate("Mount Point"))
mount_point.default = "/mnt/aliyundrive"
read_buffer_size = e:option(Value, "read_buffer_size", translate("Read Buffer Size"))
read_buffer_size.default = "10485760"
read_buffer_size.datatype = "uinteger"
allow_other = e:option(Flag, "allow_other", translate("Allow Other users Access"))
allow_other.description = translate("Allow other users to access the drive, enable this if you share with samba")
allow_other.rmempty = false
debug = e:option(Flag, "debug", translate("Debug Mode"))
debug.rmempty = false
return m

View File

@ -0,0 +1,9 @@
log = SimpleForm("logview")
log.submit = false
log.reset = false
t = log:field(DummyValue, '', '')
t.rawhtml = true
t.template = 'aliyundrive-fuse/aliyundrive-fuse_log'
return log

View File

@ -0,0 +1,15 @@
<%+cbi/valueheader%>
<textarea id="logview" class="cbi-input-textarea" style="width: 100%" rows="30" readonly="readonly"></textarea>
<script type="text/javascript">
const LOG_URL = '<%=luci.dispatcher.build_url("admin", "services", "aliyundrive-fuse", "logtail")%>';
XHR.poll(1, LOG_URL, null, (x, d) => {
let logview = document.getElementById("logview");
if (!d.running) {
XHR.halt();
}
logview.value = d.log;
logview.scrollTop = logview.scrollHeight;
});
</script>
<%+cbi/valuefooter%>

View File

@ -0,0 +1,21 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=url([[admin]], [[services]], [[aliyundrive-fuse]], [[status]])%>', null,
function(x, data) {
var tb = document.getElementById('aliyundrive-fuse_status');
if (data && tb) {
if (data.running) {
tb.innerHTML = '<em><b style=color:green>' + data.application + '<%:RUNNING%></b></em>';
} else {
tb.innerHTML = '<em><b style=color:red>' + data.application + '<%:NOT RUNNING%></b></em>';
}
}
}
);
//]]>
</script>
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
<p id="aliyundrive-fuse_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>

View File

@ -0,0 +1,50 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8\n"
msgid "AliyunDrive"
msgstr "阿里云盘"
msgid "AliyunDrive FUSE"
msgstr "阿里云盘 FUSE"
msgid "Enable"
msgstr "启用"
msgid "Refresh Token"
msgstr "Refresh Token"
msgid "Mount Point"
msgstr "挂载点"
msgid "Read Buffer Size"
msgstr "下载缓冲大小(bytes)"
msgid "Collecting data..."
msgstr "获取数据中..."
msgid "RUNNING"
msgstr "运行中"
msgid "NOT RUNNING"
msgstr "未运行"
msgid "Settings"
msgstr "设置"
msgid "Log"
msgstr "日志"
msgid "Debug Mode"
msgstr "调试模式"
msgid "<a href=\"https://github.com/messense/aliyundrive-fuse\" target=\"_blank\">Project GitHub URL</a>"
msgstr "<a href=\"https://github.com/messense/aliyundrive-fuse\" target=\"_blank\">GitHub 项目地址</a>"
msgid "<a href=\"https://github.com/messense/aliyundrive-webdav#%E8%8E%B7%E5%8F%96-refresh_token\" target=\"_blank\">How to get refresh token</a>"
msgstr "<a href=\"https://github.com/messense/aliyundrive-webdav#%E8%8E%B7%E5%8F%96-refresh_token\" target=\"_blank\">查看获取 refresh token 的方法</a>"
msgid "Allow Other users Access"
msgstr "允许其他用户访问"
msgid "Allow other users to access the drive, enable this if you share with samba"
msgstr "允许其他用户访问此驱动如果你想用Samba分享请开启此开关"

View File

@ -0,0 +1 @@
zh-cn

View File

@ -0,0 +1,11 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@aliyundrive-fuse[-1]
add ucitrack aliyundrive-fuse
set ucitrack.@aliyundrive-fuse[-1].init=aliyundrive-fuse
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0

View File

@ -0,0 +1,11 @@
{
"luci-app-aliyundrive-fuse": {
"description": "Grant UCI access for luci-app-aliyundrive-fuse",
"read": {
"uci": [ "aliyundrive-fuse" ]
},
"write": {
"uci": [ "aliyundrive-fuse" ]
}
}
}

View File

@ -0,0 +1,5 @@
module YAML
class << self
alias_method :load, :unsafe_load if YAML.respond_to? :unsafe_load
end
end

View File

@ -0,0 +1,21 @@
#!/bin/sh
. /lib/functions.sh
cfg_unused_servers_del()
{
local section="$1"
config_get_bool "enabled" "$section" "enabled" "1"
if [ "$enabled" = "1" ]; then
return
fi
#删除未选中节点
uci delete openclash."$section" 2>/dev/null
}
config_load "openclash"
config_foreach cfg_unused_servers_del "servers"
uci commit openclash

View File

@ -0,0 +1,45 @@
#!/bin/bash
set_lock() {
exec 884>"/tmp/lock/openclash_clash_version.lock" 2>/dev/null
flock -x 884 2>/dev/null
}
del_lock() {
flock -u 884 2>/dev/null
rm -rf "/tmp/lock/openclash_clash_version.lock"
}
TIME=$(date "+%Y-%m-%d-%H")
CHTIME=$(date "+%Y-%m-%d-%H" -r "/tmp/clash_last_version" 2>/dev/null)
LAST_OPVER="/tmp/clash_last_version"
RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master")
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
LOG_FILE="/tmp/openclash.log"
set_lock
if [ "$TIME" != "$CHTIME" ]; then
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -SsL -m 60 "$github_address_mod"gh/vernesong/OpenClash@core/"$RELEASE_BRANCH"/core_version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -SsL -m 60 https://raw.fastgit.org/vernesong/OpenClash/core/"$RELEASE_BRANCH"/core_version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else
curl -SsL -m 60 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/core/"$RELEASE_BRANCH"/core_version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
else
curl -SsL -m 60 https://raw.githubusercontent.com/vernesong/OpenClash/core/"$RELEASE_BRANCH"/core_version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
if [ "${PIPESTATUS[0]}" -ne 0 ] || [ -n "$(cat $LAST_OPVER |grep '<html>')" ]; then
curl -SsL -m 60 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/core_version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
curl_status=${PIPESTATUS[0]}
else
curl_status=0
fi
if [ "$curl_status" -ne 0 ] ; then
rm -rf $LAST_OPVER
fi
fi
del_lock

View File

@ -0,0 +1,23 @@
#!/bin/sh
START_LOG="/tmp/openclash_start.log"
LOG_FILE="/tmp/openclash.log"
LOG_OUT()
{
if [ -n "${1}" ]; then
echo -e "${1}" > $START_LOG
echo -e "$(date "+%Y-%m-%d %H:%M:%S") ${1}" >> $LOG_FILE
fi
}
LOG_ALERT()
{
echo -e "$(tail -n 20 $LOG_FILE |grep -E 'level=fatal|FTL\ \[Config\]' |awk 'END {print}')" > $START_LOG
sleep 3
}
SLOG_CLEAN()
{
echo "" > $START_LOG
}

View File

@ -0,0 +1,657 @@
#!/bin/bash
. /lib/functions.sh
. /usr/share/openclash/ruby.sh
. /usr/share/openclash/openclash_ps.sh
. /usr/share/openclash/log.sh
set_lock() {
exec 889>"/tmp/lock/openclash_subs.lock" 2>/dev/null
flock -x 889 2>/dev/null
}
del_lock() {
flock -u 889 2>/dev/null
rm -rf "/tmp/lock/openclash_subs.lock"
}
LOGTIME=$(echo $(date "+%Y-%m-%d %H:%M:%S"))
LOG_FILE="/tmp/openclash.log"
CFG_FILE="/tmp/yaml_sub_tmp_config.yaml"
CRON_FILE="/etc/crontabs/root"
CONFIG_PATH=$(uci -q get openclash.config.config_path)
servers_update=$(uci -q get openclash.config.servers_update)
dns_port=$(uci -q get openclash.config.dns_port)
enable_redirect_dns=$(uci -q get openclash.config.enable_redirect_dns)
disable_masq_cache=$(uci -q get openclash.config.disable_masq_cache)
default_resolvfile=$(uci -q get openclash.config.default_resolvfile)
en_mode=$(uci -q get openclash.config.en_mode)
china_ip_route=$(uci -q get openclash.config.china_ip_route)
disable_udp_quic=$(uci -q get openclash.config.disable_udp_quic)
ipv6_enable=$(uci -q get openclash.config.ipv6_enable)
router_self_proxy=$(uci -q get openclash.config.router_self_proxy || echo 1)
DNSPORT=$(uci -q get dhcp.@dnsmasq[0].port)
DNSMASQ_CONF_DIR=$(uci -q get dhcp.@dnsmasq[0].confdir || echo '/tmp/dnsmasq.d')
DNSMASQ_CONF_DIR=${DNSMASQ_CONF_DIR%*/}
custom_china_domain_dns_server=$(uci -q get openclash.config.custom_china_domain_dns_server || echo "114.114.114.114")
FW4=$(command -v fw4)
if [ -z "$DNSPORT" ]; then
DNSPORT=$(netstat -nlp |grep -E '127.0.0.1:.*dnsmasq' |awk -F '127.0.0.1:' '{print $2}' |awk '{print $1}' |head -1 || echo 53)
fi
restart=0
only_download=0
set_lock
urlencode() {
if [ "$#" -eq 1 ]; then
echo "$(/usr/share/openclash/openclash_urlencode.lua "$1")"
fi
}
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
done
streaming_unlock_pids=$(unify_ps_pids "openclash_streaming_unlock.lua")
for streaming_unlock_pid in $streaming_unlock_pids; do
kill -9 "$streaming_unlock_pid" >/dev/null 2>&1
done >/dev/null 2>&1
}
config_download()
{
if [ -n "$subscribe_url_param" ]; then
if [ -n "$c_address" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 -H 'User-Agent: Clash' "$c_address""$subscribe_url_param" -o "$CFG_FILE" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$CFG_FILE" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 -H 'User-Agent: Clash' https://api.dler.io/sub"$subscribe_url_param" -o "$CFG_FILE" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$CFG_FILE" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
if [ "$?" -ne 0 ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 -H 'User-Agent: Clash' https://subconverter.herokuapp.com/sub"$subscribe_url_param" -o "$CFG_FILE" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$CFG_FILE" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
fi
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 -H 'User-Agent: Clash' "$subscribe_url" -o "$CFG_FILE" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$CFG_FILE" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
}
config_cus_up()
{
if [ -z "$CONFIG_PATH" ]; then
CONFIG_PATH="/etc/openclash/config/$(ls -lt /etc/openclash/config/ | grep -E '.yaml|.yml' | head -n 1 |awk '{print $9}')"
uci -q set openclash.config.config_path="$CONFIG_PATH"
uci commit openclash
fi
if [ -z "$subscribe_url_param" ]; then
if [ -n "$key_match_param" ] || [ -n "$key_ex_match_param" ]; then
LOG_OUT "Config File【$name】is Replaced Successfully, Start Picking Nodes..."
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
begin
Value = YAML.load_file('$CONFIG_FILE');
if Value.has_key?('proxies') and not Value['proxies'].to_a.empty? then
Value['proxies'].reverse.each{
|x|
if not '$key_match_param'.empty? then
if not /$key_match_param/i =~ x['name'] then
Value['proxies'].delete(x)
Value['proxy-groups'].each{
|g|
g['proxies'].reverse.each{
|p|
if p == x['name'] then
g['proxies'].delete(p)
end
}
}
end
end;
if not '$key_ex_match_param'.empty? then
if /$key_ex_match_param/i =~ x['name'] then
if Value['proxies'].include?(x) then
Value['proxies'].delete(x)
Value['proxy-groups'].each{
|g|
g['proxies'].reverse.each{
|p|
if p == x['name'] then
g['proxies'].delete(p)
end
}
}
end
end
end;
}
end;
rescue Exception => e
puts '${LOGTIME} Error: Filter Proxies Failed,【' + e.message + '】'
ensure
File.open('$CONFIG_FILE','w') {|f| YAML.dump(Value, f)};
end" 2>/dev/null >> $LOG_FILE
fi
fi
if [ "$servers_update" -eq 1 ]; then
LOG_OUT "Config File【$name】is Replaced Successfully, Start to Reserving..."
uci -q set openclash.config.config_update_path="/etc/openclash/config/$name.yaml"
uci -q set openclash.config.servers_if_update=1
uci commit openclash
/usr/share/openclash/yml_groups_get.sh
uci -q set openclash.config.servers_if_update=1
uci commit openclash
/usr/share/openclash/yml_groups_set.sh
if [ "$CONFIG_FILE" == "$CONFIG_PATH" ]; then
restart=1
fi
LOG_OUT "Config File【$name】Update Successful!"
SLOG_CLEAN
elif [ "$CONFIG_FILE" == "$CONFIG_PATH" ]; then
LOG_OUT "Config File【$name】Update Successful!"
restart=1
else
LOG_OUT "Config File【$name】Update Successful!"
SLOG_CLEAN
fi
rm -rf /tmp/Proxy_Group 2>/dev/null
}
config_su_check()
{
LOG_OUT "Config File Download Successful, Check If There is Any Update..."
sed -i 's/!<str> /!!str /g' "$CFG_FILE" >/dev/null 2>&1
if [ -f "$CONFIG_FILE" ]; then
cmp -s "$BACKPACK_FILE" "$CFG_FILE"
if [ "$?" -ne 0 ]; then
LOG_OUT "Config File【$name】Are Updates, Start Replacing..."
cp "$CFG_FILE" "$BACKPACK_FILE"
#保留规则部分
if [ "$servers_update" -eq 1 ] && [ "$only_download" -eq 0 ]; then
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
Value = YAML.load_file('$CONFIG_FILE');
Value_1 = YAML.load_file('$CFG_FILE');
if Value.key?('rules') or Value.key?('script') or Value.key?('rule-providers') then
if Value.key?('rules') then
Value_1['rules'] = Value['rules']
end;
if Value.key?('script') then
Value_1['script'] = Value['script']
end;
if Value.key?('rule-providers') then
Value_1['rule-providers'] = Value['rule-providers']
end;
File.open('$CFG_FILE','w') {|f| YAML.dump(Value_1, f)};
end;
" 2>/dev/null
fi
mv "$CFG_FILE" "$CONFIG_FILE" 2>/dev/null
if [ "$only_download" -eq 0 ]; then
config_cus_up
else
LOG_OUT "Config File【$name】Update Successful!"
SLOG_CLEAN
fi
else
LOG_OUT "Config File【$name】No Change, Do Nothing!"
rm -rf "$CFG_FILE"
SLOG_CLEAN
fi
else
LOG_OUT "Config File【$name】Download Successful, Start To Create..."
mv "$CFG_FILE" "$CONFIG_FILE" 2>/dev/null
cp "$CONFIG_FILE" "$BACKPACK_FILE"
if [ "$only_download" -eq 0 ]; then
config_cus_up
else
LOG_OUT "Config File【$name】Update Successful!"
SLOG_CLEAN
fi
fi
}
config_error()
{
LOG_OUT "Error:【$name】Update Error, Please Try Again Later..."
rm -rf "$CFG_FILE" 2>/dev/null
SLOG_CLEAN
}
change_dns()
{
if pidof clash >/dev/null; then
if [ "$enable_redirect_dns" = "1" ]; then
uci -q del dhcp.@dnsmasq[-1].server
uci -q add_list dhcp.@dnsmasq[0].server=127.0.0.1#"$dns_port"
uci -q delete dhcp.@dnsmasq[0].resolvfile
uci -q set dhcp.@dnsmasq[0].noresolv=1
[ "$disable_masq_cache" -eq 1 ] && {
uci -q set dhcp.@dnsmasq[0].cachesize=0
}
uci commit dhcp
fi
if [ -z "$(echo "$en_mode" |grep "redir-host")" ] && [ "$china_ip_route" -eq 1 ] && [ "$enable_redirect_dns" != "2" ]; then
cat "/etc/openclash/accelerated-domains.china.conf" |awk -v dns="${custom_china_domain_dns_server}" -F '/' '!/^$/&&!/^#/{print $1"/"$2"/"dns}' >${DNSMASQ_CONF_DIR}/dnsmasq_accelerated-domains.china.conf 2>/dev/null
for i in `awk '!/^$/&&!/^#/&&!/(^([1-9]|1[0-9]|1[1-9]{2}|2[0-4][0-9]|25[0-5])\.)(([0-9]{1,2}|1[1-9]{2}|2[0-4][0-9]|25[0-5])\.){2}([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-5][0-9]|25[0-4])((\/[0-9][0-9])?)$/{printf("%s\n",$0)}' /etc/openclash/custom/openclash_custom_chnroute_pass.list`
do
sed -i "/server=\/${i}\//d" ${DNSMASQ_CONF_DIR}/dnsmasq_accelerated-domains.china.conf 2>/dev/null
done 2>/dev/null
fi
/etc/init.d/dnsmasq restart >/dev/null 2>&1
if [ -n "$FW4" ]; then
for nft in "nat_output" "mangle_output"; do
local handles=$(nft -a list chain inet fw4 ${nft} |grep -E "openclash|OpenClash" |grep -v "OpenClash DNS Hijack" |awk -F '# handle ' '{print$2}')
for handle in $handles; do
nft delete rule inet fw4 ${nft} handle ${handle}
done
done >/dev/null 2>&1
echo "$nat_output_rules" |while read line
do
if [ -n "$(echo "$line" |grep "OpenClash DNS Hijack")" ]; then
continue
fi
nft add rule inet fw4 nat_output ${line}
done >/dev/null 2>&1
echo "$mangle_output_rules" |while read line
do
if [ -n "$(echo "$line" |grep "OpenClash DNS Hijack")" ]; then
continue
fi
nft add rule inet fw4 mangle_output ${line}
done >/dev/null 2>&1
if [ "$enable_redirect_dns" = "2" ]; then
if [ "$router_self_proxy" = 1 ]; then
nft add rule inet fw4 nat_output position 0 tcp dport 53 ip daddr {127.0.0.1} meta skuid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 nat_output position 0 udp dport 53 ip daddr {127.0.0.1} meta skuid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
fi
if [ "$ipv6_enable" -eq 1 ]; then
if [ "$router_self_proxy" = 1 ]; then
nft add rule inet fw4 nat_output position 0 meta nfproto {ipv6} tcp dport 53 ip daddr {::/0} meta skuid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 nat_output position 0 meta nfproto {ipv6} udp dport 53 ip daddr {::/0} meta skuid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
fi
fi
fi
if [ -z "$(echo "$en_mode" |grep "redir-host")" ] && [ "$china_ip_route" -eq 1 ] && [ "$enable_redirect_dns" != "2" ]; then
LOG_OUT "Tip: Bypass the China IP May Cause the Dnsmasq Load For a Long Time After Restart in FAKE-IP Mode, Hijack the DNS to Core Untill the Dnsmasq Works Well..."
nft insert rule inet fw4 dstnat position 0 tcp dport 53 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft insert rule inet fw4 dstnat position 0 udp dport 53 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft 'add chain inet fw4 nat_output { type nat hook output priority -1; }' 2>/dev/null
nft add rule inet fw4 nat_output position 0 tcp dport 53 meta skuid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 nat_output position 0 udp dport 53 meta skuid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 nat_output position 0 tcp dport 12353 meta skuid != 65534 counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 nat_output position 0 udp dport 12353 meta skuid != 65534 counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
if [ "$ipv6_enable" -eq 1 ]; then
nft insert rule inet fw4 dstnat position 0 meta nfproto {ipv6} tcp dport 53 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft insert rule inet fw4 dstnat position 0 meta nfproto {ipv6} udp dport 53 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft 'add chain inet fw4 nat_output { type nat hook output priority -1; }' 2>/dev/null
nft add rule inet fw4 nat_output position 0 meta nfproto {ipv6} tcp dport 53 meta skuid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 nat_output position 0 meta nfproto {ipv6} udp dport 53 meta skuid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 nat_output position 0 meta nfproto {ipv6} tcp dport 12353 meta skuid != 65534 counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 nat_output position 0 meta nfproto {ipv6} udp dport 12353 meta skuid != 65534 counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
fi
fi
else
iptables -t nat -D OUTPUT -j openclash_output >/dev/null 2>&1
iptables -t mangle -D OUTPUT -j openclash_output >/dev/null 2>&1
ip6tables -t mangle -D OUTPUT -j openclash_output >/dev/null 2>&1
iptables -t nat -A OUTPUT -j openclash_output >/dev/null 2>&1
iptables -t mangle -A OUTPUT -j openclash_output >/dev/null 2>&1
ip6tables -t mangle -A OUTPUT -j openclash_output >/dev/null 2>&1
if [ "$enable_redirect_dns" = "2" ]; then
if [ "$router_self_proxy" = 1 ]; then
iptables -t nat -I OUTPUT -p udp --dport 53 -d 127.0.0.1 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
iptables -t nat -I OUTPUT -p tcp --dport 53 -d 127.0.0.1 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
fi
if [ "$ipv6_enable" -eq 1 ]; then
if [ "$router_self_proxy" = 1 ]; then
ip6tables -t nat -I OUTPUT -p udp --dport 53 -d ::/0 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
ip6tables -t nat -I OUTPUT -p tcp --dport 53 -d ::/0 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
fi
fi
fi
if [ -z "$(echo "$en_mode" |grep "redir-host")" ] && [ "$china_ip_route" -eq 1 ] && [ "$enable_redirect_dns" != "2" ]; then
LOG_OUT "Tip: Bypass the China IP May Cause the Dnsmasq Load For a Long Time After Restart in FAKE-IP Mode, Hijack the DNS to Core Untill the Dnsmasq Works Well..."
iptables -t nat -I PREROUTING -p udp --dport 53 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
iptables -t nat -I PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
iptables -t nat -I OUTPUT -p udp --dport 53 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
iptables -t nat -I OUTPUT -p tcp --dport 53 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
iptables -t nat -I OUTPUT -p udp --dport 12353 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
iptables -t nat -I OUTPUT -p tcp --dport 12353 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
if [ "$ipv6_enable" -eq 1 ]; then
ip6tables -t nat -I PREROUTING -p udp --dport 53 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
ip6tables -t nat -I PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
ip6tables -t nat -I OUTPUT -p udp --dport 53 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
ip6tables -t nat -I OUTPUT -p tcp --dport 53 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
ip6tables -t nat -I OUTPUT -p udp --dport 12353 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
ip6tables -t nat -I OUTPUT -p tcp --dport 12353 -m owner ! --uid-owner 65534 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
fi
fi
fi
[ "$(unify_ps_status "openclash_watchdog.sh")" -eq 0 ] && [ "$(unify_ps_prevent)" -eq 0 ] && nohup /usr/share/openclash/openclash_watchdog.sh &
fi
}
field_name_check()
{
#检查field名称不兼容旧写法
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
Value = YAML.load_file('$CFG_FILE');
if Value.key?('Proxy') or Value.key?('Proxy Group') or Value.key?('Rule') or Value.key?('rule-provider') then
if Value.key?('Proxy') then
Value['proxies'] = Value['Proxy']
Value.delete('Proxy')
puts '${LOGTIME} Warning: Proxy is no longer used. Auto replaced by proxies'
end
if Value.key?('Proxy Group') then
Value['proxy-groups'] = Value['Proxy Group']
Value.delete('Proxy Group')
puts '${LOGTIME} Warning: Proxy Group is no longer used. Auto replaced by proxy-groups'
end
if Value.key?('Rule') then
Value['rules'] = Value['Rule']
Value.delete('Rule')
puts '${LOGTIME} Warning: Rule is no longer used. Auto replaced by rules'
end
if Value.key?('rule-provider') then
Value['rule-providers'] = Value['rule-provider']
Value.delete('rule-provider')
puts '${LOGTIME} Warning: rule-provider is no longer used. Auto replaced by rule-providers'
end;
File.open('$CFG_FILE','w') {|f| YAML.dump(Value, f)};
end;
" 2>/dev/null >> $LOG_FILE
}
config_download_direct()
{
if pidof clash >/dev/null && [ "$router_self_proxy" = 1 ]; then
kill_watchdog
if [ "$enable_redirect_dns" -eq 1 ]; then
uci -q del_list dhcp.@dnsmasq[0].server=127.0.0.1#"$dns_port"
if [ -n "$default_resolvfile" ]; then
uci -q set dhcp.@dnsmasq[0].resolvfile="$default_resolvfile"
elif [ -s "/tmp/resolv.conf.d/resolv.conf.auto" ] && [ -n "$(grep "nameserver" /tmp/resolv.conf.d/resolv.conf.auto)" ]; then
uci -q set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.d/resolv.conf.auto
elif [ -s "/tmp/resolv.conf.auto" ] && [ -n "$(grep "nameserver" /tmp/resolv.conf.auto)" ]; then
uci -q set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto
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 -q set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto
fi
uci -q set dhcp.@dnsmasq[0].noresolv=0
uci -q delete dhcp.@dnsmasq[0].cachesize
uci commit dhcp
rm -rf ${DNSMASQ_CONF_DIR}/dnsmasq_accelerated-domains.china.conf >/dev/null 2>&1
/etc/init.d/dnsmasq restart >/dev/null 2>&1
fi
if [ -n "$FW4" ]; then
nat_output_rules=$(nft -a list chain inet fw4 nat_output |grep -E "openclash|OpenClash" |awk -F '# handle ' '{print$1}' |sed 's/^[ \t]*//g')
mangle_output_rules=$(nft -a list chain inet fw4 mangle_output |grep -E "openclash|OpenClash" |awk -F '# handle ' '{print$1}' |sed 's/^[ \t]*//g')
for nft in "nat_output" "mangle_output"; do
local handles=$(nft -a list chain inet fw4 ${nft} |grep -E "openclash|OpenClash" |awk -F '# handle ' '{print$2}')
for handle in $handles; do
nft delete rule inet fw4 ${nft} handle ${handle}
done
done >/dev/null 2>&1
else
iptables -t nat -D OUTPUT -j openclash_output >/dev/null 2>&1
iptables -t mangle -D OUTPUT -j openclash_output >/dev/null 2>&1
ip6tables -t mangle -D OUTPUT -j openclash_output >/dev/null 2>&1
for ipt in "iptables -nvL OUTPUT -t nat" "iptables -nvL OUTPUT -t mangle" "ip6tables -nvL OUTPUT -t mangle" "ip6tables -nvL OUTPUT -t nat"; do
for comment in "OpenClash DNS Hijack"; do
local lines=$($ipt |sed 1,2d |sed -n "/${comment}/=" 2>/dev/null |sort -rn)
if [ -n "$lines" ]; then
for line in $lines; do
$(echo "$ipt" |awk -v OFS=" " '{print $1,$4,$5}' |sed 's/[ ]*$//g') -D $(echo "$ipt" |awk '{print $3}') $line
done
fi
done
done >/dev/null 2>&1
fi
sleep 3
config_download
if [ "${PIPESTATUS[0]}" -eq 0 ] && [ -s "$CFG_FILE" ]; then
#prevent ruby unexpected error
sed -i -E 's/protocol-param: ([^,'"'"'"''}( *#)\n\r]+)/protocol-param: "\1"/g' "$CFG_FILE" 2>/dev/null
ruby -ryaml -rYAML -I "/usr/share/openclash" -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
LOG_OUT "Error: Ruby Works Abnormally, Please Check The Ruby Library Depends!"
only_download=1
change_dns
config_su_check
elif [ ! -f "$CFG_FILE" ]; then
LOG_OUT "Config File Format Validation Failed..."
change_dns
config_error
elif ! "$(ruby_read "$CFG_FILE" ".key?('proxies')")" && ! "$(ruby_read "$CFG_FILE" ".key?('proxy-providers')")" ; then
field_name_check
if ! "$(ruby_read "$CFG_FILE" ".key?('proxies')")" && ! "$(ruby_read "$CFG_FILE" ".key?('proxy-providers')")" ; then
LOG_OUT "Error: Updated Config【$name】Has No Proxy Field, Update Exit..."
change_dns
config_error
else
change_dns
config_su_check
fi
else
change_dns
config_su_check
fi
else
change_dns
config_error
fi
else
config_error
fi
}
server_key_match()
{
local key_match key_word
if [ -n "$(echo "$1" |grep "^ \{0,\}$")" ] || [ -n "$(echo "$1" |grep "^\t\{0,\}$")" ]; then
return
fi
if [ -n "$(echo "$1" |grep "&")" ]; then
key_word=$(echo "$1" |sed 's/&/ /g')
for k in $key_word
do
if [ -z "$k" ]; then
continue
fi
k="(?=.*$k)"
key_match="$key_match$k"
done
key_match="^($key_match).*"
else
if [ -n "$1" ]; then
key_match="($1)"
fi
fi
if [ "$2" = "keyword" ]; then
if [ -z "$key_match_param" ]; then
key_match_param="$key_match"
else
key_match_param="$key_match_param|$key_match"
fi
elif [ "$2" = "ex_keyword" ]; then
if [ -z "$key_ex_match_param" ]; then
key_ex_match_param="$key_match"
else
key_ex_match_param="$key_ex_match_param|$key_match"
fi
fi
}
sub_info_get()
{
local section="$1" subscribe_url template_path subscribe_url_param template_path_encode key_match_param key_ex_match_param c_address de_ex_keyword
config_get_bool "enabled" "$section" "enabled" "1"
config_get "name" "$section" "name" ""
config_get "sub_convert" "$section" "sub_convert" ""
config_get "address" "$section" "address" ""
config_get "keyword" "$section" "keyword" ""
config_get "ex_keyword" "$section" "ex_keyword" ""
config_get "emoji" "$section" "emoji" ""
config_get "udp" "$section" "udp" ""
config_get "skip_cert_verify" "$section" "skip_cert_verify" ""
config_get "sort" "$section" "sort" ""
config_get "convert_address" "$section" "convert_address" ""
config_get "template" "$section" "template" ""
config_get "node_type" "$section" "node_type" ""
config_get "rule_provider" "$section" "rule_provider" ""
config_get "custom_template_url" "$section" "custom_template_url" ""
config_get "de_ex_keyword" "$section" "de_ex_keyword" ""
if [ "$enabled" -eq 0 ]; then
return
fi
if [ -z "$address" ]; then
return
fi
if [ "$udp" == "true" ]; then
udp="&udp=true"
else
udp=""
fi
if [ "$rule_provider" == "true" ]; then
rule_provider="&expand=false&classic=true"
else
rule_provider=""
fi
if [ -z "$name" ]; then
name="config"
CONFIG_FILE="/etc/openclash/config/config.yaml"
BACKPACK_FILE="/etc/openclash/backup/config.yaml"
else
CONFIG_FILE="/etc/openclash/config/$name.yaml"
BACKPACK_FILE="/etc/openclash/backup/$name.yaml"
fi
if [ ! -z "$keyword" ] || [ ! -z "$ex_keyword" ]; then
config_list_foreach "$section" "keyword" server_key_match "keyword"
config_list_foreach "$section" "ex_keyword" server_key_match "ex_keyword"
fi
if [ -n "$de_ex_keyword" ]; then
for i in $de_ex_keyword;
do
if [ -z "$key_ex_match_param" ]; then
key_ex_match_param="($i)"
else
key_ex_match_param="$key_ex_match_param|($i)"
fi
done
fi
if [ "$sub_convert" -eq 0 ]; then
subscribe_url=$address
elif [ "$sub_convert" -eq 1 ] && [ -n "$template" ]; then
while read line
do
subscribe_url=$([ -n "$subscribe_url" ] && echo "$subscribe_url|")$(urlencode "$line")
done < <(echo "$address")
if [ "$template" != "0" ]; then
template_path=$(grep "^$template," /usr/share/openclash/res/sub_ini.list |awk -F ',' '{print $3}' 2>/dev/null)
else
template_path=$custom_template_url
fi
if [ -n "$template_path" ]; then
template_path_encode=$(urlencode "$template_path")
[ -n "$key_match_param" ] && key_match_param="(?i)$(urlencode "$key_match_param")"
[ -n "$key_ex_match_param" ] && key_ex_match_param="(?i)$(urlencode "$key_ex_match_param")"
subscribe_url_param="?target=clash&new_name=true&url=$subscribe_url&config=$template_path_encode&include=$key_match_param&exclude=$key_ex_match_param&emoji=$emoji&list=false&sort=$sort$udp&scv=$skip_cert_verify&append_type=$node_type&fdn=true$rule_provider"
c_address="$convert_address"
else
subscribe_url=$address
fi
else
subscribe_url=$address
fi
LOG_OUT "Start Updating Config File【$name】..."
config_download
if [ "${PIPESTATUS[0]}" -eq 0 ] && [ -s "$CFG_FILE" ]; then
#prevent ruby unexpected error
sed -i -E 's/protocol-param: ([^,'"'"'"''}( *#)\n\r]+)/protocol-param: "\1"/g' "$CFG_FILE" 2>/dev/null
ruby -ryaml -rYAML -I "/usr/share/openclash" -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
LOG_OUT "Error: Ruby Works Abnormally, Please Check The Ruby Library Depends!"
only_download=1
config_su_check
elif [ ! -f "$CFG_FILE" ]; then
LOG_OUT "Config File Format Validation Failed, Trying To Download Without Agent..."
config_download_direct
elif ! "$(ruby_read "$CFG_FILE" ".key?('proxies')")" && ! "$(ruby_read "$CFG_FILE" ".key?('proxy-providers')")" ; then
field_name_check
if ! "$(ruby_read "$CFG_FILE" ".key?('proxies')")" && ! "$(ruby_read "$CFG_FILE" ".key?('proxy-providers')")" ; then
LOG_OUT "Error: Updated Config【$name】Has No Proxy Field, Trying To Download Without Agent..."
config_download_direct
else
config_su_check
fi
else
config_su_check
fi
else
LOG_OUT "Error: Config File【$name】Subscribed Failed, Trying to Download Without Agent..."
config_download_direct
fi
}
#分别获取订阅信息进行处理
config_load "openclash"
config_foreach sub_info_get "config_subscribe"
uci -q delete openclash.config.config_update_path
uci commit openclash
if [ "$restart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
elif [ "$restart" -eq 0 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ] && [ "$(uci -q get openclash.config.restart)" -eq 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
uci -q set openclash.config.restart=0
uci -q commit openclash
elif [ "$restart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -gt 1 ]; then
uci -q set openclash.config.restart=1
uci -q commit openclash
else
sed -i '/openclash.sh/d' $CRON_FILE 2>/dev/null
[ "$(uci -q get openclash.config.auto_update)" -eq 1 ] && [ "$(uci -q get openclash.config.config_auto_update_mode)" -ne 1 ] && echo "0 $(uci -q get openclash.config.auto_update_time) * * $(uci -q get openclash.config.config_update_week_time) /usr/share/openclash/openclash.sh" >> $CRON_FILE
/etc/init.d/cron restart
fi
del_lock

View File

@ -0,0 +1,165 @@
#!/bin/bash
. /usr/share/openclash/openclash_ps.sh
. /usr/share/openclash/log.sh
FW4=$(command -v fw4)
set_lock() {
exec 879>"/tmp/lock/openclash_chn.lock" 2>/dev/null
flock -x 879 2>/dev/null
}
del_lock() {
flock -u 879 2>/dev/null
rm -rf "/tmp/lock/openclash_chn.lock"
}
china_ip_route=$(uci -q get openclash.config.china_ip_route)
china_ip6_route=$(uci -q get openclash.config.china_ip6_route)
CHNR_CUSTOM_URL=$(uci -q get openclash.config.chnr_custom_url)
CHNR6_CUSTOM_URL=$(uci -q get openclash.config.chnr6_custom_url)
CNDOMAIN_CUSTOM_URL=$(uci -q get openclash.config.cndomain_custom_url)
disable_udp_quic=$(uci -q get openclash.config.disable_udp_quic)
small_flash_memory=$(uci -q get openclash.config.small_flash_memory)
en_mode=$(uci -q get openclash.config.en_mode)
LOG_FILE="/tmp/openclash.log"
restart=0
set_lock
if [ "$small_flash_memory" != "1" ]; then
chnr_path="/etc/openclash/china_ip_route.ipset"
chnr6_path="/etc/openclash/china_ip6_route.ipset"
cndomain_path="/etc/openclash/accelerated-domains.china.conf"
mkdir -p /etc/openclash
else
chnr_path="/tmp/etc/openclash/china_ip_route.ipset"
chnr6_path="/tmp/etc/openclash/china_ip6_route.ipset"
cndomain_path="/tmp/etc/openclash/accelerated-domains.china.conf"
mkdir -p /tmp/etc/openclash
fi
LOG_OUT "Start Downloading The Chnroute Cidr List..."
if [ -z "$CHNR_CUSTOM_URL" ]; then
if pidof clash >/dev/null; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://ispip.clang.cn/all_cn.txt -o /tmp/china_ip_route.txt 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/china_ip_route.txt" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
if [ "${PIPESTATUS[0]}" != "0" ] || ! pidof clash >/dev/null; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://ispip.clang.cn/all_cn_cidr.txt -o /tmp/china_ip_route.txt 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/china_ip_route.txt" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$CHNR_CUSTOM_URL" -o /tmp/china_ip_route.txt 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/china_ip_route.txt" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
if [ "${PIPESTATUS[0]}" -eq 0 ] && [ -s "/tmp/china_ip_route.txt" ]; then
LOG_OUT "Chnroute Cidr List Download Success, Check Updated..."
#预处理
if [ -n "$FW4" ]; then
echo "define china_ip_route = {" >/tmp/china_ip_route.list
awk '!/^$/&&!/^#/{printf(" %s,'" "'\n",$0)}' /tmp/china_ip_route.txt >>/tmp/china_ip_route.list
echo "}" >>/tmp/china_ip_route.list
echo "add set inet fw4 china_ip_route { type ipv4_addr; flags interval; auto-merge; }" >>/tmp/china_ip_route.list
echo 'add element inet fw4 china_ip_route $china_ip_route' >>/tmp/china_ip_route.list
else
echo "create china_ip_route hash:net family inet hashsize 1024 maxelem 1000000" >/tmp/china_ip_route.list
awk '!/^$/&&!/^#/{printf("add china_ip_route %s'" "'\n",$0)}' /tmp/china_ip_route.txt >>/tmp/china_ip_route.list
fi
cmp -s /tmp/china_ip_route.list "$chnr_path"
if [ "$?" -ne "0" ]; then
LOG_OUT "Chnroute Cidr List Has Been Updated, Starting To Replace The Old Version..."
mv /tmp/china_ip_route.list "$chnr_path" >/dev/null 2>&1
if [ "$china_ip_route" -eq 1 ] || [ "$disable_udp_quic" -eq 1 ]; then
restart=1
fi
LOG_OUT "Chnroute Cidr List Update Successful!"
else
LOG_OUT "Updated Chnroute Cidr List No Change, Do Nothing..."
fi
else
LOG_OUT "Chnroute Cidr List Update Error, Please Try Again Later..."
fi
#ipv6
LOG_OUT "Start Downloading The Chnroute6 Cidr List..."
if [ -z "$CHNR6_CUSTOM_URL" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://ispip.clang.cn/all_cn_ipv6.txt -o /tmp/china_ip6_route.txt 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/china_ip6_route.txt" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$CHNR6_CUSTOM_URL" -o /tmp/china_ip6_route.txt 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/china_ip6_route.txt" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
if [ "${PIPESTATUS[0]}" -eq "0" ] && [ -s "/tmp/china_ip6_route.txt" ]; then
LOG_OUT "Chnroute6 Cidr List Download Success, Check Updated..."
#预处理
if [ -n "$FW4" ]; then
echo "define china_ip6_route = {" >/tmp/china_ip6_route.list
awk '!/^$/&&!/^#/{printf(" %s,'" "'\n",$0)}' /tmp/china_ip6_route.txt >>/tmp/china_ip6_route.list
echo "}" >>/tmp/china_ip6_route.list
echo "add set inet fw4 china_ip6_route { type ipv6_addr; flags interval; auto-merge; }" >>/tmp/china_ip6_route.list
echo 'add element inet fw4 china_ip6_route $china_ip6_route' >>/tmp/china_ip6_route.list
else
echo "create china_ip6_route hash:net family inet6 hashsize 1024 maxelem 1000000" >/tmp/china_ip6_route.list
awk '!/^$/&&!/^#/{printf("add china_ip6_route %s'" "'\n",$0)}' /tmp/china_ip6_route.txt >>/tmp/china_ip6_route.list
fi
cmp -s /tmp/china_ip6_route.list "$chnr6_path"
if [ "$?" -ne "0" ]; then
LOG_OUT "Chnroute6 Cidr List Has Been Updated, Starting To Replace The Old Version..."
mv /tmp/china_ip6_route.list "$chnr6_path" >/dev/null 2>&1
if [ "$china_ip6_route" -eq 1 ] || [ "$disable_udp_quic" -eq 1 ]; then
restart=1
fi
LOG_OUT "Chnroute6 Cidr List Update Successful!"
else
LOG_OUT "Updated Chnroute6 Cidr List No Change, Do Nothing..."
fi
else
LOG_OUT "Chnroute6 Cidr List Update Error, Please Try Again Later..."
fi
#CN DOMAIN
LOG_OUT "Start Downloading The CN Domains List..."
if [ -n "$CNDOMAIN_CUSTOM_URL" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$CNDOMAIN_CUSTOM_URL" -o "/tmp/china_domains.list" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/china_domains.list" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"gh/felixonmars/dnsmasq-china-list@master/accelerated-domains.china.conf -o "/tmp/china_domains.list" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/china_domains.list" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.fastgit.org/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf -o "/tmp/china_domains.list" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/china_domains.list" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf -o "/tmp/china_domains.list" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/china_domains.list" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf -o "/tmp/china_domains.list" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/china_domains.list" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
fi
if [ "${PIPESTATUS[0]}" -eq "0" ] && [ -s "/tmp/china_domains.list" ] && [ -n "$(cat "/tmp/china_domains.list" |head -1 |grep "server=")" ]; then
LOG_OUT "CN Domains List Download Success, Check Updated..."
cmp -s /tmp/china_domains.list "$cndomain_path"
if [ "$?" -ne "0" ]; then
LOG_OUT "CN Domains List Has Been Updated, Starting To Replace The Old Version..."
mv /tmp/china_domains.list "$cndomain_path" >/dev/null 2>&1
if [ "$china_ip_route" -eq 1 ] && [ -z "$(echo "$en_mode" |grep "redir-host")" ]; then
restart=1
fi
LOG_OUT "CN Domains List Update Successful!"
else
LOG_OUT "Updated CN Domains List No Change, Do Nothing..."
fi
else
LOG_OUT "CN Domains List Update Error, Please Try Again Later..."
fi
if [ "$restart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
elif [ "$restart" -eq 0 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ] && [ "$(uci -q get openclash.config.restart)" -eq 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
uci -q set openclash.config.restart=0
uci -q commit openclash
elif [ "$restart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ]; then
uci -q set openclash.config.restart=1
uci -q commit openclash
fi
rm -rf /tmp/china_ip*_route* >/dev/null 2>&1
rm -rf /tmp/china_domains.list >/dev/null 2>&1
SLOG_CLEAN
del_lock

View File

@ -0,0 +1,220 @@
#!/bin/bash
. /lib/functions.sh
. /usr/share/openclash/openclash_ps.sh
. /usr/share/openclash/log.sh
CORE_TYPE="$1"
C_CORE_TYPE=$(uci -q get openclash.config.core_type)
[ -z "$CORE_TYPE" ] || [ "$1" = "one_key_update" ] && CORE_TYPE="Dev"
small_flash_memory=$(uci -q get openclash.config.small_flash_memory)
CPU_MODEL=$(uci -q get openclash.config.core_version)
RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master")
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
LOG_FILE="/tmp/openclash.log"
[ ! -f "/tmp/clash_last_version" ] && /usr/share/openclash/clash_version.sh 2>/dev/null
if [ ! -f "/tmp/clash_last_version" ]; then
LOG_OUT "Error: 【"$CORE_TYPE"】Core Version Check Error, Please Try Again Later..."
SLOG_CLEAN
exit 0
fi
if [ "$small_flash_memory" != "1" ]; then
dev_core_path="/etc/openclash/core/clash"
tun_core_path="/etc/openclash/core/clash_tun"
meta_core_path="/etc/openclash/core/clash_meta"
mkdir -p /etc/openclash/core
else
dev_core_path="/tmp/etc/openclash/core/clash"
tun_core_path="/tmp/etc/openclash/core/clash_tun"
meta_core_path="/tmp/etc/openclash/core/clash_meta"
mkdir -p /tmp/etc/openclash/core
fi
case $CORE_TYPE in
"TUN")
CORE_CV=$($tun_core_path -v 2>/dev/null |awk -F ' ' '{print $2}')
CORE_LV=$(sed -n 2p /tmp/clash_last_version 2>/dev/null)
if [ -z "$CORE_LV" ]; then
LOG_OUT "Error: 【"$CORE_TYPE"】Core Version Check Error, Please Try Again Later..."
SLOG_CLEAN
exit 0
fi
;;
"Meta")
CORE_CV=$($meta_core_path -v 2>/dev/null |awk -F ' ' '{print $3}' |head -1)
CORE_LV=$(sed -n 3p /tmp/clash_last_version 2>/dev/null)
;;
*)
CORE_CV=$($dev_core_path -v 2>/dev/null |awk -F ' ' '{print $2}')
CORE_LV=$(sed -n 1p /tmp/clash_last_version 2>/dev/null)
esac
[ "$C_CORE_TYPE" = "$CORE_TYPE" ] || [ -z "$C_CORE_TYPE" ] && if_restart=1
if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
if [ "$CPU_MODEL" != 0 ]; then
case $CORE_TYPE in
"TUN")
LOG_OUT "【TUN】Core Downloading, Please Try to Download and Upload Manually If Fails"
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"gh/vernesong/OpenClash@core/"$RELEASE_BRANCH"/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_tun.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.fastgit.org/vernesong/OpenClash/core/"$RELEASE_BRANCH"/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_tun.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/core/"$RELEASE_BRANCH"/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_tun.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/vernesong/OpenClash/core/"$RELEASE_BRANCH"/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_tun.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
if [ "${PIPESTATUS[0]}" -ne 0 ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/core-lateset/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_tun.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
curl_status=${PIPESTATUS[0]}
else
curl_status=0
fi
if [ "$curl_status" -eq 0 ]; then
gzip -t /tmp/clash_tun.gz >/dev/null 2>&1
fi
;;
"Meta")
LOG_OUT "【Meta】Core Downloading, Please Try to Download and Upload Manually If Fails"
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"gh/vernesong/OpenClash@core/"$RELEASE_BRANCH"/meta/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_meta.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_meta.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.fastgit.org/vernesong/OpenClash/core/"$RELEASE_BRANCH"/meta/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_meta.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_meta.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/core/"$RELEASE_BRANCH"/meta/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_meta.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_meta.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/vernesong/OpenClash/core/"$RELEASE_BRANCH"/meta/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_meta.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_meta.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
if [ "${PIPESTATUS[0]}" -ne 0 ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/core-lateset/meta/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_meta.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_meta.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
curl_status=${PIPESTATUS[0]}
else
curl_status=0
fi
if [ "$curl_status" -eq 0 ]; then
gzip -t /tmp/clash_meta.tar.gz >/dev/null 2>&1
fi
;;
*)
LOG_OUT "【Dev】Core Downloading, Please Try to Download and Upload Manually If Fails"
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"gh/vernesong/OpenClash@core/"$RELEASE_BRANCH"/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.fastgit.org/vernesong/OpenClash/core/"$RELEASE_BRANCH"/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/core/"$RELEASE_BRANCH"/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/vernesong/OpenClash/core/"$RELEASE_BRANCH"/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
if [ "${PIPESTATUS[0]}" -ne 0 ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/core-lateset/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
curl_status=${PIPESTATUS[0]}
else
curl_status=0
fi
if [ "$curl_status" -eq 0 ]; then
gzip -t /tmp/clash.tar.gz >/dev/null 2>&1
fi
esac
if [ "$?" == "0" ]; then
LOG_OUT "【"$CORE_TYPE"】Core Download Successful, Start Update..."
case $CORE_TYPE in
"TUN")
[ -s "/tmp/clash_tun.gz" ] && {
gzip -d /tmp/clash_tun.gz >/dev/null 2>&1
rm -rf /tmp/clash_tun.gz >/dev/null 2>&1
rm -rf "$tun_core_path" >/dev/null 2>&1
chmod 4755 /tmp/clash_tun >/dev/null 2>&1
}
;;
"Meta")
[ -s "/tmp/clash_meta.tar.gz" ] && {
rm -rf "$meta_core_path" >/dev/null 2>&1
tar zxvf /tmp/clash_meta.tar.gz -C /tmp
mv /tmp/clash /tmp/clash_meta >/dev/null 2>&1
rm -rf /tmp/clash_meta.tar.gz >/dev/null 2>&1
chmod 4755 /tmp/clash_meta >/dev/null 2>&1
}
;;
*)
[ -s "/tmp/clash.tar.gz" ] && {
rm -rf "$dev_core_path" >/dev/null 2>&1
tar zxvf /tmp/clash.tar.gz -C /tmp
rm -rf /tmp/clash.tar.gz >/dev/null 2>&1
chmod 4755 /tmp/clash >/dev/null 2>&1
}
esac
if [ "$?" != "0" ]; then
LOG_OUT "【"$CORE_TYPE"】Core Update Failed. Please Make Sure Enough Flash Memory Space And Try Again!"
case $CORE_TYPE in
"TUN")
rm -rf /tmp/clash_tun >/dev/null 2>&1
;;
"Meta")
rm -rf /tmp/clash_meta >/dev/null 2>&1
;;
*)
rm -rf /tmp/clash >/dev/null 2>&1
esac
SLOG_CLEAN
exit 0
fi
case $CORE_TYPE in
"TUN")
mv /tmp/clash_tun "$tun_core_path" >/dev/null 2>&1
;;
"Meta")
mv /tmp/clash_meta "$meta_core_path" >/dev/null 2>&1
;;
*)
mv /tmp/clash "$dev_core_path" >/dev/null 2>&1
esac
if [ "$?" == "0" ]; then
LOG_OUT "【"$CORE_TYPE"】Core Update Successful!"
if [ "$if_restart" -eq 1 ]; then
uci -q set openclash.config.config_reload=0
uci -q commit openclash
if [ -z "$2" ] && [ "$1" != "one_key_update" ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ] && [ "$(unify_ps_prevent)" -eq 0 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
fi
else
SLOG_CLEAN
fi
else
LOG_OUT "【"$CORE_TYPE"】Core Update Failed. Please Make Sure Enough Flash Memory Space And Try Again!"
SLOG_CLEAN
fi
else
LOG_OUT "【"$CORE_TYPE"】Core Update Failed, Please Check The Network or Try Again Later!"
SLOG_CLEAN
fi
else
LOG_OUT "No Compiled Version Selected, Please Select In Global Settings And Try Again!"
SLOG_CLEAN
fi
else
LOG_OUT "【"$CORE_TYPE"】Core Has Not Been Updated, Stop Continuing Operation!"
SLOG_CLEAN
fi
case $CORE_TYPE in
"TUN")
rm -rf /tmp/clash_tun >/dev/null 2>&1
;;
"Meta")
rm -rf /tmp/clash_meta >/dev/null 2>&1
;;
*)
rm -rf /tmp/clash >/dev/null 2>&1
esac

View File

@ -0,0 +1,33 @@
#!/bin/sh
. /usr/share/openclash/log.sh
set_lock() {
exec 883>"/tmp/lock/openclash_cus_domian.lock" 2>/dev/null
flock -x 883 2>/dev/null
}
del_lock() {
flock -u 883 2>/dev/null
rm -rf "/tmp/lock/openclash_cus_domian.lock"
}
set_lock
DNSMASQ_CONF_DIR=$(uci -q get dhcp.@dnsmasq[0].confdir || echo '/tmp/dnsmasq.d')
DNSMASQ_CONF_DIR=${DNSMASQ_CONF_DIR%*/}
rm -rf ${DNSMASQ_CONF_DIR}/dnsmasq_openclash_custom_domain.conf >/dev/null 2>&1
if [ "$(uci get openclash.config.enable_custom_domain_dns_server 2>/dev/null)" = "1" ] && [ "$(uci get openclash.config.enable_redirect_dns 2>/dev/null)" = "1" ]; then
LOG_OUT "Setting Secondary DNS Server List..."
custom_domain_dns_server=$(uci get openclash.config.custom_domain_dns_server 2>/dev/null)
[ -z "$custom_domain_dns_server" ] && {
custom_domain_dns_server="114.114.114.114"
}
if [ -s "/etc/openclash/custom/openclash_custom_domain_dns.list" ]; then
mkdir -p ${DNSMASQ_CONF_DIR}
awk -v tag="$custom_domain_dns_server" '!/^$/&&!/^#/{printf("server=/%s/"'tag'"\n",$0)}' /etc/openclash/custom/openclash_custom_domain_dns.list >>${DNSMASQ_CONF_DIR}/dnsmasq_openclash_custom_domain.conf 2>/dev/null
fi
fi
del_lock

View File

@ -0,0 +1,540 @@
#!/bin/bash
. /lib/functions.sh
. /usr/share/openclash/ruby.sh
set_lock() {
exec 885>"/tmp/lock/openclash_debug.lock" 2>/dev/null
flock -x 885 2>/dev/null
}
del_lock() {
flock -u 885 2>/dev/null
rm -rf "/tmp/lock/openclash_debug.lock"
}
DEBUG_LOG="/tmp/openclash_debug.log"
LOGTIME=$(echo $(date "+%Y-%m-%d %H:%M:%S"))
uci -q commit openclash
set_lock
enable_custom_dns=$(uci -q get openclash.config.enable_custom_dns)
rule_source=$(uci -q get openclash.config.rule_source)
enable_custom_clash_rules=$(uci -q get openclash.config.enable_custom_clash_rules)
ipv6_enable=$(uci -q get openclash.config.ipv6_enable)
ipv6_dns=$(uci -q get openclash.config.ipv6_dns)
enable_redirect_dns=$(uci -q get openclash.config.enable_redirect_dns)
disable_masq_cache=$(uci -q get openclash.config.disable_masq_cache)
proxy_mode=$(uci -q get openclash.config.proxy_mode)
intranet_allowed=$(uci -q get openclash.config.intranet_allowed)
enable_udp_proxy=$(uci -q get openclash.config.enable_udp_proxy)
enable_rule_proxy=$(uci -q get openclash.config.enable_rule_proxy)
en_mode=$(uci -q get openclash.config.en_mode)
RAW_CONFIG_FILE=$(uci -q get openclash.config.config_path)
CONFIG_FILE="/etc/openclash/$(uci -q get openclash.config.config_path |awk -F '/' '{print $5}' 2>/dev/null)"
core_model=$(uci -q get openclash.config.core_version)
cpu_model=$(opkg status libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' 2>/dev/null)
core_version=$(/etc/openclash/core/clash -v 2>/dev/null |awk -F ' ' '{print $2}' 2>/dev/null)
core_tun_version=$(/etc/openclash/core/clash_tun -v 2>/dev/null |awk -F ' ' '{print $2}' 2>/dev/null)
core_meta_version=$(/etc/openclash/core/clash_meta -v 2>/dev/null |awk -F ' ' '{print $3}' |head -1 2>/dev/null)
servers_update=$(uci -q get openclash.config.servers_update)
mix_proxies=$(uci -q get openclash.config.mix_proxies)
op_version=$(opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F 'Version: ' '{print "v"$2}')
china_ip_route=$(uci -q get openclash.config.china_ip_route)
common_ports=$(uci -q get openclash.config.common_ports)
router_self_proxy=$(uci -q get openclash.config.router_self_proxy)
core_type=$(uci -q get openclash.config.core_type || echo "Dev")
da_password=$(uci -q get openclash.config.dashboard_password)
cn_port=$(uci -q get openclash.config.cn_port)
lan_ip=$(uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
dnsmasq_default_resolvfile=$(uci -q get openclash.config.default_resolvfile)
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}')
if [ ! -z "$CONFIG_NAME" ]; then
RAW_CONFIG_FILE="/etc/openclash/config/$CONFIG_NAME"
CONFIG_FILE="/etc/openclash/$CONFIG_NAME"
fi
fi
ts_cf()
{
if [ "$1" != 1 ]; then
echo "停用"
else
echo "启用"
fi
}
ts_re()
{
if [ -z "$1" ]; then
echo "未安装"
else
echo "已安装"
fi
}
dns_re()
{
if [ "$1" = "1" ]; then
echo "Dnsmasq 转发"
elif [ "$1" = "2" ]; then
echo "Firewall 转发"
else
echo "停用"
fi
}
echo "OpenClash 调试日志" > "$DEBUG_LOG"
cat >> "$DEBUG_LOG" <<-EOF
生成时间: $LOGTIME
插件版本: $op_version
隐私提示: 上传此日志前请注意检查、屏蔽公网IP、节点、密码等相关敏感信息
\`\`\`
EOF
cat >> "$DEBUG_LOG" <<-EOF
#===================== 系统信息 =====================#
主机型号: $(cat /tmp/sysinfo/model 2>/dev/null)
固件版本: $(cat /usr/lib/os-release 2>/dev/null |grep OPENWRT_RELEASE 2>/dev/null |awk -F '"' '{print $2}' 2>/dev/null)
LuCI版本: $(opkg status luci 2>/dev/null |grep 'Version' |awk -F ': ' '{print $2}' 2>/dev/null)
内核版本: $(uname -r 2>/dev/null)
处理器架构: $cpu_model
#此项有值时,如不使用IPv6,建议到网络-接口-lan的设置中禁用IPV6的DHCP
IPV6-DHCP: $(uci -q get dhcp.lan.dhcpv6)
DNS劫持: $(dns_re "$enable_redirect_dns")
#DNS劫持为Dnsmasq时此项结果应仅有配置文件的DNS监听地址
Dnsmasq转发设置: $(uci -q get dhcp.@dnsmasq[0].server)
EOF
cat >> "$DEBUG_LOG" <<-EOF
#===================== 依赖检查 =====================#
dnsmasq-full: $(ts_re "$(opkg status dnsmasq-full 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
coreutils: $(ts_re "$(opkg status coreutils 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
coreutils-nohup: $(ts_re "$(opkg status coreutils-nohup 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
bash: $(ts_re "$(opkg status bash 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
curl: $(ts_re "$(opkg status curl 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
ca-certificates: $(ts_re "$(opkg status ca-certificates 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
ipset: $(ts_re "$(opkg status ipset 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
ip-full: $(ts_re "$(opkg status ip-full 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
libcap: $(ts_re "$(opkg status libcap 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
libcap-bin: $(ts_re "$(opkg status libcap-bin 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
ruby: $(ts_re "$(opkg status ruby 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
ruby-yaml: $(ts_re "$(opkg status ruby-yaml 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
ruby-psych: $(ts_re "$(opkg status ruby-psych 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
ruby-pstore: $(ts_re "$(opkg status ruby-pstore 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
kmod-tun(TUN模式): $(ts_re "$(opkg status kmod-tun 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
luci-compat(Luci >= 19.07): $(ts_re "$(opkg status luci-compat 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
kmod-inet-diag(PROCESS-NAME): $(ts_re "$(opkg status kmod-inet-diag 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
unzip: $(ts_re "$(opkg status unzip 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
EOF
if [ -n "$(command -v fw4)" ]; then
cat >> "$DEBUG_LOG" <<-EOF
kmod-nft-tproxy: $(ts_re "$(opkg status kmod-nft-tproxy 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
EOF
else
cat >> "$DEBUG_LOG" <<-EOF
iptables-mod-tproxy: $(ts_re "$(opkg status iptables-mod-tproxy 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
kmod-ipt-tproxy: $(ts_re "$(opkg status kmod-ipt-tproxy 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
iptables-mod-extra: $(ts_re "$(opkg status iptables-mod-extra 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
kmod-ipt-extra: $(ts_re "$(opkg status kmod-ipt-extra 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
kmod-ipt-nat: $(ts_re "$(opkg status kmod-ipt-nat 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
EOF
fi
#core
cat >> "$DEBUG_LOG" <<-EOF
#===================== 内核检查 =====================#
EOF
if pidof clash >/dev/null; then
cat >> "$DEBUG_LOG" <<-EOF
运行状态: 运行中
运行内核:$core_type
进程pid: $(pidof clash)
运行权限: `getpcaps $(pidof clash)`
运行用户: $(ps |grep "/etc/openclash/clash" |grep -v grep |awk '{print $2}' 2>/dev/null)
EOF
else
cat >> "$DEBUG_LOG" <<-EOF
运行状态: 未运行
EOF
fi
if [ "$core_model" = "0" ]; then
core_model="未选择架构"
fi
cat >> "$DEBUG_LOG" <<-EOF
已选择的架构: $core_model
#下方无法显示内核版本号时请确认您的内核版本是否正确或者有无权限
EOF
cat >> "$DEBUG_LOG" <<-EOF
Tun内核版本: $core_tun_version
EOF
if [ ! -f "/etc/openclash/core/clash_tun" ]; then
cat >> "$DEBUG_LOG" <<-EOF
Tun内核文件: 不存在
EOF
else
cat >> "$DEBUG_LOG" <<-EOF
Tun内核文件: 存在
EOF
fi
if [ ! -x "/etc/openclash/core/clash_tun" ]; then
cat >> "$DEBUG_LOG" <<-EOF
Tun内核运行权限: 否
EOF
else
cat >> "$DEBUG_LOG" <<-EOF
Tun内核运行权限: 正常
EOF
fi
cat >> "$DEBUG_LOG" <<-EOF
Dev内核版本: $core_version
EOF
if [ ! -f "/etc/openclash/core/clash" ]; then
cat >> "$DEBUG_LOG" <<-EOF
Dev内核文件: 不存在
EOF
else
cat >> "$DEBUG_LOG" <<-EOF
Dev内核文件: 存在
EOF
fi
if [ ! -x "/etc/openclash/core/clash" ]; then
cat >> "$DEBUG_LOG" <<-EOF
Dev内核运行权限: 否
EOF
else
cat >> "$DEBUG_LOG" <<-EOF
Dev内核运行权限: 正常
EOF
fi
cat >> "$DEBUG_LOG" <<-EOF
Meta内核版本: $core_meta_version
EOF
if [ ! -f "/etc/openclash/core/clash_meta" ]; then
cat >> "$DEBUG_LOG" <<-EOF
Meta内核文件: 不存在
EOF
else
cat >> "$DEBUG_LOG" <<-EOF
Meta内核文件: 存在
EOF
fi
if [ ! -x "/etc/openclash/core/clash_meta" ]; then
cat >> "$DEBUG_LOG" <<-EOF
Meta内核运行权限: 否
EOF
else
cat >> "$DEBUG_LOG" <<-EOF
Meta内核运行权限: 正常
EOF
fi
cat >> "$DEBUG_LOG" <<-EOF
#===================== 插件设置 =====================#
当前配置文件: $RAW_CONFIG_FILE
启动配置文件: $CONFIG_FILE
运行模式: $en_mode
默认代理模式: $proxy_mode
UDP流量转发(tproxy): $(ts_cf "$enable_udp_proxy")
自定义DNS: $(ts_cf "$enable_custom_dns")
IPV6代理: $(ts_cf "$ipv6_enable")
IPV6-DNS解析: $(ts_cf "$ipv6_dns")
禁用Dnsmasq缓存: $(ts_cf "$disable_masq_cache")
自定义规则: $(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 "$router_self_proxy")
#启动异常时建议关闭此项后重试
混合节点: $(ts_cf "$mix_proxies")
保留配置: $(ts_cf "$servers_update")
EOF
cat >> "$DEBUG_LOG" <<-EOF
#启动异常时建议关闭此项后重试
第三方规则: $(ts_cf "$rule_source")
EOF
if [ "$enable_custom_clash_rules" -eq 1 ]; then
cat >> "$DEBUG_LOG" <<-EOF
#===================== 自定义规则 一 =====================#
EOF
cat /etc/openclash/custom/openclash_custom_rules.list >> "$DEBUG_LOG"
cat >> "$DEBUG_LOG" <<-EOF
#===================== 自定义规则 二 =====================#
EOF
cat /etc/openclash/custom/openclash_custom_rules_2.list >> "$DEBUG_LOG"
fi
cat >> "$DEBUG_LOG" <<-EOF
#===================== 配置文件 =====================#
EOF
if [ -f "$CONFIG_FILE" ]; then
ruby_read "$CONFIG_FILE" ".select {|x| 'proxies' != x and 'proxy-providers' != x }.to_yaml" 2>/dev/null >> "$DEBUG_LOG"
else
ruby_read "$RAW_CONFIG_FILE" ".select {|x| 'proxies' != x and 'proxy-providers' != x }.to_yaml" 2>/dev/null >> "$DEBUG_LOG"
fi
sed -i '/^ \{0,\}secret:/d' "$DEBUG_LOG" 2>/dev/null
#custom overwrite
cat >> "$DEBUG_LOG" <<-EOF
#===================== 自定义覆写设置 =====================#
EOF
cat /etc/openclash/custom/openclash_custom_overwrite.sh >> "$DEBUG_LOG" 2>/dev/null
#firewall
cat >> "$DEBUG_LOG" <<-EOF
#===================== 自定义防火墙设置 =====================#
EOF
cat /etc/openclash/custom/openclash_custom_firewall_rules.sh >> "$DEBUG_LOG" 2>/dev/null
cat >> "$DEBUG_LOG" <<-EOF
#===================== IPTABLES 防火墙设置 =====================#
#IPv4 NAT chain
EOF
iptables-save -t nat >> "$DEBUG_LOG" 2>/dev/null
cat >> "$DEBUG_LOG" <<-EOF
#IPv4 Mangle chain
EOF
iptables-save -t mangle >> "$DEBUG_LOG" 2>/dev/null
cat >> "$DEBUG_LOG" <<-EOF
#IPv4 Filter chain
EOF
iptables-save -t filter >> "$DEBUG_LOG" 2>/dev/null
cat >> "$DEBUG_LOG" <<-EOF
#IPv6 NAT chain
EOF
ip6tables-save -t nat >> "$DEBUG_LOG" 2>/dev/null
cat >> "$DEBUG_LOG" <<-EOF
#IPv6 Mangle chain
EOF
ip6tables-save -t mangle >> "$DEBUG_LOG" 2>/dev/null
cat >> "$DEBUG_LOG" <<-EOF
#IPv6 Filter chain
EOF
ip6tables-save -t filter >> "$DEBUG_LOG" 2>/dev/null
if [ -n "$(command -v fw4)" ]; then
cat >> "$DEBUG_LOG" <<-EOF
#===================== NFTABLES 防火墙设置 =====================#
EOF
for nft in "input" "forward" "dstnat" "srcnat" "nat_output" "mangle_prerouting" "mangle_output"; do
nft list chain inet fw4 "$nft" >> "$DEBUG_LOG" 2>/dev/null
done >/dev/null 2>&1
for nft in "openclash" "openclash_mangle" "openclash_mangle_output" "openclash_output" "openclash_post" "openclash_wan_input" "openclash_dns_hijack" "openclash_dns_redirect" "openclash_mangle_v6" "openclash_mangle_output_v6" "openclash_post_v6" "openclash_wan6_input"; do
nft list chain inet fw4 "$nft" >> "$DEBUG_LOG" 2>/dev/null
done >/dev/null 2>&1
fi
cat >> "$DEBUG_LOG" <<-EOF
#===================== IPSET状态 =====================#
EOF
ipset list -t >> "$DEBUG_LOG"
cat >> "$DEBUG_LOG" <<-EOF
#===================== 路由表状态 =====================#
EOF
echo "#IPv4" >> "$DEBUG_LOG"
echo "" >> "$DEBUG_LOG"
echo "#route -n" >> "$DEBUG_LOG"
route -n >> "$DEBUG_LOG" 2>/dev/null
echo "" >> "$DEBUG_LOG"
echo "#ip route list" >> "$DEBUG_LOG"
ip route list >> "$DEBUG_LOG" 2>/dev/null
echo "" >> "$DEBUG_LOG"
echo "#ip rule show" >> "$DEBUG_LOG"
ip rule show >> "$DEBUG_LOG" 2>/dev/null
echo "" >> "$DEBUG_LOG"
echo "#IPv6" >> "$DEBUG_LOG"
echo "" >> "$DEBUG_LOG"
echo "#route -A inet6" >> "$DEBUG_LOG"
route -A inet6 >> "$DEBUG_LOG" 2>/dev/null
echo "" >> "$DEBUG_LOG"
echo "#ip -6 route list" >> "$DEBUG_LOG"
ip -6 route list >> "$DEBUG_LOG" 2>/dev/null
echo "" >> "$DEBUG_LOG"
echo "#ip -6 rule show" >> "$DEBUG_LOG"
ip -6 rule show >> "$DEBUG_LOG" 2>/dev/null
if [ "$en_mode" != "fake-ip" ] && [ "$en_mode" != "redir-host" ]; then
cat >> "$DEBUG_LOG" <<-EOF
#===================== Tun设备状态 =====================#
EOF
ip tuntap list >> "$DEBUG_LOG" 2>/dev/null
fi
cat >> "$DEBUG_LOG" <<-EOF
#===================== 端口占用状态 =====================#
EOF
netstat -nlp |grep clash >> "$DEBUG_LOG" 2>/dev/null
cat >> "$DEBUG_LOG" <<-EOF
#===================== 测试本机DNS查询(www.baidu.com) =====================#
EOF
nslookup www.baidu.com >> "$DEBUG_LOG" 2>/dev/null
cat >> "$DEBUG_LOG" <<-EOF
#===================== 测试内核DNS查询(www.instagram.com) =====================#
EOF
/usr/share/openclash/openclash_debug_dns.lua "www.instagram.com" >> "$DEBUG_LOG" 2>/dev/null
cat >> "$DEBUG_LOG" <<-EOF
Dnsmasq 当前默认 resolv 文件:$dnsmasq_default_resolvfile
EOF
if [ -s "/tmp/resolv.conf.auto" ]; then
cat >> "$DEBUG_LOG" <<-EOF
#===================== /tmp/resolv.conf.auto =====================#
EOF
cat /tmp/resolv.conf.auto >> "$DEBUG_LOG"
fi
if [ -s "/tmp/resolv.conf.d/resolv.conf.auto" ]; then
cat >> "$DEBUG_LOG" <<-EOF
#===================== /tmp/resolv.conf.d/resolv.conf.auto =====================#
EOF
cat /tmp/resolv.conf.d/resolv.conf.auto >> "$DEBUG_LOG"
fi
cat >> "$DEBUG_LOG" <<-EOF
#===================== 测试本机网络连接(www.baidu.com) =====================#
EOF
curl -SsI -m 5 www.baidu.com >> "$DEBUG_LOG" 2>/dev/null
cat >> "$DEBUG_LOG" <<-EOF
#===================== 测试本机网络下载(raw.githubusercontent.com) =====================#
EOF
VERSION_URL="https://raw.githubusercontent.com/vernesong/OpenClash/master/version"
if pidof clash >/dev/null; then
curl -SsIL -m 3 --retry 2 "$VERSION_URL" >> "$DEBUG_LOG" 2>/dev/null
else
curl -SsIL -m 3 --retry 2 "$VERSION_URL" >> "$DEBUG_LOG" 2>/dev/null
fi
cat >> "$DEBUG_LOG" <<-EOF
#===================== 最近运行日志(自动切换为Debug模式) =====================#
EOF
if pidof clash >/dev/null; then
curl -sL -m 3 -H "Content-Type: application/json" -H "Authorization: Bearer ${da_password}" -XPATCH http://${lan_ip}:${cn_port}/configs -d '{"log-level": "debug"}'
sleep 10
fi
tail -n 100 "/tmp/openclash.log" >> "$DEBUG_LOG" 2>/dev/null
cat >> "$DEBUG_LOG" <<-EOF
#===================== 最近运行日志获取完成(自动切换为silent模式) =====================#
EOF
if pidof clash >/dev/null; then
curl -sL -m 3 -H "Content-Type: application/json" -H "Authorization: Bearer ${da_password}" -XPATCH http://${lan_ip}:${cn_port}/configs -d '{"log-level": "silent"}'
fi
cat >> "$DEBUG_LOG" <<-EOF
#===================== 活动连接信息 =====================#
EOF
/usr/share/openclash/openclash_debug_getcon.lua
cat >> "$DEBUG_LOG" <<-EOF
\`\`\`
EOF
wan_ip=$(/usr/share/openclash/openclash_get_network.lua "wanip")
wan_ip6=$(/usr/share/openclash/openclash_get_network.lua "wanip6")
if [ -n "$wan_ip" ]; then
for i in $wan_ip; do
wanip=$(echo "$i" |awk -F '.' '{print $1"."$2"."$3}')
sed -i "s/${wanip}/*WAN IP*/g" "$DEBUG_LOG" 2>/dev/null
done
fi
if [ -n "$wan_ip6" ]; then
for i in $wan_ip6; do
wanip=$(echo "$i" |awk -F: 'OFS=":",NF-=1')
sed -i "s/${wanip}/*WAN IP*/g" "$DEBUG_LOG" 2>/dev/null
done
fi
del_lock

View File

@ -0,0 +1,78 @@
#!/usr/bin/lua
require "nixio"
require "luci.util"
require "luci.sys"
local uci = require("luci.model.uci").cursor()
local json = require "luci.jsonc"
local datatype = require "luci.cbi.datatypes"
local addr = arg[1]
local function debug_dns()
local info, ip, host
ip = luci.sys.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
if not ip or ip == "" then
ip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'")
end
if not ip or ip == "" then
ip = luci.sys.exec("ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1 | tr -d '\n'")
end
local port = uci:get("openclash", "config", "cn_port")
local passwd = uci:get("openclash", "config", "dashboard_password") or ""
if datatype.hostname(addr) and ip and port then
info = luci.sys.exec(string.format('curl -sL -m 3 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -XGET http://"%s":"%s"/dns/query?name="%s"', passwd, ip, port, addr))
if info then
info = json.parse(info)
end
if info then
print("Status: "..(info.Status))
print("TC: "..tostring(info.TC))
print("RD: "..tostring(info.RD))
print("RA: "..tostring(info.RA))
print("AD: "..tostring(info.AD))
print("CD: "..tostring(info.CD))
print("")
print("Question: ")
for _, v in pairs(info.Question) do
print(" Name: "..(v.Name))
print(" Qtype: "..(v.Qtype))
print(" Qclass: "..(v.Qclass))
print("")
end
if info.Answer then
print("Answer: ")
for _, v in pairs(info.Answer) do
print(" TTL: "..(v.TTL))
print(" data: "..(v.data:gsub("\n?", "")))
print(" name: "..(v.name))
print(" type: "..(v.type))
print("")
end
end
if info.Additional then
print("Additional: ")
for _, v in pairs(info.Additional) do
print(" TTL: "..(v.TTL))
print(" data: "..(v.data:gsub("\n?", "")))
print(" name: "..(v.name))
print(" type: "..(v.type))
print("")
end
end
if info.Authority then
print("Authority: ")
for _, v in pairs(info.Authority) do
print(" TTL: "..(v.TTL))
print(" data: "..(v.data:gsub("\n?", "")))
print(" name: "..(v.name))
print(" type: "..(v.type))
print("")
end
end
end
end
os.exit(0)
end
debug_dns()

View File

@ -0,0 +1,80 @@
#!/usr/bin/lua
require "nixio"
require "luci.util"
require "luci.sys"
local uci = require("luci.model.uci").cursor()
local fs = require "luci.openclash"
local json = require "luci.jsonc"
local datatype = require "luci.cbi.datatypes"
local addr = arg[1]
local function s(e)
local t=0
local a={' KB',' MB',' GB',' TB'}
repeat
e=e/1024
t=t+1
until(e<=1024)
return string.format("%.1f",e)..a[t]
end
local function debug_getcon()
local info, ip, host, diag_info
ip = luci.sys.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
if not ip or ip == "" then
ip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'")
end
if not ip or ip == "" then
ip = luci.sys.exec("ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1 | tr -d '\n'")
end
local port = uci:get("openclash", "config", "cn_port")
local passwd = uci:get("openclash", "config", "dashboard_password") or ""
if ip and port then
info = luci.sys.exec(string.format('curl -sL -m 3 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -XGET http://"%s":"%s"/connections', passwd, ip, port))
if info then
info = json.parse(info)
end
if info then
for i = 1, #(info.connections) do
if info.connections[i].metadata.host == "" then
host = "Empty"
else
host = info.connections[i].metadata.host
end
if not addr then
luci.sys.exec(string.format('echo "%s. SourceIP:【%s】 - Host:【%s】 - DestinationIP:【%s】 - Network:【%s】 - RulePayload:【%s】 - Lastchain:【%s】" >> /tmp/openclash_debug.log', i, (info.connections[i].metadata.sourceIP), host, (info.connections[i].metadata.destinationIP), (info.connections[i].metadata.network), (info.connections[i].rulePayload),(info.connections[i].chains[1])))
elseif addr == "netflix-nflxvideo" then
if string.match(host, "nflxvideo.net") or string.match(host, "amazonaws.com") then
print(host)
end
else
if datatype.hostname(addr) and string.lower(addr) == host or datatype.ipaddr(addr) and addr == (info.connections[i].metadata.destinationIP) then
print("id: "..(info.connections[i].id))
print("start: "..(info.connections[i].start))
print("download: "..s(info.connections[i].download))
print("upload: "..s(info.connections[i].upload))
print("rule: "..(info.connections[i].rule))
print("rulePayload: "..(info.connections[i].rulePayload))
print("chains: ")
for o = 1, #(info.connections[i].chains) do
print(" "..o..": "..(info.connections[i].chains[o]))
end
print("metadata: ")
print(" sourceIP: "..(info.connections[i].metadata.sourceIP))
print(" sourcePort: "..(info.connections[i].metadata.sourcePort))
print(" host: "..host)
print(" destinationIP: "..(info.connections[i].metadata.destinationIP))
print(" destinationPort: "..(info.connections[i].metadata.destinationPort))
print(" network: "..(info.connections[i].metadata.network))
print(" type: "..(info.connections[i].metadata.type))
print("")
end
end
end
end
end
os.exit(0)
end
debug_getcon()

View File

@ -0,0 +1,51 @@
#!/usr/bin/lua
require "nixio"
require "luci.util"
require "luci.sys"
local uci = require("luci.model.uci").cursor()
local fs = require "luci.openclash"
local json = require "luci.jsonc"
local function dler_checkin()
local info, path, checkin
local token = uci:get("openclash", "config", "dler_token")
local email = uci:get("openclash", "config", "dler_email")
local passwd = uci:get("openclash", "config", "dler_passwd")
local enable = uci:get("openclash", "config", "dler_checkin") or 0
local interval = uci:get("openclash", "config", "dler_checkin_interval") or 1
local multiple = uci:get("openclash", "config", "dler_checkin_multiple") or 1
path = "/tmp/dler_checkin"
if token and email and passwd and enable == "1" then
checkin = string.format("curl -sL -H 'Content-Type: application/json' -d '{\"email\":\"%s\", \"passwd\":\"%s\", \"multiple\":\"%s\"}' -X POST https://dler.cloud/api/v1/checkin -o %s", email, passwd, multiple, path)
if not nixio.fs.access(path) then
luci.sys.exec(checkin)
else
if fs.readfile(path) == "" or not fs.readfile(path) then
luci.sys.exec(checkin)
else
if (os.time() - fs.mtime(path) > interval*3600+1) then
luci.sys.exec(checkin)
else
os.exit(0)
end
end
end
info = fs.readfile(path)
if info then
info = json.parse(info)
end
if info and info.ret == 200 then
luci.sys.exec(string.format('echo "%s Dler Cloud Checkin Successful, Result:【%s】" >> /tmp/openclash.log', os.date("%Y-%m-%d %H:%M:%S"), info.data.checkin))
else
if info and info.msg then
luci.sys.exec(string.format('echo "%s Dler Cloud Checkin Failed, Result:【%s】" >> /tmp/openclash.log', os.date("%Y-%m-%d %H:%M:%S"), info.msg))
else
luci.sys.exec(string.format('echo "%s Dler Cloud Checkin Failed! Please Check And Try Again..." >> /tmp/openclash.log', os.date("%Y-%m-%d %H:%M:%S")))
end
end
end
os.exit(0)
end
dler_checkin()

View File

@ -0,0 +1,71 @@
#!/bin/bash
. /usr/share/openclash/log.sh
. /lib/functions.sh
DASH_NAME="$1"
DASH_TYPE="$2"
DASH_FILE_DIR="/tmp/dash.zip"
DASH_FILE_TMP="/tmp/dash/"
LOG_FILE="/tmp/openclash.log"
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
if [ "$DASH_NAME" == "Dashboard" ]; then
UNPACK_FILE_DIR="/usr/share/openclash/ui/dashboard/"
BACKUP_FILE_DIR="/usr/share/openclash/ui/dashboard_backup/"
if [ "$DASH_TYPE" == "Official" ]; then
DOWNLOAD_PATH="https://codeload.github.com/Dreamacro/clash-dashboard/zip/refs/heads/gh-pages"
FILE_PATH_INCLUDE="clash-dashboard-gh-pages"
else
DOWNLOAD_PATH="https://codeload.github.com/MetaCubeX/Razord-meta/zip/refs/heads/gh-pages"
FILE_PATH_INCLUDE="Razord-meta-gh-pages"
fi
else
UNPACK_FILE_DIR="/usr/share/openclash/ui/yacd/"
BACKUP_FILE_DIR="/usr/share/openclash/ui/yacd_backup/"
if [ "$DASH_TYPE" == "Official" ]; then
DOWNLOAD_PATH="https://codeload.github.com/haishanh/yacd/zip/refs/heads/gh-pages"
FILE_PATH_INCLUDE="yacd-gh-pages"
else
DOWNLOAD_PATH="https://codeload.github.com/MetaCubeX/Yacd-meta/zip/refs/heads/gh-pages"
FILE_PATH_INCLUDE="Yacd-meta-gh-pages"
fi
fi
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$DOWNLOAD_PATH" -o "$DASH_FILE_DIR" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$DASH_FILE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
if [ "${PIPESTATUS[0]}" -eq 0 ] && [ -s "$DASH_FILE_DIR" ] && [ -z "$(grep "404: Not Found" "$DASH_FILE_DIR")" ] && [ -z "$(grep "Package size exceeded the configured limit" "$DASH_FILE_DIR")" ]; then
unzip -qt "$DASH_FILE_DIR" >/dev/null 2>&1
if [ "$?" -eq "0" ]; then
cp -rf "$UNPACK_FILE_DIR". "$BACKUP_FILE_DIR" >/dev/null 2>&1
rm -rf "$UNPACK_FILE_DIR" >/dev/null 2>&1
unzip -q "$DASH_FILE_DIR" -d "$DASH_FILE_TMP" >/dev/null 2>&1
if [ "$?" -eq "0" ] && [ -d "$DASH_FILE_TMP$FILE_PATH_INCLUDE" ]; then
cp -rf "$DASH_FILE_TMP$FILE_PATH_INCLUDE"/. "$UNPACK_FILE_DIR" >/dev/null 2>&1
rm -rf "$DASH_FILE_DIR" >/dev/null 2>&1
rm -rf "$BACKUP_FILE_DIR" >/dev/null 2>&1
rm -rf "$DASH_FILE_TMP" >/dev/null 2>&1
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Download Successful!" && SLOG_CLEAN
exit 1
else
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Unzip Error!" && SLOG_CLEAN
cp -rf "$BACKUP_FILE_DIR". "$UNPACK_FILE_DIR" >/dev/null 2>&1
rm -rf "$DASH_FILE_DIR" >/dev/null 2>&1
rm -rf "$BACKUP_FILE_DIR" >/dev/null 2>&1
rm -rf "$DASH_FILE_TMP" >/dev/null 2>&1
exit 2
fi
else
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Unzip Error!" && SLOG_CLEAN
cp -rf "$BACKUP_FILE_DIR". "$UNPACK_FILE_DIR" >/dev/null 2>&1
rm -rf "$DASH_FILE_DIR" >/dev/null 2>&1
rm -rf "$BACKUP_FILE_DIR" >/dev/null 2>&1
rm -rf "$DASH_FILE_TMP" >/dev/null 2>&1
exit 2
fi
else
cp -rf "$BACKUP_FILE_DIR". "$UNPACK_FILE_DIR" >/dev/null 2>&1
rm -rf "$BACKUP_FILE_DIR" >/dev/null 2>&1
rm -rf "$DASH_FILE_DIR" >/dev/null 2>&1
rm -rf "$DASH_FILE_TMP" >/dev/null 2>&1
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Download Error!" && SLOG_CLEAN
exit 0
fi

View File

@ -0,0 +1,122 @@
#!/bin/bash
. /usr/share/openclash/log.sh
. /lib/functions.sh
urlencode() {
if [ "$#" -eq 1 ]; then
echo "$(/usr/share/openclash/openclash_urlencode.lua "$1")"
fi
}
RULE_FILE_NAME="$1"
LOG_FILE="/tmp/openclash.log"
RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master")
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
if [ "$1" == "netflix_domains" ]; then
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
DOWNLOAD_PATH="${github_address_mod}gh/vernesong/OpenClash@$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Netflix_Domains.list"
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
DOWNLOAD_PATH="https://raw.fastgit.org/vernesong/OpenClash/$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Netflix_Domains.list"
else
DOWNLOAD_PATH="${github_address_mod}https://raw.githubusercontent.com/vernesong/OpenClash/$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Netflix_Domains.list"
fi
else
DOWNLOAD_PATH="https://raw.githubusercontent.com/vernesong/OpenClash/$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Netflix_Domains.list"
fi
RULE_FILE_DIR="/usr/share/openclash/res/Netflix_Domains.list"
RULE_FILE_NAME="Netflix_Domains"
RULE_TYPE="netflix"
elif [ "$1" == "disney_domains" ]; then
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
DOWNLOAD_PATH="${github_address_mod}gh/vernesong/OpenClash@$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Disney_Plus_Domains.list"
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
DOWNLOAD_PATH="https://raw.fastgit.org/vernesong/OpenClash/$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Disney_Plus_Domains.list"
else
DOWNLOAD_PATH="${github_address_mod}https://raw.githubusercontent.com/vernesong/OpenClash/$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Disney_Plus_Domains.list"
fi
else
DOWNLOAD_PATH="https://raw.githubusercontent.com/vernesong/OpenClash/$RELEASE_BRANCH/luci-app-openclash/root/usr/share/openclash/res/Disney_Plus_Domains.list"
fi
RULE_FILE_DIR="/usr/share/openclash/res/Disney_Plus_Domains.list"
RULE_FILE_NAME="Disney_Plus_Domains"
RULE_TYPE="disney"
elif [ -z "$(grep "$RULE_FILE_NAME" /usr/share/openclash/res/rule_providers.list 2>/dev/null)" ]; then
DOWNLOAD_PATH=$(grep -F "$RULE_FILE_NAME" /usr/share/openclash/res/game_rules.list |awk -F ',' '{print $2}' 2>/dev/null)
RULE_FILE_DIR="/etc/openclash/game_rules/$RULE_FILE_NAME"
RULE_TYPE="game"
else
DOWNLOAD_PATH=$(echo "$RULE_FILE_NAME" |awk -F ',' '{print $1$2}' 2>/dev/null)
RULE_FILE_NAME=$(grep -F "$RULE_FILE_NAME" /usr/share/openclash/res/rule_providers.list |awk -F ',' '{print $NF}' 2>/dev/null)
RULE_FILE_DIR="/etc/openclash/rule_provider/$RULE_FILE_NAME"
RULE_TYPE="provider"
fi
if [ -z "$DOWNLOAD_PATH" ]; then
LOG_OUT "Rule File【$RULE_FILE_NAME】Download Error!" && SLOG_CLEAN
exit 0
fi
TMP_RULE_DIR="/tmp/$RULE_FILE_NAME"
TMP_RULE_DIR_TMP="/tmp/$RULE_FILE_NAME.tmp"
[ "$RULE_TYPE" != "netflix" ] && [ "$RULE_TYPE" != "disney" ] && DOWNLOAD_PATH=$(urlencode "$DOWNLOAD_PATH")
if [ "$RULE_TYPE" = "netflix" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$RULE_TYPE" = "disney" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$RULE_TYPE" = "game" ]; then
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"gh/FQrabbit/SSTap-Rule@master/rules/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"FQrabbit/SSTap-Rule/master/rules/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/FQrabbit/SSTap-Rule/master/rules/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/FQrabbit/SSTap-Rule/master/rules/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
elif [ "$RULE_TYPE" = "provider" ]; then
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"gh/"$(echo "$DOWNLOAD_PATH" |awk -F '/master' '{print $1}' 2>/dev/null)"@master"$(echo "$DOWNLOAD_PATH" |awk -F 'master' '{print $2}')" -o "$TMP_RULE_DIR" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod""$(echo "$DOWNLOAD_PATH" |awk -F '/master' '{print $1}' 2>/dev/null)"/master"$(echo "$DOWNLOAD_PATH" |awk -F 'master' '{print $2}')" -o "$TMP_RULE_DIR" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$TMP_RULE_DIR" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
fi
if [ "${PIPESTATUS[0]}" -eq 0 ] && [ -s "$TMP_RULE_DIR" ] && [ -z "$(grep "404: Not Found" "$TMP_RULE_DIR")" ] && [ -z "$(grep "Package size exceeded the configured limit" "$TMP_RULE_DIR")" ]; then
if [ "$RULE_TYPE" = "game" ]; then
cat "$TMP_RULE_DIR" |sed '/^#/d' 2>/dev/null |sed '/^ *$/d' 2>/dev/null |awk '{print " - "$0}' > "$TMP_RULE_DIR_TMP" 2>/dev/null
sed -i '1i\payload:' "$TMP_RULE_DIR_TMP" 2>/dev/null
cmp -s "$TMP_RULE_DIR_TMP" "$RULE_FILE_DIR"
else
cmp -s "$TMP_RULE_DIR" "$RULE_FILE_DIR"
fi
if [ "$?" -ne "0" ]; then
if [ "$RULE_TYPE" = "game" ]; then
mv "$TMP_RULE_DIR_TMP" "$RULE_FILE_DIR" >/dev/null 2>&1
else
mv "$TMP_RULE_DIR" "$RULE_FILE_DIR" >/dev/null 2>&1
fi
rm -rf "$TMP_RULE_DIR" >/dev/null 2>&1
LOG_OUT "Rule File【$RULE_FILE_NAME】Download Successful!" && SLOG_CLEAN
exit 1
else
LOG_OUT "Rule File【$RULE_FILE_NAME】No Change, Do Nothing!" && SLOG_CLEAN
rm -rf "$TMP_RULE_DIR" >/dev/null 2>&1
rm -rf "$TMP_RULE_DIR_TMP" >/dev/null 2>&1
exit 2
fi
else
rm -rf "$TMP_RULE_DIR" >/dev/null 2>&1
LOG_OUT "Rule File【$RULE_FILE_NAME】Download Error!" && SLOG_CLEAN
exit 0
fi

View File

@ -0,0 +1,77 @@
#!/bin/bash
. /usr/share/openclash/openclash_ps.sh
. /usr/share/openclash/log.sh
set_lock() {
exec 873>"/tmp/lock/openclash_geoip.lock" 2>/dev/null
flock -x 873 2>/dev/null
}
del_lock() {
flock -u 873 2>/dev/null
rm -rf "/tmp/lock/openclash_geoip.lock"
}
small_flash_memory=$(uci get openclash.config.small_flash_memory 2>/dev/null)
GEOIP_CUSTOM_URL=$(uci get openclash.config.geoip_custom_url 2>/dev/null)
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
LOG_FILE="/tmp/openclash.log"
restart=0
set_lock
if [ "$small_flash_memory" != "1" ]; then
geoip_path="/etc/openclash/GeoIP.dat"
mkdir -p /etc/openclash
else
geoip_path="/tmp/etc/openclash/GeoIP.dat"
mkdir -p /tmp/etc/openclash
fi
LOG_OUT "Start Downloading GeoIP Dat..."
if [ -z "$GEOIP_CUSTOM_URL" ]; then
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "${github_address_mod}gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat" -o /tmp/GeoIP.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoIP.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "https://raw.fastgit.org/Loyalsoldier/v2ray-rules-dat/release/geoip.dat" -o /tmp/GeoIP.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoIP.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat -o /tmp/GeoIP.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoIP.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat" -o /tmp/GeoIP.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoIP.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
if [ "${PIPESTATUS[0]}" -ne "0" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/v/v2/v2raya/dists/v2ray-rules-dat/geoip.dat" -o /tmp/GeoIP.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoIP.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$GEOIP_CUSTOM_URL" -o /tmp/GeoIP.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoIP.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
if [ "${PIPESTATUS[0]}" -eq "0" ] && [ -s "/tmp/GeoIP.dat" ]; then
LOG_OUT "GeoIP Dat Download Success, Check Updated..."
cmp -s /tmp/GeoIP.dat "$geoip_path"
if [ "$?" -ne "0" ]; then
LOG_OUT "GeoIP Dat Has Been Updated, Starting To Replace The Old Version..."
rm -rf "/etc/openclash/geoip.dat"
mv /tmp/GeoIP.dat "$geoip_path" >/dev/null 2>&1
LOG_OUT "GeoIP Dat Update Successful!"
restart=1
else
LOG_OUT "Updated GeoIP Dat No Change, Do Nothing..."
fi
else
LOG_OUT "GeoIP Dat Update Error, Please Try Again Later..."
fi
if [ "$restart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
elif [ "$restart" -eq 0 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ] && [ "$(uci -q get openclash.config.restart)" -eq 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
uci -q set openclash.config.restart=0
uci -q commit openclash
elif [ "$restart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ]; then
uci -q set openclash.config.restart=1
uci -q commit openclash
fi
rm -rf /tmp/GeoIP.dat >/dev/null 2>&1
SLOG_CLEAN
del_lock

View File

@ -0,0 +1,77 @@
#!/bin/bash
. /usr/share/openclash/openclash_ps.sh
. /usr/share/openclash/log.sh
set_lock() {
exec 874>"/tmp/lock/openclash_geosite.lock" 2>/dev/null
flock -x 874 2>/dev/null
}
del_lock() {
flock -u 874 2>/dev/null
rm -rf "/tmp/lock/openclash_geosite.lock"
}
small_flash_memory=$(uci get openclash.config.small_flash_memory 2>/dev/null)
GEOSITE_CUSTOM_URL=$(uci get openclash.config.geosite_custom_url 2>/dev/null)
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
LOG_FILE="/tmp/openclash.log"
restart=0
set_lock
if [ "$small_flash_memory" != "1" ]; then
geosite_path="/etc/openclash/GeoSite.dat"
mkdir -p /etc/openclash
else
geosite_path="/tmp/etc/openclash/GeoSite.dat"
mkdir -p /tmp/etc/openclash
fi
LOG_OUT "Start Downloading GeoSite Database..."
if [ -z "$GEOSITE_CUSTOM_URL" ]; then
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat -o /tmp/GeoSite.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoSite.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.fastgit.org/Loyalsoldier/v2ray-rules-dat/release/geosite.dat -o /tmp/GeoSite.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoSite.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat -o /tmp/GeoSite.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoSite.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat -o /tmp/GeoSite.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoSite.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
if [ "${PIPESTATUS[0]}" -ne "0" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/v/v2/v2raya/dists/v2ray-rules-dat/geosite.dat" -o /tmp/GeoSite.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoSite.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$GEOSITE_CUSTOM_URL" -o /tmp/GeoSite.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoSite.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
if [ "${PIPESTATUS[0]}" -eq "0" ] && [ -s "/tmp/GeoSite.dat" ]; then
LOG_OUT "GeoSite Database Download Success, Check Updated..."
cmp -s /tmp/GeoSite.dat "$geosite_path"
if [ "$?" -ne "0" ]; then
LOG_OUT "GeoSite Database Has Been Updated, Starting To Replace The Old Version..."
rm -rf "/etc/openclash/geosite.dat"
mv /tmp/GeoSite.dat "$geosite_path" >/dev/null 2>&1
LOG_OUT "GeoSite Database Update Successful!"
restart=1
else
LOG_OUT "Updated GeoSite Database No Change, Do Nothing..."
fi
else
LOG_OUT "GeoSite Database Update Error, Please Try Again Later..."
fi
if [ "$restart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
elif [ "$restart" -eq 0 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ] && [ "$(uci -q get openclash.config.restart)" -eq 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
uci -q set openclash.config.restart=0
uci -q commit openclash
elif [ "$restart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ]; then
uci -q set openclash.config.restart=1
uci -q commit openclash
fi
rm -rf /tmp/GeoSite.dat >/dev/null 2>&1
SLOG_CLEAN
del_lock

View File

@ -0,0 +1,153 @@
#!/usr/bin/lua
require "nixio"
require "luci.util"
require "luci.sys"
local ntm = require "luci.model.network".init()
local type = arg[1]
local rv = {}
local wan, wan6
if not type then os.exit(0) end
if pcall(function() local x = ntm:get_all_wan_networks(); local y = ntm:get_all_wan6_networks(); end) then
wan = ntm:get_all_wan_networks()
wan6 = ntm:get_all_wan6_networks()
elseif pcall(function() local x = ntm:get_wan_networks(); local y = ntm:get_wan6_networks(); end) then
wan = ntm:get_wan_networks()
wan6 = ntm:get_wan6_networks()
elseif pcall(function() local x = ntm:get_wannet(); local y = ntm:get_wan6net(); end) then
wan = {}
wan6 = {}
wan[1] = ntm:get_wannet()
wan6[1] = ntm:get_wan6net()
else
os.exit(0)
end
if wan then
rv.wan = {}
for i = 1, #wan do
rv.wan[i] = {
ipaddr = wan[i]:ipaddr(),
gwaddr = wan[i]:gwaddr(),
netmask = wan[i]:netmask(),
dns = wan[i]:dnsaddrs(),
expires = wan[i]:expires(),
uptime = wan[i]:uptime(),
proto = wan[i]:proto(),
ifname = wan[i]:ifname()
}
end
end
if wan6 then
rv.wan6 = {}
for i = 1, #wan6 do
rv.wan6[i] = {
ip6addr = wan6[i]:ip6addr(),
gw6addr = wan6[i]:gw6addr(),
dns = wan6[i]:dns6addrs(),
ip6prefix = wan6[i]:ip6prefix(),
uptime = wan6[i]:uptime(),
proto = wan6[i]:proto(),
ifname = wan6[i]:ifname()
}
end
end
if type == "dns" then
if wan then
for o = 1, #(rv.wan) do
for i = 1, #(rv.wan[o].dns) do
if rv.wan[o].dns[i] ~= rv.wan[o].gwaddr and rv.wan[o].dns[i] ~= rv.wan[o].ipaddr then
print(rv.wan[o].dns[i])
end
end
end
end
end
if type == "dns6" then
if wan6 then
for o = 1, #(rv.wan6) do
for i = 1, #(rv.wan6[o].dns) do
if rv.wan6[o].dns[i] ~= rv.wan6[o].gw6addr and rv.wan6[o].ip6addr then
print(rv.wan6[o].dns[i])
end
end
end
end
end
if type == "gateway" then
if wan then
for o = 1, #(rv.wan) do
print(rv.wan[o].gwaddr)
end
end
end
if type == "gateway6" then
if wan6 then
for o = 1, #(rv.wan6) do
print(rv.wan6[o].gw6addr)
end
end
end
if type == "dhcp" then
if wan then
for o = 1, #(rv.wan) do
if rv.wan[o].proto == "dhcp" then
print(rv.wan[o].ifname)
end
end
end
if wan6 then
for o = 1, #(rv.wan6) do
if rv.wan6[o].proto == "dhcpv6" then
print(rv.wan6[o].ifname)
end
end
end
end
if type == "pppoe" then
if wan then
for o = 1, #(rv.wan) do
if rv.wan[o].proto == "pppoe" then
print(rv.wan[o].ifname)
end
end
end
if wan6 then
for o = 1, #(rv.wan6) do
if rv.wan6[o].proto == "pppoe" then
print(rv.wan6[o].ifname)
end
end
end
end
if type == "wanip" then
if wan then
for o = 1, #(rv.wan) do
if rv.wan[o].proto == "pppoe" then
print(rv.wan[o].ipaddr)
end
end
end
end
if type == "wanip6" then
if wan6 then
for o = 1, #(rv.wan6) do
if rv.wan6[o].proto == "pppoe" or rv.wan6[o].proto == "dhcpv6" then
print(rv.wan6[o].ip6addr)
end
end
end
end
os.exit(0)

View File

@ -0,0 +1,63 @@
#!/bin/sh
. /lib/functions.sh
. /usr/share/openclash/openclash_ps.sh
set_lock() {
exec 881>"/tmp/lock/openclash_history_get.lock" 2>/dev/null
flock -x 881 2>/dev/null
}
del_lock() {
flock -u 881 2>/dev/null
rm -rf "/tmp/lock/openclash_history_get.lock"
}
close_all_conection() {
SECRET=$(uci -q get openclash.config.dashboard_password)
LAN_IP=$(uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
PORT=$(uci -q get openclash.config.cn_port)
curl -m 2 -H "Authorization: Bearer ${SECRET}" -H "Content-Type:application/json" -X DELETE http://"$LAN_IP":"$PORT"/connections >/dev/null 2>&1
}
if [ "$1" = "close_all_conection" ]; then
close_all_conection
exit 0
fi
CONFIG_FILE=$(unify_ps_cfgname)
CONFIG_NAME=$(echo "$CONFIG_FILE" |awk -F '/' '{print $4}' 2>/dev/null)
small_flash_memory=$(uci -q get openclash.config.small_flash_memory)
HISTORY_PATH_OLD="/etc/openclash/history/${CONFIG_NAME%.*}"
HISTORY_PATH="/etc/openclash/history/${CONFIG_NAME%.*}.db"
core_version=$(uci -q get openclash.config.core_version || echo 0)
CACHE_PATH_OLD="/etc/openclash/.cache"
source "/etc/openwrt_release"
set_lock
if [ -z "$CONFIG_FILE" ] || [ ! -f "$CONFIG_FILE" ]; then
CONFIG_FILE=$(uci get openclash.config.config_path 2>/dev/null)
CONFIG_NAME=$(echo "$CONFIG_FILE" |awk -F '/' '{print $5}' 2>/dev/null)
HISTORY_PATH_OLD="/etc/openclash/history/${CONFIG_NAME%.*}"
HISTORY_PATH="/etc/openclash/history/${CONFIG_NAME%.*}.db"
fi
if [ -n "$(pidof clash)" ] && [ -f "$CONFIG_FILE" ]; then
if [ "$small_flash_memory" == "1" ] || [ -n "$(echo $core_version |grep mips)" ] || [ -n "$(echo $DISTRIB_ARCH |grep mips)" ] || [ -n "$(opkg status libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' |grep mips)" ]; then
CACHE_PATH="/tmp/etc/openclash/cache.db"
if [ -f "$CACHE_PATH" ]; then
cmp -s "$CACHE_PATH" "$HISTORY_PATH"
if [ "$?" -ne "0" ]; then
cp "$CACHE_PATH" "$HISTORY_PATH" 2>/dev/null
fi
fi
fi
if [ -f "$CACHE_PATH_OLD" ]; then
cmp -s "$CACHE_PATH_OLD" "$HISTORY_PATH_OLD"
if [ "$?" -ne "0" ]; then
cp "$CACHE_PATH_OLD" "$HISTORY_PATH_OLD" 2>/dev/null
fi
fi
fi
del_lock

View File

@ -0,0 +1,73 @@
#!/bin/bash
. /usr/share/openclash/openclash_ps.sh
. /usr/share/openclash/log.sh
set_lock() {
exec 880>"/tmp/lock/openclash_ipdb.lock" 2>/dev/null
flock -x 880 2>/dev/null
}
del_lock() {
flock -u 880 2>/dev/null
rm -rf "/tmp/lock/openclash_ipdb.lock"
}
small_flash_memory=$(uci get openclash.config.small_flash_memory 2>/dev/null)
GEOIP_CUSTOM_URL=$(uci get openclash.config.geo_custom_url 2>/dev/null)
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
LOG_FILE="/tmp/openclash.log"
restart=0
set_lock
if [ "$small_flash_memory" != "1" ]; then
geoip_path="/etc/openclash/Country.mmdb"
mkdir -p /etc/openclash
else
geoip_path="/tmp/etc/openclash/Country.mmdb"
mkdir -p /tmp/etc/openclash
fi
LOG_OUT "Start Downloading Geoip Database..."
if [ -z "$GEOIP_CUSTOM_URL" ]; then
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"gh/alecthw/mmdb_china_ip_list@release/lite/Country.mmdb -o /tmp/Country.mmdb 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/Country.mmdb" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.fastgit.org/alecthw/mmdb_china_ip_list/release/lite/Country.mmdb -o /tmp/Country.mmdb 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/Country.mmdb" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/alecthw/mmdb_china_ip_list/release/lite/Country.mmdb -o /tmp/Country.mmdb 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/Country.mmdb" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/alecthw/mmdb_china_ip_list/release/lite/Country.mmdb -o /tmp/Country.mmdb 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/Country.mmdb" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$GEOIP_CUSTOM_URL" -o /tmp/Country.mmdb 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/Country.mmdb" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
if [ "${PIPESTATUS[0]}" -eq 0 ] && [ -s "/tmp/Country.mmdb" ]; then
LOG_OUT "Geoip Database Download Success, Check Updated..."
cmp -s /tmp/Country.mmdb "$geoip_path"
if [ "$?" -ne "0" ]; then
LOG_OUT "Geoip Database Has Been Updated, Starting To Replace The Old Version..."
mv /tmp/Country.mmdb "$geoip_path" >/dev/null 2>&1
LOG_OUT "Geoip Database Update Successful!"
restart=1
else
LOG_OUT "Updated Geoip Database No Change, Do Nothing..."
fi
else
LOG_OUT "Geoip Database Update Error, Please Try Again Later..."
fi
if [ "$restart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
elif [ "$restart" -eq 0 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ] && [ "$(uci -q get openclash.config.restart)" -eq 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
uci -q set openclash.config.restart=0
uci -q commit openclash
elif [ "$restart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ]; then
uci -q set openclash.config.restart=1
uci -q commit openclash
fi
rm -rf /tmp/Country.mmdb >/dev/null 2>&1
SLOG_CLEAN
del_lock

View File

@ -0,0 +1,33 @@
#!/bin/sh
unify_ps_status() {
if [ "$(ps --version 2>&1 |grep -c procps-ng)" -eq 1 ]; then
echo "$(ps -efw |grep -v grep |grep -c "$1")"
else
echo "$(ps -w |grep -v grep |grep -c "$1")"
fi
}
unify_ps_pids() {
if [ "$(ps --version 2>&1 |grep -c procps-ng)" -eq 1 ]; then
echo "$(ps -efw |grep "$1" |grep -v grep |awk '{print $2}' 2>/dev/null)"
else
echo "$(ps -w |grep "$1" |grep -v grep |awk '{print $1}' 2>/dev/null)"
fi
}
unify_ps_prevent() {
if [ "$(ps --version 2>&1 |grep -c procps-ng)" -eq 1 ]; then
echo "$(ps -efw |grep -v grep |grep -c "/etc/init.d/openclash")"
else
echo "$(ps -w |grep -v grep |grep -c "/etc/init.d/openclash")"
fi
}
unify_ps_cfgname() {
if [ "$(ps --version 2>&1 |grep -c procps-ng)" -eq 1 ]; then
echo "$(ps -efw |grep /etc/openclash/clash 2>/dev/null |grep -v grep |awk -F '-f ' '{print $2}' 2>/dev/null)"
else
echo "$(ps -w |grep /etc/openclash/clash 2>/dev/null |grep -v grep |awk -F '-f ' '{print $2}' 2>/dev/null)"
fi
}

View File

@ -0,0 +1,175 @@
#!/bin/bash
. /usr/share/openclash/openclash_ps.sh
. /lib/functions.sh
. /usr/share/openclash/ruby.sh
. /usr/share/openclash/log.sh
set_lock() {
exec 877>"/tmp/lock/openclash_rule.lock" 2>/dev/null
flock -x 877 2>/dev/null
}
del_lock() {
flock -u 877 2>/dev/null
rm -rf "/tmp/lock/openclash_rule.lock"
}
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
LOG_OUT "Warrning: Multiple Other-Rules-Configurations Enabled, Ignore..."
return
fi
config_get "rule_name" "$section" "rule_name" ""
LOG_OUT "Start Downloading Third Party Rules in Use..."
if [ "$rule_name" = "lhie1" ]; then
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"gh/dler-io/Rules@master/Clash/Rule.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.fastgit.org/dler-io/Rules/master/Clash/Rule.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/dler-io/Rules/master/Clash/Rule.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/dler-io/Rules/master/Clash/Rule.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
sed -i '1i rules:' /tmp/rules.yaml
elif [ "$rule_name" = "ConnersHua" ]; then
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"gh/DivineEngine/Profiles@master/Clash/Outbound.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.fastgit.org/DivineEngine/Profiles/master/Clash/Outbound.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/Outbound.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/Outbound.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
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 [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"gh/DivineEngine/Profiles@master/Clash/Inbound.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.fastgit.org/DivineEngine/Profiles/master/Clash/Inbound.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/Inbound.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/Inbound.yaml -o /tmp/rules.yaml 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/rules.yaml" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
fi
if [ -s "/tmp/rules.yaml" ]; then
LOG_OUT "Download Successful, Start Preprocessing Rule File..."
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
begin
YAML.load_file('/tmp/rules.yaml');
rescue Exception => e
puts '${LOGTIME} Error: Unable To Parse Updated Rules File,【${rule_name}:' + e.message + '】'
system 'rm -rf /tmp/rules.yaml 2>/dev/null'
end
" 2>/dev/null >> $LOG_FILE
if [ $? -ne 0 ]; then
LOG_OUT "Error: Ruby Works Abnormally, Please Check The Ruby Library Depends!"
rm -rf /tmp/rules.yaml >/dev/null 2>&1
SLOG_CLEAN
del_lock
exit 0
elif [ ! -f "/tmp/rules.yaml" ]; then
LOG_OUT "Error:【$rule_name】Rule File Format Validation Failed, Please Try Again Later..."
rm -rf /tmp/rules.yaml >/dev/null 2>&1
SLOG_CLEAN
del_lock
exit 0
elif ! "$(ruby_read "/tmp/rules.yaml" ".key?('rules')")" ; then
LOG_OUT "Error: Updated Others Rules【$rule_name】Has No Rules Field, Update Exit..."
rm -rf /tmp/rules.yaml >/dev/null 2>&1
SLOG_CLEAN
del_lock
exit 0
#校验是否含有新策略组
elif ! "$(ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
Value = YAML.load_file('/usr/share/openclash/res/${rule_name}.yaml');
Value_1 = YAML.load_file('/tmp/rules.yaml');
OLD_GROUP = Value['rules'].collect{|x| x.split(',')[2] or x.split(',')[1]}.uniq;
NEW_GROUP = Value_1['rules'].collect{|x| x.split(',')[2] or x.split(',')[1]}.uniq;
puts (OLD_GROUP | NEW_GROUP).eql?(OLD_GROUP)
")" && [ -f "/usr/share/openclash/res/${rule_name}.yaml" ]; then
LOG_OUT "Error: Updated Others Rules【$rule_name】Has Incompatible Proxy-Group, Update Exit, Please Wait For OpenClash Update To Adapt..."
rm -rf /tmp/rules.yaml >/dev/null 2>&1
SLOG_CLEAN
del_lock
exit 0
fi
#取出规则部分
ruby_read "/tmp/rules.yaml" ".select {|x| 'rule-providers' == x or 'script' == x or 'rules' == x }.to_yaml" > "$OTHER_RULE_FILE"
#合并
cat "$OTHER_RULE_FILE" > "/tmp/rules.yaml" 2>/dev/null
rm -rf /tmp/other_rule* 2>/dev/null
LOG_OUT "Check The Downloaded Rule File For Updates..."
cmp -s /usr/share/openclash/res/"$rule_name".yaml /tmp/rules.yaml
if [ "$?" -ne "0" ]; then
LOG_OUT "Detected that The Downloaded Rule File Has Been Updated, Starting To Replace..."
mv /tmp/rules.yaml /usr/share/openclash/res/"$rule_name".yaml >/dev/null 2>&1
LOG_OUT "Other Rules【$rule_name】Update Successful!"
ifrestart=1
else
LOG_OUT "Updated Other Rules【$rule_name】No Change, Do Nothing!"
fi
else
LOG_OUT "Other Rules【$rule_name】Update Error, Please Try Again Later..."
fi
}
LOGTIME=$(echo $(date "+%Y-%m-%d %H:%M:%S"))
LOG_FILE="/tmp/openclash.log"
RUlE_SOURCE=$(uci get openclash.config.rule_source 2>/dev/null)
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
set_lock
if [ "$RUlE_SOURCE" = "0" ]; then
LOG_OUT "Other Rules Not Enable, Update Stop!"
else
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
LOG_OUT "Get Other Rules Settings Faild, Update Stop!"
fi
if [ "$ifrestart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
fi
fi
rm -rf /tmp/rules.yaml >/dev/null 2>&1
SLOG_CLEAN
del_lock

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,127 @@
#!/bin/bash
. /usr/share/openclash/log.sh
set_lock() {
exec 878>"/tmp/lock/openclash_update.lock" 2>/dev/null
flock -x 878 2>/dev/null
}
del_lock() {
flock -u 878 2>/dev/null
rm -rf "/tmp/lock/openclash_update.lock"
}
#一键更新
if [ "$1" = "one_key_update" ]; then
uci -q set openclash.config.enable=1
uci -q commit openclash
/usr/share/openclash/openclash_core.sh "$1" >/dev/null 2>&1 &
/usr/share/openclash/openclash_core.sh "TUN" "$1" >/dev/null 2>&1 &
/usr/share/openclash/openclash_core.sh "Meta" "$1" >/dev/null 2>&1 &
wait
fi
LAST_OPVER="/tmp/openclash_last_version"
LAST_VER=$(sed -n 1p "$LAST_OPVER" 2>/dev/null |sed "s/^v//g" |tr -d "\n")
OP_CV=$(rm -f /var/lock/opkg.lock && opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F '-' '{print $1}' |awk -F 'Version: ' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
OP_LV=$(sed -n 1p "$LAST_OPVER" 2>/dev/null |awk -F '-' '{print $1}' |awk -F 'v' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master")
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
LOG_FILE="/tmp/openclash.log"
set_lock
if [ -n "$OP_CV" ] && [ -n "$OP_LV" ] && [ "$(expr "$OP_LV" \> "$OP_CV")" -eq 1 ] && [ -f "$LAST_OPVER" ]; then
LOG_OUT "Start Downloading【OpenClash - v$LAST_VER】..."
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"gh/vernesong/OpenClash@package/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/openclash.ipk" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.fastgit.org/vernesong/OpenClash/package/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/openclash.ipk" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/package/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/openclash.ipk" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/vernesong/OpenClash/package/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/openclash.ipk" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
if [ "${PIPESTATUS[0]}" -ne 0 ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/openclash.ipk" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
curl_status=${PIPESTATUS[0]}
else
curl_status=0
fi
if [ "$curl_status" -eq 0 ] && [ -s "/tmp/openclash.ipk" ]; then
LOG_OUT "【OpenClash - v$LAST_VER】Download Successful, Start Pre Update Test..."
if [ -z "$(opkg install /tmp/openclash.ipk --noaction 2>/dev/null |grep 'Upgrading luci-app-openclash on root' 2>/dev/null)" ]; then
LOG_OUT "【OpenClash - v$LAST_VER】Pre Update Test Failed, The File is Saved in /tmp/openclash.ipk, Please Try to Update Manually!"
if [ "$(uci -q get openclash.config.config_reload)" -eq 0 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
else
SLOG_CLEAN
fi
del_lock
exit 0
fi
LOG_OUT "【OpenClash - v$LAST_VER】Pre Update Test Passed, Ready to Update and Please Do not Refresh The Page and Other Operations..."
cat > /tmp/openclash_update.sh <<"EOF"
#!/bin/sh
START_LOG="/tmp/openclash_start.log"
LOG_FILE="/tmp/openclash.log"
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
LOG_OUT()
{
if [ -n "${1}" ]; then
echo -e "${1}" > $START_LOG
echo -e "${LOGTIME} ${1}" >> $LOG_FILE
fi
}
SLOG_CLEAN()
{
echo "" > $START_LOG
}
LOG_OUT "Uninstalling The Old Version, Please Do not Refresh The Page or Do Other Operations..."
uci -q set openclash.config.enable=0
uci -q commit openclash
opkg remove --force-depends --force-remove luci-app-openclash
LOG_OUT "Installing The New Version, Please Do Not Refresh The Page or Do Other Operations..."
opkg install /tmp/openclash.ipk
if [ "$?" == "0" ]; then
rm -rf /tmp/openclash.ipk >/dev/null 2>&1
LOG_OUT "OpenClash Update Successful, About To Restart!"
uci -q set openclash.config.enable=1
uci -q commit openclash
/etc/init.d/openclash restart 2>/dev/null
else
LOG_OUT "OpenClash Update Failed, The File is Saved in /tmp/openclash.ipk, Please Try to Update Manually!"
SLOG_CLEAN
fi
EOF
chmod 4755 /tmp/openclash_update.sh
nohup /tmp/openclash_update.sh &
wait
rm -rf /tmp/openclash_update.sh
else
LOG_OUT "【OpenClash - v$LAST_VER】Download Failed, Please Check The Network or Try Again Later!"
rm -rf /tmp/openclash.ipk >/dev/null 2>&1
if [ "$(uci -q get openclash.config.config_reload)" -eq 0 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
else
SLOG_CLEAN
fi
fi
else
if [ ! -f "$LAST_OPVER" ] || [ -z "$OP_CV" ] || [ -z "$OP_LV" ]; then
LOG_OUT "Failed to Get Version Information, Please Try Again Later..."
else
LOG_OUT "OpenClash Has not Been Updated, Stop Continuing!"
fi
if [ "$(uci -q get openclash.config.config_reload)" -eq 0 ]; then
/etc/init.d/openclash restart >/dev/null 2>&1 &
else
SLOG_CLEAN
fi
fi
del_lock

View File

@ -0,0 +1,13 @@
#!/usr/bin/lua
require "nixio"
require "luci.util"
require "luci.sys"
local HTTP = require "luci.http"
local url = arg[1]
if not url then os.exit(0) end
print(HTTP.urlencode(url) or url)
os.exit(0)

View File

@ -0,0 +1,47 @@
#!/bin/bash
TIME=$(date "+%Y-%m-%d-%H")
CHTIME=$(date "+%Y-%m-%d-%H" -r "/tmp/openclash_last_version" 2>/dev/null)
LAST_OPVER="/tmp/openclash_last_version"
RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master")
OP_CV=$(rm -f /var/lock/opkg.lock && opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F '-' '{print $1}' |awk -F 'Version: ' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
OP_LV=$(sed -n 1p $LAST_OPVER 2>/dev/null |awk -F '-' '{print $1}' |awk -F 'v' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
LOG_FILE="/tmp/openclash.log"
if [ "$TIME" != "$CHTIME" ]; then
if [ "$github_address_mod" != "0" ]; then
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"gh/vernesong/OpenClash@package/"$RELEASE_BRANCH"/version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.fastgit.org/vernesong/OpenClash/package/"$RELEASE_BRANCH"/version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/package/"$RELEASE_BRANCH"/version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
else
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/vernesong/OpenClash/package/"$RELEASE_BRANCH"/version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
fi
if [ "${PIPESTATUS[0]}" -ne 0 ] || [ -n "$(cat $LAST_OPVER |grep '<html>')" ]; then
curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE"
curl_status=${PIPESTATUS[0]}
else
curl_status=0
fi
if [ "$curl_status" -eq 0 ] && [ -z "$(cat $LAST_OPVER |grep '<html>')" ]; then
OP_LV=$(sed -n 1p $LAST_OPVER 2>/dev/null |awk -F '-' '{print $1}' |awk -F 'v' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
if [ "$(expr "$OP_CV" \>= "$OP_LV")" = "1" ]; then
sed -i '/^https:/,$d' $LAST_OPVER
elif [ "$(expr "$OP_LV" \> "$OP_CV")" = "1" ] && [ -n "$OP_LV" ]; then
exit 2
else
exit 0
fi
else
rm -rf "$LAST_OPVER"
fi
elif [ "$(expr "$OP_LV" \> "$OP_CV")" = "1" ] && [ -n "$OP_LV" ]; then
exit 2
else
exit 0
fi 2>/dev/null

View File

@ -0,0 +1,396 @@
#!/bin/sh
. /usr/share/openclash/log.sh
CLASH="/etc/openclash/clash"
CLASH_CONFIG="/etc/openclash"
LOG_FILE="/tmp/openclash.log"
PROXY_FWMARK="0x162"
PROXY_ROUTE_TABLE="0x162"
LOGTIME=$(echo $(date "+%Y-%m-%d %H:%M:%S"))
CONFIG_FILE="/etc/openclash/$(uci -q get openclash.config.config_path |awk -F '/' '{print $5}' 2>/dev/null)"
ipv6_enable=$(uci -q get openclash.config.ipv6_enable)
enable_redirect_dns=$(uci -q get openclash.config.enable_redirect_dns)
dns_port=$(uci -q get openclash.config.dns_port)
disable_masq_cache=$(uci -q get openclash.config.disable_masq_cache)
cfg_update_interval=$(uci -q get openclash.config.config_update_interval || echo 60)
log_size=$(uci -q get openclash.config.log_size || echo 1024)
core_type=$(uci -q get openclash.config.core_type)
router_self_proxy=$(uci -q get openclash.config.router_self_proxy || echo 1)
stream_domains_prefetch_interval=$(uci -q get openclash.config.stream_domains_prefetch_interval || echo 1440)
stream_auto_select_interval=$(uci -q get openclash.config.stream_auto_select_interval || echo 30)
NETFLIX_DOMAINS_LIST="/usr/share/openclash/res/Netflix_Domains.list"
NETFLIX_DOMAINS_CUSTOM_LIST="/etc/openclash/custom/openclash_custom_netflix_domains.list"
DISNEY_DOMAINS_LIST="/usr/share/openclash/res/Disney_Plus_Domains.list"
china_ip_route=$(uci -q get openclash.config.china_ip_route)
en_mode=$(uci -q get openclash.config.en_mode)
fakeip_range=$(uci -q get openclash.config.fakeip_range || echo "198.18.0.1/16")
ipv6_mode=$(uci -q get openclash.config.ipv6_mode || echo 0)
CRASH_NUM=0
CFG_UPDATE_INT=1
STREAM_DOMAINS_PREFETCH=1
STREAM_AUTO_SELECT=1
FW4=$(command -v fw4)
check_dnsmasq() {
if [ -z "$(echo "$en_mode" |grep "redir-host")" ] && [ "$china_ip_route" -eq 1 ] && [ "$enable_redirect_dns" != "2" ]; then
if [ "$(nslookup www.baidu.com 127.0.0.1:12353 >/dev/null 2>&1 || echo $?)" != "1" ]; then
DNSPORT=$(uci -q get dhcp.@dnsmasq[0].port)
if [ -z "$DNSPORT" ]; then
DNSPORT=$(netstat -nlp |grep -E '127.0.0.1:.*dnsmasq' |awk -F '127.0.0.1:' '{print $2}' |awk '{print $1}' |head -1 || echo 53)
fi
if [ -n "$FW4" ]; then
if [ -n "$(nft list chain inet fw4 nat_output |grep 'OpenClash DNS Hijack')" ]; then
LOG_OUT "Tip: Dnsmasq Work is Normal, Restore The Firewall DNS Hijacking Rules..."
for nft in "nat_output" "dstnat"; do
handles=$(nft -a list chain inet fw4 ${nft} |grep "OpenClash DNS Hijack" |awk -F '# handle ' '{print$2}')
for handle in $handles; do
nft delete rule inet fw4 ${nft} handle ${handle}
done
done >/dev/null 2>&1
position=$(nft list chain inet fw4 dstnat |grep "OpenClash" |grep "DNS" |awk -F '# handle ' '{print$2}' |sort -rn |head -1 || ehco 0)
nft add rule inet fw4 dstnat position "$position" tcp dport 53 redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 dstnat position "$position" udp dport 53 redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
if [ "$ipv6_enable" -eq 1 ]; then
nft add rule inet fw4 dstnat position "$position" meta nfproto {ipv6} tcp dport 53 counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
nft add rule inet fw4 dstnat position "$position" meta nfproto {ipv6} udp dport 53 counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\" 2>/dev/null
fi
fi
else
if [ -n "$(iptables -t nat -nL OUTPUT --line-number |grep 'OpenClash DNS Hijack')" ]; then
LOG_OUT "Tip: Dnsmasq Work is Normal, Restore The Firewall DNS Hijacking Rules..."
for ipt in "iptables -nvL OUTPUT -t nat" "iptables -nvL PREROUTING -t nat" "ip6tables -nvL PREROUTING -t nat" "ip6tables -nvL OUTPUT -t nat"; do
lines=$($ipt |sed 1,2d |sed -n "/OpenClash DNS Hijack/=" 2>/dev/null |sort -rn)
if [ -n "$lines" ]; then
for line in $lines; do
$(echo "$ipt" |awk -v OFS=" " '{print $1,$4,$5}' |sed 's/[ ]*$//g') -D $(echo "$ipt" |awk '{print $3}') $line
done
fi
done >/dev/null 2>&1
position=$(iptables -nvL PREROUTING -t nat |sed 1,2d |grep "OpenClash" |sed -n "/DNS/=" 2>/dev/null |sort -rn |head -1 || ehco 0)
[ "$position" -ne 0 ] && let position++
iptables -t nat -I PREROUTING "$position" -p udp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
iptables -t nat -I PREROUTING "$position" -p tcp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
if [ "$ipv6_enable" -eq 1 ]; then
position=$(ip6tables -nvL PREROUTING -t nat |sed 1,2d |grep "OpenClash" |sed -n "/DNS/=" 2>/dev/null |sort -rn |head -1 || ehco 0)
[ "$position" -ne 0 ] && let position++
ip6tables -t nat -I PREROUTING "$position" -p udp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
ip6tables -t nat -I PREROUTING "$position" -p tcp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
fi
fi
fi
fi
fi
}
check_dnsmasq
sleep 60
while :;
do
cfg_update=$(uci -q get openclash.config.auto_update)
cfg_update_mode=$(uci -q get openclash.config.config_auto_update_mode)
cfg_update_interval_now=$(uci -q get openclash.config.config_update_interval || echo 60)
stream_domains_prefetch=$(uci -q get openclash.config.stream_domains_prefetch || echo 0)
stream_domains_prefetch_interval_now=$(uci -q get openclash.config.stream_domains_prefetch_interval || echo 1440)
stream_auto_select=$(uci -q get openclash.config.stream_auto_select || echo 0)
stream_auto_select_interval_now=$(uci -q get openclash.config.stream_auto_select_interval || echo 30)
stream_auto_select_netflix=$(uci -q get openclash.config.stream_auto_select_netflix || echo 0)
stream_auto_select_disney=$(uci -q get openclash.config.stream_auto_select_disney || echo 0)
stream_auto_select_hbo_now=$(uci -q get openclash.config.stream_auto_select_hbo_now || echo 0)
stream_auto_select_hbo_max=$(uci -q get openclash.config.stream_auto_select_hbo_max || echo 0)
stream_auto_select_hbo_go_asia=$(uci -q get openclash.config.stream_auto_select_hbo_go_asia || echo 0)
stream_auto_select_tvb_anywhere=$(uci -q get openclash.config.stream_auto_select_tvb_anywhere || echo 0)
stream_auto_select_prime_video=$(uci -q get openclash.config.stream_auto_select_prime_video || echo 0)
stream_auto_select_ytb=$(uci -q get openclash.config.stream_auto_select_ytb || echo 0)
stream_auto_select_dazn=$(uci -q get openclash.config.stream_auto_select_dazn || echo 0)
stream_auto_select_paramount_plus=$(uci -q get openclash.config.stream_auto_select_paramount_plus || echo 0)
stream_auto_select_discovery_plus=$(uci -q get openclash.config.stream_auto_select_discovery_plus || echo 0)
stream_auto_select_bilibili=$(uci -q get openclash.config.stream_auto_select_bilibili || echo 0)
stream_auto_select_google_not_cn=$(uci -q get openclash.config.stream_auto_select_google_not_cn || echo 0)
stream_auto_select_chatgpt=$(uci -q get openclash.config.stream_auto_select_chatgpt || echo 0)
upnp_lease_file=$(uci -q get upnpd.config.upnp_lease_file)
enable=$(uci -q get openclash.config.enable)
if [ "$enable" -eq 1 ]; then
clash_pids=$(pidof clash |sed 's/$//g' |wc -l)
if [ "$clash_pids" -gt 1 ]; then
LOG_OUT "Watchdog: Multiple Clash Processes, Kill All..."
clash_pids=$(pidof clash |sed 's/$//g')
for clash_pid in $clash_pids; do
kill -9 "$clash_pid" 2>/dev/null
done >/dev/null 2>&1
sleep 1
fi 2>/dev/null
if ! pidof clash >/dev/null; then
CRASH_NUM=$(expr "$CRASH_NUM" + 1)
if [ "$CRASH_NUM" -le 3 ]; then
LOG_OUT "Watchdog: Clash Core Problem, Restart..."
touch /tmp/openclash.log 2>/dev/null
chmod o+w /etc/openclash/proxy_provider/* 2>/dev/null
chmod o+w /etc/openclash/rule_provider/* 2>/dev/null
chmod o+w /etc/openclash/history/* 2>/dev/null
chmod o+w /tmp/openclash.log 2>/dev/null
chmod o+w /etc/openclash/cache.db 2>/dev/null
chown nobody:nogroup /etc/openclash/core/* 2>/dev/null
capabilties="cap_sys_resource,cap_dac_override,cap_net_raw,cap_net_bind_service,cap_net_admin,cap_sys_ptrace"
capsh --caps="${capabilties}+eip" -- -c "capsh --user=nobody --addamb='${capabilties}' -- -c 'nohup $CLASH -d $CLASH_CONFIG -f \"$CONFIG_FILE\" >> $LOG_FILE 2>&1 &'" >> $LOG_FILE 2>&1
sleep 3
if [ "$core_type" == "TUN" ] || [ "$core_type" == "Meta" ]; then
ip route replace default dev utun table "$PROXY_ROUTE_TABLE" 2>/dev/null
ip rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE" 2>/dev/null
if [ "$ipv6_mode" -eq 2 ] && [ "$ipv6_enable" -eq 1 ]; then
ip -6 rule del oif utun table 2022 >/dev/null 2>&1
ip -6 route del default dev utun table 2022 >/dev/null 2>&1
ip -6 route replace default dev utun table "$PROXY_ROUTE_TABLE" >/dev/null 2>&1
ip -6 rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE" >/dev/null 2>&1
fi
fi
sleep 60
continue
else
LOG_OUT "Watchdog: Already Restart 3 Times With Clash Core Problem, Auto-Exit..."
/etc/init.d/openclash stop
exit 0
fi
else
CRASH_NUM=0
fi
fi
## Porxy history
/usr/share/openclash/openclash_history_get.sh
## Log File Size Manage:
LOGSIZE=`ls -l /tmp/openclash.log |awk '{print int($5/1024)}'`
if [ "$LOGSIZE" -gt "$log_size" ]; then
: > /tmp/openclash.log
LOG_OUT "Watchdog: Log Size Limit, Clean Up All Log Records..."
fi
## 端口转发重启
last_line=$(iptables -t nat -nL PREROUTING --line-number |awk '{print $1}' 2>/dev/null |awk 'END {print}' |sed -n '$p')
op_line=$(iptables -t nat -nL PREROUTING --line-number |grep "openclash " 2>/dev/null |awk '{print $1}' 2>/dev/null |head -1)
if [ "$last_line" != "$op_line" ] && [ -n "$op_line" ]; then
pre_lines=$(iptables -nvL PREROUTING -t nat |sed 1,2d |sed -n '/openclash /=' 2>/dev/null |sort -rn)
for pre_line in $pre_lines; do
iptables -t nat -D PREROUTING "$pre_line" >/dev/null 2>&1
done >/dev/null 2>&1
iptables -t nat -A PREROUTING -p tcp -j openclash
LOG_OUT "Watchdog: Setting Firewall For Enabling Redirect..."
fi
## 防止 DNSMASQ 加载配置时间过长导致 DNS 无法解析
check_dnsmasq
## Localnetwork 刷新
wan_ip4s=$(/usr/share/openclash/openclash_get_network.lua "wanip" 2>/dev/null)
wan_ip6s=$(ifconfig | grep 'inet6 addr' | awk '{print $3}' 2>/dev/null)
if [ -n "$FW4" ]; then
if [ -n "$wan_ip4s" ]; then
for wan_ip4 in $wan_ip4s; do
nft add element inet fw4 localnetwork { "$wan_ip4" } 2>/dev/null
done
fi
if [ "$ipv6_enable" -eq 1 ]; then
if [ -n "$wan_ip6s" ]; then
for wan_ip6 in $wan_ip6s; do
nft add element inet fw4 localnetwork6 { "$wan_ip6" } 2>/dev/null
done
fi
fi
else
if [ -n "$wan_ip4s" ]; then
for wan_ip4 in $wan_ip4s; do
ipset add localnetwork "$wan_ip4" 2>/dev/null
done
fi
if [ "$ipv6_enable" -eq 1 ]; then
if [ -n "$wan_ip6s" ]; then
for wan_ip6 in $wan_ip6s; do
ipset add localnetwork6 "$wan_ip6" 2>/dev/null
done
fi
fi
fi
## UPNP
if [ -f "$upnp_lease_file" ]; then
#del
if [ -n "$FW4" ]; then
for i in `$(nft list chain inet fw4 openclash_upnp |grep "return")`
do
upnp_ip=$(echo "$i" |awk -F 'ip saddr \\{ ' '{print $2}' |awk '{print $1}')
upnp_dp=$(echo "$i" |awk -F 'udp sport ' '{print $2}' |awk '{print $1}')
if [ -n "$upnp_ip" ] && [ -n "$upnp_dp" ]; then
if [ -z "$(cat "$upnp_lease_file" |grep "$upnp_ip" |grep "$upnp_dp")" ]; then
handles=$(nft list chain inet fw4 openclash_upnp |grep "$i" |awk -F '# handle ' '{print$2}')
for handle in $handles; do
nft delete rule inet fw4 openclash_upnp handle ${handle}
done
fi
fi
done >/dev/null 2>&1
else
for i in `$(iptables -t mangle -nL openclash_upnp |grep "RETURN")`
do
upnp_ip=$(echo "$i" |awk '{print $4}')
upnp_dp=$(echo "$i" |awk -F 'udp spt:' '{print $2}')
if [ -n "$upnp_ip" ] && [ -n "$upnp_dp" ]; then
if [ -z "$(cat "$upnp_lease_file" |grep "$upnp_ip" |grep "$upnp_dp")" ]; then
iptables -t mangle -D openclash_upnp -p udp -s "$upnp_ip" --sport "$upnp_dp" -j RETURN 2>/dev/null
fi
fi
done >/dev/null 2>&1
fi
#add
if [ -s "$upnp_lease_file" ] && [ -n "$(iptables --line-numbers -t nat -xnvL openclash_upnp 2>/dev/null)"] || [ -n "$(nft list chain inet fw4 openclash_upnp 2>/dev/null)"]; then
cat "$upnp_lease_file" |while read -r line
do
if [ -n "$line" ]; then
upnp_ip=$(echo "$line" |awk -F ':' '{print $3}')
upnp_dp=$(echo "$line" |awk -F ':' '{print $4}')
if [ -n "$upnp_ip" ] && [ -n "$upnp_dp" ]; then
if [ -n "$FW4" ]; then
if [ -z "$(nft list chain inet fw4 openclash_upnp |grep "$upnp_ip" |grep "$upnp_dp")" ]; then
nft add rule inet fw4 openclash_upnp ip saddr { "$upnp_ip" } udp sport "$upnp_dp" counter return 2>/dev/null
fi
else
if [ -z "$(iptables -t mangle -nL openclash_upnp |grep "$upnp_ip" |grep "$upnp_dp")" ]; then
iptables -t mangle -A openclash_upnp -p udp -s "$upnp_ip" --sport "$upnp_dp" -j RETURN 2>/dev/null
fi
fi
fi
fi
done >/dev/null 2>&1
fi
fi
## DNS转发劫持
if [ "$enable_redirect_dns" = "1" ]; then
if [ -z "$(uci -q get dhcp.@dnsmasq[0].server |grep "$dns_port")" ] || [ ! -z "$(uci -q get dhcp.@dnsmasq[0].server |awk -F ' ' '{print $2}')" ]; then
LOG_OUT "Watchdog: Force Reset DNS Hijack..."
uci -q del dhcp.@dnsmasq[-1].server
uci -q add_list dhcp.@dnsmasq[0].server=127.0.0.1#"$dns_port"
uci -q delete dhcp.@dnsmasq[0].resolvfile
uci -q set dhcp.@dnsmasq[0].noresolv=1
[ "$disable_masq_cache" -eq 1 ] && {
uci -q set dhcp.@dnsmasq[0].cachesize=0
}
uci -q commit dhcp
/etc/init.d/dnsmasq restart >/dev/null 2>&1
fi
fi
## 配置文件循环更新
if [ "$cfg_update" -eq 1 ] && [ "$cfg_update_mode" -eq 1 ]; then
[ "$cfg_update_interval" -ne "$cfg_update_interval_now" ] && CFG_UPDATE_INT=0 && cfg_update_interval="$cfg_update_interval_now"
if [ "$CFG_UPDATE_INT" -ne 0 ]; then
[ "$(expr "$CFG_UPDATE_INT" % "$cfg_update_interval_now")" -eq 0 ] && /usr/share/openclash/openclash.sh
fi
CFG_UPDATE_INT=$(expr "$CFG_UPDATE_INT" + 1)
fi
##Dler Cloud Checkin
/usr/share/openclash/openclash_dler_checkin.lua >/dev/null 2>&1
##STREAMING_UNLOCK_CHECK
if [ "$stream_auto_select" -eq 1 ] && [ "$router_self_proxy" -eq 1 ]; then
[ "$stream_auto_select_interval" -ne "$stream_auto_select_interval_now" ] && STREAM_AUTO_SELECT=1 && stream_auto_select_interval="$stream_auto_select_interval_now"
if [ "$STREAM_AUTO_SELECT" -ne 0 ]; then
if [ "$(expr "$STREAM_AUTO_SELECT" % "$stream_auto_select_interval_now")" -eq 0 ] || [ "$STREAM_AUTO_SELECT" -eq 1 ]; then
if [ "$stream_auto_select_netflix" -eq 1 ]; then
LOG_OUT "Tip: Start Auto Select Proxy For Netflix Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "Netflix" >> $LOG_FILE
fi
if [ "$stream_auto_select_disney" -eq 1 ]; then
LOG_OUT "Tip: Start Auto Select Proxy For Disney Plus Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "Disney Plus" >> $LOG_FILE
fi
if [ "$stream_auto_select_google_not_cn" -eq 1 ]; then
LOG_OUT "Tip: Start Auto Select Proxy For Google Not CN Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "Google" >> $LOG_FILE
fi
if [ "$stream_auto_select_ytb" -eq 1 ]; then
LOG_OUT "Tip: Start Auto Select Proxy For YouTube Premium Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "YouTube Premium" >> $LOG_FILE
fi
if [ "$stream_auto_select_prime_video" -eq 1 ]; then
LOG_OUT "Tip: Start Auto Select Proxy For Amazon Prime Video Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "Amazon Prime Video" >> $LOG_FILE
fi
if [ "$stream_auto_select_hbo_now" -eq 1 ]; then
LOG_OUT "Tip: Start Auto Select Proxy For HBO Now Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "HBO Now" >> $LOG_FILE
fi
if [ "$stream_auto_select_hbo_max" -eq 1 ]; then
LOG_OUT "Tip: Start Auto Select Proxy For HBO Max Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "HBO Max" >> $LOG_FILE
fi
if [ "$stream_auto_select_hbo_go_asia" -eq 1 ]; then
LOG_OUT "Tip: Start Auto Select Proxy For HBO GO Asia Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "HBO GO Asia" >> $LOG_FILE
fi
if [ "$stream_auto_select_tvb_anywhere" -eq 1 ]; then
LOG_OUT "Tip: Start Auto Select Proxy For TVB Anywhere+ Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "TVB Anywhere+" >> $LOG_FILE
fi
if [ "$stream_auto_select_dazn" -eq 1 ]; then
LOG_OUT "Tip: Start Auto Select Proxy For DAZN Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "DAZN" >> $LOG_FILE
fi
if [ "$stream_auto_select_paramount_plus" -eq 1 ]; then
LOG_OUT "Tip: Start Auto Select Proxy For Paramount Plus Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "Paramount Plus" >> $LOG_FILE
fi
if [ "$stream_auto_select_discovery_plus" -eq 1 ]; then
LOG_OUT "Tip: Start Auto Select Proxy For Discovery Plus Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "Discovery Plus" >> $LOG_FILE
fi
if [ "$stream_auto_select_bilibili" -eq 1 ]; then
LOG_OUT "Tip: Start Auto Select Proxy For Bilibili Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "Bilibili" >> $LOG_FILE
fi
if [ "$stream_auto_select_chatgpt" -eq 1 ]; then
LOG_OUT "Tip: Start Auto Select Proxy For ChatGPT Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "ChatGPT" >> $LOG_FILE
fi
fi
fi
STREAM_AUTO_SELECT=$(expr "$STREAM_AUTO_SELECT" + 1)
elif [ "$router_self_proxy" != "1" ] && [ "$stream_auto_select" -eq 1 ]; then
LOG_OUT "Error: Streaming Unlock Could not Work Because of Router-Self Proxy Disabled, Exiting..."
fi
##STREAM_DNS_PREFETCH
if [ "$stream_domains_prefetch" -eq 1 ] && [ "$router_self_proxy" -eq 1 ]; then
[ "$stream_domains_prefetch_interval" -ne "$stream_domains_prefetch_interval_now" ] && STREAM_DOMAINS_PREFETCH=1 && stream_domains_prefetch_interval="$stream_domains_prefetch_interval_now"
if [ "$STREAM_DOMAINS_PREFETCH" -ne 0 ]; then
if [ "$(expr "$STREAM_DOMAINS_PREFETCH" % "$stream_domains_prefetch_interval_now")" -eq 0 ] || [ "$STREAM_DOMAINS_PREFETCH" -eq 1 ]; then
LOG_OUT "Tip: Start Prefetch Netflix Domains..."
cat "$NETFLIX_DOMAINS_LIST" |while read -r line
do
[ -n "$line" ] && nslookup $line
done >/dev/null 2>&1
cat "$NETFLIX_DOMAINS_CUSTOM_LIST" |while read -r line
do
[ -n "$line" ] && nslookup $line
done >/dev/null 2>&1
LOG_OUT "Tip: Netflix Domains Prefetch Finished!"
LOG_OUT "Tip: Start Prefetch Disney Plus Domains..."
cat "$DISNEY_DOMAINS_LIST" |while read -r line
do
[ -n "$line" ] && nslookup $line
done >/dev/null 2>&1
LOG_OUT "Tip: Disney Plus Domains Prefetch Finished!"
fi
fi
STREAM_DOMAINS_PREFETCH=$(expr "$STREAM_DOMAINS_PREFETCH" + 1)
elif [ "$router_self_proxy" != "1" ] && [ "$stream_domains_prefetch" -eq 1 ]; then
LOG_OUT "Error: Streaming DNS Prefetch Could not Work Because of Router-Self Proxy Disabled, Exiting..."
fi
SLOG_CLEAN
sleep 60
done 2>/dev/null

View File

@ -0,0 +1,47 @@
rule-providers:
Unbreak:
type: http
behavior: classical
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"
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"
url: https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/StreamingSE.yaml
interval: 86400
Global:
type: http
behavior: classical
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"
url: https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/RuleSet/China.yaml
interval: 86400
rules:
- 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
- IP-CIDR,119.28.28.28/32,DIRECT
- IP-CIDR,182.254.116.0/24,DIRECT
- MATCH,MATCH

View File

@ -0,0 +1,79 @@
rules:
##source:ConnersHua_return
# (Video)
# AcFun
# USER-AGENT,AcFun*,PROXY
- DOMAIN-SUFFIX,acfun.cn,PROXY
- DOMAIN-SUFFIX,acfun.com,PROXY
- DOMAIN-SUFFIX,aixifan.com,PROXY
# > bilibili
# USER-AGENT,bili-universal,PROXY
# USER-AGENT,Bilibili*,PROXY
- DOMAIN-SUFFIX,acgvideo.com,PROXY
- DOMAIN-SUFFIX,bilibili.com,PROXY
- DOMAIN-SUFFIX,hdslb.com,PROXY
# > HunanTV
# USER-AGENT,MGTV*,PROXY
- DOMAIN-SUFFIX,hitv.com,PROXY
- DOMAIN-SUFFIX,hunantv.com,PROXY
- DOMAIN-SUFFIX,mgtv.com,PROXY
# > Migu
# USER-AGENT,MiguVideo*,PROXY
# USER-AGENT,%E5%92%AA%E5%92%95%E8%A7%86%E9%A2%91,PROXY
- DOMAIN-SUFFIX,cmvideo.cn,PROXY
- DOMAIN-SUFFIX,migu.cn,PROXY
- DOMAIN-SUFFIX,miguvideo.com,PROXY
# > iQiyi
# USER-AGENT,iQiYiPhoneVideo,PROXY
# USER-AGENT,PPStream,PROXY
# USER-AGENT,QIYIVideo,PROXY
# USER-AGENT,QYPlayer,PROXY
- DOMAIN-SUFFIX,iqiyi.com,PROXY
- DOMAIN-SUFFIX,iqiyipic.com,PROXY
- DOMAIN-SUFFIX,qy.net,PROXY
# > Sohu
- DOMAIN-SUFFIX,sohu.com,PROXY
- DOMAIN-SUFFIX,sohu.com.cn,PROXY
- DOMAIN-SUFFIX,itc.cn,PROXY
- DOMAIN-SUFFIX,v-56.com,PROXY
# > Tencent
# USER-AGENT,live4iphone*,PROXY
# USER-AGENT,qqlive4iphone*,PROXY
# USER-AGENT,TencentMidasConnect*,PROXY
- DOMAIN-SUFFIX,video.qq.com,PROXY
# > Youku
# USER-AGENT,Youku*,PROXY
# USER-AGENT,%E4%BC%98%E9%85%B7*,PROXY
- DOMAIN-SUFFIX,soku.com,PROXY
- DOMAIN-SUFFIX,youku.com,PROXY
- DOMAIN-SUFFIX,ykimg.com,PROXY
# (Music)
# > Alibaba
# USER-AGENT,walkman*,PROXY
# USER-AGENT,xiami*,PROXY
- DOMAIN-SUFFIX,xiami.com,PROXY
- DOMAIN-SUFFIX,xiami.net,PROXY
# > Netease
# USER-AGENT,NeteaseMusic*,PROXY
# USER-AGENT,%E7%BD%91%E6%98%93%E4%BA%91%E9%9F%B3%E4%B9%90*,PROXY
- DOMAIN-SUFFIX,music.126.net,PROXY
- DOMAIN-SUFFIX,music.163.com,PROXY
# > Tencent
# USER-AGENT,MOO%E9%9F%B3%E4%B9%90*,PROXY
# USER-AGENT,QQ%E9%9F%B3%E4%B9%90,PROXY
- DOMAIN-SUFFIX,qqmusic.qq.com,PROXY
- DOMAIN-SUFFIX,y.qq.com,PROXY
- DOMAIN,aqqmusic.tc.qq.com,PROXY
# Kugou and Kuwo
- DOMAIN-SUFFIX,kugou.com,PROXY
# USER-AGENT,%E9%85%B7%E6%88%91%E9%9F%B3%E4%B9%90*,PROXY
- DOMAIN-SUFFIX,kuwo.cn,PROXY
- DOMAIN-SUFFIX,koowo.com,PROXY
# > Baidu
# USER-AGENT,baiduyinyue,PROXY
- DOMAIN-SUFFIX,qianqian.com,PROXY
- GEOIP,CN,PROXY
- MATCH,DIRECT

View File

@ -0,0 +1,48 @@
vod-akc-eu-south-1.media.dssott.com
vod-vzc-eu-south-1.media.dssott.com
vod-l3c-na-central-1.media.dssott.com
vod-akc-na-central-1.media.dssott.com
vod-ftc-na-central-1.media.dssott.com
vod-vzc-na-central-1.media.dssott.com
vod-l3c-na-east-1.media.dssott.com
vod-bgc-na-east-1.media.dssott.com
vod-akc-na-east-1.media.dssott.com
vod-ftc-na-east-1.media.dssott.com
vod-vzc-na-east-1.media.dssott.com
vod-bgc-oc-east-1.media.dssott.com
vod-l3c-na-west-1.media.dssott.com
vod-akc-na-west-1.media.dssott.com
vod-ftc-na-west-1.media.dssott.com
vod-vzc-na-west-1.media.dssott.com
vod-l3c-eu-south-2.media.dssott.com
vod-ftc-eu-south-2.media.dssott.com
vod-l3c-na-east-2.media.dssott.com
vod-akc-na-east-2.media.dssott.com
vod-ftc-na-east-2.media.dssott.com
vod-vzc-na-east-2.media.dssott.com
vod-l3c-oc-east-2.media.dssott.com
vod-akc-oc-east-2.media.dssott.com
vod-ftc-oc-east-2.media.dssott.com
vod-vzc-oc-east-2.media.dssott.com
vod-l3c-na-west-2.media.dssott.com
vod-akc-na-west-2.media.dssott.com
vod-llc-na-west-2.media.dssott.com
vod-cmc-na-west-2.media.dssott.com
vod-ftc-na-west-2.media.dssott.com
vod-vzc-na-west-2.media.dssott.com
cdn.registerdisney.go.com
qa.cdn.registerdisney.go.com
stg.cdn.registerdisney.go.com
val.cdn.registerdisney.go.com
prod-ripcut-delivery.disney-plus.net
appconfigs.disney-plus.net
prod-static.disney-plus.net
global.edge.bamgrid.com
bam-sdk-configs.bamgrid.com
playback-certs.bamgrid.com
search-api-disney.bamgrid.com
content.global.edge.bamgrid.com
disney.playback.edge.bamgrid.com
disney.api.edge.bamgrid.com
disney.content.edge.bamgrid.com
disney.connections.edge.bamgrid.com

View File

@ -0,0 +1,574 @@
ipv4-c001-hkg001-hgc-isp.1.oca.nflxvideo.net
ipv4-c003-hkg001-hgc-isp.1.oca.nflxvideo.net
ipv4-c004-hkg001-hgc-isp.1.oca.nflxvideo.net
ipv4-c001-hkg002-hgc-isp.1.oca.nflxvideo.net
ipv4-c002-hkg002-hgc-isp.1.oca.nflxvideo.net
ipv4-c001-hkg001-cmhk-isp.1.oca.nflxvideo.net
ipv4-c002-hkg001-cmhk-isp.1.oca.nflxvideo.net
ipv4-c002-hkg001-hkbn-isp.1.oca.nflxvideo.net
ipv4-c003-hkg001-hkbn-isp.1.oca.nflxvideo.net
ipv4-c004-hkg001-hkbn-isp.1.oca.nflxvideo.net
ipv4-c005-hkg001-hkbn-isp.1.oca.nflxvideo.net
ipv4-c001-hkg002-hkbn-isp.1.oca.nflxvideo.net
ipv4-c002-hkg002-hkbn-isp.1.oca.nflxvideo.net
ipv4-c003-hkg002-hkbn-isp.1.oca.nflxvideo.net
ipv4-c004-hkg002-hkbn-isp.1.oca.nflxvideo.net
ipv4-c001-hkg001-pccw-isp.1.oca.nflxvideo.net
ipv4-c003-hkg001-pccw-isp.1.oca.nflxvideo.net
ipv4-c004-hkg001-pccw-isp.1.oca.nflxvideo.net
ipv4-c002-hkg002-pccw-isp.1.oca.nflxvideo.net
ipv4-c003-hkg002-pccw-isp.1.oca.nflxvideo.net
ipv4-c004-hkg002-pccw-isp.1.oca.nflxvideo.net
ipv4-c005-hkg002-pccw-isp.1.oca.nflxvideo.net
ipv4-c001-hkg003-pccw-isp.1.oca.nflxvideo.net
ipv4-c002-hkg003-pccw-isp.1.oca.nflxvideo.net
ipv4-c003-hkg003-pccw-isp.1.oca.nflxvideo.net
ipv4-c004-hkg003-pccw-isp.1.oca.nflxvideo.net
ipv4-c010-hkg001-ix.1.oca.nflxvideo.net
ipv6-c010-hkg001-ix.1.oca.nflxvideo.net
ipv4-c020-hkg001-ix.1.oca.nflxvideo.net
ipv6-c020-hkg001-ix.1.oca.nflxvideo.net
ipv4-c030-hkg001-ix.1.oca.nflxvideo.net
ipv6-c030-hkg001-ix.1.oca.nflxvideo.net
ipv4-c040-hkg001-ix.1.oca.nflxvideo.net
ipv6-c040-hkg001-ix.1.oca.nflxvideo.net
ipv4-c050-hkg001-ix.1.oca.nflxvideo.net
ipv4-c060-hkg001-ix.1.oca.nflxvideo.net
ipv6-c001-hkg001-ix.1.oca.nflxvideo.net
ipv4-c011-hkg001-ix.1.oca.nflxvideo.net
ipv6-c011-hkg001-ix.1.oca.nflxvideo.net
ipv4-c021-hkg001-ix.1.oca.nflxvideo.net
ipv6-c021-hkg001-ix.1.oca.nflxvideo.net
ipv4-c031-hkg001-ix.1.oca.nflxvideo.net
ipv6-c031-hkg001-ix.1.oca.nflxvideo.net
ipv4-c041-hkg001-ix.1.oca.nflxvideo.net
ipv6-c041-hkg001-ix.1.oca.nflxvideo.net
ipv4-c051-hkg001-ix.1.oca.nflxvideo.net
ipv4-c061-hkg001-ix.1.oca.nflxvideo.net
ipv4-c002-hkg001-ix.1.oca.nflxvideo.net
ipv6-c002-hkg001-ix.1.oca.nflxvideo.net
ipv4-c012-hkg001-ix.1.oca.nflxvideo.net
ipv4-c022-hkg001-ix.1.oca.nflxvideo.net
ipv6-c022-hkg001-ix.1.oca.nflxvideo.net
ipv4-c032-hkg001-ix.1.oca.nflxvideo.net
ipv6-c032-hkg001-ix.1.oca.nflxvideo.net
ipv4-c042-hkg001-ix.1.oca.nflxvideo.net
ipv6-c042-hkg001-ix.1.oca.nflxvideo.net
ipv4-c052-hkg001-ix.1.oca.nflxvideo.net
ipv4-c062-hkg001-ix.1.oca.nflxvideo.net
ipv4-c003-hkg001-ix.1.oca.nflxvideo.net
ipv6-c003-hkg001-ix.1.oca.nflxvideo.net
ipv4-c013-hkg001-ix.1.oca.nflxvideo.net
ipv6-c013-hkg001-ix.1.oca.nflxvideo.net
ipv4-c023-hkg001-ix.1.oca.nflxvideo.net
ipv6-c023-hkg001-ix.1.oca.nflxvideo.net
ipv4-c033-hkg001-ix.1.oca.nflxvideo.net
ipv6-c033-hkg001-ix.1.oca.nflxvideo.net
ipv4-c043-hkg001-ix.1.oca.nflxvideo.net
ipv6-c043-hkg001-ix.1.oca.nflxvideo.net
ipv4-c053-hkg001-ix.1.oca.nflxvideo.net
ipv4-c004-hkg001-ix.1.oca.nflxvideo.net
ipv6-c004-hkg001-ix.1.oca.nflxvideo.net
ipv4-c014-hkg001-ix.1.oca.nflxvideo.net
ipv6-c014-hkg001-ix.1.oca.nflxvideo.net
ipv4-c024-hkg001-ix.1.oca.nflxvideo.net
ipv6-c024-hkg001-ix.1.oca.nflxvideo.net
ipv4-c034-hkg001-ix.1.oca.nflxvideo.net
ipv6-c034-hkg001-ix.1.oca.nflxvideo.net
ipv4-c044-hkg001-ix.1.oca.nflxvideo.net
ipv6-c044-hkg001-ix.1.oca.nflxvideo.net
ipv4-c054-hkg001-ix.1.oca.nflxvideo.net
ipv4-c005-hkg001-ix.1.oca.nflxvideo.net
ipv6-c005-hkg001-ix.1.oca.nflxvideo.net
ipv4-c015-hkg001-ix.1.oca.nflxvideo.net
ipv6-c015-hkg001-ix.1.oca.nflxvideo.net
ipv4-c025-hkg001-ix.1.oca.nflxvideo.net
ipv6-c025-hkg001-ix.1.oca.nflxvideo.net
ipv4-c035-hkg001-ix.1.oca.nflxvideo.net
ipv6-c035-hkg001-ix.1.oca.nflxvideo.net
ipv4-c045-hkg001-ix.1.oca.nflxvideo.net
ipv4-c055-hkg001-ix.1.oca.nflxvideo.net
ipv4-c006-hkg001-ix.1.oca.nflxvideo.net
ipv6-c006-hkg001-ix.1.oca.nflxvideo.net
ipv4-c016-hkg001-ix.1.oca.nflxvideo.net
ipv6-c016-hkg001-ix.1.oca.nflxvideo.net
ipv4-c026-hkg001-ix.1.oca.nflxvideo.net
ipv6-c026-hkg001-ix.1.oca.nflxvideo.net
ipv4-c036-hkg001-ix.1.oca.nflxvideo.net
ipv6-c036-hkg001-ix.1.oca.nflxvideo.net
ipv4-c046-hkg001-ix.1.oca.nflxvideo.net
ipv4-c056-hkg001-ix.1.oca.nflxvideo.net
ipv4-c007-hkg001-ix.1.oca.nflxvideo.net
ipv6-c007-hkg001-ix.1.oca.nflxvideo.net
ipv4-c017-hkg001-ix.1.oca.nflxvideo.net
ipv6-c017-hkg001-ix.1.oca.nflxvideo.net
ipv4-c027-hkg001-ix.1.oca.nflxvideo.net
ipv6-c027-hkg001-ix.1.oca.nflxvideo.net
ipv4-c037-hkg001-ix.1.oca.nflxvideo.net
ipv6-c037-hkg001-ix.1.oca.nflxvideo.net
ipv4-c047-hkg001-ix.1.oca.nflxvideo.net
ipv4-c057-hkg001-ix.1.oca.nflxvideo.net
ipv4-c008-hkg001-ix.1.oca.nflxvideo.net
ipv6-c008-hkg001-ix.1.oca.nflxvideo.net
ipv4-c018-hkg001-ix.1.oca.nflxvideo.net
ipv6-c018-hkg001-ix.1.oca.nflxvideo.net
ipv4-c028-hkg001-ix.1.oca.nflxvideo.net
ipv6-c028-hkg001-ix.1.oca.nflxvideo.net
ipv4-c038-hkg001-ix.1.oca.nflxvideo.net
ipv6-c038-hkg001-ix.1.oca.nflxvideo.net
ipv4-c048-hkg001-ix.1.oca.nflxvideo.net
ipv4-c058-hkg001-ix.1.oca.nflxvideo.net
ipv4-c009-hkg001-ix.1.oca.nflxvideo.net
ipv6-c009-hkg001-ix.1.oca.nflxvideo.net
ipv6-c019-hkg001-ix.1.oca.nflxvideo.net
ipv4-c029-hkg001-ix.1.oca.nflxvideo.net
ipv6-c029-hkg001-ix.1.oca.nflxvideo.net
ipv4-c039-hkg001-ix.1.oca.nflxvideo.net
ipv6-c039-hkg001-ix.1.oca.nflxvideo.net
ipv4-c049-hkg001-ix.1.oca.nflxvideo.net
ipv4-c059-hkg001-ix.1.oca.nflxvideo.net
ipv4-c001-hkg001-ix.1.oca.nflxvideo.net
ipv4-c019-hkg001-ix.1.oca.nflxvideo.net
ipv4-c001-sin001-starhub-isp.1.oca.nflxvideo.net
ipv6-c001-sin001-starhub-isp.1.oca.nflxvideo.net
ipv4-c002-sin001-starhub-isp.1.oca.nflxvideo.net
ipv6-c002-sin001-starhub-isp.1.oca.nflxvideo.net
ipv4-c003-sin001-starhub-isp.1.oca.nflxvideo.net
ipv6-c003-sin001-starhub-isp.1.oca.nflxvideo.net
ipv4-c004-sin001-starhub-isp.1.oca.nflxvideo.net
ipv6-c004-sin001-starhub-isp.1.oca.nflxvideo.net
ipv4-c005-sin001-starhub-isp.1.oca.nflxvideo.net
ipv6-c005-sin001-starhub-isp.1.oca.nflxvideo.net
ipv4-c006-sin001-starhub-isp.1.oca.nflxvideo.net
ipv4-c010-sin001-ix.1.oca.nflxvideo.net
ipv6-c010-sin001-ix.1.oca.nflxvideo.net
ipv4-c020-sin001-ix.1.oca.nflxvideo.net
ipv4-c030-sin001-ix.1.oca.nflxvideo.net
ipv6-c030-sin001-ix.1.oca.nflxvideo.net
ipv4-c040-sin001-ix.1.oca.nflxvideo.net
ipv6-c040-sin001-ix.1.oca.nflxvideo.net
ipv4-c050-sin001-ix.1.oca.nflxvideo.net
ipv4-c060-sin001-ix.1.oca.nflxvideo.net
ipv4-c001-sin001-ix.1.oca.nflxvideo.net
ipv4-c011-sin001-ix.1.oca.nflxvideo.net
ipv6-c011-sin001-ix.1.oca.nflxvideo.net
ipv4-c021-sin001-ix.1.oca.nflxvideo.net
ipv4-c031-sin001-ix.1.oca.nflxvideo.net
ipv6-c031-sin001-ix.1.oca.nflxvideo.net
ipv4-c041-sin001-ix.1.oca.nflxvideo.net
ipv6-c041-sin001-ix.1.oca.nflxvideo.net
ipv4-c051-sin001-ix.1.oca.nflxvideo.net
ipv4-c061-sin001-ix.1.oca.nflxvideo.net
ipv4-c002-sin001-ix.1.oca.nflxvideo.net
ipv6-c002-sin001-ix.1.oca.nflxvideo.net
ipv4-c012-sin001-ix.1.oca.nflxvideo.net
ipv6-c012-sin001-ix.1.oca.nflxvideo.net
ipv4-c032-sin001-ix.1.oca.nflxvideo.net
ipv6-c032-sin001-ix.1.oca.nflxvideo.net
ipv4-c042-sin001-ix.1.oca.nflxvideo.net
ipv6-c042-sin001-ix.1.oca.nflxvideo.net
ipv4-c052-sin001-ix.1.oca.nflxvideo.net
ipv4-c062-sin001-ix.1.oca.nflxvideo.net
ipv4-c003-sin001-ix.1.oca.nflxvideo.net
ipv4-c013-sin001-ix.1.oca.nflxvideo.net
ipv6-c013-sin001-ix.1.oca.nflxvideo.net
ipv4-c033-sin001-ix.1.oca.nflxvideo.net
ipv4-c043-sin001-ix.1.oca.nflxvideo.net
ipv6-c043-sin001-ix.1.oca.nflxvideo.net
ipv4-c053-sin001-ix.1.oca.nflxvideo.net
ipv6-c053-sin001-ix.1.oca.nflxvideo.net
ipv4-c063-sin001-ix.1.oca.nflxvideo.net
ipv4-c004-sin001-ix.1.oca.nflxvideo.net
ipv6-c004-sin001-ix.1.oca.nflxvideo.net
ipv4-c014-sin001-ix.1.oca.nflxvideo.net
ipv6-c014-sin001-ix.1.oca.nflxvideo.net
ipv4-c034-sin001-ix.1.oca.nflxvideo.net
ipv6-c034-sin001-ix.1.oca.nflxvideo.net
ipv4-c044-sin001-ix.1.oca.nflxvideo.net
ipv6-c044-sin001-ix.1.oca.nflxvideo.net
ipv4-c054-sin001-ix.1.oca.nflxvideo.net
ipv4-c005-sin001-ix.1.oca.nflxvideo.net
ipv6-c005-sin001-ix.1.oca.nflxvideo.net
ipv4-c015-sin001-ix.1.oca.nflxvideo.net
ipv6-c015-sin001-ix.1.oca.nflxvideo.net
ipv4-c025-sin001-ix.1.oca.nflxvideo.net
ipv6-c025-sin001-ix.1.oca.nflxvideo.net
ipv4-c035-sin001-ix.1.oca.nflxvideo.net
ipv6-c035-sin001-ix.1.oca.nflxvideo.net
ipv4-c045-sin001-ix.1.oca.nflxvideo.net
ipv6-c045-sin001-ix.1.oca.nflxvideo.net
ipv4-c055-sin001-ix.1.oca.nflxvideo.net
ipv4-c006-sin001-ix.1.oca.nflxvideo.net
ipv4-c016-sin001-ix.1.oca.nflxvideo.net
ipv4-c026-sin001-ix.1.oca.nflxvideo.net
ipv4-c036-sin001-ix.1.oca.nflxvideo.net
ipv6-c036-sin001-ix.1.oca.nflxvideo.net
ipv4-c046-sin001-ix.1.oca.nflxvideo.net
ipv6-c046-sin001-ix.1.oca.nflxvideo.net
ipv4-c056-sin001-ix.1.oca.nflxvideo.net
ipv4-c007-sin001-ix.1.oca.nflxvideo.net
ipv6-c007-sin001-ix.1.oca.nflxvideo.net
ipv4-c017-sin001-ix.1.oca.nflxvideo.net
ipv6-c017-sin001-ix.1.oca.nflxvideo.net
ipv4-c027-sin001-ix.1.oca.nflxvideo.net
ipv6-c027-sin001-ix.1.oca.nflxvideo.net
ipv4-c037-sin001-ix.1.oca.nflxvideo.net
ipv6-c037-sin001-ix.1.oca.nflxvideo.net
ipv4-c047-sin001-ix.1.oca.nflxvideo.net
ipv6-c047-sin001-ix.1.oca.nflxvideo.net
ipv4-c057-sin001-ix.1.oca.nflxvideo.net
ipv4-c008-sin001-ix.1.oca.nflxvideo.net
ipv6-c008-sin001-ix.1.oca.nflxvideo.net
ipv4-c018-sin001-ix.1.oca.nflxvideo.net
ipv4-c028-sin001-ix.1.oca.nflxvideo.net
ipv6-c028-sin001-ix.1.oca.nflxvideo.net
ipv4-c038-sin001-ix.1.oca.nflxvideo.net
ipv6-c038-sin001-ix.1.oca.nflxvideo.net
ipv4-c048-sin001-ix.1.oca.nflxvideo.net
ipv6-c048-sin001-ix.1.oca.nflxvideo.net
ipv4-c058-sin001-ix.1.oca.nflxvideo.net
ipv4-c009-sin001-ix.1.oca.nflxvideo.net
ipv6-c009-sin001-ix.1.oca.nflxvideo.net
ipv4-c019-sin001-ix.1.oca.nflxvideo.net
ipv6-c019-sin001-ix.1.oca.nflxvideo.net
ipv6-c029-sin001-ix.1.oca.nflxvideo.net
ipv4-c039-sin001-ix.1.oca.nflxvideo.net
ipv6-c039-sin001-ix.1.oca.nflxvideo.net
ipv4-c049-sin001-ix.1.oca.nflxvideo.net
ipv6-c049-sin001-ix.1.oca.nflxvideo.net
ipv4-c059-sin001-ix.1.oca.nflxvideo.net
ipv6-c050-sin001-ix.1.oca.nflxvideo.net
ipv4-c029-sin001-ix.1.oca.nflxvideo.net
ipv4-c001-xsp001-m1-isp.1.oca.nflxvideo.net
ipv4-c002-xsp001-m1-isp.1.oca.nflxvideo.net
ipv4-c003-xsp001-m1-isp.1.oca.nflxvideo.net
ipv4-c001-xsp002-m1-isp.1.oca.nflxvideo.net
ipv4-c002-xsp002-m1-isp.1.oca.nflxvideo.net
ipv4-c003-xsp002-m1-isp.1.oca.nflxvideo.net
ipv4-c001-xsp002-starhub-isp.1.oca.nflxvideo.net
ipv6-c001-xsp002-starhub-isp.1.oca.nflxvideo.net
ipv4-c003-xsp002-starhub-isp.1.oca.nflxvideo.net
ipv6-c003-xsp002-starhub-isp.1.oca.nflxvideo.net
ipv4-c004-xsp002-starhub-isp.1.oca.nflxvideo.net
ipv6-c004-xsp002-starhub-isp.1.oca.nflxvideo.net
ipv4-c005-xsp002-starhub-isp.1.oca.nflxvideo.net
ipv6-c005-xsp002-starhub-isp.1.oca.nflxvideo.net
ipv4-c006-xsp002-starhub-isp.1.oca.nflxvideo.net
ipv6-c006-xsp002-starhub-isp.1.oca.nflxvideo.net
ipv4-c007-xsp002-starhub-isp.1.oca.nflxvideo.net
ipv4-c002-xsp003-starhub-isp.1.oca.nflxvideo.net
ipv6-c002-xsp003-starhub-isp.1.oca.nflxvideo.net
ipv4-c004-xsp003-starhub-isp.1.oca.nflxvideo.net
ipv6-c004-xsp003-starhub-isp.1.oca.nflxvideo.net
ipv4-c005-xsp003-starhub-isp.1.oca.nflxvideo.net
ipv4-c006-xsp003-starhub-isp.1.oca.nflxvideo.net
ipv6-c006-xsp003-starhub-isp.1.oca.nflxvideo.net
ipv4-c007-xsp003-starhub-isp.1.oca.nflxvideo.net
ipv4-c008-xsp003-starhub-isp.1.oca.nflxvideo.net
ipv6-c008-xsp003-starhub-isp.1.oca.nflxvideo.net
ipv4-c100-fra002-ix.1.oca.nflxvideo.net
ipv4-c010-fra002-ix.1.oca.nflxvideo.net
ipv4-c110-fra002-ix.1.oca.nflxvideo.net
ipv4-c020-fra002-ix.1.oca.nflxvideo.net
ipv4-c120-fra002-ix.1.oca.nflxvideo.net
ipv4-c030-fra002-ix.1.oca.nflxvideo.net
ipv4-c130-fra002-ix.1.oca.nflxvideo.net
ipv4-c040-fra002-ix.1.oca.nflxvideo.net
ipv4-c140-fra002-ix.1.oca.nflxvideo.net
ipv4-c050-fra002-ix.1.oca.nflxvideo.net
ipv4-c150-fra002-ix.1.oca.nflxvideo.net
ipv4-c060-fra002-ix.1.oca.nflxvideo.net
ipv4-c070-fra002-ix.1.oca.nflxvideo.net
ipv4-c080-fra002-ix.1.oca.nflxvideo.net
ipv4-c090-fra002-ix.1.oca.nflxvideo.net
ipv4-c001-fra002-ix.1.oca.nflxvideo.net
ipv4-c101-fra002-ix.1.oca.nflxvideo.net
ipv4-c011-fra002-ix.1.oca.nflxvideo.net
ipv4-c111-fra002-ix.1.oca.nflxvideo.net
ipv4-c021-fra002-ix.1.oca.nflxvideo.net
ipv4-c121-fra002-ix.1.oca.nflxvideo.net
ipv4-c031-fra002-ix.1.oca.nflxvideo.net
ipv4-c131-fra002-ix.1.oca.nflxvideo.net
ipv4-c041-fra002-ix.1.oca.nflxvideo.net
ipv4-c141-fra002-ix.1.oca.nflxvideo.net
ipv4-c051-fra002-ix.1.oca.nflxvideo.net
ipv4-c061-fra002-ix.1.oca.nflxvideo.net
ipv4-c071-fra002-ix.1.oca.nflxvideo.net
ipv4-c081-fra002-ix.1.oca.nflxvideo.net
ipv4-c091-fra002-ix.1.oca.nflxvideo.net
ipv4-c002-fra002-ix.1.oca.nflxvideo.net
ipv4-c102-fra002-ix.1.oca.nflxvideo.net
ipv4-c012-fra002-ix.1.oca.nflxvideo.net
ipv4-c112-fra002-ix.1.oca.nflxvideo.net
ipv4-c022-fra002-ix.1.oca.nflxvideo.net
ipv4-c122-fra002-ix.1.oca.nflxvideo.net
ipv4-c132-fra002-ix.1.oca.nflxvideo.net
ipv4-c042-fra002-ix.1.oca.nflxvideo.net
ipv4-c062-fra002-ix.1.oca.nflxvideo.net
ipv4-c072-fra002-ix.1.oca.nflxvideo.net
ipv4-c082-fra002-ix.1.oca.nflxvideo.net
ipv4-c092-fra002-ix.1.oca.nflxvideo.net
ipv4-c003-fra002-ix.1.oca.nflxvideo.net
ipv4-c103-fra002-ix.1.oca.nflxvideo.net
ipv4-c013-fra002-ix.1.oca.nflxvideo.net
ipv4-c113-fra002-ix.1.oca.nflxvideo.net
ipv4-c023-fra002-ix.1.oca.nflxvideo.net
ipv4-c123-fra002-ix.1.oca.nflxvideo.net
ipv4-c033-fra002-ix.1.oca.nflxvideo.net
ipv4-c133-fra002-ix.1.oca.nflxvideo.net
ipv4-c043-fra002-ix.1.oca.nflxvideo.net
ipv4-c153-fra002-ix.1.oca.nflxvideo.net
ipv4-c063-fra002-ix.1.oca.nflxvideo.net
ipv4-c073-fra002-ix.1.oca.nflxvideo.net
ipv4-c083-fra002-ix.1.oca.nflxvideo.net
ipv4-c093-fra002-ix.1.oca.nflxvideo.net
ipv4-c004-fra002-ix.1.oca.nflxvideo.net
ipv4-c104-fra002-ix.1.oca.nflxvideo.net
ipv4-c014-fra002-ix.1.oca.nflxvideo.net
ipv4-c114-fra002-ix.1.oca.nflxvideo.net
ipv4-c024-fra002-ix.1.oca.nflxvideo.net
ipv4-c124-fra002-ix.1.oca.nflxvideo.net
ipv4-c034-fra002-ix.1.oca.nflxvideo.net
ipv4-c134-fra002-ix.1.oca.nflxvideo.net
ipv4-c044-fra002-ix.1.oca.nflxvideo.net
ipv4-c154-fra002-ix.1.oca.nflxvideo.net
ipv4-c064-fra002-ix.1.oca.nflxvideo.net
ipv4-c074-fra002-ix.1.oca.nflxvideo.net
ipv4-c084-fra002-ix.1.oca.nflxvideo.net
ipv4-c094-fra002-ix.1.oca.nflxvideo.net
ipv4-c005-fra002-ix.1.oca.nflxvideo.net
ipv4-c105-fra002-ix.1.oca.nflxvideo.net
ipv4-c015-fra002-ix.1.oca.nflxvideo.net
ipv4-c115-fra002-ix.1.oca.nflxvideo.net
ipv4-c025-fra002-ix.1.oca.nflxvideo.net
ipv4-c125-fra002-ix.1.oca.nflxvideo.net
ipv4-c035-fra002-ix.1.oca.nflxvideo.net
ipv4-c135-fra002-ix.1.oca.nflxvideo.net
ipv4-c045-fra002-ix.1.oca.nflxvideo.net
ipv4-c145-fra002-ix.1.oca.nflxvideo.net
ipv4-c065-fra002-ix.1.oca.nflxvideo.net
ipv4-c075-fra002-ix.1.oca.nflxvideo.net
ipv4-c085-fra002-ix.1.oca.nflxvideo.net
ipv4-c095-fra002-ix.1.oca.nflxvideo.net
ipv4-c006-fra002-ix.1.oca.nflxvideo.net
ipv4-c106-fra002-ix.1.oca.nflxvideo.net
ipv4-c016-fra002-ix.1.oca.nflxvideo.net
ipv4-c116-fra002-ix.1.oca.nflxvideo.net
ipv4-c026-fra002-ix.1.oca.nflxvideo.net
ipv4-c126-fra002-ix.1.oca.nflxvideo.net
ipv4-c036-fra002-ix.1.oca.nflxvideo.net
ipv4-c136-fra002-ix.1.oca.nflxvideo.net
ipv4-c046-fra002-ix.1.oca.nflxvideo.net
ipv4-c146-fra002-ix.1.oca.nflxvideo.net
ipv4-c056-fra002-ix.1.oca.nflxvideo.net
ipv4-c156-fra002-ix.1.oca.nflxvideo.net
ipv4-c066-fra002-ix.1.oca.nflxvideo.net
ipv4-c076-fra002-ix.1.oca.nflxvideo.net
ipv4-c086-fra002-ix.1.oca.nflxvideo.net
ipv4-c096-fra002-ix.1.oca.nflxvideo.net
ipv4-c007-fra002-ix.1.oca.nflxvideo.net
ipv4-c107-fra002-ix.1.oca.nflxvideo.net
ipv4-c017-fra002-ix.1.oca.nflxvideo.net
ipv4-c117-fra002-ix.1.oca.nflxvideo.net
ipv4-c027-fra002-ix.1.oca.nflxvideo.net
ipv4-c127-fra002-ix.1.oca.nflxvideo.net
ipv4-c037-fra002-ix.1.oca.nflxvideo.net
ipv4-c137-fra002-ix.1.oca.nflxvideo.net
ipv4-c047-fra002-ix.1.oca.nflxvideo.net
ipv4-c057-fra002-ix.1.oca.nflxvideo.net
ipv4-c067-fra002-ix.1.oca.nflxvideo.net
ipv4-c077-fra002-ix.1.oca.nflxvideo.net
ipv4-c087-fra002-ix.1.oca.nflxvideo.net
ipv4-c097-fra002-ix.1.oca.nflxvideo.net
ipv4-c008-fra002-ix.1.oca.nflxvideo.net
ipv4-c108-fra002-ix.1.oca.nflxvideo.net
ipv4-c018-fra002-ix.1.oca.nflxvideo.net
ipv4-c028-fra002-ix.1.oca.nflxvideo.net
ipv4-c128-fra002-ix.1.oca.nflxvideo.net
ipv4-c038-fra002-ix.1.oca.nflxvideo.net
ipv4-c138-fra002-ix.1.oca.nflxvideo.net
ipv4-c048-fra002-ix.1.oca.nflxvideo.net
ipv4-c148-fra002-ix.1.oca.nflxvideo.net
ipv4-c058-fra002-ix.1.oca.nflxvideo.net
ipv4-c158-fra002-ix.1.oca.nflxvideo.net
ipv4-c068-fra002-ix.1.oca.nflxvideo.net
ipv4-c078-fra002-ix.1.oca.nflxvideo.net
ipv4-c088-fra002-ix.1.oca.nflxvideo.net
ipv4-c098-fra002-ix.1.oca.nflxvideo.net
ipv4-c009-fra002-ix.1.oca.nflxvideo.net
ipv4-c109-fra002-ix.1.oca.nflxvideo.net
ipv4-c019-fra002-ix.1.oca.nflxvideo.net
ipv4-c119-fra002-ix.1.oca.nflxvideo.net
ipv4-c029-fra002-ix.1.oca.nflxvideo.net
ipv4-c129-fra002-ix.1.oca.nflxvideo.net
ipv4-c039-fra002-ix.1.oca.nflxvideo.net
ipv4-c139-fra002-ix.1.oca.nflxvideo.net
ipv4-c049-fra002-ix.1.oca.nflxvideo.net
ipv4-c149-fra002-ix.1.oca.nflxvideo.net
ipv4-c059-fra002-ix.1.oca.nflxvideo.net
ipv4-c069-fra002-ix.1.oca.nflxvideo.net
ipv4-c079-fra002-ix.1.oca.nflxvideo.net
ipv4-c089-fra002-ix.1.oca.nflxvideo.net
ipv4-c099-fra002-ix.1.oca.nflxvideo.net
ipv4-c010-fra002-dev-ix.1.oca.nflxvideo.net
ipv4-c001-fra002-dev-ix.1.oca.nflxvideo.net
ipv4-c011-fra002-dev-ix.1.oca.nflxvideo.net
ipv4-c002-fra002-dev-ix.1.oca.nflxvideo.net
ipv6-c002-fra002-dev-ix.1.oca.nflxvideo.net
ipv4-c012-fra002-dev-ix.1.oca.nflxvideo.net
ipv4-c003-fra002-dev-ix.1.oca.nflxvideo.net
ipv6-c003-fra002-dev-ix.1.oca.nflxvideo.net
ipv4-c004-fra002-dev-ix.1.oca.nflxvideo.net
ipv6-c004-fra002-dev-ix.1.oca.nflxvideo.net
ipv4-c005-fra002-dev-ix.1.oca.nflxvideo.net
ipv4-c006-fra002-dev-ix.1.oca.nflxvideo.net
ipv4-c007-fra002-dev-ix.1.oca.nflxvideo.net
ipv4-c008-fra002-dev-ix.1.oca.nflxvideo.net
ipv4-c009-fra002-dev-ix.1.oca.nflxvideo.net
ipv4-c151-fra002-ix.1.oca.nflxvideo.net
ipv4-c032-fra002-ix.1.oca.nflxvideo.net
ipv4-c142-fra002-ix.1.oca.nflxvideo.net
ipv4-c152-fra002-ix.1.oca.nflxvideo.net
ipv4-c143-fra002-ix.1.oca.nflxvideo.net
ipv4-c144-fra002-ix.1.oca.nflxvideo.net
ipv4-c155-fra002-ix.1.oca.nflxvideo.net
ipv4-c147-fra002-ix.1.oca.nflxvideo.net
ipv4-c157-fra002-ix.1.oca.nflxvideo.net
ipv4-c118-fra002-ix.1.oca.nflxvideo.net
ipv4-c003-mfm001-ctm-isp.1.oca.nflxvideo.net
ipv4-c001-tsa001-chieftelecom-isp.1.oca.nflxvideo.net
ipv4-c001-tsa001-cht-isp.1.oca.nflxvideo.net
ipv4-c002-tsa001-cht-isp.1.oca.nflxvideo.net
ipv4-c003-tsa001-cht-isp.1.oca.nflxvideo.net
ipv4-c004-tsa001-cht-isp.1.oca.nflxvideo.net
ipv4-c005-tsa001-cht-isp.1.oca.nflxvideo.net
ipv4-c006-tsa001-cht-isp.1.oca.nflxvideo.net
ipv4-c007-tsa001-cht-isp.1.oca.nflxvideo.net
ipv4-c008-tsa001-cht-isp.1.oca.nflxvideo.net
ipv4-c002-cjj001-lguplus-isp.1.oca.nflxvideo.net
ipv4-c006-cjj001-lguplus-isp.1.oca.nflxvideo.net
ipv4-c001-hlp001-im2-isp.1.oca.nflxvideo.net
ipv4-c001-hlp001-myrepublicid-isp.1.oca.nflxvideo.net
ipv4-c002-hlp001-myrepublicid-isp.1.oca.nflxvideo.net
ipv4-c001-hlp001-cbn-isp.1.oca.nflxvideo.net
ipv4-c002-hlp001-cbn-isp.1.oca.nflxvideo.net
ipv4-c001-hlp002-linknet-isp.1.oca.nflxvideo.net
ipv4-c002-hlp002-linknet-isp.1.oca.nflxvideo.net
ipv4-c001-hlp003-linknet-isp.1.oca.nflxvideo.net
ipv4-c002-hlp003-linknet-isp.1.oca.nflxvideo.net
ipv4-c001-hlp001-mncplay-isp.1.oca.nflxvideo.net
ipv4-c002-hlp001-mncplay-isp.1.oca.nflxvideo.net
ipv4-c001-bdo001-starnetid-isp.1.oca.nflxvideo.net
ipv4-c002-bdo001-starnetid-isp.1.oca.nflxvideo.net
ipv4-c002-cgk001-moratel-isp.1.oca.nflxvideo.net
ipv4-c001-cgk001-linknet-isp.1.oca.nflxvideo.net
ipv4-c002-cgk001-linknet-isp.1.oca.nflxvideo.net
ipv4-c003-cgk001-linknet-isp.1.oca.nflxvideo.net
ipv4-c001-cgk002-linknet-isp.1.oca.nflxvideo.net
ipv4-c002-cgk002-linknet-isp.1.oca.nflxvideo.net
ipv4-c003-cgk002-linknet-isp.1.oca.nflxvideo.net
ipv4-c003-cgk002-biznet-isp.1.oca.nflxvideo.net
ipv4-c004-cgk002-biznet-isp.1.oca.nflxvideo.net
ipv4-c001-cxp001-biznet-isp.1.oca.nflxvideo.net
ipv4-c001-sub001-biznet-isp.1.oca.nflxvideo.net
ipv4-c016-jnb001-ix.1.oca.nflxvideo.net
ipv4-c010-jnb001-ix.1.oca.nflxvideo.net
ipv4-c025-jnb001-ix.1.oca.nflxvideo.net
ipv4-c027-jnb001-ix.1.oca.nflxvideo.net
ipv6-c001-sin001-ix.1.oca.nflxvideo.net
ipv4-c002-jnb001-ix.1.oca.nflxvideo.net
ipv4-c008-jnb001-ix.1.oca.nflxvideo.net
ipv4-c004-jnb001-ix.1.oca.nflxvideo.net
ipv6-c063-sin001-ix.1.oca.nflxvideo.net
ipv6-c117-fra002-ix.1.oca.nflxvideo.net
ipv4-c037-jnb001-ix.1.oca.nflxvideo.net
ipv4-c026-jnb001-ix.1.oca.nflxvideo.net
ipv6-c124-fra002-ix.1.oca.nflxvideo.net
ipv6-c062-hkg001-ix.1.oca.nflxvideo.net
ipv6-c058-hkg001-ix.1.oca.nflxvideo.net
ipv6-c057-sin001-ix.1.oca.nflxvideo.net
ipv6-c051-hkg001-ix.1.oca.nflxvideo.net
ipv6-c108-fra002-ix.1.oca.nflxvideo.net
ipv4-c024-jnb001-ix.1.oca.nflxvideo.net
ipv4-c030-jnb001-ix.1.oca.nflxvideo.net
ipv4-c010-osa001-ix.1.oca.nflxvideo.net
ipv4-c020-osa001-ix.1.oca.nflxvideo.net
ipv4-c001-osa001-ix.1.oca.nflxvideo.net
ipv4-c011-osa001-ix.1.oca.nflxvideo.net
ipv4-c021-osa001-ix.1.oca.nflxvideo.net
ipv4-c002-osa001-ix.1.oca.nflxvideo.net
ipv4-c012-osa001-ix.1.oca.nflxvideo.net
ipv4-c022-osa001-ix.1.oca.nflxvideo.net
ipv4-c003-osa001-ix.1.oca.nflxvideo.net
ipv4-c013-osa001-ix.1.oca.nflxvideo.net
ipv4-c004-osa001-ix.1.oca.nflxvideo.net
ipv4-c014-osa001-ix.1.oca.nflxvideo.net
ipv4-c005-osa001-ix.1.oca.nflxvideo.net
ipv4-c015-osa001-ix.1.oca.nflxvideo.net
ipv4-c006-osa001-ix.1.oca.nflxvideo.net
ipv4-c016-osa001-ix.1.oca.nflxvideo.net
ipv4-c007-osa001-ix.1.oca.nflxvideo.net
ipv4-c017-osa001-ix.1.oca.nflxvideo.net
ipv4-c008-osa001-ix.1.oca.nflxvideo.net
ipv4-c018-osa001-ix.1.oca.nflxvideo.net
ipv4-c009-osa001-ix.1.oca.nflxvideo.net
ipv4-c019-osa001-ix.1.oca.nflxvideo.net
ipv4-c020-jnb001-ix.1.oca.nflxvideo.net
ipv4-c001-jnb001-ix.1.oca.nflxvideo.net
ipv4-c011-jnb001-ix.1.oca.nflxvideo.net
ipv4-c021-jnb001-ix.1.oca.nflxvideo.net
ipv4-c031-jnb001-ix.1.oca.nflxvideo.net
ipv4-c012-jnb001-ix.1.oca.nflxvideo.net
ipv4-c022-jnb001-ix.1.oca.nflxvideo.net
ipv4-c032-jnb001-ix.1.oca.nflxvideo.net
ipv4-c003-jnb001-ix.1.oca.nflxvideo.net
ipv4-c023-jnb001-ix.1.oca.nflxvideo.net
ipv4-c033-jnb001-ix.1.oca.nflxvideo.net
ipv4-c014-jnb001-ix.1.oca.nflxvideo.net
ipv4-c034-jnb001-ix.1.oca.nflxvideo.net
ipv4-c005-jnb001-ix.1.oca.nflxvideo.net
ipv4-c015-jnb001-ix.1.oca.nflxvideo.net
ipv4-c006-jnb001-ix.1.oca.nflxvideo.net
ipv4-c036-jnb001-ix.1.oca.nflxvideo.net
ipv4-c007-jnb001-ix.1.oca.nflxvideo.net
ipv4-c017-jnb001-ix.1.oca.nflxvideo.net
ipv4-c018-jnb001-ix.1.oca.nflxvideo.net
ipv4-c028-jnb001-ix.1.oca.nflxvideo.net
ipv4-c038-jnb001-ix.1.oca.nflxvideo.net
ipv4-c009-jnb001-ix.1.oca.nflxvideo.net
ipv4-c019-jnb001-ix.1.oca.nflxvideo.net
ipv4-c029-jnb001-ix.1.oca.nflxvideo.net
ipv4-c013-jnb001-ix.1.oca.nflxvideo.net
ipv4-c035-jnb001-ix.1.oca.nflxvideo.net
dualstack.apiproxy-nrdp-prod-nlb-4-9fae3883a092e5c6.elb.us-west-2.amazonaws.com
dualstack.apiproxy-nrdp-prod-nlb-2-42101415231301e4.elb.us-west-2.amazonaws.com
dualstack.apiproxy-nrdp-prod-nlb-1-4659b24f746a127b.elb.us-west-2.amazonaws.com
dualstack.apiproxy-nrdp-prod-nlb-3-80d1f4b305f7c0e4.elb.us-west-2.amazonaws.com
ipv4-c002-hkg001-pccw-isp.1.oca.nflxvideo.net
ipv6-c012-hkg001-ix.1.oca.nflxvideo.net
ipv6-c006-sin001-starhub-isp.1.oca.nflxvideo.net
ipv6-c026-sin001-ix.1.oca.nflxvideo.net
ipv4-c001-cgk001-moratel-isp.1.oca.nflxvideo.net
ipv4-c221-sjc002-ix.1.oca.nflxvideo.net
ipv4-c204-sjc002-dev-ix.1.oca.nflxvideo.net
ipv4-c070-lax009-ix.1.oca.nflxvideo.net
ipv4-c024-lax009-ix.1.oca.nflxvideo.net
ipv4-c044-lhr005-ix.1.oca.nflxvideo.net
ipv4-c133-lhr004-ix.1.oca.nflxvideo.net
ipv4-c144-sea001-ix.1.oca.nflxvideo.net
ipv4-c046-nyc005-ix.1.oca.nflxvideo.net
ipv4-c007-pdx001-ix.1.oca.nflxvideo.net
ipv4-c111-lhr004-ix.1.oca.nflxvideo.net
ipv4-c059-lhr005-ix.1.oca.nflxvideo.net
ipv4-c162-sea001-ix.1.oca.nflxvideo.net
ipv4-c031-nyc005-ix.1.oca.nflxvideo.net
ipv4-c022-pdx001-ix.1.oca.nflxvideo.net
ipv6-c212-sea001-ix.1.oca.nflxvideo.net
ipv6-c147-sea001-ix.1.oca.nflxvideo.net
ipv6-c181-sea001-ix.1.oca.nflxvideo.net
ipv6-c204-sea001-ix.1.oca.nflxvideo.net
ipv4-c132-lhr004-ix.1.oca.nflxvideo.net
ipv4-c067-lhr005-ix.1.oca.nflxvideo.net
ipv4-c197-sea001-ix.1.oca.nflxvideo.net
ipv4-c044-pdx001-ix.1.oca.nflxvideo.net
ipv4-c060-nyc005-ix.1.oca.nflxvideo.net

View File

@ -0,0 +1,472 @@
# 官方配置模板https://github.com/Dreamacro/clash/wiki/Configuration
# Meta配置模板https://github.com/MetaCubeX/Clash.Meta/blob/Alpha/docs/config.yaml
# 接管:部分参数不支持在此页面直接修改,请到全局设置页面进行修改
# Port of HTTP(S) proxy server on the local end
port: 7890
# Port of SOCKS5 proxy server on the local end
socks-port: 7891
# Transparent proxy server port for Linux and macOS (Redirect TCP and TProxy UDP)
redir-port: 7892
# Transparent proxy server port for Linux (TProxy TCP and TProxy UDP)
tproxy-port: 7893
# HTTP(S) and SOCKS4(A)/SOCKS5 server on the same port
mixed-port: 7893
# authentication of local SOCKS5/HTTP(S) server
# authentication:
# - "user1:pass1"
# - "user2:pass2"
# Set to true to allow connections to the local-end server from
# other LAN IP addresses
allow-lan: true
# This is only applicable when `allow-lan` is `true`
# '*': bind all IP addresses
# 192.168.122.11: bind a single IPv4 address
# "[aaaa::a8aa:ff:fe09:57d8]": bind a single IPv6 address
bind-address: '*'
# Clash router working mode
# rule: rule-based packet routing
# global: all packets will be forwarded to a single endpoint
# direct: directly forward the packets to the Internet
mode: rule
# Clash by default prints logs to STDOUT
# info / warning / error / debug / silent
# log-level: info
# When set to false, resolver won't translate hostnames to IPv6 addresses
# ipv6: false
# RESTful web API listening address
external-controller: 127.0.0.1:9090
# A relative path to the configuration directory or an absolute path to a
# directory in which you put some static web resource. Clash core will then
# serve it at `http://{{external-controller}}/ui`.
# external-ui: folder
# Secret for the RESTful API (optional)
# Authenticate by spedifying HTTP header `Authorization: Bearer ${secret}`
# ALWAYS set a secret if RESTful API is listening on 0.0.0.0
# secret: ""
# Outbound interface name
# interface-name: en0
# fwmark on Linux only
# routing-mark: 6666
# Static hosts for DNS server and connection establishment (like /etc/hosts)
#
# Wildcard hostnames are supported (e.g. *.clash.dev, *.foo.*.example.com)
# Non-wildcard domain names have a higher priority than wildcard domain names
# e.g. foo.example.com > *.example.com > .example.com
# P.S. +.foo.com equals to .foo.com and foo.com
hosts:
# '*.clash.dev': 127.0.0.1
# '.dev': 127.0.0.1
# 'alpha.clash.dev': '::1'
profile:
# Store the `select` results in $HOME/.config/clash/.cache
# set false If you don't want this behavior
# when two different configurations have groups with the same name, the selected values are shared
store-selected: true
# persistence fakeip
store-fake-ip: true
# DNS server settings
# This section is optional. When not present, the DNS server will be disabled.
dns:
enable: true
listen: 0.0.0.0:53
# ipv6: false # when the false, response to AAAA questions will be empty
# These nameservers are used to resolve the DNS nameserver hostnames below.
# Specify IP addresses only
default-nameserver:
- 114.114.114.114
- 8.8.8.8
enhanced-mode: fake-ip # or redir-host (not recommended)
fake-ip-range: 198.18.0.1/16 # Fake IP addresses pool CIDR
# use-hosts: true # lookup hosts and return IP record
# Hostnames in this list will not be resolved with fake IPs
# i.e. questions to these domain names will always be answered with their
# real IP addresses
# fake-ip-filter:
# - '*.lan'
# - localhost.ptlogin2.qq.com
# Supports UDP, TCP, DoT, DoH. You can specify the port to connect to.
# All DNS questions are sent directly to the nameserver, without proxies
# involved. Clash answers the DNS question with the first result gathered.
nameserver:
- 114.114.114.114 # default value
#- 8.8.8.8 # default value
#- tls://dns.rubyfish.cn:853 # DNS over TLS
#- https://1.1.1.1/dns-query # DNS over HTTPS
#- dhcp://en0 # dns from dhcp
# - '8.8.8.8#en0'
# When `fallback` is present, the DNS server will send concurrent requests
# to the servers in this section along with servers in `nameservers`.
# The answers from fallback servers are used when the GEOIP country
# is not `CN`.
# fallback:
# - tcp://1.1.1.1
# - 'tcp://1.1.1.1#en0'
# If IP addresses resolved with servers in `nameservers` are in the specified
# subnets below, they are considered invalid and results from `fallback`
# servers are used instead.
#
# IP address resolved with servers in `nameserver` is used when
# `fallback-filter.geoip` is true and when GEOIP of the IP address is `CN`.
#
# If `fallback-filter.geoip` is false, results from `nameserver` nameservers
# are always used if not match `fallback-filter.ipcidr`.
#
# This is a countermeasure against DNS pollution attacks.
# fallback-filter:
# geoip: true
# geoip-code: CN
# ipcidr:
# - 240.0.0.0/4
# domain:
# - '+.google.com'
# - '+.facebook.com'
# - '+.youtube.com'
# Lookup domains via specific nameservers
# nameserver-policy:
# 'www.baidu.com': '114.114.114.114'
# '+.internal.crop.com': '10.0.0.1'
proxies:
# Shadowsocks
# The supported ciphers (encryption methods):
# aes-128-gcm aes-192-gcm aes-256-gcm
# aes-128-cfb aes-192-cfb aes-256-cfb
# aes-128-ctr aes-192-ctr aes-256-ctr
# rc4-md5 chacha20-ietf xchacha20
# chacha20-ietf-poly1305 xchacha20-ietf-poly1305
- name: "ss1"
type: ss
server: server
port: 443
cipher: chacha20-ietf-poly1305
password: "password"
# udp: true
- name: "ss2"
type: ss
server: server
port: 443
cipher: chacha20-ietf-poly1305
password: "password"
plugin: obfs
plugin-opts:
mode: tls # or http
# host: bing.com
- name: "ss3"
type: ss
server: server
port: 443
cipher: chacha20-ietf-poly1305
password: "password"
plugin: v2ray-plugin
plugin-opts:
mode: websocket # no QUIC now
# tls: true # wss
# skip-cert-verify: true
# host: bing.com
# path: "/"
# mux: true
# headers:
# custom: value
# vmess
# cipher support auto/aes-128-gcm/chacha20-poly1305/none
- name: "vmess"
type: vmess
server: server
port: 443
uuid: uuid
alterId: 32
cipher: auto
# udp: true
# tls: true
# skip-cert-verify: true
# servername: example.com # priority over wss host
# network: ws
# ws-opts:
# path: /path
# headers:
# Host: v2ray.com
# max-early-data: 2048
# early-data-header-name: Sec-WebSocket-Protocol
- name: "vmess-h2"
type: vmess
server: server
port: 443
uuid: uuid
alterId: 32
cipher: auto
network: h2
tls: true
h2-opts:
host:
- http.example.com
- http-alt.example.com
path: /
- name: "vmess-http"
type: vmess
server: server
port: 443
uuid: uuid
alterId: 32
cipher: auto
# udp: true
# network: http
# http-opts:
# # method: "GET"
# # path:
# # - '/'
# # - '/video'
# # headers:
# # Connection:
# # - keep-alive
- name: vmess-grpc
server: server
port: 443
type: vmess
uuid: uuid
alterId: 32
cipher: auto
network: grpc
tls: true
servername: example.com
# skip-cert-verify: true
grpc-opts:
grpc-service-name: "example"
# socks5
- name: "socks"
type: socks5
server: server
port: 443
# username: username
# password: password
# tls: true
# skip-cert-verify: true
# udp: true
# http
- name: "http"
type: http
server: server
port: 443
# username: username
# password: password
# tls: true # https
# skip-cert-verify: true
# sni: custom.com
# Snell
# Beware that there's currently no UDP support yet
- name: "snell"
type: snell
server: server
port: 44046
psk: yourpsk
# version: 2
# obfs-opts:
# mode: http # or tls
# host: bing.com
# Trojan
- name: "trojan"
type: trojan
server: server
port: 443
password: yourpsk
# udp: true
# sni: example.com # aka server name
# alpn:
# - h2
# - http/1.1
# skip-cert-verify: true
- name: trojan-grpc
server: server
port: 443
type: trojan
password: "example"
network: grpc
sni: example.com
# skip-cert-verify: true
udp: true
grpc-opts:
grpc-service-name: "example"
- name: trojan-ws
server: server
port: 443
type: trojan
password: "example"
network: ws
sni: example.com
# skip-cert-verify: true
udp: true
# ws-opts:
# path: /path
# headers:
# Host: example.com
# ShadowsocksR
# The supported ciphers (encryption methods): all stream ciphers in ss
# The supported obfses:
# plain http_simple http_post
# random_head tls1.2_ticket_auth tls1.2_ticket_fastauth
# The supported supported protocols:
# origin auth_sha1_v4 auth_aes128_md5
# auth_aes128_sha1 auth_chain_a auth_chain_b
- name: "ssr"
type: ssr
server: server
port: 443
cipher: chacha20-ietf
password: "password"
obfs: tls1.2_ticket_auth
protocol: auth_sha1_v4
# obfs-param: domain.tld
# protocol-param: "#"
# udp: true
proxy-groups:
# relay chains the proxies. proxies shall not contain a relay. No UDP support.
# Traffic: clash <-> http <-> vmess <-> ss1 <-> ss2 <-> Internet
- name: "relay"
type: relay
proxies:
- http
- vmess
- ss1
- ss2
# url-test select which proxy will be used by benchmarking speed to a URL.
- name: "auto"
type: url-test
proxies:
- ss1
- ss2
- vmess1
# tolerance: 150
# lazy: true
url: 'http://www.gstatic.com/generate_204'
interval: 300
# fallback selects an available policy by priority. The availability is tested by accessing an URL, just like an auto url-test group.
- name: "fallback-auto"
type: fallback
proxies:
- ss1
- ss2
- vmess1
url: 'http://www.gstatic.com/generate_204'
interval: 300
# load-balance: The request of the same eTLD+1 will be dial to the same proxy.
- name: "load-balance"
type: load-balance
proxies:
- ss1
- ss2
- vmess1
url: 'http://www.gstatic.com/generate_204'
interval: 300
# strategy: consistent-hashing # or round-robin
# select is used for selecting proxy or proxy group
# you can use RESTful API to switch proxy is recommended for use in GUI.
- name: Proxy
type: select
# disable-udp: true
proxies:
- ss1
- ss2
- vmess1
- auto
# direct to another infacename or fwmark, also supported on proxy
- name: en1
type: select
interface-name: en1
routing-mark: 6667
proxies:
- DIRECT
- name: UseProvider
type: select
use:
- provider1
proxies:
- Proxy
- DIRECT
proxy-providers:
provider1:
type: http
url: "url"
interval: 3600
path: ./provider1.yaml
health-check:
enable: true
interval: 600
# lazy: true
url: http://www.gstatic.com/generate_204
test:
type: file
path: /test.yaml
health-check:
enable: true
interval: 36000
url: http://www.gstatic.com/generate_204
tunnels:
# one line config
#- tcp/udp,127.0.0.1:6553,114.114.114.114:53,proxy
#- tcp,127.0.0.1:6666,rds.mysql.com:3306,vpn
# full yaml config
#- network: [tcp, udp]
# address: 127.0.0.1:7777
# target: target.com
# proxy: proxy
rules:
- DOMAIN-SUFFIX,google.com,auto
- DOMAIN-KEYWORD,google,auto
- DOMAIN,google.com,auto
- DOMAIN-SUFFIX,ad.com,REJECT
- SRC-IP-CIDR,192.168.1.201/32,DIRECT
# optional param "no-resolve" for IP rules (GEOIP, IP-CIDR, IP-CIDR6)
- IP-CIDR,127.0.0.0/8,DIRECT
- GEOIP,CN,DIRECT
- DST-PORT,80,DIRECT
- SRC-PORT,7777,DIRECT
- RULE-SET,apple,REJECT # Premium only
- MATCH,auto

View File

@ -0,0 +1,165 @@
300英雄,300hero-cn.rules
永恒之塔-台服,Aion-TW.rules
美国卡车模拟国际服,American-Truck-Simulator.rules
太空狼人杀,Among Us.rules
圣歌,Anthem.rules
Apex英雄,Apex.rules
Apex英雄-uu策略,Apex-uu.rules
方舟:生存进化,ARK--Survival-Evolved.rules
武装突袭(Codefourgaming和官服),Arma3.rules
刺客信条:奥德赛,Assassin's-Creed-Odyssey.rules,Assassins-Creed-Odyssey.rules
刺客信条:起源,Assassin's-Creed-Origins.rules,Assassins-Creed-Origins.rules
Atlas-全区,Atlas.rules
战地1,Battlefield-1.rules
战地4,BattleField-4.rules
战地5,Battlefield-.rules,Battlefield-5.rules
黑色沙漠,Black-Desert.rules
黑色幸存者,BlackSurvivor.rules
剑灵台服,Blade&Soul TW.rules
剑灵-日服,Blade-&-Soul-jp.rules
剑灵-国服全部区服UU规则,Blood-&-Soul-CN.rules
剑灵-国服-南天国(测试版),Blood-&-Soul-CN-TestServer-NantianGuo-Alpha.rules
无主之地3,Borderlands3-asia.rules
泡泡战士-跑跑卡丁车-韩服,BubbleFighter-KartRider-KR.rules
使命召唤4现代战争重置版,Call-Of-Duty-4-Modern-Warfare.rules
使命召唤15亚服,Call-Of-Duty15-Asia.rules
使命召唤16&19现代战争I&II,Call-Of-Duty-Modern-Warfare.rules
使命召唤17冷战,Call-Of-Duty17-ColdWar.rules
英雄连2,Company-Of-Heroes-2.rules
反恐精英:全球攻势,CS-GO.rules
反恐精英:全球攻势-港服(uu),CSGO-HKuu.rules
反恐精英:全球攻势-港服(tx),CSGO-HKtx.rules
反恐精英:全球攻势-日服(tx),CSGO-JPtx.rules
反恐精英:全球攻势-美服(tx),CSGO-UStx.rules
黑暗之魂3,Dark-Souls-3.rules
不屈不挠,Dauntless.rules
DayZ-steam,DayZ.rules
黎明杀机,Dead-by-Daylight.rules
命运2-全服(tx),Destiny2-Alltx.rules
命运2-全服(uu),Destiny2-Alluu.rules
天命2-亚服/命运2-亚服,Destiny2-Asia.rules
天命2-欧服/命运2-欧服,Destiny2-EU.rules
命运2-steam,Destiny2-steam.rules
天命2-美服/命运2-美服,Destiny2-US.rules
暗黑破坏神2重制版-亚服,Diablo-2-Resurrected.rules
暗黑破坏神3-亚服,Diablo3-Asia.rules
暗黑破坏神3-美服,Diablo3-US.rules
脏弹-Steam,Dirty-Bomb.rules
Discord,Discord-All.rules
饥荒-steam,Don't-Starve-steam.rules,Dont-Starve-steam.rules
DOTA2-日服,Dota2-jp.rules
刀塔霸业,Dota-Underlords.rules
逃离塔科夫,Escape-from-Tarkov.rules
欧卡2所有分区-UU,Euro-Truck-Simulator-2.rules
Eve-online欧服,Eve-online.rules
FIFA19,FiFa19-INT.rules
FIFA20,FIFA20.rules
糖豆人,Fall-Guys.rules
最终幻想14,Final-Fantasy-XIV.rules
最终幻想14国服,FINAL-FANTASY-XIV-cn.rules
荣耀战魂,For-Honour.rules
堡垒之夜-亚服,Fortnite-AS.rules
堡垒之夜-国服,Fortnite-cn.rules
极限竞速地平线4,Forza-Horizon-4.rules
极限竞速地平线5,Forza-Horizon-5.rules
极限竞速7,Forza-Motorsport-7.rules
基佬大乱斗Gang-Beasts,Gang-Beasts.rules
鹅鸭杀-港服,Goose-Goose-Duck-HK.rules
Grand Theft Auto V(GTA5),Grand Theft Auto V.rules
激战2,Guild-Wars-2.rules
巫师昆特牌国际服,Gwent_The-Witcher-Card-game.rules
杀手2外服,HITMAN2.rules
光环:士官长合集,Halo-The-Master-Chief-Collection.rules
荒野行动PC版-国服,HuangYeXingDong-cn.rules
叛乱:沙漠风暴,Insurgency-Sandstorm.rules
Jump大乱斗,Jump-Force.rules
跑跑卡丁车(韩服),KartRider.rules
Kurtzpel,Kurtzpel.rules
求生之路2-Test,L4D2-Test.rules
英雄联盟-日服,League-of-Legends-jp.rules
英雄联盟-韩服,League-of-Legends-kr.rules
英雄联盟PBE,League-of-Legends-PBE.rules
英雄联盟-台服,League-of-Legends-tw+Garena(2018-12-19).rules
英雄联盟-台服+Garena平台(2018-12-19更新),League-of-Legends-tw.rules
英雄联盟-美服,League-of-Legends-us.rules
失落的方舟韩服,Lost-Ark.rules
失落的方舟俄服,Lostark-RU.rules
冒险岛,Maplestory-us.rules
心灵终结,MentalOmega.rules
微软模拟飞行年度版,Microsoft-Flight-Simulator-Game-Of-The-Year-Edition.rules
微软商店,Microsoft-Srote.rules
我的世界-地下城,Minecraft-Dungeons.rules
传奇4,MIR4-asia.rules
误造,Miscreated.rules
怪兽世界猎人steam版,Monster-Hunter-World.rules
万智牌:竞技场-国际服,MTG-Arena.rules
奇迹传奇MU2,MU2.rules
NBA-2K19,NBA-2K19.rules
NBA2K20,NBA2K20.rules
仁王,NIOH.rules
橘子客户端-UU,Origin.rules
Osu!,Osu!.rules
守望先锋-亚服,Overwatch-Asia.rules
守望先锋-美服,Overwatch-US.rules
流亡黯道-国际服,Path Of Exile.rules
流放之路,PathOfexile.rules
梦幻之星2-日服(tx),PHANTASY STAR ONLINE2-JPtx.rules
行星边际2,PlanetSide-2.rules
绝地求生大逃杀,PlayerUnknown's-Battlegrounds-update.rules,PlayerUnknowns-Battlegrounds-update.rules
实况足球-2018,Pro-Evolution-Soccer-2018.rules
实况足球-2019,Pro-Evolution-Soccer-2019.rules
绝地求生亚服-东南亚服,PUBG-Asia&-Southeast-Asia.rules
绝地求生国际服,PUBG-INT.rules
绝地求生韩服,PUBG-kakao.rules
绝地求生低配版-Garena,PUBGLite-Garena.rules
绝地求生轻量版-WEB客户端,PUBGLITE-WEB.rules
R2竞技场服,R2Arena.rules
R2俄服官服,R2RU.rules
R2美服,R2US.rules
仙境传说OL美国,Ragnarok-Online-2-us.rules
仙境传说OL台湾,Ragnarok-Online-tw.rules
荒野大镖客2,Red-dead-redemption2.rules
无限法则,Ring-of-Elysium-asia.rules
Roblox,Roblox.rules
影之诗,Shadowverse.rules
灵魂行者-台服,Soul-Worker.rules
星际公民,Star-Citizen.rules
星球大战2前线,Star-Wars-BattlefrontII.rules
StarCraft-亚服,StarCraft-2-asia.rules
星际争霸2-国服,StarCraftⅡ-cn.rules,StarCraft2-cn.rules
Steam-社区,Steam.rules
极限巅峰,Steep.rules
街头霸王5,Street-Fighter-V.rules
神谕之战,TERA.rules
飙酷车神,The-Crew.rules
飙酷车神2,The-Crew2.rules
上古卷轴OL,The-Elder-Scrolls-Online.rules
天涯明月刀-台服,TianYaMingYueDao-tw.rules
泰坦陨落2,TiTanFall2.rules
新枫之谷,TMS.rules
幽灵行动:荒野,Tom-Clancy's-Ghost-Recon-Wildlands.rules,Tom-Clancys-Ghost-Recon-Wildlands.rules
彩虹六号-围攻-全部,Tom-Clancy's-Rainbow-Six-Siege-all.rules,Tom-Clancys-Rainbow-Six-Siege-all.rules
彩虹六号-围攻-EAS,Tom-Clancy's-Rainbow-Six-Siege-EAS.rules,Tom-Clancys-Rainbow-Six-Siege-EAS.rules
彩虹六号-异种-全部,Tom-Clancy's-Rainbow-Six-Extraction-all.rules,Tom-Clancys-Rainbow-Six-Extraction-all.rules
全境封锁,Tom-clancy's-The-Division-2.rules,Tom-clancys-The-Division-2.rules
全境封锁2,Tom-clancy's-The-Division.rules,Tom-clancys-The-Division.rules
未转变者Unturned,Unturned.rules
无畏契约,Valorant.rules
战争雷霆,War-thunder-steam.rules
战争前线-steam,Warface.rules
看门狗,Watch-Dogs.rules
看门狗2,Watch-Dogs2.rules
求生意志OL,Will-To-Live-Online.rules
第三次世界大战-欧服,World-War-3.rules
坦克世界-亚服,World-of-Tanks-Asia.rules
坦克世界-国服,World-of-Tanks-cn.rules
坦克世界闪电战,World-of-Tanks-Blitz.rules
魔兽世界台服,World-of-warcraft-tw.rules
战舰世界-亚服,World-of-Warships-US.rules
战舰世界-欧服,World-of-warships-EU.rules
战舰世界-美服,World-of-Warships.rules
战舰世界国服UU,World-of-Warships-CN.rules
僵尸世界大战,Worldwar-Z.rules
魔兽世界-欧服,WoW-EU.rules
游戏王决斗链接,YO-GI-HO delulinks.rules
游侠对战平台,YouXiaDuiZhanPingTai.rules

View File

@ -0,0 +1,507 @@
rules:
- RULE-SET,Reject,AdBlock
- RULE-SET,Special,DIRECT
- RULE-SET,Netflix,Netflix
- RULE-SET,Spotify,Spotify
- RULE-SET,YouTube,YouTube
- RULE-SET,Disney Plus,Disney
- RULE-SET,Bilibili,Asian TV
- RULE-SET,IQ,Asian TV
- RULE-SET,IQIYI,Asian TV
- RULE-SET,Letv,Asian TV
- RULE-SET,Netease Music,Asian TV
- RULE-SET,Tencent Video,Asian TV
- RULE-SET,Youku,Asian TV
- RULE-SET,WeTV,Asian TV
- RULE-SET,ABC,Global TV
- RULE-SET,Abema TV,Global TV
- RULE-SET,Amazon,Global TV
- RULE-SET,Bahamut,Global TV
- RULE-SET,BBC iPlayer,Global TV
- RULE-SET,DAZN,Global TV
- RULE-SET,Discovery Plus,Global TV
- RULE-SET,encoreTVB,Global TV
- RULE-SET,F1 TV,Global TV
- RULE-SET,Fox Now,Global TV
- RULE-SET,Fox+,Global TV
- RULE-SET,HBO Go,Global TV
- RULE-SET,HBO Max,Global TV
- RULE-SET,Hulu Japan,Global TV
- RULE-SET,Hulu,Global TV
- RULE-SET,Japonx,Global TV
- RULE-SET,JOOX,Global TV
- RULE-SET,KKBOX,Global TV
- RULE-SET,KKTV,Global TV
- RULE-SET,Line TV,Global TV
- RULE-SET,myTV SUPER,Global TV
- RULE-SET,Niconico,Global TV
- RULE-SET,Pandora,Global TV
- RULE-SET,PBS,Global TV
- RULE-SET,Pornhub,Global TV
- RULE-SET,Soundcloud,Global TV
- RULE-SET,ViuTV,Global TV
- RULE-SET,Telegram,Telegram
- RULE-SET,Crypto,Crypto
- RULE-SET,Discord,Discord
- RULE-SET,Steam,Steam
- RULE-SET,Speedtest,Speedtest
- RULE-SET,PayPal,PayPal
- RULE-SET,Microsoft,Microsoft
- RULE-SET,ChatGPT,ChatGPT
- RULE-SET,Apple Music,Apple TV
- RULE-SET,Apple News,Apple TV
- RULE-SET,Apple TV,Apple TV
- RULE-SET,Apple,Apple
- RULE-SET,Google FCM,Google FCM
- RULE-SET,Scholar,Scholar
- RULE-SET,PROXY,Proxy
- RULE-SET,Domestic,Domestic
- RULE-SET,Domestic IPs,Domestic
- RULE-SET,LAN,DIRECT
- GEOIP,CN,Domestic
- MATCH,Others
script:
code: |
def main(ctx, metadata):
ruleset_action = {"Reject": "AdBlock",
"Special": "DIRECT",
"Netflix": "Netflix",
"Spotify": "Spotify",
"YouTube": "YouTube",
"Disney Plus": "Disney",
"Bilibili": "Asian TV",
"IQ": "Asian TV",
"IQIYI": "Asian TV",
"Letv": "Asian TV",
"Netease Music": "Asian TV",
"Tencent Video": "Asian TV",
"Youku": "Asian TV",
"WeTV": "Asian TV",
"ABC": "Global TV",
"Abema TV": "Global TV",
"Amazon": "Global TV",
"Bahamut": "Global TV",
"BBC iPlayer": "Global TV",
"DAZN": "Global TV",
"Discovery Plus": "Global TV",
"encoreTVB": "Global TV",
"F1 TV": "Global TV",
"Fox Now": "Global TV",
"Fox+": "Global TV",
"HBO Go": "Global TV",
"HBO Max": "Global TV",
"Hulu Japan": "Global TV",
"Hulu": "Global TV",
"Japonx": "Global TV",
"JOOX": "Global TV",
"KKBOX": "Global TV",
"KKTV": "Global TV",
"Line TV": "Global TV",
"myTV SUPER": "Global TV",
"Niconico": "Global TV",
"Pandora": "Global TV",
"PBS": "Global TV",
"Pornhub": "Global TV",
"Soundcloud": "Global TV",
"ViuTV": "Global TV",
"Telegram": "Telegram",
"Crypto": "Crypto",
"Discord": "Discord",
"Steam": "Steam",
"Speedtest": "Speedtest",
"PayPal": "PayPal",
"Microsoft": "Microsoft",
"ChatGPT": "ChatGPT",
"Apple Music": "Apple TV",
"Apple News": "Apple TV",
"Apple TV": "Apple TV",
"Apple": "Apple",
"Google FCM": "Google FCM",
"Scholar": "Scholar",
"PROXY": "Proxy",
"Domestic": "Domestic",
"Domestic IPs": "Domestic",
"LAN": "DIRECT"
}
port = int(metadata["dst_port"])
if metadata["network"] == "UDP" and port == 443:
ctx.log('[Script] matched QUIC traffic use reject')
return "REJECT"
port_list = [21, 22, 23, 53, 80, 123, 143, 194, 443, 465, 587, 853, 993, 995, 998, 2052, 2053, 2082, 2083, 2086, 2095, 2096, 3389, 5222, 5228, 5229, 5230, 8080, 8443, 8880, 8888, 8889]
if port not in port_list:
ctx.log('[Script] not common port use direct')
return "DIRECT"
if metadata["dst_ip"] == "":
metadata["dst_ip"] = ctx.resolve_ip(metadata["host"])
for ruleset in ruleset_action:
if ctx.rule_providers[ruleset].match(metadata):
return ruleset_action[ruleset]
if metadata["dst_ip"] != "":
code = ctx.geoip(metadata["dst_ip"])
if code == "CN":
ctx.log('[Script] Geoip CN')
return "Domestic"
ctx.log('[Script] FINAL')
return "Others"
rule-providers:
Reject:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Reject.yaml
path: "./Rules/Reject"
interval: 86400
Special:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Special.yaml
path: "./Rules/Special"
interval: 86400
Netflix:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Netflix.yaml
path: "./Rules/Media/Netflix"
interval: 86400
Spotify:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Spotify.yaml
path: "./Rules/Media/Spotify"
interval: 86400
YouTube:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/YouTube.yaml
path: "./Rules/Media/YouTube"
interval: 86400
Bilibili:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Bilibili.yaml
path: "./Rules/Media/Bilibili"
interval: 86400
IQ:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/IQ.yaml
path: "./Rules/Media/IQI"
interval: 86400
IQIYI:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/IQIYI.yaml
path: "./Rules/Media/IQYI"
interval: 86400
Letv:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Letv.yaml
path: "./Rules/Media/Letv"
interval: 86400
Netease Music:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Netease%20Music.yaml
path: "./Rules/Media/Netease_Music"
interval: 86400
Tencent Video:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Tencent%20Video.yaml
path: "./Rules/Media/Tencent_Video"
interval: 86400
Youku:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Youku.yaml
path: "./Rules/Media/Youku"
interval: 86400
WeTV:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/WeTV.yaml
path: "./Rules/Media/WeTV"
interval: 86400
ABC:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/ABC.yaml
path: "./Rules/Media/ABC"
interval: 86400
Abema TV:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Abema%20TV.yaml
path: "./Rules/Media/Abema_TV"
interval: 86400
Amazon:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Amazon.yaml
path: "./Rules/Media/Amazon"
interval: 86400
Apple Music:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Apple%20Music.yaml
path: "./Rules/Media/Apple_Music"
interval: 86400
Apple News:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Apple%20News.yaml
path: "./Rules/Media/Apple_News"
interval: 86400
Apple TV:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Apple%20TV.yaml
path: "./Rules/Media/Apple_TV"
interval: 86400
Bahamut:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Bahamut.yaml
path: "./Rules/Media/Bahamut"
interval: 86400
BBC iPlayer:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/BBC%20iPlayer.yaml
path: "./Rules/Media/BBC_iPlayer"
interval: 86400
DAZN:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/DAZN.yaml
path: "./Rules/Media/DAZN"
interval: 86400
Discovery Plus:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Discovery%20Plus.yaml
path: "./Rules/Media/Discovery_Plus"
interval: 86400
Disney Plus:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Disney%20Plus.yaml
path: "./Rules/Media/Disney_Plus"
interval: 86400
encoreTVB:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/encoreTVB.yaml
path: "./Rules/Media/encoreTVB"
interval: 86400
F1 TV:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/F1%20TV.yaml
path: "./Rules/Media/F1_TV"
interval: 86400
Fox Now:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Fox%20Now.yaml
path: "./Rules/Media/Fox_Now"
interval: 86400
Fox+:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Fox%2B.yaml
path: "./Rules/Media/Fox+"
interval: 86400
HBO Go:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/HBO%20Go.yaml
path: "./Rules/Media/HBO_Go"
interval: 86400
HBO Max:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/HBO%20Max.yaml
path: "./Rules/Media/HBO_Max"
interval: 86400
Hulu Japan:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Hulu%20Japan.yaml
path: "./Rules/Media/Hulu_Japan"
interval: 86400
Hulu:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Hulu.yaml
path: "./Rules/Media/Hulu"
interval: 86400
Japonx:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Japonx.yaml
path: "./Rules/Media/Japonx"
interval: 86400
JOOX:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/JOOX.yaml
path: "./Rules/Media/JOOX"
interval: 86400
KKBOX:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/KKBOX.yaml
path: "./Rules/Media/KKBOX"
interval: 86400
KKTV:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/KKTV.yaml
path: "./Rules/Media/KKTV"
interval: 86400
Line TV:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Line%20TV.yaml
path: "./Rules/Media/Line_TV"
interval: 86400
myTV SUPER:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/myTV%20SUPER.yaml
path: "./Rules/Media/myTV_SUPER"
interval: 86400
Niconico:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Niconico.yaml
path: "./Rules/Media/Niconico"
interval: 86400
Pandora:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Pandora.yaml
path: "./Rules/Media/Pandora"
interval: 86400
PBS:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/PBS.yaml
path: "./Rules/Media/PBS"
interval: 86400
Pornhub:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Pornhub.yaml
path: "./Rules/Media/Pornhub"
interval: 86400
Soundcloud:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/Soundcloud.yaml
path: "./Rules/Media/Soundcloud"
interval: 86400
ViuTV:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Media/ViuTV.yaml
path: "./Rules/Media/ViuTV"
interval: 86400
Telegram:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Telegram.yaml
path: "./Rules/Telegram"
interval: 86400
Crypto:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Crypto.yaml
path: "./Rules/Crypto"
interval: 86400
Discord:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Discord.yaml
path: "./Rules/Discord"
interval: 86400
Steam:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Steam.yaml
path: "./Rules/Steam"
interval: 86400
Speedtest:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Speedtest.yaml
path: "./Rules/Speedtest"
interval: 86400
PayPal:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/PayPal.yaml
path: "./Rules/PayPal"
interval: 86400
Microsoft:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Microsoft.yaml
path: "./Rules/Microsoft"
interval: 86400
ChatGPT:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/ChatGPT.yaml
path: "./Rules/ChatGPT"
interval: 86400
PROXY:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Proxy.yaml
path: "./Rules/Proxy"
interval: 86400
Domestic:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Domestic.yaml
path: "./Rules/Domestic"
interval: 86400
Apple:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Apple.yaml
path: "./Rules/Apple"
interval: 86400
Google FCM:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Google%20FCM.yaml
path: "./Rules/Google FCM"
interval: 86400
Scholar:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Scholar.yaml
path: "./Rules/Scholar"
interval: 86400
Domestic IPs:
type: http
behavior: ipcidr
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Domestic%20IPs.yaml
path: "./Rules/Domestic_IPs"
interval: 86400
LAN:
type: http
behavior: classical
url: https://fastly.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/LAN.yaml
path: "./Rules/LAN"
interval: 86400

View File

@ -0,0 +1,180 @@
放行规则-ConnersHua(建议置顶并直连),ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/,Unbreak.yaml
放行规则-lhie1(建议置顶并直连),lhie1,classical,dler-io/Rules/master/Clash/Provider/,Special.yaml
放行规则-ACL4SSR(建议置顶并直连),ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/,UnBan.yaml
反劫持规则,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Guard/,Hijacking.yaml
国内IP白名单(By lhie1),lhie1,ipcidr,dler-io/Rules/master/Clash/Provider/,Domestic%20IPs.yaml,Domestic IPs.yaml
国内IP白名单,ConnersHua,ipcidr,DivineEngine/Profiles/master/Clash/RuleSet/Extra/,ChinaIP.yaml
国内域名白名单(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/,Domestic.yaml
国内域名白名单,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/,China.yaml
国内流媒体合集,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/,StreamingCN.yaml
国内流媒体国际版合集,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/,StreamingSE.yaml
国外常用网站合集(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/,Proxy.yaml
国外常用网站合集,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/,Global.yaml
国外流媒体合集,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/,Streaming.yaml
学术网站,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/,Scholar.yaml
广告规则(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/,Reject.yaml
广告规则,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Guard/,Advertising.yaml
微软服务,lhie1,classical,dler-io/Rules/master/Clash/Provider/,Microsoft.yaml
数字货币相关,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/,Cryptocurrency.yaml
隐私规则合集,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Guard/,Privacy.yaml
ABC,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,ABC.yaml
Abema TV,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Abema%20TV.yaml,Abema TV.yaml
AbemaTV(By ACL4SSR),ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,AbemaTV.yaml,AbemaTV-ACL4SSR.yaml
AbemaTV,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,AbemaTV.yaml
Adobe,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Adobe.yaml
All-4,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,All-4.yaml
Amazon(By ACL4SSR),ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Amazon.yaml,Amazon-ACL4SSR.yaml
Amazon,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Amazon.yaml
AmazonIp,ACL4SSR,ipcidr,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,AmazonIp.yaml
AppStore,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/,AppStore.yaml
AppStoreConnect,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/,AppStoreConnect.yaml
Apple FindMy,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/,FindMy.yaml
Apple Music,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/,Music.yaml
Apple News(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Apple%20News.yaml,Apple News.yaml
Apple News,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/,News.yaml
Apple SoftwareUpdate,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/,SoftwareUpdate.yaml
Apple TV(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Apple%20TV.yaml,Apple TV.yaml
Apple TV,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/,TV.yaml
Apple TestFlight,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/,TestFlight.yaml
Apple iCloud,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/,iCloud.yaml
Apple(By ACL4SSR),ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Apple.yaml,Apple-ACL4SSR.yaml
Apple(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/,Apple.yaml,Apple-lhie1.yaml
Apple,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/,Apple.yaml
BBC iPlayer,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,BBC iPlayer.yaml
BBC-iPlayer,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,BBC-iPlayer.yaml
Bahamut(By ACL4SSR),ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Bahamut.yaml,Bahamut-ACL4SSR.yaml
Bahamut(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Bahamut.yaml,Bahamut-lhie1.yaml
Bahamut,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,Bahamut.yaml
BanAD,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/,BanAD.yaml
BanEasyList,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/,BanEasyList.yaml
BanEasyListChina,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/,BanEasyListChina.yaml
BanEasyPrivacy,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/,BanEasyPrivacy.yaml
BanProgramAD,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/,BanProgramAD.yaml
Bilibili(By ACL4SSR),ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Bilibili.yaml,Bilibili-ACL4SSR.yaml
Bilibili,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Bilibili.yaml
Bilibili-Intl,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,bilibili-Intl.yaml
BilibiliHMT,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,BilibiliHMT.yaml
Blizzard(By ConnersHua),ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Game/,Blizzard.yaml,Blizzard-ConnersHua.yaml
Blizzard,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Blizzard.yaml
ChatGPT,lhie1,classical,dler-io/Rules/master/Clash/Provider/,ChatGPT.yaml
ChinaCompanyIp,ACL4SSR,ipcidr,ACL4SSR/ACL4SSR/master/Clash/Providers/,ChinaCompanyIp.yaml
ChinaDomain,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/,ChinaDomain.yaml
ChinaIp(By ACL4SSR),ACL4SSR,ipcidr,ACL4SSR/ACL4SSR/master/Clash/Providers/,ChinaIp.yaml,ChinaIp-ACL4SSR.yaml
ChinaMedia,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/,ChinaMedia.yaml
Chromecast,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Google/,Chromecast.yaml
DAZN(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,DAZN.yaml,DAZN-lhie1.yaml
DAZN,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,DAZN.yaml
Deezer,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Music/,Deezer.yaml
Developer,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Developer.yaml
Discord,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Game/,Discord.yaml
DiscoveryPlus,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,DiscoveryPlus.yaml
Disney Plus,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Disney%20Plus.yaml,Disney Plus.yaml
DisneyPlus(By ACL4SSR),ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,DisneyPlus.yaml,DisneyPlus-ACL4SSR.yaml
DisneyPlus,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,DisneyPlus.yaml
Download,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/,Download.yaml
EHGallery,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,EHGallery.yaml
Epic,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Epic.yaml
FOX,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,FOX.yaml
Fox Now,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Fox%20Now.yaml,Fox Now.yaml
Fox+,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Fox+.yaml
GFW地址,ConnersHua,ipcidr,DivineEngine/Profiles/master/Clash/RuleSet/Extra/,IP-Blackhole.yaml
Google,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Google.yaml
GoogleCN,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,GoogleCN.yaml
GoogleDrive,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Google/,GoogleDrive.yaml
GoogleFCM,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,GoogleFCM.yaml
GoogleSearch,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Google/,GoogleSearch.yaml
GoogleVoice,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Google/,GoogleVoice.yaml
HBO(By ACL4SSR),ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,HBO.yaml,HBO-ACL4SSR.yaml
HBO(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,HBO.yaml,HBO-lhie1.yaml
HBO,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,HBO.yaml
HBO-GO-HKG,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,HBO-GO-HKG.yaml
HWTV,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,HWTV.yaml
Himalaya,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Podcast/,Himalaya.yaml
Hulu Japan,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Hulu Japan.yaml
Hulu(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Hulu.yaml,Hulu-lhie1.yaml
Hulu,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,Hulu.yaml
Hulu-JPN,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,Hulu-JPN.yaml
ITV,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,ITV.yaml
Instagram,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Music/,Instagram.yaml
JOOX(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,JOOX.yaml,JOOX-lhie1.yaml
JOOX,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Music/,JOOX.yaml
Japonx,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Japonx.yaml
KKBOX(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,KKBOX.yaml,KKBOX-lhie1.yaml
KKBOX,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Music/,KKBOX.yaml
KKTV(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,KKTV.yaml,KKTV-lhie1.yaml
KKTV,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,KKTV.yaml
LINE-TV,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,LINE-TV.yaml
Letv,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Letv.yaml
LiTV,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,LiTV.yaml
Line TV,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Line%20TV.yaml,Line TV.yaml
LocalAreaNetwork,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/,LocalAreaNetwork.yaml
MOO,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,MOO.yaml
Microsoft(By ACL4SSR),ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Microsoft.yaml,Microsoft-ACL4SSR.yaml
My5,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,My5.yaml
NetEaseMusic,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,NetEaseMusic.yaml
Netease Music,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Netease%20Music.yaml,Netease Music.yaml
Netflix(By ACL4SSR),ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Netflix.yaml,Netflix-ACL4SSR.yaml
Netflix(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Netflix.yaml,Netflix-lhie1.yaml
Netflix,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,Netflix.yaml
Nintendo,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Game/,Nintendo.yaml
Now-E,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,Now-E.yaml
OneDrive(By ACL4SSR),ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,OneDrive.yaml,OneDrive-ACL4SSR.yaml
OneDrive,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Microsoft/,OneDrive.yaml
Origin,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Game/,Origin.yaml
PBS(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,PBS.yaml,PBS-lhie1.yaml
PBS,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,PBS.yaml
Pandora(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Pandora.yaml,Pandora-lhie1.yaml
Pandora,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Music/,Pandora.yaml
ParamountPlus,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,ParamountPlus.yaml
PayPal(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/,PayPal.yaml,PayPal-lhie1.yaml
PayPal,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/,PayPal.yaml
Peacock,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,Peacock.yaml
Porn,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Porn.yaml
Pornhub(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Pornhub.yaml,Pornhub-lhie1.yaml
Pornhub,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,Pornhub.yaml
Prime-Video,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,Prime-Video.yaml
ProxyGFWlist,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/,ProxyGFWlist.yaml
ProxyLite,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/,ProxyLite.yaml
ProxyMedia,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/,ProxyMedia.yaml
Scholar(By ACL4SSR),ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Scholar.yaml,Scholar-ACL4SSR.yaml
Siri,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/,Siri.yaml
Sony,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Sony.yaml
SoundCloud,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Music/,SoundCloud.yaml
Soundcloud(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Soundcloud.yaml,Soundcloud-lhie1.yaml
Speedtest,lhie1,classical,dler-io/Rules/master/Clash/Provider/,Speedtest.yaml
Spotify(By ACL4SSR),ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Spotify.yaml,Spotify-ACL4SSR.yaml
Spotify(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Spotify.yaml,Spotify-lhie1.yaml
Spotify,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Music/,Spotify.yaml
Steam(By ACL4SSR),ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Steam.yaml,Steam-ACL4SSR.yaml
Steam,lhie1,classical,dler-io/Rules/master/Clash/Provider/,Steam.yaml
SteamCN,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,SteamCN.yaml
TIDAL,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Music/,TIDAL.yaml
TaiwanGood,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,TaiwanGood.yaml
Telegram(By ACL4SSR),ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Telegram.yaml,Telegram-ACL4SSR.yaml
Telegram(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/,Telegram.yaml,Telegram-lhie1.yaml
Telegram,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Telegram/,Telegram.yaml
TelegramNL,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Telegram/,TelegramNL.yaml
TelegramSG,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Telegram/,TelegramSG.yaml
TelegramUS,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Telegram/,TelegramUS.yaml
Tencent Video,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Tencent%20Video.yaml,Tencent Video.yaml
TikTok,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,TikTok.yaml
Twitch,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Live/,Twitch.yaml
ViuTV(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,ViuTV.yaml,ViuTV-lhie1.yaml
ViuTV,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,ViuTV.yaml
WeTV,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,WeTV.yaml
Xbox,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Xbox.yaml
YouTube Music,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,YouTube%20Music.yaml,YouTube Music.yaml
YouTube(By ACL4SSR),ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,YouTube.yaml,YouTube-ACL4SSR.yaml
YouTube(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,YouTube.yaml,YouTube-lhie1.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
Youku,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,Youku.yaml
encoreTVB(By lhie1),lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,encoreTVB.yaml,encoreTVB-lhie1.yaml
encoreTVB,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,encoreTVB.yaml
iCloud-email,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Apple/,Mail.yaml
iQIYI,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,iQIYI.yaml
IQIYI,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,IQIYI.yaml
IQ,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,IQ.yaml
myTV SUPER,lhie1,classical,dler-io/Rules/master/Clash/Provider/Media/,myTV%20SUPER.yaml,myTV SUPER.yaml
myTV-SUPER,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,myTV-SUPER.yaml
niconico,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/StreamingMedia/Video/,niconico.yaml

View File

@ -0,0 +1,39 @@
默认附带用于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 神机规则 Pro,connershua_pro.ini,https://gist.githubusercontent.com/tindy2013/1fa08640a9088ac8652dbd40c5d2715b/raw/connershua_new.ini
lhie1 洞主规则(使用 Clash 分组规则),lhie1_clash.ini,https://gist.githubusercontent.com/vernesong/4c27ed54ab2a5fedd9c4011389ac11ed/raw/lhie1_clash.ini
lhie1 洞主规则完整版,lhie1_dler.ini,https://gist.githubusercontent.com/vernesong/4c27ed54ab2a5fedd9c4011389ac11ed/raw/lhie1_dler.ini
ACL4SSR 规则标准版,ACL4SSR.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR.ini
ACL4SSR 规则 AdblockPlus,ACL4SSR_AdblockPlus.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_AdblockPlus.ini
ACL4SSR 规则 BackCN,ACL4SSR_BackCN.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_BackCN.ini
ACL4SSR 规则 Mini,ACL4SSR_Mini.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Mini.ini
ACL4SSR 规则 Mini Fallback,ACL4SSR_Mini_Fallback.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Mini_Fallback.ini
ACL4SSR 规则 Mini MultiMode,ACL4SSR_Mini_MultiMode.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Mini_MultiMode.ini
ACL4SSR 规则 Mini NoAuto,ACL4SSR_Mini_NoAuto.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Mini_NoAuto.ini
ACL4SSR 规则 NoApple,ACL4SSR_NoApple.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_NoApple.ini
ACL4SSR 规则 NoAuto,ACL4SSR_NoAuto.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_NoAuto.ini
ACL4SSR 规则 NoAuto NoApple,ACL4SSR_NoAuto_NoApple.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_NoAuto_NoApple.ini
ACL4SSR 规则 NoAuto NoApple NoMicrosoft,ACL4SSR_NoAuto_NoApple_NoMicrosoft.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_NoAuto_NoApple_NoMicrosoft.ini
ACL4SSR 规则 NoMicrosoft,ACL4SSR_NoMicrosoft.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_NoMicrosoft.ini
ACL4SSR 规则 Online,ACL4SSR_Online.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online.ini
ACL4SSR 规则 Online AdblockPlus,ACL4SSR_Online_AdblockPlus.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_AdblockPlus.ini
ACL4SSR 规则 Online Full,ACL4SSR_Online_Full.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Full.ini
ACL4SSR 规则 Online Full AdblockPlus,ACL4SSR_Online_Full_AdblockPlus.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Full_AdblockPlus.ini
ACL4SSR 规则 Online Full Google,ACL4SSR_Online_Full_Google.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Full_Google.ini
ACL4SSR 规则 Online Full MultiMode,ACL4SSR_Online_Full_MultiMode.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Full_MultiMode.ini
ACL4SSR 规则 Online Full Netflix,ACL4SSR_Online_Full_Netflix.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Full_Netflix.ini
ACL4SSR 规则 Online Full NoAuto,ACL4SSR_Online_Full_NoAuto.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Full_NoAuto.ini
ACL4SSR 规则 Online Mini,ACL4SSR_Online_Mini.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini.ini
ACL4SSR 规则 Online Mini AdblockPlus,ACL4SSR_Online_Mini_AdblockPlus.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini_AdblockPlus.ini
ACL4SSR 规则 Online Mini Fallback,ACL4SSR_Online_Mini_Fallback.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini_Fallback.ini
ACL4SSR 规则 Online Mini MultiCountry,ACL4SSR_Online_Mini_MultiCountry.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini_MultiCountry.ini
ACL4SSR 规则 Online Mini MultiMode,ACL4SSR_Online_Mini_MultiMode.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini_MultiMode.ini
ACL4SSR 规则 Online Mini NoAuto,ACL4SSR_Online_Mini_NoAuto.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini_NoAuto.ini
ACL4SSR 规则 Online MultiCountry,ACL4SSR_Online_MultiCountry.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_MultiCountry.ini
ACL4SSR 规则 Online NoAuto,ACL4SSR_Online_NoAuto.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_NoAuto.ini
ACL4SSR 规则 Online NoReject,ACL4SSR_Online_NoReject.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_NoReject.ini
ACL4SSR 规则 WithChinaIp,ACL4SSR_WithChinaIp.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_WithChinaIp.ini
ACL4SSR 规则 WithChinaIp WithGFW,ACL4SSR_WithChinaIp_WithGFW.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_WithChinaIp_WithGFW.ini
ACL4SSR 规则 WithGFW,ACL4SSR_WithGFW.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_WithGFW.ini
eHpo1 规则,ehpo1_main.ini,https://gist.githubusercontent.com/tindy2013/1fa08640a9088ac8652dbd40c5d2715b/raw/ehpo1_main.ini

View File

@ -0,0 +1,111 @@
#!/bin/sh
ruby_read()
{
local Value RUBY_YAML_PARSE
if [ -z "$1" ] || [ -z "$2" ]; then
return
fi
RUBY_YAML_PARSE="Thread.new{Value = YAML.load_file('$1'); puts Value$2}.join"
if [ -n "$(echo "$2" |grep '.to_yaml' 2>/dev/null)" ]; then
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "$RUBY_YAML_PARSE" 2>/dev/null |sed '1d' 2>/dev/null
else
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "$RUBY_YAML_PARSE" 2>/dev/null
fi
}
ruby_read_hash()
{
local Value RUBY_YAML_PARSE
if [ -z "$1" ] || [ -z "$2" ]; then
return
fi
RUBY_YAML_PARSE="Thread.new{Value = $1; puts Value$2}.join"
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "$RUBY_YAML_PARSE" 2>/dev/null
}
ruby_edit()
{
local Value RUBY_YAML_PARSE
if [ -z "$1" ] || [ -z "$2" ]; then
return
fi
RUBY_YAML_PARSE="Thread.new{Value = YAML.load_file('$1'); Value$2=$3; File.open('$1','w') {|f| YAML.dump(Value, f)}}.join"
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "$RUBY_YAML_PARSE" 2>/dev/null
}
#数组覆盖
ruby_cover()
{
local Value Value_1 RUBY_YAML_PARSE
if [ -z "$1" ] || [ -z "$2" ]; then
return
fi
RUBY_YAML_PARSE="Thread.new{Value = YAML.load_file('$1'); if File::exist?('$3') then Value_1 = YAML.load_file('$3'); if not '$4'.empty? then Value$2=Value_1['$4']; else Value$2=Value_1 end else if not '$4'.empty? then Value.delete('$4'); end; end; File.open('$1','w') {|f| YAML.dump(Value, f)}}.join"
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "$RUBY_YAML_PARSE" 2>/dev/null
}
#hash增加
ruby_merge()
{
local Value Value_1 RUBY_YAML_PARSE
if [ -z "$1" ] || [ -z "$2" ]; then
return
fi
RUBY_YAML_PARSE="Thread.new{Value = YAML.load_file('$1'); Value_1 = YAML.load_file('$3'); Value$2.merge!(Value_1$4); File.open('$1','w') {|f| YAML.dump(Value, f)}}.join"
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "$RUBY_YAML_PARSE" 2>/dev/null
}
#hash去重
ruby_uniq()
{
local Value RUBY_YAML_PARSE
if [ -z "$1" ] || [ -z "$2" ]; then
return
fi
RUBY_YAML_PARSE="Thread.new{Value = YAML.load_file('$1'); Value$2=Value$2.uniq; File.open('$1','w') {|f| YAML.dump(Value, f)}}.join"
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "$RUBY_YAML_PARSE" 2>/dev/null
}
#数组指定位置前添加一组值(不要key)
ruby_arr_add_file()
{
local Value Value_1 RUBY_YAML_PARSE
if [ -z "$1" ] || [ -z "$2" ]; then
return
fi
RUBY_YAML_PARSE="Thread.new{Value = YAML.load_file('$1'); Value_1 = YAML.load_file('$4').reverse!; Value_1$5.each{|x| Value$2.insert($3,x)}; Value$2=Value$2.uniq; File.open('$1','w') {|f| YAML.dump(Value, f)}}.join"
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "$RUBY_YAML_PARSE" 2>/dev/null
}
#数组开头添加一组值(含key)
ruby_arr_head_add_file()
{
local Value Value_1 RUBY_YAML_PARSE
if [ -z "$1" ] || [ -z "$2" ]; then
return
fi
RUBY_YAML_PARSE="Thread.new{Value = YAML.load_file('$1'); Value_1 = YAML.load_file('$3'); Value$2=(Value_1$4+Value$2).uniq; File.open('$1','w') {|f| YAML.dump(Value, f)}}.join"
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "$RUBY_YAML_PARSE" 2>/dev/null
}
#数组指定位置前增加值
ruby_arr_insert()
{
local Value RUBY_YAML_PARSE
if [ -z "$1" ] || [ -z "$2" ]; then
return
fi
RUBY_YAML_PARSE="Thread.new{Value = YAML.load_file('$1'); Value$2=Value$2.insert($3,'$4').uniq; File.open('$1','w') {|f| YAML.dump(Value, f)}}.join"
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "$RUBY_YAML_PARSE" 2>/dev/null
}
ruby_read_hash_arr()
{
local Value RUBY_YAML_PARSE
if [ -z "$1" ] || [ -z "$2" ]; then
return
fi
RUBY_YAML_PARSE="Thread.new{Value = YAML.load_file('$1'); Value$2.each do |i| puts i$3 end}.join"
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "$RUBY_YAML_PARSE" 2>/dev/null
}

View File

@ -0,0 +1 @@
clash.razord.top

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,20 @@
<!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="#f4f5f6" />
<meta name="description" content="Clash web port" />
<!--meta name="external-controller" content="http://secret@example.com:9090"-->
<title>Clash</title>
<script type="module" crossorigin src="./assets/index-a1967476.js"></script>
<link rel="modulepreload" crossorigin href="./assets/vendor-0606363c.js">
<link rel="stylesheet" href="./assets/index-9ebfe719.css">
<link rel="manifest" href="./manifest.webmanifest"><script id="vite-plugin-pwa:inline-sw">if('serviceWorker' in navigator) {window.addEventListener('load', () => {navigator.serviceWorker.register('./sw.js', { scope: './' })})}</script></head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>

View File

@ -0,0 +1 @@
{"name":"Clash Dashboard","short_name":"Clash Dashboard","start_url":"/","display":"standalone","background_color":"#ffffff","lang":"en","scope":"./","icons":[{"src":"//cdn.jsdelivr.net/gh/Dreamacro/clash-dashboard/src/assets/Icon.png","sizes":"512x512","type":"image/png"}]}

View File

@ -0,0 +1 @@
if(!self.define){let e,s={};const n=(n,i)=>(n=new URL(n+".js",i).href,s[n]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()})).then((()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didnt register its module`);return e})));self.define=(i,t)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(s[r])return;let o={};const l=e=>n(e,r),d={module:{uri:r},exports:o,require:l};s[r]=Promise.all(i.map((e=>d[e]||l(e)))).then((e=>(t(...e),o)))}}define(["./workbox-e0782b83"],(function(e){"use strict";self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()})),e.precacheAndRoute([{url:"assets/index-9ebfe719.css",revision:null},{url:"assets/index-a1967476.js",revision:null},{url:"assets/vendor-0606363c.js",revision:null},{url:"index.html",revision:"ac6496dc8e5aad8b0ae34cda277c7b21"},{url:"manifest.webmanifest",revision:"d3dd1da0aa7614180924343e65244285"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}));

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
yacd.haishan.me

View File

@ -0,0 +1,12 @@
# for netlify hosting
# https://docs.netlify.com/routing/headers/#syntax-for-the-headers-file
/*
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Referrer-Policy: same-origin
/*.css
Cache-Control: public, max-age=31536000, immutable
/*.js
Cache-Control: public, max-age=31536000, immutable

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -0,0 +1 @@
._root_165du_1,._section_165du_2{display:grid;grid-template-columns:repeat(auto-fill,minmax(345px,1fr));max-width:900px;gap:5px}@media screen and (min-width: 30em){._root_165du_1,._section_165du_2{gap:15px}}._root_165du_1,._section_165du_2{padding:6px 15px 10px}@media screen and (min-width: 30em){._root_165du_1,._section_165du_2{padding:10px 40px 15px}}._wrapSwitch_165du_26{height:40px;display:flex;align-items:center}._sep_165du_32{max-width:900px;padding:0 15px}@media screen and (min-width: 30em){._sep_165du_32{padding:0 40px}}._sep_165du_32>div{border-top:1px dashed #373737}._label_165du_45{padding:11px 0}._fieldset_1ghjp_1{margin:0;padding:0;border:0;display:flex;flex-wrap:wrap}._input_1ghjp_9+._cnt_1ghjp_9{border:1px solid transparent;border-radius:8px;cursor:pointer;margin-right:5px;margin-bottom:5px}._input_1ghjp_9:focus+._cnt_1ghjp_9{border-color:#387cec}._input_1ghjp_9:checked+._cnt_1ghjp_9{border-color:#387cec}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
.react-tabs{-webkit-tap-highlight-color:transparent}.react-tabs__tab-list{margin:0 0 10px;padding:0 30px}.react-tabs__tab{display:inline-flex;align-items:center;border:1px solid transparent;border-radius:5px;bottom:-1px;position:relative;list-style:none;padding:6px 10px;cursor:pointer;font-size:1.2em;opacity:.5}.react-tabs__tab--selected{opacity:1}.react-tabs__tab--disabled{color:GrayText;cursor:default}.react-tabs__tab:focus{border-color:#0188fe;outline:none}.react-tabs__tab:focus:after{content:"";position:absolute}.react-tabs__tab-panel{display:none}.react-tabs__tab-panel--selected{display:block}._placeHolder_12xws_1{height:100%;display:flex;align-items:center;justify-content:center;color:var(--color-background);opacity:.1}._connQty_12xws_10{font-family:var(--font-normal);font-size:.75em;margin-left:3px;padding:2px 7px;display:inline-flex;justify-content:center;align-items:center;background-color:var(--bg-near-transparent);border-radius:30px}._inputWrapper_12xws_22{margin:0 30px;width:100%;max-width:350px;justify-self:flex-end}._input_12xws_22{-webkit-appearance:none;background-color:var(--color-input-bg);background-image:none;border-radius:18px;border:1px solid var(--color-input-border);box-sizing:border-box;color:#c1c1c1;display:inline-block;font-size:inherit;height:36px;outline:none;padding:0 15px;transition:border-color .2s cubic-bezier(.645,.045,.355,1);width:100%}._tr_daq0k_1{display:grid;grid-template-columns:repeat(var(--col-count, 11),minmax(-webkit-max-content,auto));grid-template-columns:repeat(var(--col-count, 11),minmax(max-content,auto))}._th_daq0k_6{padding:8px 10px;height:50px;background:var(--color-background);position:-webkit-sticky;position:sticky;top:0;font-size:.8em;text-align:center;-webkit-user-select:none;user-select:none;display:flex;align-items:center;justify-content:space-between}._th_daq0k_6:hover{color:var(--color-text-highlight)}._td_daq0k_23{padding:8px 13px;font-size:.9em;font-family:var(--font-normal)}._td_daq0k_23._odd_daq0k_29{background:var(--color-row-odd)}._du_daq0k_34{text-align:right}._sortIconContainer_daq0k_38{display:inline-flex;margin-left:10px;width:16px;height:16px}._rotate180_daq0k_45{-webkit-transform:rotate(180deg);transform:rotate(180deg)}._overlay_148w6_1{background-color:#0009}._cnt_148w6_5{background-color:var(--bg-modal);color:var(--color-text);max-width:300px;line-height:1.4;-webkit-transform:translate(-50%,-50%) scale(1.2);transform:translate(-50%,-50%) scale(1.2);opacity:.6;transition:all .3s ease}._afterOpen_148w6_15{opacity:1;-webkit-transform:translate(-50%,-50%) scale(1);transform:translate(-50%,-50%) scale(1)}._btngrp_148w6_20{display:flex;align-items:center;justify-content:center;margin-top:30px}

View File

@ -0,0 +1 @@
import{j as e,b,i as y,r as l}from"./index-3e6aad90.js";const E="_spining_4i8sg_1",F="_spining_keyframes_4i8sg_1",M={spining:E,spining_keyframes:F},{useState:j}=y;function B({children:s}){return e("span",{className:M.spining,children:s})}const H={right:10,bottom:10},L=({children:s,...n})=>e("button",{type:"button",...n,className:"rtf--ab",children:s}),v=({children:s,...n})=>e("button",{type:"button",className:"rtf--mb",...n,children:s}),O={bottom:24,right:24},R=({event:s="hover",style:n=O,alwaysShowTitle:o=!1,children:f,icon:g,mainButtonStyles:h,onClick:p,text:d,..._})=>{const[a,r]=j(!1),c=o||!a,u=()=>r(!0),m=()=>r(!1),k=()=>s==="hover"&&u(),x=()=>s==="hover"&&m(),N=t=>p?p(t):(t.persist(),s==="click"?a?m():u():null),$=(t,i)=>{t.persist(),r(!1),setTimeout(()=>{i(t)},1)},C=()=>l.Children.map(f,(t,i)=>l.isValidElement(t)?b("li",{className:`rtf--ab__c ${"top"in n?"top":""}`,children:[l.cloneElement(t,{"data-testid":`action-button-${i}`,"aria-label":t.props.text||`Menu button ${i+1}`,"aria-hidden":c,tabIndex:a?0:-1,...t.props,onClick:I=>{t.props.onClick&&$(I,t.props.onClick)}}),t.props.text&&e("span",{className:`${"right"in n?"right":""} ${o?"always-show":""}`,"aria-hidden":c,children:t.props.text})]}):null);return e("ul",{onMouseEnter:k,onMouseLeave:x,className:`rtf ${a?"open":"closed"}`,"data-testid":"fab",style:n,..._,children:b("li",{className:"rtf--mb__c",children:[e(v,{onClick:N,style:h,"data-testid":"main-button",role:"button","aria-label":"Floating menu",tabIndex:0,children:g}),d&&e("span",{className:`${"right"in n?"right":""} ${o?"always-show":""}`,"aria-hidden":c,children:d}),e("ul",{children:C()})]})})};export{L as A,R as F,B as I,H as p};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
._RuleSearch_1oz2t_1{padding:0 40px 5px}._RuleSearchContainer_1oz2t_5{position:relative;height:40px}._inputWrapper_1oz2t_10{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);left:0;width:100%}._input_1oz2t_10{-webkit-appearance:none;background-color:var(--color-input-bg);background-image:none;border-radius:20px;border:1px solid var(--color-input-border);box-sizing:border-box;color:#c1c1c1;display:inline-block;font-size:inherit;height:40px;outline:none;padding:0 15px 0 35px;transition:border-color .2s cubic-bezier(.645,.045,.355,1);width:100%}._iconWrapper_1oz2t_35{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);left:10px;display:flex;justify-content:center;align-items:center}._logMeta_7a1x3_1{display:flex;align-items:center;flex-wrap:wrap;font-size:.9em}._logType_7a1x3_8{color:#eee;flex-shrink:0;text-align:center;width:66px;border-radius:100px;padding:3px 5px;margin:0 8px}._logTime_7a1x3_18{flex-shrink:0;color:#999;font-size:14px}._logText_7a1x3_24{flex-shrink:0;display:flex;font-family:Roboto Mono,Menlo,monospace;align-items:center;padding:8px 0;width:100%;white-space:pre;overflow:auto}._logsWrapper_7a1x3_37{margin:0;padding:0;color:var(--color-text)}._logsWrapper_7a1x3_37 .log{padding:10px 40px;background:var(--color-background)}._logsWrapper_7a1x3_37 .log.even{background:var(--color-background)}._logPlaceholder_7a1x3_51{display:flex;flex-direction:column;align-items:center;justify-content:center;color:#2d2d30}._logPlaceholder_7a1x3_51 div:nth-child(2){color:var(--color-text-secondary);font-size:1.4em;opacity:.6}._logPlaceholderIcon_7a1x3_64{opacity:.3}._search_7a1x3_68{max-width:1000px}

View File

@ -0,0 +1 @@
import{r as m,R as f,k as d,j as n,b as g,e as b,J as P,K as R,y as L,L as N,u as w,C as z,S as C,N as W,O,h as j,P as k,i as I,c as E}from"./index-3e6aad90.js";import{a as $,F}from"./index.esm-37f2c08f.js";import{r as M,s as A,f as B}from"./logs-08774dd8.js";import{d as D}from"./debounce-c1ba2006.js";import{u as H}from"./useRemainingViewPortHeight-175c2a6c.js";import{F as K,p as q}from"./Fab-169bb281.js";import{P as J,a as V}from"./play-30aef65c.js";function v(){return v=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},v.apply(this,arguments)}function Y(e,r){if(e==null)return{};var t=G(e,r),o,a;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a<s.length;a++)o=s[a],!(r.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(e,o)&&(t[o]=e[o])}return t}function G(e,r){if(e==null)return{};var t={},o=Object.keys(e),a,s;for(s=0;s<o.length;s++)a=o[s],!(r.indexOf(a)>=0)&&(t[a]=e[a]);return t}var x=m.forwardRef(function(e,r){var t=e.color,o=t===void 0?"currentColor":t,a=e.size,s=a===void 0?24:a,l=Y(e,["color","size"]);return f.createElement("svg",v({ref:r,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),f.createElement("circle",{cx:"11",cy:"11",r:"8"}),f.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}))});x.propTypes={color:d.string,size:d.oneOfType([d.string,d.number])};x.displayName="Search";const Q=x,U="_RuleSearch_1oz2t_1",X="_RuleSearchContainer_1oz2t_5",Z="_inputWrapper_1oz2t_10",ee="_input_1oz2t_10",te="_iconWrapper_1oz2t_35",p={RuleSearch:U,RuleSearchContainer:X,inputWrapper:Z,input:ee,iconWrapper:te};function oe({dispatch:e,searchText:r,updateSearchText:t}){const[o,a]=m.useState(r),s=m.useCallback(i=>{e(t(i))},[e,t]),l=m.useMemo(()=>D(s,300),[s]),h=i=>{a(i.target.value),l(i.target.value)};return n("div",{className:p.RuleSearch,children:g("div",{className:p.RuleSearchContainer,children:[n("div",{className:p.inputWrapper,children:n("input",{type:"text",value:o,onChange:h,className:p.input})}),n("div",{className:p.iconWrapper,children:n(Q,{size:20})})]})})}const re=e=>({searchText:P(e),updateSearchText:R}),ae=b(re)(oe),ne="_logMeta_7a1x3_1",se="_logType_7a1x3_8",ce="_logTime_7a1x3_18",ie="_logText_7a1x3_24",le="_logsWrapper_7a1x3_37",pe="_logPlaceholder_7a1x3_51",ge="_logPlaceholderIcon_7a1x3_64",he="_search_7a1x3_68",c={logMeta:ne,logType:se,logTime:ce,logText:ie,logsWrapper:le,logPlaceholder:pe,logPlaceholderIcon:ge,search:he},{useCallback:S,memo:ue,useEffect:de}=I,_=30,me={debug:"#28792c",info:"var(--bg-log-info-tag)",warning:"#b99105",error:"#c11c1c"};function fe({time:e,even:r,payload:t,type:o}){const a=E({even:r},"log");return n("div",{className:a,children:g("div",{className:c.logMeta,children:[n("div",{className:c.logTime,children:e}),n("div",{className:c.logType,style:{backgroundColor:me[o]},children:o}),n("div",{className:c.logText,children:t})]})})}function _e(e,r){return r[e].id}const ve=ue(({index:e,style:r,data:t})=>{const o=t[e];return n("div",{style:r,children:n(fe,{...o})})},$);function xe({dispatch:e,logLevel:r,apiConfig:t,logs:o,logStreamingPaused:a}){const s=L(),l=S(()=>{a?M({...t,logLevel:r}):A(),s.app.updateAppConfig("logStreamingPaused",!a)},[t,r,a,s.app]),h=S(T=>e(N(T)),[e]);de(()=>{B({...t,logLevel:r},h)},[t,r,h]);const[i,y]=H(),{t:u}=w();return g("div",{children:[n(z,{title:u("Logs")}),n("div",{className:c.search,children:n(ae,{})}),n("div",{ref:i,style:{paddingBottom:_},children:o.length===0?g("div",{className:c.logPlaceholder,style:{height:y-_},children:[n("div",{className:c.logPlaceholderIcon,children:n(C,{width:200,height:200})}),n("div",{children:u("no_logs")})]}):g("div",{className:c.logsWrapper,children:[n(F,{height:y-_,width:"100%",itemCount:o.length,itemSize:80,itemData:o,itemKey:_e,children:ve}),n(K,{icon:a?n(J,{size:16}):n(V,{size:16}),mainButtonStyles:a?{background:"#e74c3c"}:{},style:q,text:u(a?"Resume Refresh":"Pause Refresh"),onClick:l})]})})]})}const ye=e=>({logs:W(e),logLevel:O(e),apiConfig:j(e),logStreamingPaused:k(e)}),we=b(ye)(xe);export{we as default};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
._FlexCenter_1380a_1{display:flex;justify-content:center;align-items:center}._header_1y9js_1{display:flex;align-items:center}._header_1y9js_1:focus{outline:none}._header_1y9js_1 ._arrow_1y9js_8{display:inline-flex;-webkit-transform:rotate(0deg);transform:rotate(0);transition:-webkit-transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s}._header_1y9js_1 ._arrow_1y9js_8._isOpen_1y9js_13{-webkit-transform:rotate(180deg);transform:rotate(180deg)}._header_1y9js_1 ._arrow_1y9js_8:focus{outline:var(--color-focus-blue) solid 1px}._btn_1y9js_20{margin-left:5px}._qty_1y9js_25{font-family:var(--font-normal);font-size:.75em;margin-left:3px;padding:2px 7px;display:inline-flex;justify-content:center;align-items:center;background-color:var(--bg-near-transparent);border-radius:30px}._header_5pmv2_1{margin-bottom:12px}._groupHead_5pmv2_5{display:flex;flex-wrap:wrap;align-items:center}._action_5pmv2_11{margin:0 5px}._proxy_ryc3j_1{margin:3px;padding:5px;position:relative;border-radius:8px;overflow:hidden;display:flex;flex-direction:column;justify-content:space-between;outline:none;border:1px solid transparent;max-width:200px;background-color:var(--color-bg-proxy)}._proxy_ryc3j_1:focus{border:1px solid var(--color-focus-blue)}@media screen and (min-width: 30em){._proxy_ryc3j_1{min-width:200px;border-radius:10px;padding:10px}}._proxy_ryc3j_1._now_ryc3j_25{background-color:var(--color-focus-blue);color:#ddd}._proxy_ryc3j_1._error_ryc3j_29{opacity:.5}._proxy_ryc3j_1._selectable_ryc3j_32{transition:-webkit-transform .2s ease-in-out;transition:transform .2s ease-in-out;transition:transform .2s ease-in-out,-webkit-transform .2s ease-in-out;cursor:pointer}._proxy_ryc3j_1._selectable_ryc3j_32:hover{border-color:hsl(0deg,0%,var(--card-hover-border-lightness))}._proxyType_ryc3j_40{font-family:var(--font-mono);font-size:.6em;margin-right:3px}@media screen and (min-width: 30em){._proxyType_ryc3j_40{font-size:.85em}}._row_ryc3j_51{display:flex;align-items:center;justify-content:space-between}._proxyName_ryc3j_57{width:100%;margin-bottom:5px;font-size:.85em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}._proxySmall_ryc3j_66{--size: 13px;width:var(--size);height:var(--size);border-radius:50%;position:relative}._proxySmall_ryc3j_66._now_ryc3j_25{--size: 15px}._proxySmall_ryc3j_66._now_ryc3j_25:before{--size-dot: 7px;content:"";position:absolute;width:var(--size-dot);height:var(--size-dot);background-color:#fff;border:1px solid var(--color-proxy-dot-selected-ind-bo);border-radius:4px;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}._proxySmall_ryc3j_66._selectable_ryc3j_32{transition:-webkit-transform .1s ease-in-out;transition:transform .1s ease-in-out;transition:transform .1s ease-in-out,-webkit-transform .1s ease-in-out;cursor:pointer}._proxySmall_ryc3j_66._selectable_ryc3j_32:hover{-webkit-transform:scale(1.2);transform:scale(1.2)}._proxyLatency_pw0sa_1{border-radius:20px;color:#eee;font-size:.6em}@media screen and (min-width: 30em){._proxyLatency_pw0sa_1{font-size:.85em}}._list_1oy7w_1{display:flex;flex-wrap:wrap;margin:8px 0 8px -3px}._listSummaryView_1oy7w_8{margin:14px 0;display:grid;grid-template-columns:repeat(auto-fill,13px);grid-gap:10px;place-items:center;max-width:900px}._updatedAt_919yi_1{margin-bottom:12px}._updatedAt_919yi_1 small{color:#777}._main_919yi_8{padding:10px 15px}@media screen and (min-width: 30em){._main_919yi_8{padding:10px 40px}}._head_919yi_17{display:flex;align-items:center;flex-wrap:wrap}._action_919yi_23{margin:0 5px;display:grid;grid-template-columns:auto auto;gap:10px;place-items:center}._refresh_919yi_31{display:flex;justify-content:center;align-items:center;cursor:pointer}._labeledInput_cmki0_1{max-width:85vw;width:400px;display:flex;justify-content:space-between;align-items:center;font-size:13px;padding:13px 0}hr{height:1px;background-color:var(--color-separator);border:none;outline:none;margin:1rem 0px}._overlay_uuk3b_1{background-color:#0009}._cnt_uuk3b_5{position:absolute;background-color:var(--bg-modal);color:var(--color-text);line-height:1.4;opacity:.6;transition:all .3s ease;-webkit-transform:translate(-50%,-50%) scale(1.2);transform:translate(-50%,-50%) scale(1.2);box-shadow:#0000001f 0 4px 4px,#0000003d 0 16px 32px}._afterOpen_uuk3b_16{opacity:1;-webkit-transform:translate(-50%,-50%) scale(1);transform:translate(-50%,-50%) scale(1)}._topBar_16fpp_1{position:-webkit-sticky;position:sticky;top:0;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;z-index:1;background-color:var(--color-background2);-webkit-backdrop-filter:blur(36px);backdrop-filter:blur(36px)}._topBarRight_16fpp_13{display:flex;align-items:center;flex-wrap:wrap;flex:1;justify-content:flex-end;margin-right:20px}._textFilterContainer_16fpp_22{max-width:350px;min-width:150px;flex:1;margin-right:8px}._group_16fpp_29{padding:10px 15px}@media screen and (min-width: 30em){._group_16fpp_29{padding:10px 40px}}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
._RuleProviderItem_12aid_1{display:grid;grid-template-columns:40px 1fr 46px;height:100%}._left_12aid_7{display:inline-flex;align-items:center;color:var(--color-text-secondary);opacity:.4}._middle_12aid_14{display:grid;gap:6px;grid-template-rows:1fr auto auto;align-items:center}._gray_12aid_21{color:#777}._action_12aid_25{display:grid;gap:4px;grid-template-columns:auto 1fr;align-items:center}._refreshBtn_12aid_32{padding:5px}._rule_1kxgd_1{display:flex;align-items:center;padding:6px 15px}@media screen and (min-width: 30em){._rule_1kxgd_1{padding:10px 40px}}._left_1kxgd_12{width:40px;padding-right:15px;color:var(--color-text-secondary);opacity:.4}._a_1kxgd_19{display:flex;align-items:center;font-size:12px;opacity:.8}._b_1kxgd_26{padding:10px 0;font-family:Roboto Mono,Menlo,monospace;font-size:16px}@media screen and (min-width: 30em){._b_1kxgd_26{font-size:19px}}._type_1kxgd_37{width:110px}._header_n1m95_1{display:grid;grid-template-columns:1fr minmax(auto,330px);align-items:center;padding-right:15px}@media screen and (min-width: 30em){._header_n1m95_1{padding-right:40px}}._RuleProviderItemWrapper_n1m95_17{padding:6px 15px}@media screen and (min-width: 30em){._RuleProviderItemWrapper_n1m95_17{padding:10px 40px}}

View File

@ -0,0 +1 @@
._select_13zm8_1{height:40px;line-height:1.5;width:100%;padding-left:8px;-webkit-appearance:none;appearance:none;background-color:var(--color-input-bg);color:var(--color-text);padding-right:20px;border-radius:4px;border:1px solid var(--color-input-border);background-image:url(data:image/svg+xml,%0A%20%20%20%20%3Csvg%20width%3D%228%22%20height%3D%2224%22%20viewBox%3D%220%200%208%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%20%20%3Cpath%20d%3D%22M4%207L7%2011H1L4%207Z%22%20fill%3D%22%23999999%22%20%2F%3E%0A%20%20%20%20%20%20%3Cpath%20d%3D%22M4%2017L1%2013L7%2013L4%2017Z%22%20fill%3D%22%23999999%22%20%2F%3E%0A%20%20%20%20%3C%2Fsvg%3E%0A%20%20);background-position:right 8px center;background-repeat:no-repeat}._select_13zm8_1:hover,._select_13zm8_1:focus{border-color:#343434;outline:none!important;color:var(--color-text-highlight);background-image:var(--select-bg-hover)}._select_13zm8_1:focus{box-shadow:#4299e199 0 0 0 3px}._select_13zm8_1 option{background-color:var(--color-background)}

View File

@ -0,0 +1 @@
import{j as s}from"./index-3e6aad90.js";const o="_select_13zm8_1",r={select:o};function i({options:t,selected:c,onChange:l}){return s("select",{className:r.select,value:c,onChange:l,children:t.map(([e,n])=>s("option",{value:e,children:n},e))})}export{i as S};

View File

@ -0,0 +1 @@
import{r as g,R as c,k as i,c as d,j as l,V as h,i as m}from"./index-3e6aad90.js";import{d as v}from"./debounce-c1ba2006.js";function p(){return p=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},p.apply(this,arguments)}function x(t,n){if(t==null)return{};var e=_(t,n),o,r;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)o=a[r],!(n.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(e[o]=t[o])}return e}function _(t,n){if(t==null)return{};var e={},o=Object.keys(t),r,a;for(a=0;a<o.length;a++)r=o[a],!(n.indexOf(r)>=0)&&(e[r]=t[r]);return e}var u=g.forwardRef(function(t,n){var e=t.color,o=e===void 0?"currentColor":e,r=t.size,a=r===void 0?24:r,s=x(t,["color","size"]);return c.createElement("svg",p({ref:n,xmlns:"http://www.w3.org/2000/svg",width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},s),c.createElement("polyline",{points:"23 4 23 10 17 10"}),c.createElement("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"}))});u.propTypes={color:i.string,size:i.oneOfType([i.string,i.number])};u.displayName="RotateCw";const b=u,y="_rotate_1dspl_1",R="_isRotating_1dspl_5",w="_rotating_1dspl_1",f={rotate:y,isRotating:R,rotating:w};function $(t){const n=t.size||16,e=d(f.rotate,{[f.isRotating]:t.isRotating});return l("span",{className:e,children:l(b,{size:n})})}const{useCallback:O,useState:j,useMemo:T}=m;function C(t){const[,n]=h(t),[e,o]=j(""),r=T(()=>v(n,300),[n]);return[O(s=>{o(s.target.value),r(s.target.value)},[r]),e]}const k="_input_16a1f_1",z={input:k};function L(t){const[n,e]=C(t.textAtom);return l("input",{className:z.input,type:"text",value:e,onChange:n,placeholder:t.placeholder})}export{$ as R,L as T,b as a};

View File

@ -0,0 +1 @@
._rotate_1dspl_1{display:inline-flex}._isRotating_1dspl_5{-webkit-animation:_rotating_1dspl_1 3s infinite linear;animation:_rotating_1dspl_1 3s infinite linear;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}@-webkit-keyframes _rotating_1dspl_1{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes _rotating_1dspl_1{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}._input_16a1f_1{-webkit-appearance:none;background-color:var(--color-input-bg);background-image:none;border-radius:20px;border:1px solid var(--color-input-border);box-sizing:border-box;color:#c1c1c1;display:inline-block;font-size:inherit;outline:none;padding:8px 15px;transition:border-color .2s cubic-bezier(.645,.045,.355,1);width:100%}._input_16a1f_1:focus{border:1px solid var(--color-focus-blue)}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
import{r as c,R as l,k as a}from"./index-3e6aad90.js";function s(){return s=Object.assign||function(r){for(var o=1;o<arguments.length;o++){var t=arguments[o];for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e])}return r},s.apply(this,arguments)}function v(r,o){if(r==null)return{};var t=u(r,o),e,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(n=0;n<i.length;n++)e=i[n],!(o.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(r,e)&&(t[e]=r[e])}return t}function u(r,o){if(r==null)return{};var t={},e=Object.keys(r),n,i;for(i=0;i<e.length;i++)n=e[i],!(o.indexOf(n)>=0)&&(t[n]=r[n]);return t}var p=c.forwardRef(function(r,o){var t=r.color,e=t===void 0?"currentColor":t,n=r.size,i=n===void 0?24:n,f=v(r,["color","size"]);return l.createElement("svg",s({ref:o,xmlns:"http://www.w3.org/2000/svg",width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},f),l.createElement("polyline",{points:"6 9 12 15 18 9"}))});p.propTypes={color:a.string,size:a.oneOfType([a.string,a.number])};p.displayName="ChevronDown";const h=p;export{h as C};

View File

@ -0,0 +1 @@
function O(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}var M=typeof global=="object"&&global&&global.Object===Object&&global;const R=M;var w=typeof self=="object"&&self&&self.Object===Object&&self,B=R||w||Function("return this")();const W=B;var F=function(){return W.Date.now()};const S=F;var G=/\s/;function U(e){for(var n=e.length;n--&&G.test(e.charAt(n)););return n}var _=/^\s+/;function D(e){return e&&e.slice(0,U(e)+1).replace(_,"")}var H=W.Symbol;const y=H;var L=Object.prototype,X=L.hasOwnProperty,q=L.toString,g=y?y.toStringTag:void 0;function z(e){var n=X.call(e,g),i=e[g];try{e[g]=void 0;var o=!0}catch{}var f=q.call(e);return o&&(n?e[g]=i:delete e[g]),f}var J=Object.prototype,K=J.toString;function Q(e){return K.call(e)}var V="[object Null]",Y="[object Undefined]",$=y?y.toStringTag:void 0;function Z(e){return e==null?e===void 0?Y:V:$&&$ in Object(e)?z(e):Q(e)}function ee(e){return e!=null&&typeof e=="object"}var ne="[object Symbol]";function te(e){return typeof e=="symbol"||ee(e)&&Z(e)==ne}var E=0/0,re=/^[-+]0x[0-9a-f]+$/i,ie=/^0b[01]+$/i,oe=/^0o[0-7]+$/i,ae=parseInt;function k(e){if(typeof e=="number")return e;if(te(e))return E;if(O(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=O(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=D(e);var i=ie.test(e);return i||oe.test(e)?ae(e.slice(2),i?2:8):re.test(e)?E:+e}var fe="Expected a function",ce=Math.max,ue=Math.min;function se(e,n,i){var o,f,s,u,r,c,d=0,v=!1,l=!1,T=!0;if(typeof e!="function")throw new TypeError(fe);n=k(n)||0,O(i)&&(v=!!i.leading,l="maxWait"in i,s=l?ce(k(i.maxWait)||0,n):s,T="trailing"in i?!!i.trailing:T);function j(t){var a=o,b=f;return o=f=void 0,d=t,u=e.apply(b,a),u}function N(t){return d=t,r=setTimeout(m,n),v?j(t):u}function P(t){var a=t-c,b=t-d,I=n-a;return l?ue(I,s-b):I}function h(t){var a=t-c,b=t-d;return c===void 0||a>=n||a<0||l&&b>=s}function m(){var t=S();if(h(t))return x(t);r=setTimeout(m,P(t))}function x(t){return r=void 0,T&&o?j(t):(o=f=void 0,u)}function A(){r!==void 0&&clearTimeout(r),d=0,o=c=f=r=void 0}function C(){return r===void 0?u:x(S())}function p(){var t=S(),a=h(t);if(o=arguments,f=this,c=t,a){if(r===void 0)return N(c);if(l)return clearTimeout(r),r=setTimeout(m,n),j(c)}return r===void 0&&(r=setTimeout(m,n)),u}return p.cancel=A,p.flush=C,p}export{se as d};

View File

@ -0,0 +1 @@
const e={Overview:"Overview",Proxies:"Proxies",Rules:"Rules",Conns:"Conns",Config:"Config",Logs:"Logs",Upload:"Upload",Download:"Download","Upload Total":"Upload Total","Download Total":"Download Total","Active Connections":"Active Connections","Pause Refresh":"Pause Refresh","Resume Refresh":"Resume Refresh",Up:"Up",Down:"Down","Test Latency":"Test Latency",settings:"settings",sort_in_grp:"Sorting in group",hide_unavail_proxies:"Hide unavailable proxies",auto_close_conns:"Automatically close old connections",order_natural:"Original order in config file",order_latency_asc:"By latency from small to big",order_latency_desc:"By latency from big to small",order_name_asc:"By name alphabetically (A-Z)",order_name_desc:"By name alphabetically (Z-A)",Connections:"Connections",current_backend:"Current Backend",Active:"Active",switch_backend:"Switch backend",Closed:"Closed",switch_theme:"Switch theme",theme:"theme",about:"about",no_logs:"No logs yet, hang tight...",chart_style:"Chart Style",latency_test_url:"Latency Test URL",lang:"Language",update_all_rule_provider:"Update all rule providers",update_all_proxy_provider:"Update all proxy providers"};export{e as data};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,2 @@
import{E as w,G as D,H as u}from"./index-3e6aad90.js";const v="/logs",L=new TextDecoder("utf-8"),M=()=>Math.floor((1+Math.random())*65536).toString(16);let h=!1,i=!1,f="",s,g;function m(e,n){let t;try{t=JSON.parse(e)}catch{console.log("JSON.parse error",JSON.parse(e))}const r=new Date,l=$(r);t.time=l,t.id=+r-0+M(),t.even=h=!h,n(t)}function $(e){const n=e.getFullYear()%100,t=u(e.getMonth()+1,2),r=u(e.getDate(),2),l=u(e.getHours(),2),o=u(e.getMinutes(),2),c=u(e.getSeconds(),2);return`${n}-${t}-${r} ${l}:${o}:${c}`}function p(e,n){return e.read().then(({done:t,value:r})=>{const l=L.decode(r,{stream:!t});f+=l;const o=f.split(`
`),c=o[o.length-1];for(let d=0;d<o.length-1;d++)m(o[d],n);if(t){m(c,n),f="",console.log("GET /logs streaming done"),i=!1;return}else f=c;return p(e,n)})}function S(e){const n=Object.keys(e);return n.sort(),n.map(t=>e[t]).join("|")}let b,a;function k(e,n){if(e.logLevel==="uninit"||i||s&&s.readyState===1)return;g=n;const t=w(e,v);s=new WebSocket(t),s.addEventListener("error",()=>{y(e,n)}),s.addEventListener("message",function(r){m(r.data,n)})}function H(){s.close(),a&&a.abort()}function O(e){!g||!s||(s.close(),i=!1,k(e,g))}function y(e,n){if(a&&S(e)!==b)a.abort();else if(i)return;i=!0,b=S(e),a=new AbortController;const t=a.signal,{url:r,init:l}=D(e);fetch(r+v+"?level="+e.logLevel,{...l,signal:t}).then(o=>{const c=o.body.getReader();p(c,n)},o=>{i=!1,!t.aborted&&console.log("GET /logs error:",o.message)})}export{k as f,O as r,H as s};

View File

@ -0,0 +1 @@
import{r as g,R as s,k as a}from"./index-3e6aad90.js";function p(){return p=Object.assign||function(t){for(var o=1;o<arguments.length;o++){var r=arguments[o];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},p.apply(this,arguments)}function v(t,o){if(t==null)return{};var r=y(t,o),e,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)e=i[n],!(o.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(r[e]=t[e])}return r}function y(t,o){if(t==null)return{};var r={},e=Object.keys(t),n,i;for(i=0;i<e.length;i++)n=e[i],!(o.indexOf(n)>=0)&&(r[n]=t[n]);return r}var c=g.forwardRef(function(t,o){var r=t.color,e=r===void 0?"currentColor":r,n=t.size,i=n===void 0?24:n,l=v(t,["color","size"]);return s.createElement("svg",p({ref:o,xmlns:"http://www.w3.org/2000/svg",width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),s.createElement("rect",{x:"6",y:"4",width:"4",height:"16"}),s.createElement("rect",{x:"14",y:"4",width:"4",height:"16"}))});c.propTypes={color:a.string,size:a.oneOfType([a.string,a.number])};c.displayName="Pause";const b=c;function f(){return f=Object.assign||function(t){for(var o=1;o<arguments.length;o++){var r=arguments[o];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},f.apply(this,arguments)}function h(t,o){if(t==null)return{};var r=O(t,o),e,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)e=i[n],!(o.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(r[e]=t[e])}return r}function O(t,o){if(t==null)return{};var r={},e=Object.keys(t),n,i;for(i=0;i<e.length;i++)n=e[i],!(o.indexOf(n)>=0)&&(r[n]=t[n]);return r}var u=g.forwardRef(function(t,o){var r=t.color,e=r===void 0?"currentColor":r,n=t.size,i=n===void 0?24:n,l=h(t,["color","size"]);return s.createElement("svg",f({ref:o,xmlns:"http://www.w3.org/2000/svg",width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),s.createElement("polygon",{points:"5 3 19 12 5 21 5 3"}))});u.propTypes={color:a.string,size:a.oneOfType([a.string,a.number])};u.displayName="Play";const w=u;export{w as P,b as a};

View File

@ -0,0 +1 @@
import{i as r}from"./index-3e6aad90.js";const{useState:s,useRef:u,useCallback:a,useLayoutEffect:c}=r;function d(){const t=u(null),[n,i]=s(200),e=a(()=>{const{top:o}=t.current.getBoundingClientRect();i(window.innerHeight-o)},[]);return c(()=>(e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}),[e]),[t,n]}export{d as u};

View File

@ -0,0 +1 @@
const e={Overview:"概览",Proxies:"代理",Rules:"规则",Conns:"连接",Config:"配置",Logs:"日志",Upload:"上传",Download:"下载","Upload Total":"上传总量","Download Total":"下载总量","Active Connections":"活动连接","Pause Refresh":"暂停刷新","Resume Refresh":"继续刷新",Up:"上传",Down:"下载","Test Latency":"延迟测速",settings:"设置",sort_in_grp:"代理组条目排序",hide_unavail_proxies:"隐藏不可用代理",auto_close_conns:"切换代理时自动断开旧连接",order_natural:"原 config 文件中的排序",order_latency_asc:"按延迟从小到大",order_latency_desc:"按延迟从大到小",order_name_asc:"按名称字母排序 (A-Z)",order_name_desc:"按名称字母排序 (Z-A)",Connections:"连接",current_backend:"当前后端",Active:"活动",switch_backend:"切换后端",Closed:"已断开",switch_theme:"切换主题",theme:"主题",about:"关于",no_logs:"暂无日志...",chart_style:"流量图样式",latency_test_url:"延迟测速 URL",lang:"语言",update_all_rule_provider:"更新所有 rule provider",update_all_proxy_provider:"更新所有 proxy providers"};export{e as data};

View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="yacd.ico" />
<link rel="icon" type="image/png" sizes="64x64" href="yacd-64.png" />
<link rel="icon" type="image/png" sizes="128x128" href="yacd-128.png" />
<link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png" />
<meta name="apple-mobile-web-app-title" content="yacd">
<meta name="theme-color" content="#eeeeee" media="(prefers-color-scheme: light)" />
<meta name="theme-color" content="#202020" media="(prefers-color-scheme: dark)" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="application-name" content="yacd" />
<meta name="description" content="Yet Another Clash Dashboard" />
<title>yacd</title>
<script type="module" crossorigin src="./assets/index-3e6aad90.js"></script>
<link rel="stylesheet" href="./assets/index-8c12d331.css">
<link rel="manifest" href="./manifest.webmanifest"><script id="vite-plugin-pwa:register-sw" src="./registerSW.js"></script></head>
<body>
<div id="app" data-base-url="http://127.0.0.1:9090"></div>
</body>
</html>

View File

@ -0,0 +1 @@
{"name":"yacd","short_name":"yacd","start_url":"./","display":"standalone","background_color":"#ffffff","lang":"en","scope":"./"}

View File

@ -0,0 +1 @@
if('serviceWorker' in navigator) {window.addEventListener('load', () => {navigator.serviceWorker.register('./sw.js', { scope: './' })})}

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More