mirror of
https://github.com/roacn/openwrt-packages.git
synced 2025-01-09 04:18:08 +08:00
🦄 Sync 2023-02-22 09:50
This commit is contained in:
parent
b745ab3f45
commit
82ba925b41
5
luci-app-openclash/root/usr/share/openclash/YAML.rb
Normal file
5
luci-app-openclash/root/usr/share/openclash/YAML.rb
Normal file
@ -0,0 +1,5 @@
|
||||
module YAML
|
||||
class << self
|
||||
alias_method :load, :unsafe_load if YAML.respond_to? :unsafe_load
|
||||
end
|
||||
end
|
@ -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
|
||||
|
45
luci-app-openclash/root/usr/share/openclash/clash_version.sh
Normal file
45
luci-app-openclash/root/usr/share/openclash/clash_version.sh
Normal 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")
|
||||
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 10 "$github_address_mod"gh/vernesong/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"
|
||||
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
|
||||
curl -SsL -m 10 https://raw.fastgit.org/vernesong/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"
|
||||
else
|
||||
curl -SsL -m 10 "$github_address_mod"https://raw.githubusercontent.com/vernesong/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"
|
||||
fi
|
||||
else
|
||||
curl -SsL -m 10 https://raw.githubusercontent.com/vernesong/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"
|
||||
fi
|
||||
|
||||
if [ "${PIPESTATUS[0]}" -ne 0 ] || [ -n "$(cat $LAST_OPVER |grep '<html>')" ]; then
|
||||
curl -SsL -m 10 --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
|
23
luci-app-openclash/root/usr/share/openclash/log.sh
Normal file
23
luci-app-openclash/root/usr/share/openclash/log.sh
Normal 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
|
||||
}
|
665
luci-app-openclash/root/usr/share/openclash/openclash.sh
Normal file
665
luci-app-openclash/root/usr/share/openclash/openclash.sh
Normal file
@ -0,0 +1,665 @@
|
||||
#!/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)
|
||||
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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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
|
||||
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!"
|
||||
sleep 3
|
||||
SLOG_CLEAN
|
||||
fi
|
||||
else
|
||||
if [ "$CONFIG_FILE" == "$CONFIG_PATH" ]; then
|
||||
LOG_OUT "Config File【$name】Update Successful!"
|
||||
restart=1
|
||||
else
|
||||
LOG_OUT "Config File【$name】Update Successful!"
|
||||
sleep 3
|
||||
SLOG_CLEAN
|
||||
fi
|
||||
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!"
|
||||
sleep 3
|
||||
SLOG_CLEAN
|
||||
fi
|
||||
else
|
||||
LOG_OUT "Config File【$name】No Change, Do Nothing!"
|
||||
rm -rf "$CFG_FILE"
|
||||
sleep 3
|
||||
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!"
|
||||
sleep 3
|
||||
SLOG_CLEAN
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
config_error()
|
||||
{
|
||||
LOG_OUT "Error:【$name】Update Error, Please Try Again Later..."
|
||||
rm -rf "$CFG_FILE" 2>/dev/null
|
||||
sleep 3
|
||||
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
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
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 >/dev/null 2>&1
|
||||
nft add rule inet fw4 nat_output ${line}
|
||||
done
|
||||
echo "$mangle_output_rules" |while read line
|
||||
do
|
||||
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
|
||||
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
|
||||
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; 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
|
||||
/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
|
||||
if [ -z "$(echo "$en_mode" |grep "redir-host")" ] && [ "$china_ip_route" -eq 1 ] && [ "$enable_redirect_dns" = "1" ]; 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..."
|
||||
handles=$(nft -a list chain inet fw4 dstnat |grep "OpenClash DNS Hijack" |awk -F '# handle ' '{print$2}')
|
||||
for handle in $handles; do
|
||||
nft delete rule inet fw4 dstnat handle ${handle}
|
||||
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 insert rule inet fw4 dstnat position "$position" tcp dport 53 redirect to "$dns_port" comment \"OpenClash DNS Hijack\" 2>/dev/null
|
||||
nft insert rule inet fw4 dstnat position "$position" udp dport 53 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 "$position" 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 "$position" meta nfproto {ipv6} udp dport 53 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 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
|
||||
for ipt in "iptables -nvL OUTPUT -t nat" "iptables -nvL PREROUTING -t nat" "ip6tables -nvL PREROUTING -t nat" "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
|
||||
if [ -z "$(echo "$en_mode" |grep "redir-host")" ] && [ "$china_ip_route" -eq 1 ] && [ "$enable_redirect_dns" = "1" ]; 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..."
|
||||
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 "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
|
||||
iptables -t nat -I PREROUTING "$position" -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
|
||||
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 "$dns_port" -m comment --comment "OpenClash DNS Hijack" 2>/dev/null
|
||||
ip6tables -t nat -I PREROUTING "$position" -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
|
||||
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!"
|
||||
sleep 3
|
||||
only_download=1
|
||||
change_dns
|
||||
config_su_check
|
||||
elif [ ! -f "$CFG_FILE" ]; then
|
||||
LOG_OUT "Config File Format Validation Failed..."
|
||||
sleep 3
|
||||
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..."
|
||||
sleep 3
|
||||
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!"
|
||||
sleep 3
|
||||
only_download=1
|
||||
config_su_check
|
||||
elif [ ! -f "$CFG_FILE" ]; then
|
||||
LOG_OUT "Config File Format Validation Failed, Trying To Download Without Agent..."
|
||||
sleep 3
|
||||
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..."
|
||||
sleep 3
|
||||
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
|
@ -0,0 +1,171 @@
|
||||
#!/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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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..."
|
||||
sleep 3
|
||||
fi
|
||||
else
|
||||
LOG_OUT "Chnroute Cidr List Update Error, Please Try Again Later..."
|
||||
sleep 3
|
||||
fi
|
||||
|
||||
#ipv6
|
||||
LOG_OUT "Start Downloading The Chnroute6 Cidr List..."
|
||||
if [ -z "$CHNR6_CUSTOM_URL" ]; then
|
||||
curl -SsL --connect-timeout 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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..."
|
||||
sleep 3
|
||||
fi
|
||||
else
|
||||
LOG_OUT "Chnroute6 Cidr List Update Error, Please Try Again Later..."
|
||||
sleep 3
|
||||
fi
|
||||
|
||||
#CN DOMAIN
|
||||
LOG_OUT "Start Downloading The CN Domains List..."
|
||||
if [ -n "$CNDOMAIN_CUSTOM_URL" ]; then
|
||||
curl -SsL --connect-timeout 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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..."
|
||||
sleep 3
|
||||
fi
|
||||
else
|
||||
LOG_OUT "CN Domains List Update Error, Please Try Again Later..."
|
||||
sleep 3
|
||||
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
|
228
luci-app-openclash/root/usr/share/openclash/openclash_core.sh
Normal file
228
luci-app-openclash/root/usr/share/openclash/openclash_core.sh
Normal file
@ -0,0 +1,228 @@
|
||||
#!/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..."
|
||||
sleep 3
|
||||
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..."
|
||||
sleep 3
|
||||
SLOG_CLEAN
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
"Meta")
|
||||
CORE_CV=$($meta_core_path -v 2>/dev/null |awk -F ' ' '{print $3}')
|
||||
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 10 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"gh/vernesong/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"
|
||||
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
|
||||
curl -SsL --connect-timeout 10 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.fastgit.org/vernesong/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"
|
||||
else
|
||||
curl -SsL --connect-timeout 10 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz 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 10 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/vernesong/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"
|
||||
fi
|
||||
if [ "${PIPESTATUS[0]}" -ne 0 ]; then
|
||||
curl -SsL --connect-timeout 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"gh/vernesong/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"
|
||||
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
|
||||
curl -SsL --connect-timeout 10 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.fastgit.org/vernesong/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"
|
||||
else
|
||||
curl -SsL --connect-timeout 10 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/vernesong/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"
|
||||
fi
|
||||
else
|
||||
curl -SsL --connect-timeout 10 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/vernesong/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"
|
||||
fi
|
||||
if [ "${PIPESTATUS[0]}" -ne 0 ]; then
|
||||
curl -SsL --connect-timeout 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"gh/vernesong/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"
|
||||
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
|
||||
curl -SsL --connect-timeout 10 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.fastgit.org/vernesong/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"
|
||||
else
|
||||
curl -SsL --connect-timeout 10 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz 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 10 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/vernesong/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"
|
||||
fi
|
||||
if [ "${PIPESTATUS[0]}" -ne 0 ]; then
|
||||
curl -SsL --connect-timeout 10 -m 30 --speed-time 15 --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
|
||||
sleep 3
|
||||
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
|
||||
sleep 3
|
||||
SLOG_CLEAN
|
||||
fi
|
||||
else
|
||||
LOG_OUT "【"$CORE_TYPE"】Core Update Failed. Please Make Sure Enough Flash Memory Space And Try Again!"
|
||||
sleep 3
|
||||
SLOG_CLEAN
|
||||
fi
|
||||
else
|
||||
LOG_OUT "【"$CORE_TYPE"】Core Update Failed, Please Check The Network or Try Again Later!"
|
||||
sleep 3
|
||||
SLOG_CLEAN
|
||||
fi
|
||||
else
|
||||
LOG_OUT "No Compiled Version Selected, Please Select In Global Settings And Try Again!"
|
||||
sleep 3
|
||||
SLOG_CLEAN
|
||||
fi
|
||||
else
|
||||
LOG_OUT "【"$CORE_TYPE"】Core Has Not Been Updated, Stop Continuing Operation!"
|
||||
sleep 3
|
||||
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
|
@ -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.dns_advanced_setting 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
|
494
luci-app-openclash/root/usr/share/openclash/openclash_debug.sh
Normal file
494
luci-app-openclash/root/usr/share/openclash/openclash_debug.sh
Normal file
@ -0,0 +1,494 @@
|
||||
#!/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_type=$(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}' 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)
|
||||
|
||||
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监听地址
|
||||
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
|
||||
|
||||
EOF
|
||||
|
||||
#core
|
||||
cat >> "$DEBUG_LOG" <<-EOF
|
||||
|
||||
#===================== 内核检查 =====================#
|
||||
|
||||
EOF
|
||||
if pidof clash >/dev/null; then
|
||||
cat >> "$DEBUG_LOG" <<-EOF
|
||||
运行状态: 运行中
|
||||
进程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_type" = "0" ]; then
|
||||
core_type="未选择架构"
|
||||
fi
|
||||
cat >> "$DEBUG_LOG" <<-EOF
|
||||
已选择的架构: $core_type
|
||||
|
||||
#下方无法显示内核版本号时请确认您的内核版本是否正确或者有无权限
|
||||
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劫持: $(dns_re "$enable_redirect_dns")
|
||||
自定义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
|
||||
|
||||
#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_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 |grep "Name:" >> "$DEBUG_LOG"
|
||||
|
||||
cat >> "$DEBUG_LOG" <<-EOF
|
||||
|
||||
#===================== 路由表状态 =====================#
|
||||
|
||||
EOF
|
||||
echo "#route -n" >> "$DEBUG_LOG"
|
||||
route -n >> "$DEBUG_LOG" 2>/dev/null
|
||||
echo "#ip route list" >> "$DEBUG_LOG"
|
||||
ip route list >> "$DEBUG_LOG" 2>/dev/null
|
||||
echo "#ip rule show" >> "$DEBUG_LOG"
|
||||
ip 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
|
||||
|
||||
if [ -s "/tmp/resolv.conf.auto" ]; then
|
||||
cat >> "$DEBUG_LOG" <<-EOF
|
||||
|
||||
#===================== 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
|
||||
|
||||
#===================== resolv.conf.d =====================#
|
||||
|
||||
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
|
||||
|
||||
#===================== 最近运行日志 =====================#
|
||||
|
||||
EOF
|
||||
tail -n 50 "/tmp/openclash.log" >> "$DEBUG_LOG" 2>/dev/null
|
||||
|
||||
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
|
@ -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()
|
@ -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()
|
@ -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()
|
@ -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 10 -m 30 --speed-time 15 --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
|
@ -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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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
|
@ -0,0 +1,79 @@
|
||||
#!/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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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..."
|
||||
sleep 3
|
||||
fi
|
||||
else
|
||||
LOG_OUT "GeoIP Dat Update Error, Please Try Again Later..."
|
||||
sleep 3
|
||||
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
|
@ -0,0 +1,79 @@
|
||||
#!/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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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..."
|
||||
sleep 3
|
||||
fi
|
||||
else
|
||||
LOG_OUT "GeoSite Database Update Error, Please Try Again Later..."
|
||||
sleep 3
|
||||
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
|
@ -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)
|
@ -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
|
@ -0,0 +1,75 @@
|
||||
#!/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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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..."
|
||||
sleep 3
|
||||
fi
|
||||
else
|
||||
LOG_OUT "Geoip Database Update Error, Please Try Again Later..."
|
||||
sleep 3
|
||||
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
|
33
luci-app-openclash/root/usr/share/openclash/openclash_ps.sh
Normal file
33
luci-app-openclash/root/usr/share/openclash/openclash_ps.sh
Normal 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
|
||||
}
|
183
luci-app-openclash/root/usr/share/openclash/openclash_rule.sh
Normal file
183
luci-app-openclash/root/usr/share/openclash/openclash_rule.sh
Normal file
@ -0,0 +1,183 @@
|
||||
#!/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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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 10 -m 30 --speed-time 15 --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
|
||||
sleep 3
|
||||
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
|
||||
sleep 3
|
||||
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
|
||||
sleep 3
|
||||
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
|
||||
sleep 3
|
||||
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!"
|
||||
sleep 3
|
||||
fi
|
||||
else
|
||||
LOG_OUT "Other Rules【$rule_name】Update Error, Please Try Again Later..."
|
||||
sleep 3
|
||||
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!"
|
||||
sleep 3
|
||||
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!"
|
||||
sleep 3
|
||||
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
132
luci-app-openclash/root/usr/share/openclash/openclash_update.sh
Normal file
132
luci-app-openclash/root/usr/share/openclash/openclash_update.sh
Normal file
@ -0,0 +1,132 @@
|
||||
#!/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 10 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"gh/vernesong/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"
|
||||
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
|
||||
curl -SsL --connect-timeout 10 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.fastgit.org/vernesong/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"
|
||||
else
|
||||
curl -SsL --connect-timeout 10 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/vernesong/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"
|
||||
fi
|
||||
else
|
||||
curl -SsL --connect-timeout 10 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/vernesong/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"
|
||||
fi
|
||||
if [ "${PIPESTATUS[0]}" -ne 0 ]; then
|
||||
curl -SsL --connect-timeout 10 -m 30 --speed-time 15 --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
|
||||
sleep 3
|
||||
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!"
|
||||
sleep 3
|
||||
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!"
|
||||
sleep 3
|
||||
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
|
||||
sleep 3
|
||||
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
|
||||
sleep 3
|
||||
SLOG_CLEAN
|
||||
fi
|
||||
fi
|
||||
del_lock
|
@ -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)
|
@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
TIME=$(date "+%Y-%m-%d-%H")
|
||||
CHTIME=$(date "+%Y-%m-%d-%H" -r "/tmp/openclash_last_version")
|
||||
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 10 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"gh/vernesong/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"
|
||||
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
|
||||
curl -SsL --connect-timeout 10 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.fastgit.org/vernesong/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"
|
||||
else
|
||||
curl -SsL --connect-timeout 10 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$github_address_mod"https://raw.githubusercontent.com/vernesong/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"
|
||||
fi
|
||||
else
|
||||
curl -SsL --connect-timeout 10 -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/vernesong/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"
|
||||
fi
|
||||
|
||||
if [ "${PIPESTATUS[0]}" -ne 0 ] || [ -n "$(cat $LAST_OPVER |grep '<html>')" ]; then
|
||||
curl -SsL --connect-timeout 10 -m 30 --speed-time 15 --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
|
@ -0,0 +1,409 @@
|
||||
#!/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")
|
||||
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" = "1" ]; 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)
|
||||
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
|
||||
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 刷新
|
||||
lan_ip_cidrs=$(ip route | grep "/" | awk '{print $1}' | grep -vE "^$(echo "$fakeip_range"|awk -F '.' '{print $1"."$2}')" 2>/dev/null)
|
||||
lan_ip6_cidrs=$(ip -6 route | grep "/" | awk '{print $1}' | grep -vE "^unreachable" 2>/dev/null)
|
||||
wan_ip4s=$(ifconfig | grep 'inet addr' | awk '{print $2}' | cut -d: -f2 | grep -vE "(^$(echo "$fakeip_range"|awk -F '.' '{print $1"."$2}')|^192.168|^127.0)" 2>/dev/null)
|
||||
if [ -n "$FW4" ]; then
|
||||
if [ -n "$lan_ip_cidrs" ]; then
|
||||
for lan_ip_cidr in $lan_ip_cidrs; do
|
||||
nft add element inet fw4 localnetwork { "$lan_ip_cidr" } 2>/dev/null
|
||||
done
|
||||
fi
|
||||
|
||||
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 "$lan_ip6_cidrs" ]; then
|
||||
for lan_ip6_cidr in $lan_ip6_cidrs; do
|
||||
nft add element inet fw4 localnetwork6 { "$lan_ip6_cidr" } 2>/dev/null
|
||||
done
|
||||
fi
|
||||
|
||||
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 "$lan_ip_cidrs" ]; then
|
||||
for lan_ip_cidr in $lan_ip_cidrs; do
|
||||
ipset add localnetwork "$lan_ip_cidr" 2>/dev/null
|
||||
done
|
||||
fi
|
||||
|
||||
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 "$lan_ip6_cidrs" ]; then
|
||||
for lan_ip6_cidr in $lan_ip6_cidrs; do
|
||||
ipset add localnetwork6 "$lan_ip6_cidr" 2>/dev/null
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "$wan_ip6s" ]; then
|
||||
for wan_ip6 in $wan_ip6s; do
|
||||
ipset add localnetwork6 "$wan_ip6" 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
|
||||
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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
472
luci-app-openclash/root/usr/share/openclash/res/default.yaml
Normal file
472
luci-app-openclash/root/usr/share/openclash/res/default.yaml
Normal 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
|
165
luci-app-openclash/root/usr/share/openclash/res/game_rules.list
Normal file
165
luci-app-openclash/root/usr/share/openclash/res/game_rules.list
Normal 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
|
507
luci-app-openclash/root/usr/share/openclash/res/lhie1.yaml
Normal file
507
luci-app-openclash/root/usr/share/openclash/res/lhie1.yaml
Normal 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
|
@ -0,0 +1,179 @@
|
||||
放行规则-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
|
||||
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
|
39
luci-app-openclash/root/usr/share/openclash/res/sub_ini.list
Normal file
39
luci-app-openclash/root/usr/share/openclash/res/sub_ini.list
Normal 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
|
111
luci-app-openclash/root/usr/share/openclash/ruby.sh
Normal file
111
luci-app-openclash/root/usr/share/openclash/ruby.sh
Normal 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; 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
|
||||
}
|
@ -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
@ -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-6ac9f125.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="./assets/vendor-076c6210.js">
|
||||
<link rel="stylesheet" href="./assets/index-7e15a32d.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>
|
@ -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"}]}
|
@ -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} didn’t 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-6ac9f125.js",revision:null},{url:"assets/index-7e15a32d.css",revision:null},{url:"assets/vendor-076c6210.js",revision:null},{url:"index.html",revision:"5ec6a3429b8a0efec76ec9e1f172bdf7"},{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
@ -0,0 +1 @@
|
||||
yacd.haishan.me
|
12
luci-app-openclash/root/usr/share/openclash/ui/yacd/_headers
Normal file
12
luci-app-openclash/root/usr/share/openclash/ui/yacd/_headers
Normal 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 |
@ -0,0 +1 @@
|
||||
._root_v2s4h_1,._section_v2s4h_2{display:grid;grid-template-columns:repeat(auto-fill,minmax(345px,1fr));max-width:900px;gap:5px}@media screen and (min-width: 30em){._root_v2s4h_1,._section_v2s4h_2{gap:15px}}._root_v2s4h_1,._section_v2s4h_2{padding:6px 15px 10px}@media screen and (min-width: 30em){._root_v2s4h_1,._section_v2s4h_2{padding:10px 40px 15px}}._wrapSwitch_v2s4h_26{height:40px;display:flex;align-items:center}._sep_v2s4h_32{max-width:900px;padding:0 15px}@media screen and (min-width: 30em){._sep_v2s4h_32{padding:0 40px}}._sep_v2s4h_32>div{border-top:1px dashed #373737}._label_v2s4h_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
@ -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}
|
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
|
||||
import{j as e,b,i as y,r as l}from"./index.171f553a.js";const F="_spining_4i8sg_1",M="_spining_keyframes_4i8sg_1",j={spining:F,spining_keyframes:M},{useState:v}=y;function B({children:s}){return e("span",{className:j.spining,children:s})}const H={right:10,bottom:10},L=({children:s,...n})=>e("button",{type:"button",...n,className:"rtf--ab",children:s}),E=({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]=v(!1),c=o||!a,u=()=>r(!0),m=()=>r(!1),x=()=>s==="hover"&&u(),k=()=>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.exports.Children.map(f,(t,i)=>l.exports.isValidElement(t)?b("li",{className:`rtf--ab__c ${"top"in n?"top":""}`,children:[l.exports.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:x,onMouseLeave:k,className:`rtf ${a?"open":"closed"}`,"data-testid":"fab",style:n,..._,children:b("li",{className:"rtf--mb__c",children:[e(E,{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};
|
@ -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}
|
@ -0,0 +1 @@
|
||||
import{r as m,b as l,j as t,k as u,e as y,J as T,K as b,y as P,L,u as R,C as N,S as z,N as C,O as W,h as w,P as k,i as j,c as I}from"./index.171f553a.js";import{a as O,F}from"./index.esm.e4dd1508.js";import{r as M,s as $,f as A}from"./logs.43986220.js";import{d as B}from"./debounce.c2d20996.js";import{u as D}from"./useRemainingViewPortHeight.7395542b.js";import{F as E,p as H}from"./Fab.ef67ff10.js";import{P as K,a as q}from"./play.7b1a5f99.js";function J(e,n){if(e==null)return{};var r=V(e,n),a,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)a=s[o],!(n.indexOf(a)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,a)||(r[a]=e[a]))}return r}function V(e,n){if(e==null)return{};var r={},a=Object.keys(e),o,s;for(s=0;s<a.length;s++)o=a[s],!(n.indexOf(o)>=0)&&(r[o]=e[o]);return r}var f=m.exports.forwardRef(function(e,n){var r=e.color,a=r===void 0?"currentColor":r,o=e.size,s=o===void 0?24:o,p=J(e,["color","size"]);return l("svg",{ref:n,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:a,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...p,children:[t("circle",{cx:"11",cy:"11",r:"8"}),t("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})});f.propTypes={color:u.exports.string,size:u.exports.oneOfType([u.exports.string,u.exports.number])};f.displayName="Search";const Y=f,G="_RuleSearch_1oz2t_1",Q="_RuleSearchContainer_1oz2t_5",U="_inputWrapper_1oz2t_10",X="_input_1oz2t_10",Z="_iconWrapper_1oz2t_35",h={RuleSearch:G,RuleSearchContainer:Q,inputWrapper:U,input:X,iconWrapper:Z};function ee({dispatch:e,searchText:n,updateSearchText:r}){const[a,o]=m.exports.useState(n),s=m.exports.useCallback(i=>{e(r(i))},[e,r]),p=m.exports.useMemo(()=>B(s,300),[s]),g=i=>{o(i.target.value),p(i.target.value)};return t("div",{className:h.RuleSearch,children:l("div",{className:h.RuleSearchContainer,children:[t("div",{className:h.inputWrapper,children:t("input",{type:"text",value:a,onChange:g,className:h.input})}),t("div",{className:h.iconWrapper,children:t(Y,{size:20})})]})})}const te=e=>({searchText:T(e),updateSearchText:b}),oe=y(te)(ee),re="_logMeta_7a1x3_1",ae="_logType_7a1x3_8",ne="_logTime_7a1x3_18",se="_logText_7a1x3_24",ce="_logsWrapper_7a1x3_37",ie="_logPlaceholder_7a1x3_51",le="_logPlaceholderIcon_7a1x3_64",pe="_search_7a1x3_68",c={logMeta:re,logType:ae,logTime:ne,logText:se,logsWrapper:ce,logPlaceholder:ie,logPlaceholderIcon:le,search:pe},{useCallback:v,memo:he,useEffect:ge}=j,_=30,de={debug:"#28792c",info:"var(--bg-log-info-tag)",warning:"#b99105",error:"#c11c1c"};function ue({time:e,even:n,payload:r,type:a}){const o=I({even:n},"log");return t("div",{className:o,children:l("div",{className:c.logMeta,children:[t("div",{className:c.logTime,children:e}),t("div",{className:c.logType,style:{backgroundColor:de[a]},children:a}),t("div",{className:c.logText,children:r})]})})}function me(e,n){return n[e].id}const _e=he(({index:e,style:n,data:r})=>{const a=r[e];return t("div",{style:n,children:t(ue,{...a})})},O);function fe({dispatch:e,logLevel:n,apiConfig:r,logs:a,logStreamingPaused:o}){const s=P(),p=v(()=>{o?M({...r,logLevel:n}):$(),s.app.updateAppConfig("logStreamingPaused",!o)},[r,n,o,s.app]),g=v(S=>e(L(S)),[e]);ge(()=>{A({...r,logLevel:n},g)},[r,n,g]);const[i,x]=D(),{t:d}=R();return l("div",{children:[t(N,{title:d("Logs")}),t("div",{className:c.search,children:t(oe,{})}),t("div",{ref:i,style:{paddingBottom:_},children:a.length===0?l("div",{className:c.logPlaceholder,style:{height:x-_},children:[t("div",{className:c.logPlaceholderIcon,children:t(z,{width:200,height:200})}),t("div",{children:d("no_logs")})]}):l("div",{className:c.logsWrapper,children:[t(F,{height:x-_,width:"100%",itemCount:a.length,itemSize:80,itemData:a,itemKey:me,children:_e}),t(E,{icon:o?t(K,{size:16}):t(q,{size:16}),mainButtonStyles:o?{background:"#e74c3c"}:{},style:H,text:d(o?"Resume Refresh":"Pause Refresh"),onClick:p})]})})]})}const xe=e=>({logs:C(e),logLevel:W(e),apiConfig:w(e),logStreamingPaused:k(e)}),Re=y(xe)(fe);export{Re as default};
|
File diff suppressed because one or more lines are too long
@ -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_8ev0l_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_8ev0l_1:focus{border:1px solid var(--color-focus-blue)}@media screen and (min-width: 30em){._proxy_8ev0l_1{min-width:200px;border-radius:10px;padding:10px}}._proxy_8ev0l_1._now_8ev0l_25{background-color:var(--color-focus-blue);color:#ddd}._proxy_8ev0l_1._error_8ev0l_29{opacity:.5}._proxy_8ev0l_1._selectable_8ev0l_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_8ev0l_1._selectable_8ev0l_32:hover{border-color:hsl(0deg,0%,var(--card-hover-border-lightness))}._proxyType_8ev0l_40{font-family:var(--font-mono);font-size:.6em;margin-right:3px}@media screen and (min-width: 30em){._proxyType_8ev0l_40{font-size:.85em}}._row_8ev0l_51{display:flex;align-items:center;justify-content:space-between}._proxyName_8ev0l_57{width:100%;margin-bottom:5px;font-size:.85em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}._proxySmall_8ev0l_66{--size: 13px;width:var(--size);height:var(--size);border-radius:50%;position:relative}._proxySmall_8ev0l_66._now_8ev0l_25{--size: 15px}._proxySmall_8ev0l_66._now_8ev0l_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_8ev0l_66._selectable_8ev0l_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_8ev0l_66._selectable_8ev0l_32:hover{-webkit-transform:scale(1.2);transform:scale(1.2)}._proxyLatency_hz69v_1{border-radius:20px;color:#eee;font-size:.6em}@media screen and (min-width: 30em){._proxyLatency_hz69v_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_1rx92_1{margin-bottom:12px}._updatedAt_1rx92_1 small{color:#777}._main_1rx92_8{padding:10px 15px}@media screen and (min-width: 30em){._main_1rx92_8{padding:10px 40px}}._head_1rx92_17{display:flex;align-items:center;flex-wrap:wrap}._action_1rx92_23{margin:0 5px;display:grid;grid-template-columns:auto auto;gap:10px;place-items:center}._refresh_1rx92_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_jgy4z_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_jgy4z_13{display:flex;align-items:center;flex-wrap:wrap;flex:1;justify-content:flex-end;margin-right:20px}._textFilterContainer_jgy4z_22{max-width:350px;min-width:150px;flex:1;margin-right:8px}._group_jgy4z_29{padding:10px 15px}@media screen and (min-width: 30em){._group_jgy4z_29{padding:10px 40px}}
|
File diff suppressed because one or more lines are too long
@ -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_1ymqx_1{display:flex;align-items:center;padding:6px 15px}@media screen and (min-width: 30em){._rule_1ymqx_1{padding:10px 40px}}._left_1ymqx_12{width:40px;padding-right:15px;color:var(--color-text-secondary);opacity:.4}._a_1ymqx_19{display:flex;align-items:center;font-size:12px;opacity:.8}._b_1ymqx_26{padding:10px 0;font-family:Roboto Mono,Menlo,monospace;font-size:16px}@media screen and (min-width: 30em){._b_1ymqx_26{font-size:19px}}._type_1ymqx_37{width:110px}._header_1j1w3_1{display:grid;grid-template-columns:1fr minmax(auto,330px);align-items:center;padding-right:15px}@media screen and (min-width: 30em){._header_1j1w3_1{padding-right:40px}}._RuleProviderItemWrapper_1j1w3_17{padding:6px 15px}@media screen and (min-width: 30em){._RuleProviderItemWrapper_1j1w3_17{padding:10px 40px}}
|
@ -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)}
|
@ -0,0 +1 @@
|
||||
import{j as s}from"./index.171f553a.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};
|
@ -0,0 +1 @@
|
||||
import{r as u,b as g,j as i,k as c,c as f,V as x,i as d}from"./index.171f553a.js";import{d as h}from"./debounce.c2d20996.js";function v(t,n){if(t==null)return{};var o=_(t,n),r,e;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(e=0;e<s.length;e++)r=s[e],!(n.indexOf(r)>=0)&&(!Object.prototype.propertyIsEnumerable.call(t,r)||(o[r]=t[r]))}return o}function _(t,n){if(t==null)return{};var o={},r=Object.keys(t),e,s;for(s=0;s<r.length;s++)e=r[s],!(n.indexOf(e)>=0)&&(o[e]=t[e]);return o}var l=u.exports.forwardRef(function(t,n){var o=t.color,r=o===void 0?"currentColor":o,e=t.size,s=e===void 0?24:e,a=v(t,["color","size"]);return g("svg",{ref:n,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...a,children:[i("polyline",{points:"23 4 23 10 17 10"}),i("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]})});l.propTypes={color:c.exports.string,size:c.exports.oneOfType([c.exports.string,c.exports.number])};l.displayName="RotateCw";const b=l,y="_rotate_1dspl_1",m="_isRotating_1dspl_5",R="_rotating_1dspl_1",p={rotate:y,isRotating:m,rotating:R};function P(t){const n=t.size||16,o=f(p.rotate,{[p.isRotating]:t.isRotating});return i("span",{className:o,children:i(b,{size:n})})}const{useCallback:w,useState:j,useMemo:k}=d;function O(t){const[,n]=x(t),[o,r]=j(""),e=k(()=>h(n,300),[n]);return[w(a=>{r(a.target.value),e(a.target.value)},[e]),o]}const T="_input_16a1f_1",C={input:T};function $(t){const[n,o]=O(t.textAtom);return i("input",{className:C.input,type:"text",value:o,onChange:n,placeholder:t.placeholder})}export{P as R,$ as T,b as a};
|
@ -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
@ -0,0 +1 @@
|
||||
import{r as f,j as l,k as s}from"./index.171f553a.js";function c(r,i){if(r==null)return{};var n=v(r,i),o,e;if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);for(e=0;e<t.length;e++)o=t[e],!(i.indexOf(o)>=0)&&(!Object.prototype.propertyIsEnumerable.call(r,o)||(n[o]=r[o]))}return n}function v(r,i){if(r==null)return{};var n={},o=Object.keys(r),e,t;for(t=0;t<o.length;t++)e=o[t],!(i.indexOf(e)>=0)&&(n[e]=r[e]);return n}var p=f.exports.forwardRef(function(r,i){var n=r.color,o=n===void 0?"currentColor":n,e=r.size,t=e===void 0?24:e,a=c(r,["color","size"]);return l("svg",{ref:i,xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...a,children:l("polyline",{points:"6 9 12 15 18 9"})})});p.propTypes={color:s.exports.string,size:s.exports.oneOfType([s.exports.string,s.exports.number])};p.displayName="ChevronDown";const u=p;export{u as C};
|
@ -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};
|
@ -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",Active:"Active",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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
import{E as w,G as D,H as u}from"./index.171f553a.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};
|
@ -0,0 +1 @@
|
||||
import{r as c,b as u,j as p,k as s}from"./index.171f553a.js";function y(e,n){if(e==null)return{};var i=g(e,n),t,r;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],!(n.indexOf(t)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,t)||(i[t]=e[t]))}return i}function g(e,n){if(e==null)return{};var i={},t=Object.keys(e),r,o;for(o=0;o<t.length;o++)r=t[o],!(n.indexOf(r)>=0)&&(i[r]=e[r]);return i}var l=c.exports.forwardRef(function(e,n){var i=e.color,t=i===void 0?"currentColor":i,r=e.size,o=r===void 0?24:r,a=y(e,["color","size"]);return u("svg",{ref:n,xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...a,children:[p("rect",{x:"6",y:"4",width:"4",height:"16"}),p("rect",{x:"14",y:"4",width:"4",height:"16"})]})});l.propTypes={color:s.exports.string,size:s.exports.oneOfType([s.exports.string,s.exports.number])};l.displayName="Pause";const d=l;function h(e,n){if(e==null)return{};var i=v(e,n),t,r;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],!(n.indexOf(t)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,t)||(i[t]=e[t]))}return i}function v(e,n){if(e==null)return{};var i={},t=Object.keys(e),r,o;for(o=0;o<t.length;o++)r=t[o],!(n.indexOf(r)>=0)&&(i[r]=e[r]);return i}var f=c.exports.forwardRef(function(e,n){var i=e.color,t=i===void 0?"currentColor":i,r=e.size,o=r===void 0?24:r,a=h(e,["color","size"]);return p("svg",{ref:n,xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...a,children:p("polygon",{points:"5 3 19 12 5 21 5 3"})})});f.propTypes={color:s.exports.string,size:s.exports.oneOfType([s.exports.string,s.exports.number])};f.displayName="Play";const w=f;export{w as P,d as a};
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
||||
import{i as r}from"./index.171f553a.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};
|
@ -0,0 +1 @@
|
||||
const u={Overview:"\u6982\u89C8",Proxies:"\u4EE3\u7406",Rules:"\u89C4\u5219",Conns:"\u8FDE\u63A5",Config:"\u914D\u7F6E",Logs:"\u65E5\u5FD7",Upload:"\u4E0A\u4F20",Download:"\u4E0B\u8F7D","Upload Total":"\u4E0A\u4F20\u603B\u91CF","Download Total":"\u4E0B\u8F7D\u603B\u91CF","Active Connections":"\u6D3B\u52A8\u8FDE\u63A5","Pause Refresh":"\u6682\u505C\u5237\u65B0","Resume Refresh":"\u7EE7\u7EED\u5237\u65B0",Up:"\u4E0A\u4F20",Down:"\u4E0B\u8F7D","Test Latency":"\u5EF6\u8FDF\u6D4B\u901F",settings:"\u8BBE\u7F6E",sort_in_grp:"\u4EE3\u7406\u7EC4\u6761\u76EE\u6392\u5E8F",hide_unavail_proxies:"\u9690\u85CF\u4E0D\u53EF\u7528\u4EE3\u7406",auto_close_conns:"\u5207\u6362\u4EE3\u7406\u65F6\u81EA\u52A8\u65AD\u5F00\u65E7\u8FDE\u63A5",order_natural:"\u539F config \u6587\u4EF6\u4E2D\u7684\u6392\u5E8F",order_latency_asc:"\u6309\u5EF6\u8FDF\u4ECE\u5C0F\u5230\u5927",order_latency_desc:"\u6309\u5EF6\u8FDF\u4ECE\u5927\u5230\u5C0F",order_name_asc:"\u6309\u540D\u79F0\u5B57\u6BCD\u6392\u5E8F (A-Z)",order_name_desc:"\u6309\u540D\u79F0\u5B57\u6BCD\u6392\u5E8F (Z-A)",Connections:"\u8FDE\u63A5",Active:"\u6D3B\u52A8",Closed:"\u5DF2\u65AD\u5F00",switch_theme:"\u5207\u6362\u4E3B\u9898",theme:"\u4E3B\u9898",about:"\u5173\u4E8E",no_logs:"\u6682\u65E0\u65E5\u5FD7...",chart_style:"\u6D41\u91CF\u56FE\u6837\u5F0F",latency_test_url:"\u5EF6\u8FDF\u6D4B\u901F URL",lang:"\u8BED\u8A00",update_all_rule_provider:"\u66F4\u65B0\u6240\u6709 rule provider",update_all_proxy_provider:"\u66F4\u65B0\u6240\u6709 proxy providers"};export{u as data};
|
@ -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.171f553a.js"></script>
|
||||
<link rel="stylesheet" href="./assets/index.b38debfc.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>
|
@ -0,0 +1 @@
|
||||
{"name":"yacd","short_name":"yacd","start_url":"./","display":"standalone","background_color":"#ffffff","lang":"en","scope":"./"}
|
@ -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
BIN
luci-app-openclash/root/usr/share/openclash/ui/yacd/yacd-128.png
Normal file
BIN
luci-app-openclash/root/usr/share/openclash/ui/yacd/yacd-128.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.5 KiB |
BIN
luci-app-openclash/root/usr/share/openclash/ui/yacd/yacd-64.png
Normal file
BIN
luci-app-openclash/root/usr/share/openclash/ui/yacd/yacd-64.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
BIN
luci-app-openclash/root/usr/share/openclash/ui/yacd/yacd.ico
Normal file
BIN
luci-app-openclash/root/usr/share/openclash/ui/yacd/yacd.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
851
luci-app-openclash/root/usr/share/openclash/yml_change.sh
Normal file
851
luci-app-openclash/root/usr/share/openclash/yml_change.sh
Normal file
@ -0,0 +1,851 @@
|
||||
#!/bin/sh
|
||||
. /usr/share/openclash/ruby.sh
|
||||
. /usr/share/openclash/log.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
LOG_FILE="/tmp/openclash.log"
|
||||
LOGTIME=$(echo $(date "+%Y-%m-%d %H:%M:%S"))
|
||||
dns_advanced_setting=$(uci -q get openclash.config.dns_advanced_setting)
|
||||
core_type=$(uci -q get openclash.config.core_type)
|
||||
enable_custom_dns=$(uci -q get openclash.config.enable_custom_dns)
|
||||
append_wan_dns=$(uci -q get openclash.config.append_wan_dns || echo 1)
|
||||
tolerance=$(uci -q get openclash.config.tolerance || echo 0)
|
||||
custom_fallback_filter=$(uci -q get openclash.config.custom_fallback_filter || echo 0)
|
||||
enable_meta_core=$(uci -q get openclash.config.enable_meta_core || echo 0)
|
||||
china_ip_route=$(uci -q get openclash.config.china_ip_route || echo 0)
|
||||
|
||||
lan_block_google_dns=$(uci -q get openclash.config.lan_block_google_dns_ips || uci -q get openclash.config.lan_block_google_dns_macs || echo 0)
|
||||
|
||||
if [ -n "$(ruby_read "$5" "['tun']")" ]; then
|
||||
uci -q set openclash.config.config_reload=0
|
||||
else
|
||||
if [ -n "${11}" ]; then
|
||||
uci -q set openclash.config.config_reload=0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "${11}" ]; then
|
||||
en_mode_tun=0
|
||||
else
|
||||
en_mode_tun=${11}
|
||||
fi
|
||||
|
||||
if [ -z "${12}" ]; then
|
||||
stack_type=system
|
||||
else
|
||||
stack_type=${12}
|
||||
fi
|
||||
|
||||
if [ "${21}" != "1" ]; then
|
||||
enable_geoip_dat="false"
|
||||
else
|
||||
enable_geoip_dat="true"
|
||||
fi
|
||||
|
||||
if [ "${25}" != "1" ]; then
|
||||
enable_tcp_concurrent="false"
|
||||
else
|
||||
enable_tcp_concurrent="true"
|
||||
fi
|
||||
|
||||
if [ "$(ruby_read "$5" "['external-controller']")" != "$controller_address:$3" ]; then
|
||||
uci -q set openclash.config.config_reload=0
|
||||
fi
|
||||
|
||||
if [ "$(ruby_read "$5" "['secret']")" != "$2" ]; then
|
||||
uci -q set openclash.config.config_reload=0
|
||||
fi
|
||||
|
||||
if [ "$core_type" != "TUN" ] && [ "${10}" == "script" ]; then
|
||||
rule_mode="rule"
|
||||
uci -q set openclash.config.proxy_mode="$rule_mode"
|
||||
uci -q set openclash.config.router_self_proxy="1"
|
||||
LOG_OUT "Warning: Only TUN Core Support Script Mode, Switch To The Rule Mode!"
|
||||
else
|
||||
rule_mode="${10}"
|
||||
fi
|
||||
|
||||
uci commit openclash
|
||||
|
||||
if [ "$1" = "fake-ip" ] && [ "$china_ip_route" = "1" ]; then
|
||||
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
|
||||
echo "$i" >> /tmp/openclash_fake_filter_include
|
||||
done 2>/dev/null
|
||||
fi
|
||||
|
||||
#获取认证信息
|
||||
yml_auth_get()
|
||||
{
|
||||
local section="$1"
|
||||
local enabled username password
|
||||
config_get_bool "enabled" "$section" "enabled" "1"
|
||||
config_get "username" "$section" "username" ""
|
||||
config_get "password" "$section" "password" ""
|
||||
|
||||
if [ "$enabled" = "0" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -z "$username" ] || [ -z "$password" ]; then
|
||||
return
|
||||
else
|
||||
LOG_OUT "Tip: You have seted the authentication of SOCKS5/HTTP(S) proxy with【$username:$password】"
|
||||
echo " - $username:$password" >>/tmp/yaml_openclash_auth
|
||||
fi
|
||||
}
|
||||
|
||||
#添加自定义DNS设置
|
||||
yml_dns_custom()
|
||||
{
|
||||
if [ "$1" = 1 ] || [ "$3" = 1 ]; then
|
||||
sys_dns_append "$3" "$4"
|
||||
config_load "openclash"
|
||||
config_foreach yml_dns_get "dns_servers" "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
#获取DHCP或接口的DNS并追加
|
||||
sys_dns_append()
|
||||
{
|
||||
if [ "$1" = 1 ]; then
|
||||
wan_dns=$(/usr/share/openclash/openclash_get_network.lua "dns")
|
||||
wan6_dns=$(/usr/share/openclash/openclash_get_network.lua "dns6")
|
||||
wan_gate=$(/usr/share/openclash/openclash_get_network.lua "gateway")
|
||||
wan6_gate=$(/usr/share/openclash/openclash_get_network.lua "gateway6")
|
||||
dhcp_iface=$(/usr/share/openclash/openclash_get_network.lua "dhcp")
|
||||
pppoe_iface=$(/usr/share/openclash/openclash_get_network.lua "pppoe")
|
||||
if [ -z "$dhcp_iface" ] && [ -z "$pppoe_iface" ]; then
|
||||
if [ -n "$wan_dns" ]; then
|
||||
for i in $wan_dns; do
|
||||
echo " - \"$i\"" >>/tmp/yaml_config.namedns.yaml
|
||||
done
|
||||
fi
|
||||
if [ -n "$wan6_dns" ] && [ "$2" = 1 ]; then
|
||||
for i in $wan6_dns; do
|
||||
echo " - \"[${i}]:53\"" >>/tmp/yaml_config.namedns.yaml
|
||||
done
|
||||
fi
|
||||
if [ -n "$wan_gate" ]; then
|
||||
for i in $wan_gate; do
|
||||
echo " - \"$i\"" >>/tmp/yaml_config.namedns.yaml
|
||||
done
|
||||
fi
|
||||
if [ -n "$wan6_gate" ] && [ "$2" = 1 ]; then
|
||||
for i in $wan6_gate; do
|
||||
echo " - \"[${i}]:53\"" >>/tmp/yaml_config.namedns.yaml
|
||||
done
|
||||
fi
|
||||
else
|
||||
if [ -n "$dhcp_iface" ]; then
|
||||
for i in $dhcp_iface; do
|
||||
echo " - dhcp://\"$i\"" >>/tmp/yaml_config.namedns.yaml
|
||||
done
|
||||
if [ -n "$wan_gate" ]; then
|
||||
for i in $wan_gate; do
|
||||
echo " - \"$i\"" >>/tmp/yaml_config.namedns.yaml
|
||||
done
|
||||
fi
|
||||
if [ -n "$wan6_gate" ] && [ "$2" = 1 ]; then
|
||||
for i in $wan6_gate; do
|
||||
echo " - \"[${i}]:53\"" >>/tmp/yaml_config.namedns.yaml
|
||||
done
|
||||
fi
|
||||
fi
|
||||
if [ -n "$pppoe_iface" ]; then
|
||||
if [ -n "$wan_dns" ]; then
|
||||
for i in $wan_dns; do
|
||||
echo " - \"$i\"" >>/tmp/yaml_config.namedns.yaml
|
||||
done
|
||||
fi
|
||||
if [ -n "$wan6_dns" ] && [ "$2" = 1 ]; then
|
||||
for i in $wan6_dns; do
|
||||
echo " - \"[${i}]:53\"" >>/tmp/yaml_config.namedns.yaml
|
||||
done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -f "/tmp/yaml_config.namedns.yaml" ] && [ -z "$(grep "^ \{0,\}nameserver:$" /tmp/yaml_config.namedns.yaml 2>/dev/null)" ]; then
|
||||
sed -i '1i\ nameserver:' "/tmp/yaml_config.namedns.yaml"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
#获取自定义DNS设置
|
||||
yml_dns_get()
|
||||
{
|
||||
local section="$1" regex='^([0-9a-fA-F]{0,4}:){1,7}[0-9a-fA-F]{0,4}$'
|
||||
local enabled port type ip group dns_type dns_address interface specific_group
|
||||
config_get_bool "enabled" "$section" "enabled" "1"
|
||||
config_get "port" "$section" "port" ""
|
||||
config_get "type" "$section" "type" ""
|
||||
config_get "ip" "$section" "ip" ""
|
||||
config_get "group" "$section" "group" ""
|
||||
config_get "interface" "$section" "interface" ""
|
||||
config_get "specific_group" "$section" "specific_group" ""
|
||||
config_get_bool "node_resolve" "$section" "node_resolve" "0"
|
||||
config_get_bool "http3" "$section" "http3" "0"
|
||||
|
||||
if [ "$enabled" = "0" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -z "$ip" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ "$ip" =~ "$regex" ]]; then
|
||||
ip="[${ip}]"
|
||||
fi
|
||||
|
||||
if [ "$type" = "tcp" ]; then
|
||||
dns_type="tcp://"
|
||||
elif [ "$type" = "tls" ]; then
|
||||
dns_type="tls://"
|
||||
elif [ "$type" = "udp" ]; then
|
||||
dns_type=""
|
||||
elif [ "$type" = "https" ]; then
|
||||
dns_type="https://"
|
||||
elif [ "$type" = "quic" ]; then
|
||||
dns_type="quic://"
|
||||
fi
|
||||
|
||||
if [ -n "$port" ] && [ -n "$ip" ]; then
|
||||
if [ ${ip%%/*} != ${ip#*/} ]; then
|
||||
dns_address="${ip%%/*}:$port/${ip#*/}"
|
||||
else
|
||||
dns_address="$ip:$port"
|
||||
fi
|
||||
elif [ -z "$port" ] && [ -n "$ip" ]; then
|
||||
dns_address="$ip"
|
||||
else
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$type" == "quic" ] && [ "$enable_meta_core" != "1" ]; then
|
||||
LOG_OUT "Warning: Only Meta Core Support QUIC Type DNS, Skip【$dns_type$dns_address】"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$specific_group" != "Disable" ] && [ -n "$specific_group" ] && [ "$enable_meta_core" = "1" ]; then
|
||||
group_check=$(ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
|
||||
begin
|
||||
Thread.new{
|
||||
Value = YAML.load_file('$2');
|
||||
Value['proxy-groups'].each{
|
||||
|x|
|
||||
if x['name'] == '$specific_group' then
|
||||
if (x.key?('use') and not x['use'].to_a.empty?) or (x.key?('proxies') and not x['proxies'].to_a.empty?) then
|
||||
puts 'return'
|
||||
end;
|
||||
end;
|
||||
};
|
||||
}.join;
|
||||
rescue Exception => e
|
||||
puts 'return'
|
||||
end;" 2>/dev/null)
|
||||
|
||||
if [ "$group_check" != "return" ]; then
|
||||
/usr/share/openclash/yml_groups_set.sh >/dev/null 2>&1 "$specific_group"
|
||||
fi
|
||||
specific_group="#$specific_group"
|
||||
elif [ "$specific_group" != "Disable" ] && [ -n "$specific_group" ]; then
|
||||
LOG_OUT "Warning: Only Meta Core Support Specific Group, Skip Setting【$dns_type$dns_address】"
|
||||
specific_group=""
|
||||
else
|
||||
specific_group=""
|
||||
fi
|
||||
|
||||
if [ "$interface" != "Disable" ] && [ -n "$interface" ] && [ "$enable_meta_core" != "1" ]; then
|
||||
interface="#$interface"
|
||||
elif [ "$interface" != "Disable" ] && [ -n "$interface" ]; then
|
||||
LOG_OUT "Warning: Meta Core not Support Specific Interface, Skip Setting【$dns_type$dns_address】"
|
||||
interface=""
|
||||
else
|
||||
interface=""
|
||||
fi
|
||||
|
||||
if [ "$http3" = "1" ] && [ "$enable_meta_core" = "1" ] && [ -n "$specific_group" ]; then
|
||||
http3="&h3=true"
|
||||
elif [ "$http3" = "1" ] && [ "$enable_meta_core" = "1" ] && [ -z "$specific_group" ]; then
|
||||
http3="#h3=true"
|
||||
elif [ "$http3" = "1" ] && [ "$enable_meta_core" != "1" ]; then
|
||||
LOG_OUT "Warning: Only Meta Core Support Force HTTP/3 to connect, Skip Setting【$dns_type$dns_address】"
|
||||
http3=""
|
||||
else
|
||||
http3=""
|
||||
fi
|
||||
|
||||
if [ "$node_resolve" = "1" ] && [ "$enable_meta_core" = "1" ]; then
|
||||
if [ -z "$(grep "^ \{0,\}proxy-server-nameserver:$" /tmp/yaml_config.proxynamedns.yaml 2>/dev/null)" ]; then
|
||||
echo " proxy-server-nameserver:" >/tmp/yaml_config.proxynamedns.yaml
|
||||
fi
|
||||
echo " - \"$dns_type$dns_address$specific_group$http3\"" >>/tmp/yaml_config.proxynamedns.yaml
|
||||
elif [ "$node_resolve" = "1" ]; then
|
||||
LOG_OUT "Warning: Only Meta Core Support proxy-server-nameserver, Skip Setting【$dns_type$dns_address$specific_group$http3】"
|
||||
fi
|
||||
|
||||
dns_address="$dns_address$interface$specific_group$http3"
|
||||
|
||||
if [ -n "$group" ]; then
|
||||
if [ "$group" = "nameserver" ]; then
|
||||
if [ -z "$(grep "^ \{0,\}nameserver:$" /tmp/yaml_config.namedns.yaml 2>/dev/null)" ]; then
|
||||
echo " nameserver:" >/tmp/yaml_config.namedns.yaml
|
||||
fi
|
||||
echo " - \"$dns_type$dns_address\"" >>/tmp/yaml_config.namedns.yaml
|
||||
elif [ "$group" = "fallback" ]; then
|
||||
if [ -z "$(grep "^ \{0,\}fallback:$" /tmp/yaml_config.falldns.yaml 2>/dev/null)" ]; then
|
||||
echo " fallback:" >/tmp/yaml_config.falldns.yaml
|
||||
fi
|
||||
echo " - \"$dns_type$dns_address\"" >>/tmp/yaml_config.falldns.yaml
|
||||
elif [ "$group" = "default" ]; then
|
||||
if [ -z "$(grep "^ \{0,\}default-nameserver:$" /tmp/yaml_config.defaultdns.yaml 2>/dev/null)" ]; then
|
||||
echo " default-nameserver:" >/tmp/yaml_config.defaultdns.yaml
|
||||
fi
|
||||
echo " - \"$dns_type$dns_address\"" >>/tmp/yaml_config.defaultdns.yaml
|
||||
fi
|
||||
else
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
config_load "openclash"
|
||||
config_foreach yml_auth_get "authentication"
|
||||
yml_dns_custom "$enable_custom_dns" "$5" "$append_wan_dns" "${16}"
|
||||
|
||||
#配置文件覆写部分
|
||||
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
|
||||
begin
|
||||
Value = YAML.load_file('$5');
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Error: Load File Failed,【' + e.message + '】';
|
||||
end;
|
||||
|
||||
#field name check
|
||||
begin
|
||||
Thread.new{
|
||||
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;
|
||||
end;
|
||||
}.join;
|
||||
end;
|
||||
|
||||
#General
|
||||
begin
|
||||
Thread.new{
|
||||
Value['redir-port']=$4;
|
||||
Value['tproxy-port']=${15};
|
||||
Value['port']=$7;
|
||||
Value['socks-port']=$8;
|
||||
Value['mixed-port']=${14};
|
||||
Value['mode']='$rule_mode';
|
||||
Value['log-level']='$9';
|
||||
Value['allow-lan']=true;
|
||||
Value['external-controller']='0.0.0.0:$3';
|
||||
Value['secret']='$2';
|
||||
Value['bind-address']='*';
|
||||
Value['external-ui']='/usr/share/openclash/ui';
|
||||
if $6 == 1 then
|
||||
Value['ipv6']=true;
|
||||
else
|
||||
Value['ipv6']=false;
|
||||
end;
|
||||
if '${24}' != '0' then
|
||||
Value['interface-name']='${24}';
|
||||
else
|
||||
Value.delete('interface-name');
|
||||
end;
|
||||
if ${19} == 1 then
|
||||
Value['geodata-mode']=$enable_geoip_dat;
|
||||
Value['geodata-loader']='${22}';
|
||||
Value['tcp-concurrent']=$enable_tcp_concurrent;
|
||||
Value['find-process-mode']='${29}';
|
||||
Value['global-client-fingerprint']='${31}';
|
||||
else
|
||||
if Value.key?('geodata-mode') then
|
||||
Value.delete('geodata-mode');
|
||||
end;
|
||||
if Value.key?('geodata-loader') then
|
||||
Value.delete('geodata-loader');
|
||||
end;
|
||||
if Value.key?('tcp-concurrent') then
|
||||
Value.delete('tcp-concurrent');
|
||||
end
|
||||
if Value.key?('find-process-mode') then
|
||||
Value.delete('find-process-mode');
|
||||
end
|
||||
if Value.key?('global-client-fingerprint') then
|
||||
Value.delete('global-client-fingerprint');
|
||||
end
|
||||
end;
|
||||
if not Value.key?('dns') then
|
||||
Value_1={'dns'=>{'enable'=>true}};
|
||||
Value['dns']=Value_1['dns'];
|
||||
else
|
||||
Value['dns']['enable']=true;
|
||||
end;
|
||||
if ${16} == 1 then
|
||||
Value['dns']['ipv6']=true;
|
||||
#meta core v6 DNS
|
||||
if ${19} != 1 then
|
||||
Value['ipv6']=true;
|
||||
end;
|
||||
else
|
||||
Value['dns']['ipv6']=false;
|
||||
end;
|
||||
|
||||
#dev&tun core force fake-ip
|
||||
if ${19} == 1 and '$1' == 'redir-host' then
|
||||
Value['dns']['enhanced-mode']='redir-host';
|
||||
Value['dns'].delete('fake-ip-range');
|
||||
else
|
||||
Value['dns']['enhanced-mode']='fake-ip';
|
||||
Value['dns']['fake-ip-range']='${30}';
|
||||
end;
|
||||
|
||||
Value['dns']['listen']='0.0.0.0:${13}';
|
||||
|
||||
#meta only
|
||||
if ${19} == 1 and ${20} == 1 then
|
||||
Value_sniffer={'sniffer'=>{'enable'=>true}};
|
||||
Value['sniffer']=Value_sniffer['sniffer'];
|
||||
if '$1' == 'redir-host' then
|
||||
Value['sniffer']['force-dns-mapping']=true;
|
||||
else
|
||||
Value['sniffer']['force-dns-mapping']=false;
|
||||
end;
|
||||
if ${28} == 1 then
|
||||
Value['sniffer']['parse-pure-ip']=true;
|
||||
else
|
||||
Value['sniffer']['parse-pure-ip']=false;
|
||||
end;
|
||||
if File::exist?('/etc/openclash/custom/openclash_force_sniffing_domain.yaml') then
|
||||
if ${23} == 1 then
|
||||
Value_7 = YAML.load_file('/etc/openclash/custom/openclash_force_sniffing_domain.yaml');
|
||||
if Value_7 != false and not Value_7['force-domain'].to_a.empty? then
|
||||
Value['sniffer']['force-domain']=Value_7['force-domain'];
|
||||
Value['sniffer']['force-domain']=Value['sniffer']['force-domain'].uniq;
|
||||
end;
|
||||
else
|
||||
if not Value['sniffer'].key?('force-domain') then
|
||||
Value_force_domain={'force-domain'=>['+.netflix.com', '+.nflxvideo.net', '+.amazonaws.com', '+.media.dssott.com']};
|
||||
Value['sniffer'].merge!(Value_force_domain);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
if File::exist?('/etc/openclash/custom/openclash_sniffing_domain_filter.yaml') then
|
||||
if ${23} == 1 then
|
||||
Value_7 = YAML.load_file('/etc/openclash/custom/openclash_sniffing_domain_filter.yaml');
|
||||
if Value_7 != false and not Value_7['skip-sni'].to_a.empty? then
|
||||
Value['sniffer']['skip-domain']=Value_7['skip-sni'];
|
||||
Value['sniffer']['skip-domain']=Value['sniffer']['skip-domain'].uniq;
|
||||
end;
|
||||
if Value_7 != false and not Value_7['skip-domain'].to_a.empty? then
|
||||
Value['sniffer']['skip-domain']=Value_7['skip-domain'];
|
||||
Value['sniffer']['skip-domain']=Value['sniffer']['skip-domain'].uniq;
|
||||
end;
|
||||
else
|
||||
if not Value['sniffer'].key?('skip-domain') then
|
||||
Value_skip_domain={'skip-domain'=>['+.apple.com', 'Mijia Cloud', '+.jd.com']};
|
||||
Value['sniffer'].merge!(Value_skip_domain);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
if File::exist?('/etc/openclash/custom/openclash_sniffing_ports_filter.yaml') then
|
||||
if ${23} == 1 then
|
||||
Value_7 = YAML.load_file('/etc/openclash/custom/openclash_sniffing_ports_filter.yaml');
|
||||
if Value_7 != false and not Value_7['sniff'].to_a.empty? then
|
||||
Value['sniffer']['sniff']=Value_7['sniff'];
|
||||
end;
|
||||
else
|
||||
if not Value['sniffer'].key?('sniff') then
|
||||
Value_sniff={'sniff'=>{'TLS'=>nil, 'HTTP'=>{'ports'=>[80, '8080-8880'], 'override-destination'=>true}}};
|
||||
Value['sniffer'].merge!(Value_sniff);
|
||||
end;
|
||||
end;
|
||||
else
|
||||
if File::exist?('/etc/openclash/custom/openclash_sniffing_port_filter.yaml') and ${23} == 1 then
|
||||
Value_7 = YAML.load_file('/etc/openclash/custom/openclash_sniffing_port_filter.yaml');
|
||||
if Value_7 != false and not Value_7['port-whitelist'].to_a.empty? then
|
||||
Value['sniffer']['port-whitelist']=Value_7['port-whitelist'];
|
||||
Value['sniffer']['port-whitelist']=Value['sniffer']['port-whitelist'].uniq;
|
||||
end;
|
||||
end;
|
||||
Value_sniffer={'sniffing'=>['tls','http']};
|
||||
Value['sniffer'].merge!(Value_sniffer);
|
||||
end;
|
||||
else
|
||||
if Value.key?('sniffer') then
|
||||
Value.delete('sniffer');
|
||||
end;
|
||||
if '${26}' == 'TUN' then
|
||||
Value_tun_sniff={'experimental'=>{'sniff-tls-sni'=>true}};
|
||||
Value['experimental'] = Value_tun_sniff['experimental'];
|
||||
else
|
||||
if Value.key?('experimental') then
|
||||
Value.delete('experimental');
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
Value_2={'tun'=>{'enable'=>true}};
|
||||
if $en_mode_tun != 0 then
|
||||
Value['tun']=Value_2['tun'];
|
||||
Value['tun']['stack']='$stack_type';
|
||||
if ${19} == 1 then
|
||||
Value['tun']['device']='utun';
|
||||
Value['tun']['mtu']=65535;
|
||||
end;
|
||||
Value_2={'dns-hijack'=>['tcp://any:53']};
|
||||
Value['tun']['auto-route']=false;
|
||||
Value['tun']['auto-detect-interface']=false;
|
||||
Value['tun'].merge!(Value_2);
|
||||
else
|
||||
if Value.key?('tun') then
|
||||
Value.delete('tun');
|
||||
end;
|
||||
end;
|
||||
if Value.key?('iptables') then
|
||||
Value.delete('iptables');
|
||||
end;
|
||||
if not Value.key?('profile') then
|
||||
Value_3={'profile'=>{'store-selected'=>true}};
|
||||
Value['profile']=Value_3['profile'];
|
||||
else
|
||||
Value['profile']['store-selected']=true;
|
||||
end;
|
||||
if ${17} != 1 then
|
||||
Value['profile']['store-fake-ip']=false;
|
||||
else
|
||||
Value['profile']['store-fake-ip']=true;
|
||||
end;
|
||||
if Value.key?('ebpf') then
|
||||
Value.delete('ebpf');
|
||||
end;
|
||||
if Value.key?('routing-mark') then
|
||||
Value.delete('routing-mark');
|
||||
end;
|
||||
if Value.key?('auto-redir') then
|
||||
Value.delete('auto-redir');
|
||||
end;
|
||||
}.join;
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Error: Set General Failed,【' + e.message + '】';
|
||||
end;
|
||||
|
||||
#Custom dns
|
||||
begin
|
||||
Thread.new{
|
||||
if '$enable_custom_dns' == '1' or '$append_wan_dns' == '1' then
|
||||
if File::exist?('/tmp/yaml_config.namedns.yaml') then
|
||||
Value_1 = YAML.load_file('/tmp/yaml_config.namedns.yaml');
|
||||
if '$enable_custom_dns' == '1' then
|
||||
Value['dns']['nameserver'] = Value_1['nameserver'].uniq;
|
||||
elsif '$append_wan_dns' == '1' then
|
||||
if Value['dns'].has_key?('nameserver') then
|
||||
Value['dns']['nameserver'] = Value['dns']['nameserver'] | Value_1['nameserver'];
|
||||
else
|
||||
Value['dns']['nameserver'] = Value_1['nameserver'].uniq;
|
||||
end;
|
||||
end;
|
||||
if File::exist?('/tmp/yaml_config.falldns.yaml') and '$enable_custom_dns' == '1' then
|
||||
Value_2 = YAML.load_file('/tmp/yaml_config.falldns.yaml');
|
||||
Value['dns']['fallback'] = Value_2['fallback'].uniq;
|
||||
end;
|
||||
elsif '$enable_custom_dns' == '1' then
|
||||
puts '${LOGTIME} Error: Nameserver Option Must Be Setted, Stop Customing DNS Servers';
|
||||
end;
|
||||
end;
|
||||
}.join;
|
||||
end;
|
||||
|
||||
# dns check
|
||||
begin
|
||||
Thread.new{
|
||||
if not Value['dns'].key?('nameserver') or Value['dns']['nameserver'].to_a.empty? then
|
||||
puts '${LOGTIME} Detected That The nameserver DNS Option Has No Server Set, Starting To Complete...';
|
||||
Value_1={'nameserver'=>['114.114.114.114','119.29.29.29','223.5.5.5','https://doh.pub/dns-query','https://223.5.5.5/dns-query']};
|
||||
Value_2={'fallback'=>['https://dns.cloudflare.com/dns-query','https://public.dns.iij.jp/dns-query','https://jp.tiar.app/dns-query','https://jp.tiarap.org/dns-query']};
|
||||
Value['dns'].merge!(Value_1);
|
||||
Value['dns'].merge!(Value_2);
|
||||
end;
|
||||
}.join;
|
||||
end;
|
||||
|
||||
#default-nameserver
|
||||
begin
|
||||
Thread.new{
|
||||
if '$enable_custom_dns' == '1' then
|
||||
if File::exist?('/tmp/yaml_config.defaultdns.yaml') then
|
||||
Value_1 = YAML.load_file('/tmp/yaml_config.defaultdns.yaml');
|
||||
if Value['dns'].has_key?('default-nameserver') then
|
||||
Value['dns']['default-nameserver'] = Value['dns']['default-nameserver'] | Value_1['default-nameserver'];
|
||||
else
|
||||
Value['dns']['default-nameserver'] = Value_1['default-nameserver'].uniq;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
if ${27} == 1 then
|
||||
if ${19} == 1 then
|
||||
reg = /(^https:\/\/|^tls:\/\/|^quic:\/\/)?((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(?::(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?/;
|
||||
reg6 = /(^https:\/\/|^tls:\/\/|^quic:\/\/)?(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))|\[(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))\](?::(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?/i;
|
||||
else
|
||||
reg = /^((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(?::(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?$/;
|
||||
reg6 = /^(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))|\[(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))\](?::(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?$/i;
|
||||
end;
|
||||
if Value['dns'].has_key?('fallback') then
|
||||
Value_1=Value['dns']['nameserver'] | Value['dns']['fallback'];
|
||||
else
|
||||
Value_1=Value['dns']['nameserver'];
|
||||
end;
|
||||
Value_1.each{|x|
|
||||
if x =~ reg or x =~ reg6 then
|
||||
if Value['dns'].has_key?('default-nameserver') then
|
||||
Value['dns']['default-nameserver']=Value['dns']['default-nameserver'].to_a.insert(-1,x).uniq;
|
||||
else
|
||||
Value_2={'default-nameserver'=>[x]};
|
||||
Value['dns'].merge!(Value_2);
|
||||
end;
|
||||
end;
|
||||
};
|
||||
end;
|
||||
}.join;
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Error: Set default-nameserver Failed,【' + e.message + '】';
|
||||
end;
|
||||
|
||||
#proxy server dns
|
||||
begin
|
||||
Thread.new{
|
||||
if '$enable_custom_dns' == '1' then
|
||||
if File::exist?('/tmp/yaml_config.proxynamedns.yaml') then
|
||||
Value_1 = YAML.load_file('/tmp/yaml_config.proxynamedns.yaml');
|
||||
Value_1['proxy-server-nameserver'] = Value_1['proxy-server-nameserver'].uniq;
|
||||
Value['dns']['proxy-server-nameserver'] = Value_1['proxy-server-nameserver'];
|
||||
end;
|
||||
end;
|
||||
}.join;
|
||||
end;
|
||||
|
||||
#fallback-filter
|
||||
begin
|
||||
Thread.new{
|
||||
if '$custom_fallback_filter' == '1' then
|
||||
if not Value['dns'].key?('fallback') then
|
||||
puts '${LOGTIME} Error: Fallback-Filter Need fallback of DNS Been Setted, Ignore...';
|
||||
elsif not YAML.load_file('/etc/openclash/custom/openclash_custom_fallback_filter.yaml') then
|
||||
puts '${LOGTIME} Error: Unable To Parse Custom Fallback-Filter File, Ignore...';
|
||||
else
|
||||
Value['dns']['fallback-filter'] = YAML.load_file('/etc/openclash/custom/openclash_custom_fallback_filter.yaml')['fallback-filter'];
|
||||
end;
|
||||
end;
|
||||
}.join;
|
||||
end;
|
||||
|
||||
#nameserver-policy
|
||||
begin
|
||||
Thread.new{
|
||||
if '$dns_advanced_setting' == '1' then
|
||||
if File::exist?('/etc/openclash/custom/openclash_custom_domain_dns_policy.list') then
|
||||
Value_6 = YAML.load_file('/etc/openclash/custom/openclash_custom_domain_dns_policy.list');
|
||||
if Value_6 != false and not Value_6.nil? then
|
||||
if Value['dns'].has_key?('nameserver-policy') and not Value['dns']['nameserver-policy'].to_a.empty? then
|
||||
Value['dns']['nameserver-policy'].merge!(Value_6);
|
||||
else
|
||||
Value['dns']['nameserver-policy']=Value_6;
|
||||
end;
|
||||
Value['dns']['nameserver-policy'].uniq;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
}.join;
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Error: Set Nameserver-Policy Failed,【' + e.message + '】';
|
||||
end;
|
||||
|
||||
#fake-ip-filter
|
||||
begin
|
||||
Thread.new{
|
||||
if '$1' == 'fake-ip' then
|
||||
if File::exist?('/etc/openclash/custom/openclash_custom_fake_filter.list') then
|
||||
Value_4 = IO.readlines('/etc/openclash/custom/openclash_custom_fake_filter.list');
|
||||
if not Value_4.empty? then
|
||||
Value_4 = Value_4.map!{|x| x.gsub(/#.*$/,'').strip} - ['', nil];
|
||||
if Value['dns'].has_key?('fake-ip-filter') and not Value['dns']['fake-ip-filter'].to_a.empty? then
|
||||
Value['dns']['fake-ip-filter'] = Value['dns']['fake-ip-filter'] | Value_4;
|
||||
else
|
||||
Value['dns']['fake-ip-filter'] = Value_4;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
if File::exist?('/tmp/openclash_fake_filter_include') then
|
||||
Value_4 = IO.readlines('/tmp/openclash_fake_filter_include');
|
||||
if not Value_4.empty? then
|
||||
Value_4 = Value_4.map!{|x| x.gsub(/#.*$/,'').strip} - ['', nil];
|
||||
if Value['dns'].has_key?('fake-ip-filter') and not Value['dns']['fake-ip-filter'].to_a.empty? then
|
||||
Value['dns']['fake-ip-filter'] = Value['dns']['fake-ip-filter'] | Value_4;
|
||||
else
|
||||
Value['dns']['fake-ip-filter'] = Value_4;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
if ${18} == 1 then
|
||||
if Value['dns'].has_key?('fake-ip-filter') and not Value['dns']['fake-ip-filter'].to_a.empty? then
|
||||
Value['dns']['fake-ip-filter'].insert(-1,'+.nflxvideo.net');
|
||||
Value['dns']['fake-ip-filter'].insert(-1,'+.media.dssott.com');
|
||||
Value['dns']['fake-ip-filter']=Value['dns']['fake-ip-filter'].uniq;
|
||||
else
|
||||
Value['dns'].merge!({'fake-ip-filter'=>['+.nflxvideo.net', '+.media.dssott.com']});
|
||||
end;
|
||||
end;
|
||||
if '$lan_block_google_dns' != '0' then
|
||||
if Value['dns'].has_key?('fake-ip-filter') and not Value['dns']['fake-ip-filter'].to_a.empty? then
|
||||
Value['dns']['fake-ip-filter'].insert(-1,'+.dns.google');
|
||||
Value['dns']['fake-ip-filter']=Value['dns']['fake-ip-filter'].uniq;
|
||||
else
|
||||
Value['dns'].merge!({'fake-ip-filter'=>['+.dns.google']});
|
||||
end;
|
||||
end;
|
||||
elsif ${19} != 1 then
|
||||
if Value['dns'].has_key?('fake-ip-filter') and not Value['dns']['fake-ip-filter'].to_a.empty? then
|
||||
Value['dns']['fake-ip-filter'].insert(-1,'+.*');
|
||||
Value['dns']['fake-ip-filter']=Value['dns']['fake-ip-filter'].uniq;
|
||||
else
|
||||
Value['dns'].merge!({'fake-ip-filter'=>['+.*']});
|
||||
end;
|
||||
end;
|
||||
}.join;
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Error: Set Fake-IP-Filter Failed,【' + e.message + '】';
|
||||
end;
|
||||
|
||||
#custom hosts
|
||||
begin
|
||||
Thread.new{
|
||||
if File::exist?('/etc/openclash/custom/openclash_custom_hosts.list') then
|
||||
begin
|
||||
Value_3 = YAML.load_file('/etc/openclash/custom/openclash_custom_hosts.list');
|
||||
if Value_3 != false and not Value_3.nil? then
|
||||
Value['dns']['use-hosts']=true;
|
||||
if Value.has_key?('hosts') and not Value['hosts'].to_a.empty? then
|
||||
Value['hosts'].merge!(Value_3);
|
||||
else
|
||||
Value['hosts']=Value_3;
|
||||
end;
|
||||
Value['hosts'].uniq;
|
||||
puts '${LOGTIME} Warning: You May Need to Turn off The Rebinding Protection Option of Dnsmasq When Hosts Has Set a Reserved Address';
|
||||
end;
|
||||
rescue
|
||||
Value_3 = IO.readlines('/etc/openclash/custom/openclash_custom_hosts.list');
|
||||
if not Value_3.empty? then
|
||||
Value_3 = Value_3.map!{|x| x.gsub(/#.*$/,'').strip} - ['', nil];
|
||||
Value['dns']['use-hosts']=true;
|
||||
if Value.has_key?('hosts') and not Value['hosts'].to_a.empty? then
|
||||
Value_3.each{|x| Value['hosts'].merge!(x)};
|
||||
else
|
||||
Value_3.each{|x| Value['hosts'].merge!(x)};
|
||||
end;
|
||||
Value['hosts'].uniq;
|
||||
puts '${LOGTIME} Warning: You May Need to Turn off The Rebinding Protection Option of Dnsmasq When Hosts Has Set a Reserved Address';
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
}.join;
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Error: Set Hosts Rules Failed,【' + e.message + '】';
|
||||
end;
|
||||
|
||||
#tolerance
|
||||
begin
|
||||
Thread.new{
|
||||
if '$tolerance' != '0' then
|
||||
Value['proxy-groups'].each{
|
||||
|x|
|
||||
if x['type'] == 'url-test' then
|
||||
x['tolerance']='${tolerance}';
|
||||
end
|
||||
};
|
||||
end;
|
||||
}.join;
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Error: Set Url-Test Group Tolerance Failed,【' + e.message + '】';
|
||||
end;
|
||||
|
||||
#auth
|
||||
begin
|
||||
Thread.new{
|
||||
if File::exist?('/tmp/yaml_openclash_auth') then
|
||||
Value_1 = YAML.load_file('/tmp/yaml_openclash_auth');
|
||||
Value['authentication']=Value_1
|
||||
elsif Value.key?('authentication') then
|
||||
Value.delete('authentication');
|
||||
end;
|
||||
}.join;
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Error: Set authentication Failed,【' + e.message + '】';
|
||||
end;
|
||||
|
||||
#Vmess-ws formalt check, not support proxy-provider
|
||||
begin
|
||||
Thread.new{
|
||||
if Value.key?('proxies') and not Value['proxies'].nil? then
|
||||
Value['proxies'].each{
|
||||
|x|
|
||||
if x['type'] != 'vmess' then
|
||||
next
|
||||
end;
|
||||
if x.key?('ws-path') then
|
||||
if not x.key?('ws-opts') then
|
||||
x['ws-opts'] = {'path'=>x['ws-path'].to_s};
|
||||
else
|
||||
if x['ws-opts'].nil? then
|
||||
x['ws-opts'] = {'path'=>x['ws-path'].to_s};
|
||||
elsif x['ws-opts']['path'].nil? then
|
||||
x['ws-opts'].update({'path'=>x['ws-path'].to_s});
|
||||
end
|
||||
end
|
||||
x.delete('ws-path');
|
||||
end;
|
||||
if x.key?('ws-headers') then
|
||||
x['ws-headers'].keys.each{
|
||||
|v|
|
||||
if not x.key?('ws-opts') then
|
||||
x['ws-opts'] = {'headers'=>{v.to_s=>x['ws-headers'][v].to_s}};
|
||||
else
|
||||
if x['ws-opts'].nil? then
|
||||
x['ws-opts'] = {'headers'=>{v.to_s=>x['ws-headers'][v].to_s}};
|
||||
elsif x['ws-opts']['headers'].nil? then
|
||||
x['ws-opts'].update({'headers'=>{v.to_s=>x['ws-headers'][v].to_s}});
|
||||
#elsif not x['ws-opts']['headers'].key?(v)
|
||||
# x['ws-opts']['headers'].update({v.to_s=>x['ws-headers'][v].to_s});
|
||||
end;
|
||||
end;
|
||||
};
|
||||
x.delete('ws-headers');
|
||||
end;
|
||||
};
|
||||
end;
|
||||
}.join;
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Error: Edit Vmess Compatible Failed,【' + e.message + '】';
|
||||
ensure
|
||||
File.open('$5','w') {|f| YAML.dump(Value, f)};
|
||||
end" 2>/dev/null >> $LOG_FILE
|
269
luci-app-openclash/root/usr/share/openclash/yml_groups_get.sh
Normal file
269
luci-app-openclash/root/usr/share/openclash/yml_groups_get.sh
Normal file
@ -0,0 +1,269 @@
|
||||
#!/bin/bash
|
||||
. /lib/functions.sh
|
||||
. /usr/share/openclash/log.sh
|
||||
|
||||
set_lock() {
|
||||
exec 876>"/tmp/lock/openclash_groups_get.lock" 2>/dev/null
|
||||
flock -x 876 2>/dev/null
|
||||
}
|
||||
|
||||
del_lock() {
|
||||
flock -u 876 2>/dev/null
|
||||
rm -rf "/tmp/lock/openclash_groups_get.lock"
|
||||
}
|
||||
|
||||
ruby_read_hash()
|
||||
{
|
||||
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_read()
|
||||
{
|
||||
RUBY_YAML_PARSE="Thread.new{Value = YAML.load_file('$1'); puts Value$2}.join"
|
||||
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "$RUBY_YAML_PARSE" 2>/dev/null
|
||||
}
|
||||
|
||||
CFG_FILE="/etc/config/openclash"
|
||||
other_group_file="/tmp/yaml_other_group.yaml"
|
||||
servers_update=$(uci get openclash.config.servers_update 2>/dev/null)
|
||||
servers_if_update=$(uci get openclash.config.servers_if_update 2>/dev/null)
|
||||
CONFIG_FILE=$(uci get openclash.config.config_path 2>/dev/null)
|
||||
CONFIG_NAME=$(echo "$CONFIG_FILE" |awk -F '/' '{print $5}' 2>/dev/null)
|
||||
UPDATE_CONFIG_FILE=$(uci get openclash.config.config_update_path 2>/dev/null)
|
||||
UPDATE_CONFIG_NAME=$(echo "$UPDATE_CONFIG_FILE" |awk -F '/' '{print $5}' 2>/dev/null)
|
||||
LOGTIME=$(echo $(date "+%Y-%m-%d %H:%M:%S"))
|
||||
LOG_FILE="/tmp/openclash.log"
|
||||
set_lock
|
||||
|
||||
if [ ! -z "$UPDATE_CONFIG_FILE" ]; then
|
||||
CONFIG_FILE="$UPDATE_CONFIG_FILE"
|
||||
CONFIG_NAME="$UPDATE_CONFIG_NAME"
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
BACKUP_FILE="/etc/openclash/backup/$(echo "$CONFIG_FILE" |awk -F '/' '{print $5}' 2>/dev/null)"
|
||||
|
||||
if [ ! -s "$CONFIG_FILE" ] && [ ! -s "$BACKUP_FILE" ]; then
|
||||
del_lock
|
||||
exit 0
|
||||
elif [ ! -s "$CONFIG_FILE" ] && [ -s "$BACKUP_FILE" ]; then
|
||||
mv "$BACKUP_FILE" "$CONFIG_FILE"
|
||||
fi
|
||||
|
||||
LOG_OUT "Start Getting【$CONFIG_NAME】Groups Setting..."
|
||||
|
||||
/usr/share/openclash/yml_groups_name_get.sh
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_OUT "Read Error, Config File【$CONFIG_NAME】Abnormal!"
|
||||
uci commit openclash
|
||||
sleep 5
|
||||
SLOG_CLEAN
|
||||
del_lock
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#判断当前配置文件是否有策略组信息
|
||||
cfg_group_name()
|
||||
{
|
||||
local section="$1"
|
||||
config_get "config" "$section" "config" ""
|
||||
|
||||
if [ -z "$config" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
[ "$config" = "$CONFIG_NAME" ] && {
|
||||
config_group_exist=1
|
||||
}
|
||||
}
|
||||
|
||||
#删除不必要的配置
|
||||
cfg_delete()
|
||||
{
|
||||
LOG_OUT "Deleting Old Configuration..."
|
||||
#删除策略组
|
||||
group_num=$(grep "^config groups$" "$CFG_FILE" |wc -l)
|
||||
for ((i=$group_num;i>=0;i--))
|
||||
do
|
||||
if [ "$(uci get openclash.@groups["$i"].config 2>/dev/null)" = "$CONFIG_NAME" ] || [ "$(uci get openclash.@groups["$i"].config 2>/dev/null)" = "all" ]; then
|
||||
uci delete openclash.@groups["$i"] 2>/dev/null
|
||||
uci commit openclash
|
||||
fi
|
||||
done
|
||||
#删除启用的节点
|
||||
server_num=$(grep "^config servers$" "$CFG_FILE" |wc -l)
|
||||
for ((i=$server_num;i>=0;i--))
|
||||
do
|
||||
if [ "$(uci get openclash.@servers["$i"].config 2>/dev/null)" = "$CONFIG_NAME" ] || [ "$(uci get openclash.@servers["$i"].config 2>/dev/null)" = "all" ]; then
|
||||
if [ "$(uci get openclash.@servers["$i"].enabled 2>/dev/null)" = "1" ] && [ "$(uci get openclash.@servers["$i"].manual 2>/dev/null)" = "0" ]; then
|
||||
uci delete openclash.@servers["$i"] 2>/dev/null
|
||||
uci commit openclash
|
||||
fi
|
||||
fi
|
||||
done
|
||||
#删除启用的代理集
|
||||
provider_num=$(grep "^config proxy-provider$" "$CFG_FILE" 2>/dev/null |wc -l)
|
||||
for ((i=$provider_num;i>=0;i--))
|
||||
do
|
||||
if [ "$(uci get openclash.@proxy-provider["$i"].config 2>/dev/null)" = "$CONFIG_NAME" ] || [ "$(uci get openclash.@proxy-provider["$i"].config 2>/dev/null)" = "all" ]; then
|
||||
if [ "$(uci get openclash.@proxy-provider["$i"].enabled)" = "1" ] && [ "$(uci get openclash.@proxy-provider["$i"].manual)" = "0" ]; then
|
||||
uci delete openclash.@proxy-provider["$i"] 2>/dev/null
|
||||
uci commit openclash
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
config_load "openclash"
|
||||
config_foreach cfg_group_name "groups"
|
||||
|
||||
if [ "$servers_if_update" -eq 1 ] && [ "$servers_update" -eq 1 ] && [ "$config_group_exist" -eq 1 ]; then
|
||||
/usr/share/openclash/yml_proxys_get.sh
|
||||
del_lock
|
||||
exit 0
|
||||
fi
|
||||
|
||||
count=0
|
||||
match_group_file="/tmp/Proxy_Group"
|
||||
#提取策略组部分
|
||||
group_hash=$(ruby_read "$CONFIG_FILE" ".select {|x| 'proxy-groups' == x}")
|
||||
num=$(ruby_read_hash "$group_hash" "['proxy-groups'].count")
|
||||
|
||||
if [ -z "$num" ]; then
|
||||
LOG_OUT "Error: Unable To Parse Config File, Please Check And Try Again!"
|
||||
sleep 3
|
||||
del_lock
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cfg_delete
|
||||
|
||||
while [ "$count" -lt "$num" ]
|
||||
do
|
||||
|
||||
#type
|
||||
group_type=$(ruby_read_hash "$group_hash" "['proxy-groups'][$count]['type']")
|
||||
#name
|
||||
group_name=$(ruby_read_hash "$group_hash" "['proxy-groups'][$count]['name']")
|
||||
|
||||
if [ -z "$group_type" ] || [ -z "$group_name" ]; then
|
||||
let count++
|
||||
continue
|
||||
fi
|
||||
|
||||
LOG_OUT "Start Getting【$CONFIG_NAME - $group_type - $group_name】Group Setting..."
|
||||
|
||||
name=openclash
|
||||
uci_name_tmp=$(uci add $name groups)
|
||||
uci_set="uci -q set $name.$uci_name_tmp."
|
||||
uci_add="uci -q add_list $name.$uci_name_tmp."
|
||||
|
||||
${uci_set}enabled="1"
|
||||
${uci_set}config="$CONFIG_NAME"
|
||||
${uci_set}name="$group_name"
|
||||
${uci_set}old_name="$group_name"
|
||||
${uci_set}old_name_cfg="$group_name"
|
||||
${uci_set}type="$group_type"
|
||||
|
||||
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
|
||||
begin
|
||||
Value = ${group_hash};
|
||||
Thread.new{
|
||||
#strategy
|
||||
if Value['proxy-groups'][$count].key?('strategy') then
|
||||
group_strategy = '${uci_set}strategy=' + Value['proxy-groups'][$count]['strategy'].to_s
|
||||
system(group_strategy)
|
||||
end
|
||||
}.join;
|
||||
|
||||
Thread.new{
|
||||
#disable-udp
|
||||
if Value['proxy-groups'][$count].key?('disable-udp') then
|
||||
group_disable_udp = '${uci_set}disable_udp=' + Value['proxy-groups'][$count]['disable-udp'].to_s
|
||||
system(group_disable_udp)
|
||||
end
|
||||
}.join;
|
||||
|
||||
Thread.new{
|
||||
#test_url
|
||||
if Value['proxy-groups'][$count].key?('url') then
|
||||
group_test_url = '${uci_set}test_url=\"' + Value['proxy-groups'][$count]['url'].to_s + '\"'
|
||||
system(group_test_url)
|
||||
end
|
||||
}.join;
|
||||
|
||||
Thread.new{
|
||||
#test_interval
|
||||
if Value['proxy-groups'][$count].key?('interval') then
|
||||
group_test_interval = '${uci_set}test_interval=' + Value['proxy-groups'][$count]['interval'].to_s
|
||||
system(group_test_interval)
|
||||
end
|
||||
}.join;
|
||||
|
||||
Thread.new{
|
||||
#test_tolerance
|
||||
if Value['proxy-groups'][$count].key?('tolerance') then
|
||||
group_test_tolerance = '${uci_set}tolerance=' + Value['proxy-groups'][$count]['tolerance'].to_s
|
||||
system(group_test_tolerance)
|
||||
end
|
||||
}.join;
|
||||
|
||||
Thread.new{
|
||||
#Policy Filter
|
||||
if Value['proxy-groups'][$count].key?('filter') then
|
||||
policy_filter = '${uci_set}policy_filter=' + Value['proxy-groups'][$count]['filter'].to_s
|
||||
system(policy_filter)
|
||||
end
|
||||
}.join;
|
||||
|
||||
Thread.new{
|
||||
#interface-name
|
||||
if Value['proxy-groups'][$count].key?('interface-name') then
|
||||
interface_name = '${uci_set}interface_name=' + Value['proxy-groups'][$count]['interface-name'].to_s
|
||||
system(interface_name)
|
||||
end
|
||||
}.join;
|
||||
|
||||
Thread.new{
|
||||
#routing-mark
|
||||
if Value['proxy-groups'][$count].key?('routing-mark') then
|
||||
routing_mark = '${uci_set}routing_mark=' + Value['proxy-groups'][$count]['routing-mark'].to_s
|
||||
system(routing_mark)
|
||||
end
|
||||
}.join;
|
||||
|
||||
Thread.new{
|
||||
#other_group
|
||||
Value_1 = File.readlines('/tmp/Proxy_Group').map!{|x| x.strip};
|
||||
if Value['proxy-groups'][$count].key?('proxies') then
|
||||
Value['proxy-groups'][$count]['proxies'].each{
|
||||
|x|
|
||||
if Value_1.include?(x) then
|
||||
uci = '${uci_add}other_group=\"' + x.to_s + '\"'
|
||||
system(uci)
|
||||
end
|
||||
}
|
||||
end
|
||||
}.join;
|
||||
rescue Exception => e
|
||||
puts '${LOGTIME} Error: Resolve Groups Failed,【${CONFIG_NAME} - ${group_type} - ${group_name}: ' + e.message + '】'
|
||||
end
|
||||
" 2>/dev/null >> $LOG_FILE &
|
||||
|
||||
let count++
|
||||
done
|
||||
|
||||
wait
|
||||
uci commit openclash
|
||||
/usr/share/openclash/yml_proxys_get.sh
|
||||
del_lock
|
@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
. /lib/functions.sh
|
||||
|
||||
set_lock() {
|
||||
exec 882>"/tmp/lock/openclash_name_ch.lock" 2>/dev/null
|
||||
flock -x 882 2>/dev/null
|
||||
}
|
||||
|
||||
del_lock() {
|
||||
flock -u 882 2>/dev/null
|
||||
rm -rf "/tmp/lock/openclash_name_ch.lock"
|
||||
}
|
||||
|
||||
cfg_groups_set()
|
||||
{
|
||||
|
||||
CFG_FILE="/etc/config/openclash"
|
||||
local section="$1"
|
||||
config_get "name" "$section" "name" ""
|
||||
config_get "old_name_cfg" "$section" "old_name_cfg" ""
|
||||
config_get "old_name" "$section" "old_name" ""
|
||||
|
||||
if [ -z "$name" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -z "$old_name_cfg" ]; then
|
||||
uci -q set openclash."$section".old_name_cfg="$name"
|
||||
uci commit openclash
|
||||
fi
|
||||
|
||||
if [ -z "$old_name" ]; then
|
||||
uci -q set openclash."$section".old_name="$name"
|
||||
uci commit openclash
|
||||
fi
|
||||
|
||||
#名字变化时处理配置文件
|
||||
if [ "$name" != "$old_name_cfg" ] && [ ! -z "$old_name_cfg" ]; then
|
||||
sed -i "s/old_name_cfg \'${old_name_cfg}\'/old_name_cfg \'${name}\'/g" $CFG_FILE 2>/dev/null
|
||||
sed -i "s/groups \'${old_name_cfg}\'/groups \'${name}\'/g" $CFG_FILE 2>/dev/null
|
||||
sed -i "s/option group \'${old_name_cfg}\'/option group \'${name}\'/g" $CFG_FILE 2>/dev/null
|
||||
sed -i "s/option specific_group \'${old_name_cfg}\'/option specific_group \'${name}\'/g" $CFG_FILE 2>/dev/null
|
||||
sed -i "s/other_group \'${old_name_cfg}\'/other_group \'${name}\'/g" $CFG_FILE 2>/dev/null
|
||||
sed -i "s/new_servers_group \'${old_name_cfg}\'/new_servers_group \'${name}\'/g" $CFG_FILE 2>/dev/null
|
||||
sed -i "s/relay_groups \'${old_name_cfg}\'/relay_groups \'${name}\'/g" $CFG_FILE 2>/dev/null
|
||||
#第三方规则处理
|
||||
OTHER_RULE_NAMES=("GlobalTV" "AsianTV" "Proxy" "Youtube" "Bilibili" "Bahamut" "HBOGo" "HBOMax" "Pornhub" "Apple" "GoogleFCM" "Scholar" "Microsoft" "Netflix" "Disney" "Spotify" "Steam" "Speedtest" "Telegram" "PayPal" "Netease_Music" "AdBlock" "Domestic" "Others")
|
||||
for i in ${OTHER_RULE_NAMES[@]}; do
|
||||
sed -i "s/option ${i} \'${old_name_cfg}\'/option ${i} \'${name}\'/g" $CFG_FILE 2>/dev/null
|
||||
done 2>/dev/null
|
||||
config_load "openclash"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
set_lock
|
||||
config_load "openclash"
|
||||
config_foreach cfg_groups_set "groups"
|
||||
del_lock
|
@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
. /usr/share/openclash/ruby.sh
|
||||
|
||||
CFG_FILE=$(uci get openclash.config.config_path 2>/dev/null)
|
||||
UPDATE_CONFIG_FILE=$(uci get openclash.config.config_update_path 2>/dev/null)
|
||||
|
||||
if [ ! -z "$UPDATE_CONFIG_FILE" ]; then
|
||||
CFG_FILE="$UPDATE_CONFIG_FILE"
|
||||
fi
|
||||
|
||||
if [ -z "$CFG_FILE" ]; then
|
||||
CFG_FILE="/etc/openclash/config/$(ls -lt /etc/openclash/config/ | grep -E '.yaml|.yml' | head -n 1 |awk '{print $9}')"
|
||||
fi
|
||||
|
||||
if [ -f "$CFG_FILE" ]; then
|
||||
rm -rf "/tmp/Proxy_Group" 2>/dev/null
|
||||
ruby_read_hash_arr "$CFG_FILE" "['proxy-groups']" "['name']" >/tmp/Proxy_Group 2>&1
|
||||
|
||||
if [ -f "/tmp/Proxy_Group" ]; then
|
||||
echo 'DIRECT' >>/tmp/Proxy_Group
|
||||
echo 'REJECT' >>/tmp/Proxy_Group
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
return 1
|
||||
fi
|
316
luci-app-openclash/root/usr/share/openclash/yml_groups_set.sh
Normal file
316
luci-app-openclash/root/usr/share/openclash/yml_groups_set.sh
Normal file
@ -0,0 +1,316 @@
|
||||
#!/bin/sh
|
||||
. /lib/functions.sh
|
||||
. /usr/share/openclash/log.sh
|
||||
|
||||
set_lock() {
|
||||
exec 887>"/tmp/lock/openclash_groups_set.lock" 2>/dev/null
|
||||
flock -x 887 2>/dev/null
|
||||
}
|
||||
|
||||
del_lock() {
|
||||
flock -u 887 2>/dev/null
|
||||
rm -rf "/tmp/lock/openclash_groups_set.lock"
|
||||
}
|
||||
|
||||
set_lock
|
||||
GROUP_FILE="/tmp/yaml_groups.yaml"
|
||||
CFG_FILE="/etc/config/openclash"
|
||||
servers_update=$(uci get openclash.config.servers_update 2>/dev/null)
|
||||
CONFIG_FILE=$(uci get openclash.config.config_path 2>/dev/null)
|
||||
CONFIG_NAME=$(echo "$CONFIG_FILE" |awk -F '/' '{print $5}' 2>/dev/null)
|
||||
UPDATE_CONFIG_FILE=$(uci get openclash.config.config_update_path 2>/dev/null)
|
||||
UPDATE_CONFIG_NAME=$(echo "$UPDATE_CONFIG_FILE" |awk -F '/' '{print $5}' 2>/dev/null)
|
||||
|
||||
if [ -n "$UPDATE_CONFIG_FILE" ]; then
|
||||
CONFIG_FILE="$UPDATE_CONFIG_FILE"
|
||||
CONFIG_NAME="$UPDATE_CONFIG_NAME"
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
set_groups()
|
||||
{
|
||||
if [ -z "$1" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$add_for_this" -eq 1 ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$1" = "$3" ] || [ "$1" = "all" ]; then
|
||||
set_group=1
|
||||
add_for_this=1
|
||||
echo " - \"${2}\"" >>$GROUP_FILE
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
set_relay_groups()
|
||||
{
|
||||
if [ -z "$1" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$add_for_this" -eq 1 ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -n "$(echo "$1" |grep "#relay#")" ]; then
|
||||
server_relay_num=$(echo "$1" |awk -F '#relay#' '{print $2}')
|
||||
server_group_name=$(echo "$1" |awk -F '#relay#' '{print $1}')
|
||||
fi
|
||||
|
||||
if [ -n "$server_relay_num" ]; then
|
||||
if [ "$server_group_name" = "$3" ] || [ "$server_group_name" = "all" ]; then
|
||||
set_group=1
|
||||
add_for_this=1
|
||||
echo "$server_relay_num # - \"${2}\"" >>/tmp/relay_server
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
#加入节点
|
||||
yml_servers_add()
|
||||
{
|
||||
|
||||
local section="$1"
|
||||
add_for_this=0
|
||||
config_get_bool "enabled" "$section" "enabled" "1"
|
||||
config_get "config" "$section" "config" ""
|
||||
config_get "name" "$section" "name" ""
|
||||
config_get "relay_groups" "$section" "relay_groups" ""
|
||||
|
||||
if [ -n "$config" ] && [ "$config" != "$CONFIG_NAME" ] && [ "$config" != "all" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$enabled" = "0" ]; then
|
||||
return
|
||||
else
|
||||
if [ -z "$4" ] && [ "$3" = "relay" ] && [ -n "$relay_groups" ]; then
|
||||
config_list_foreach "$section" "relay_groups" set_relay_groups "$name" "$2"
|
||||
elif [ -z "$4" ]; then
|
||||
config_list_foreach "$section" "groups" set_groups "$name" "$2"
|
||||
fi
|
||||
|
||||
if [ -n "$if_game_group" ] && [ -z "$(ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "Value = YAML.load_file('$CONFIG_FILE'); Value['proxies'].each{|x| if x['name'].eql?('$name') then puts x['name'] end}" 2>/dev/null)" ]; then
|
||||
/usr/share/openclash/yml_proxys_set.sh "$name" "proxy"
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
#加入其它策略组
|
||||
set_other_groups()
|
||||
{
|
||||
if [ -z "$1" ]; then
|
||||
return
|
||||
fi
|
||||
set_group=1
|
||||
echo " - ${1}" >>$GROUP_FILE
|
||||
}
|
||||
|
||||
#加入代理集
|
||||
set_proxy_provider()
|
||||
{
|
||||
local section="$1"
|
||||
add_for_this=0
|
||||
config_get_bool "enabled" "$section" "enabled" "1"
|
||||
config_get "config" "$section" "config" ""
|
||||
config_get "name" "$section" "name" ""
|
||||
|
||||
if [ -n "$config" ] && [ "$config" != "$CONFIG_NAME" ] && [ "$config" != "all" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$enabled" = "0" ]; then
|
||||
return
|
||||
else
|
||||
if [ -z "$3" ]; then
|
||||
config_list_foreach "$section" "groups" set_provider_groups "$name" "$2"
|
||||
fi
|
||||
|
||||
if [ -n "$if_game_group" ] && [ -z "$(ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "Value = YAML.load_file('$CONFIG_FILE'); Value['proxy-providers'].keys.each{|x| if x.eql?('$name') then puts x end}" 2>/dev/null)" ]; then
|
||||
/usr/share/openclash/yml_proxys_set.sh "$name" "proxy-provider"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
set_provider_groups()
|
||||
{
|
||||
if [ -z "$1" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$add_for_this" -eq 1 ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$1" = "$3" ] || [ "$1" = "all" ]; then
|
||||
set_proxy_provider=1
|
||||
add_for_this=1
|
||||
echo " - ${2}" >>$GROUP_FILE
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
#创建策略组
|
||||
yml_groups_set()
|
||||
{
|
||||
|
||||
local section="$1"
|
||||
config_get_bool "enabled" "$section" "enabled" "1"
|
||||
config_get "config" "$section" "config" ""
|
||||
config_get "type" "$section" "type" ""
|
||||
config_get "name" "$section" "name" ""
|
||||
config_get "disable_udp" "$section" "disable_udp" ""
|
||||
config_get "strategy" "$section" "strategy" ""
|
||||
config_get "old_name" "$section" "old_name" ""
|
||||
config_get "test_url" "$section" "test_url" ""
|
||||
config_get "test_interval" "$section" "test_interval" ""
|
||||
config_get "tolerance" "$section" "tolerance" ""
|
||||
config_get "interface_name" "$section" "interface_name" ""
|
||||
config_get "routing_mark" "$section" "routing_mark" ""
|
||||
config_get "policy_filter" "$section" "policy_filter" ""
|
||||
|
||||
if [ "$enabled" = "0" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -n "$if_game_group" ] && [ "$if_game_group" != "$name" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -n "$config" ] && [ "$config" != "$CONFIG_NAME" ] && [ "$config" != "all" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -z "$type" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -z "$name" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -z "$test_url" ] || [ -z "$test_interval" ] && [ "$type" != "select" ] && [ "$type" != "relay" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
#游戏策略组存在时判断节点是否存在
|
||||
if [ -n "$if_game_group" ] && [ -n "$(grep "^$if_game_group$" /tmp/Proxy_Group)" ]; then
|
||||
config_foreach yml_servers_add "servers" "$name" "$type" "check" #加入服务器节点
|
||||
config_foreach set_proxy_provider "proxy-provider" "$group_name" "check" #加入代理集
|
||||
return
|
||||
fi
|
||||
|
||||
LOG_OUT "Start Writing【$CONFIG_NAME - $type - $name】Group To Config File..."
|
||||
|
||||
echo " - name: $name" >>$GROUP_FILE
|
||||
echo " type: $type" >>$GROUP_FILE
|
||||
if [ "$type" = "load-balance" ]; then
|
||||
[ -n "$strategy" ] && {
|
||||
echo " strategy: $strategy" >>$GROUP_FILE
|
||||
}
|
||||
fi
|
||||
[ -n "$disable_udp" ] && {
|
||||
echo " disable-udp: $disable_udp" >>$GROUP_FILE
|
||||
}
|
||||
group_name="$name"
|
||||
echo " proxies: $group_name" >>$GROUP_FILE
|
||||
|
||||
#名字变化时处理规则部分
|
||||
if [ "$name" != "$old_name" ] && [ -n "$old_name" ]; then
|
||||
sed -i "s/,${old_name}/,${name}#delete_/g" "$CONFIG_FILE" 2>/dev/null
|
||||
sed -i "s/: \"${old_name}\"/: \"${name}#delete_\"/g" "$CONFIG_FILE" 2>/dev/null
|
||||
sed -i "s/return \"${old_name}\"$/return \"${name}#delete_\"/g" "$CONFIG_FILE" 2>/dev/null
|
||||
sed -i "s/old_name \'${old_name}\'/old_name \'${name}\'/g" "$CFG_FILE" 2>/dev/null
|
||||
config_load "openclash"
|
||||
fi
|
||||
|
||||
set_group=0
|
||||
set_proxy_provider=0
|
||||
|
||||
config_list_foreach "$section" "other_group" set_other_groups #加入其他策略组
|
||||
config_foreach yml_servers_add "servers" "$name" "$type" #加入服务器节点
|
||||
|
||||
if [ "$type" = "relay" ] && [ -s "/tmp/relay_server" ]; then
|
||||
cat /tmp/relay_server |sort -k 1 |awk -F '#' '{print $2}' > /tmp/relay_server.list 2>/dev/null
|
||||
sed -i "/^ \{0,\}proxies: ${group_name}/r/tmp/relay_server.list" "$GROUP_FILE" 2>/dev/null
|
||||
rm -rf /tmp/relay_server 2>/dev/null
|
||||
fi
|
||||
|
||||
echo " use: $group_name" >>$GROUP_FILE
|
||||
|
||||
config_foreach set_proxy_provider "proxy-provider" "$group_name" #加入代理集
|
||||
|
||||
if [ "$set_group" -eq 1 ]; then
|
||||
sed -i "/^ \{0,\}proxies: ${group_name}/c\ proxies:" $GROUP_FILE
|
||||
else
|
||||
sed -i "/proxies: ${group_name}/d" $GROUP_FILE 2>/dev/null
|
||||
fi
|
||||
|
||||
if [ "$set_proxy_provider" -eq 1 ]; then
|
||||
sed -i "/^ \{0,\}use: ${group_name}/c\ use:" $GROUP_FILE
|
||||
else
|
||||
sed -i "/use: ${group_name}/d" $GROUP_FILE 2>/dev/null
|
||||
fi
|
||||
|
||||
[ -n "$test_url" ] && {
|
||||
echo " url: $test_url" >>$GROUP_FILE
|
||||
}
|
||||
[ -n "$test_interval" ] && {
|
||||
echo " interval: \"$test_interval\"" >>$GROUP_FILE
|
||||
}
|
||||
[ -n "$tolerance" ] && {
|
||||
echo " tolerance: \"$tolerance\"" >>$GROUP_FILE
|
||||
}
|
||||
[ -n "$policy_filter" ] && {
|
||||
echo " filter: \"$policy_filter\"" >>$GROUP_FILE
|
||||
}
|
||||
[ -n "$interface_name" ] && {
|
||||
echo " interface-name: \"$interface_name\"" >>$GROUP_FILE
|
||||
}
|
||||
[ -n "$routing_mark" ] && {
|
||||
echo " routing-mark: \"$routing_mark\"" >>$GROUP_FILE
|
||||
}
|
||||
}
|
||||
|
||||
create_config=$(uci get openclash.config.create_config 2>/dev/null)
|
||||
servers_if_update=$(uci get openclash.config.servers_if_update 2>/dev/null)
|
||||
if_game_group="$1"
|
||||
if [ "$create_config" = "0" ] || [ "$servers_if_update" = "1" ] || [ -n "$if_game_group" ]; then
|
||||
/usr/share/openclash/yml_groups_name_get.sh
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_OUT "Error: Config File【$CONFIG_NAME】Unable To Parse, Please Choose One-key Function To Create Config File..."
|
||||
uci commit openclash
|
||||
sleep 3
|
||||
SLOG_CLEAN
|
||||
del_lock
|
||||
exit 0
|
||||
else
|
||||
if [ -z "$if_game_group" ]; then
|
||||
echo "proxy-groups:" >$GROUP_FILE
|
||||
else
|
||||
rm -rf $GROUP_FILE
|
||||
fi
|
||||
config_load "openclash"
|
||||
config_foreach yml_groups_set "groups"
|
||||
sed -i "s/#delete_//g" "$CONFIG_FILE" 2>/dev/null
|
||||
rm -rf /tmp/relay_server.list 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
del_lock
|
||||
if [ -z "$if_game_group" ]; then
|
||||
/usr/share/openclash/yml_proxys_set.sh
|
||||
fi
|
1461
luci-app-openclash/root/usr/share/openclash/yml_proxys_get.sh
Normal file
1461
luci-app-openclash/root/usr/share/openclash/yml_proxys_get.sh
Normal file
File diff suppressed because it is too large
Load Diff
1881
luci-app-openclash/root/usr/share/openclash/yml_proxys_set.sh
Normal file
1881
luci-app-openclash/root/usr/share/openclash/yml_proxys_set.sh
Normal file
File diff suppressed because it is too large
Load Diff
1108
luci-app-openclash/root/usr/share/openclash/yml_rules_change.sh
Normal file
1108
luci-app-openclash/root/usr/share/openclash/yml_rules_change.sh
Normal file
File diff suppressed because it is too large
Load Diff
@ -8,4 +8,4 @@
|
||||
"uci": [ "openclash" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user