OpenClash: bump to v0.41.14-beta

This commit is contained in:
vernesong 2021-01-06 13:33:45 +08:00 committed by CN_SZTL
parent 6bb37834f0
commit 906844ec40
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
12 changed files with 86 additions and 19 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-openclash
PKG_VERSION:=0.41.13
PKG_VERSION:=0.41.14
PKG_RELEASE:=beta
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>

View File

@ -52,7 +52,7 @@ end
o = s:option(ListValue, "type", translate("Group Type"))
o.rmempty = true
o.description = translate("Choose The Operation Mode")
o:value("select", translate("Select"))
o:value("select", translate("Select "))
o:value("url-test", translate("URL-Test"))
o:value("fallback", translate("Fallback"))
o:value("load-balance", translate("Load-Balance"))

View File

@ -152,6 +152,17 @@ end
o:value("DIRECT")
o:value("REJECT")
o = s:option(ListValue, "Disney", translate("Disney"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
if groupname ~= nil and groupname ~= "" then
o:value(groupname)
end
end
o:value("DIRECT")
o:value("REJECT")
o = s:option(ListValue, "Spotify", translate("Spotify"))
o:depends("rule_name", "lhie1")
o.rmempty = true

View File

@ -490,6 +490,9 @@ msgstr "微软服务流量"
msgid "Netflix"
msgstr "Netflix流量"
msgid "Disney"
msgstr "Disney流量"
msgid "Spotify"
msgstr "Spotify流量"
@ -783,7 +786,7 @@ msgstr "检测频率(秒)"
msgid "Tolerance(ms)"
msgstr "节点切换容忍值(毫秒)"
msgid "Select"
msgid "Select "
msgstr "Select【手动选择】"
msgid "URL-Test"

View File

@ -1197,17 +1197,18 @@ firewall_redirect_exclude()
set_firewall()
{
if [ "$(iptables -t nat -nL PREROUTING --line-number |grep "udp dpt:53" |grep "0.0.0.0/0 \{0,\}0.0.0.0/0" |wc -l)" -gt 1 ] && [ "$enable_redirect_dns" -eq 1 ]; then
if [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(iptables -t nat -nL PREROUTING --line-number |grep "redir ports 53$")"]; then
iptables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT --to-ports 53
iptables -t nat -A PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports 53
fi
if [ "$(iptables -t nat -nL PREROUTING --line-number |grep "redir ports 53" |wc -l)" -gt 2 ] && [ "$enable_redirect_dns" -eq 1 ]; then
echo "发现53端口被劫持清理防火墙规则..." >$START_LOG
pre_lines=$(iptables -nvL PREROUTING -t nat |sed 1,2d |sed -n '/0.0.0.0\/0 \{0,\}0.0.0.0\/0 \{0,\}udp dpt:53/=' 2>/dev/null |sort -rn)
pre_lines=$(iptables -nvL PREROUTING -t nat |sed 1,2d |sed -n '/redir ports 53/=' 2>/dev/null |sort -rn)
for pre_line in $pre_lines; do
iptables -t nat -D PREROUTING "$pre_line" >/dev/null 2>&1
done
iptables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT --to-ports 53 >/dev/null 2>&1
sleep 2
elif [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(iptables -t nat -nL PREROUTING --line-number |grep "redir ports 53$")"]; then
iptables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT --to-ports 53
iptables -t nat -A PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports 53
fi
if [ -z "$(uci get firewall.openclash 2>/dev/null)" ] || [ -z "$(uci get ucitrack.@openclash[-1].init 2>/dev/null)" ]; then
@ -1313,12 +1314,11 @@ if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 3 ]; then
iptables -t nat -A openclash -m set --match-set china_ip_route dst -j RETURN >/dev/null 2>&1
fi
iptables -t nat -A openclash -p tcp -j REDIRECT --to-ports "$proxy_port"
if [ -z "$en_mode_tun" ]; then
iptables -t nat -I PREROUTING -p tcp -d 8.8.8.8 --dport 53 -j REDIRECT --to-ports "$proxy_port"
iptables -t nat -I PREROUTING -p tcp -d 8.8.4.4 --dport 53 -j REDIRECT --to-ports "$proxy_port"
fi
iptables -t nat -A PREROUTING -p tcp -j openclash
if [ -z "$en_mode_tun" ]; then
#Google dns
iptables -t nat -I PREROUTING -p tcp -d 8.8.8.8 --dport 53 -j REDIRECT --to-ports "$proxy_port"
iptables -t nat -I PREROUTING -p tcp -d 8.8.4.4 --dport 53 -j REDIRECT --to-ports "$proxy_port"
#udp
if [ "$enable_udp_proxy" -eq 1 ]; then
modprobe xt_TPROXY >/dev/null 2>&1
@ -1754,6 +1754,8 @@ reload()
do_run_mode 2>/dev/null
get_config 2>/dev/null
set_firewall 2>/dev/null
/etc/init.d/dnsmasq restart >/dev/null 2>&1
echo "${LOGTIME} Reload OpenClash Firewall Rules" >> $LOG_FILE
echo "" >$START_LOG
fi
}

View File

@ -14,6 +14,12 @@ PORT=$(uci get openclash.config.cn_port 2>/dev/null)
LOG_FILE="/tmp/openclash.log"
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
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="/etc/openclash/history/$CONFIG_NAME"
fi
if [ -n "$(pidof clash)" ] && [ -f "$CONFIG_FILE" ]; then
curl -m 5 --retry 2 -w %{http_code}"\n" -H "Authorization: Bearer ${SECRET}" -H "Content-Type:application/json" -X GET http://"$LAN_IP":"$PORT"/proxies > "$CURL_CACHE" 2>/dev/null
if [ "$(sed -n '$p' "$CURL_CACHE" 2>/dev/null)" = "200" ]; then

View File

@ -43,6 +43,12 @@ close_all_conection() {
curl -m 5 --retry 2 -H "Authorization: Bearer ${SECRET}" -H "Content-Type:application/json" -X DELETE http://"$LAN_IP":"$PORT"/connections >/dev/null 2>&1
}
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="/etc/openclash/history/$CONFIG_NAME"
fi
if [ -s "$HISTORY_PATH" ] && [ ! -z "$(pidof clash)" ]; then
cat "$HISTORY_PATH" |while read -r line
do

View File

@ -85,7 +85,10 @@ 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" ] && [ -z "$core_type" ]; then
iptables -t nat -D PREROUTING -p tcp -j openclash
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
echo "$LOGTIME Watchdog: Reset Firewall For Enabling Redirect." >>$LOG_FILE
fi

View File

@ -4,12 +4,14 @@ rules:
- RULE-SET,Netflix,Netflix
- RULE-SET,Spotify,Spotify
- RULE-SET,YouTube,YouTube
- RULE-SET,Disney Plus,Disney
- RULE-SET,Bilibili,AsianTV
- RULE-SET,iQiyi,AsianTV
- RULE-SET,Letv,AsianTV
- RULE-SET,Netease Music,AsianTV
- RULE-SET,Tencent Video,AsianTV
- RULE-SET,Youku,AsianTV
- RULE-SET,WeTV,AsianTV
- RULE-SET,ABC,GlobalTV
- RULE-SET,Abema TV,GlobalTV
- RULE-SET,Amazon,GlobalTV
@ -18,7 +20,7 @@ rules:
- RULE-SET,Bahamut,GlobalTV
- RULE-SET,BBC iPlayer,GlobalTV
- RULE-SET,DAZN,GlobalTV
- RULE-SET,Disney Plus,GlobalTV
- RULE-SET,Discovery Plus,GlobalTV
- RULE-SET,encoreTVB,GlobalTV
- RULE-SET,Fox Now,GlobalTV
- RULE-SET,Fox+,GlobalTV
@ -57,12 +59,14 @@ script:
"Netflix": "Netflix",
"Spotify": "Spotify",
"YouTube": "YouTube",
"Disney Plus": "Disney",
"Bilibili": "AsianTV",
"iQiyi": "AsianTV",
"Letv": "AsianTV",
"Netease Music": "AsianTV",
"Tencent Video": "AsianTV",
"Youku": "AsianTV",
"WeTV": "AsianTV",
"ABC": "GlobalTV",
"Abema TV": "GlobalTV",
"Amazon": "GlobalTV",
@ -71,7 +75,7 @@ script:
"Bahamut": "GlobalTV",
"BBC iPlayer": "GlobalTV",
"DAZN": "GlobalTV",
"Disney Plus": "GlobalTV",
"Discovery Plus": "GlobalTV",
"encoreTVB": "GlobalTV",
"Fox Now": "GlobalTV",
"Fox+": "GlobalTV",
@ -187,6 +191,12 @@ rule-providers:
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Youku.yaml
path: "./Rules/Media/Youku"
interval: 86400
WeTV:
type: http
behavior: classical
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/WeTV.yaml
path: "./Rules/Media/WeTV"
interval: 86400
ABC:
type: http
behavior: classical
@ -235,6 +245,12 @@ rule-providers:
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/DAZN.yaml
path: "./Rules/Media/DAZN"
interval: 86400
Discovery Plus:
type: http
behavior: classical
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Discovery%20Plus.yaml
path: "./Rules/Media/Discovery_Plus"
interval: 86400
Disney Plus:
type: http
behavior: classical

File diff suppressed because one or more lines are too long

View File

@ -813,6 +813,20 @@ cat >> "$SERVER_FILE" <<-EOF
EOF
fi
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
cat >> "$SERVER_FILE" <<-EOF
- name: Disney
type: select
proxies:
- GlobalTV
- DIRECT
EOF
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
if [ -f "/tmp/Proxy_Provider" ]; then
cat >> "$SERVER_FILE" <<-EOF
use:
EOF
fi
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
cat >> "$SERVER_FILE" <<-EOF
- name: Youtube
type: select
@ -947,6 +961,7 @@ ${uci_set}Youtube="Youtube"
${uci_set}Apple="Apple"
${uci_set}Microsoft="Microsoft"
${uci_set}Netflix="Netflix"
${uci_set}Disney="Disney"
${uci_set}Spotify="Spotify"
${uci_set}Steam="Steam"
${uci_set}AdBlock="AdBlock"
@ -964,6 +979,7 @@ ${uci_set}Others="Others"
${UCI_DEL_LIST}="AsianTV" >/dev/null 2>&1 && ${UCI_ADD_LIST}="AsianTV" >/dev/null 2>&1
${UCI_DEL_LIST}="GlobalTV" >/dev/null 2>&1 && ${UCI_ADD_LIST}="GlobalTV" >/dev/null 2>&1
${UCI_DEL_LIST}="Netflix" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Netflix" >/dev/null 2>&1
${UCI_DEL_LIST}="Disney" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Disney" >/dev/null 2>&1
${UCI_DEL_LIST}="Spotify" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Spotify" >/dev/null 2>&1
${UCI_DEL_LIST}="Steam" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Steam" >/dev/null 2>&1
${UCI_DEL_LIST}="Telegram" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Telegram" >/dev/null 2>&1

View File

@ -137,6 +137,7 @@ yml_other_rules_get()
config_get "Youtube" "$section" "Youtube" ""
config_get "Apple" "$section" "Apple" ""
config_get "Netflix" "$section" "Netflix" ""
config_get "Disney" "$section" "Disney" ""
config_get "Spotify" "$section" "Spotify" ""
config_get "Steam" "$section" "Steam" ""
config_get "AdBlock" "$section" "AdBlock" ""
@ -180,6 +181,7 @@ if [ "$2" != "0" ]; then
|| [ -z "$(grep -F "$Youtube" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Apple" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Netflix" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Disney" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Spotify" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Steam" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$AdBlock" /tmp/Proxy_Group)" ]\
@ -227,6 +229,7 @@ if [ "$2" != "0" ]; then
.gsub(/,YouTube$/, ',$Youtube#d')
.gsub(/,Apple$/, ',$Apple#d')
.gsub(/,Netflix$/, ',$Netflix#d')
.gsub(/,Disney$/, ',$Disney#d')
.gsub(/,Spotify$/, ',$Spotify#d')
.gsub(/,Steam$/, ',$Steam#d')
.gsub(/,AdBlock$/, ',$AdBlock#d')
@ -244,6 +247,7 @@ if [ "$2" != "0" ]; then
.gsub!(/: \"YouTube\"/,': \"$Youtube#d\"')
.gsub!(/: \"Apple\"/,': \"$Apple#d\"')
.gsub!(/: \"Netflix\"/,': \"$Netflix#d\"')
.gsub!(/: \"Disney\"/,': \"$Disney#d\"')
.gsub!(/: \"Spotify\"/,': \"$Spotify#d\"')
.gsub!(/: \"Steam\"/,': \"$Steam#d\"')
.gsub!(/: \"AdBlock\"/,': \"$AdBlock#d\"')