update 2023-05-18 23:35:41

This commit is contained in:
github-actions[bot] 2023-05-18 23:35:41 +08:00
parent 3fd4ba84b7
commit ec085fd73c
26 changed files with 505 additions and 253 deletions

View File

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

View File

@ -67,6 +67,12 @@ o:value("domain")
o:value("ipcidr")
o:value("classical")
o = s:option(ListValue, "format", translate("Rule Format")..translate("(TUN&Meta Core)"))
o.rmempty = true
o.description = translate("Choose The Rule File Format, For More Info:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://github.com/Dreamacro/clash/wiki/Premium%3A-Rule-Providers\")'>https://github.com/Dreamacro/clash/wiki/</a>"
o:value("yaml")
o:value("text")
o = s:option(ListValue, "path", translate("Rule Providers Path"))
o.description = translate("Update Your Rule Providers File From Config Luci Page")
local p,h={}

View File

@ -785,6 +785,63 @@ o:value("ipv6")
o:value("ipv6-prefer")
o.default = "dual"
-- [[ smux ]]--
o = s:option(ListValue, "multiplex", translate("Multiplex")..translate("(Only Meta Core)"))
o.rmempty = false
o:value("true")
o:value("false")
o.default = "false"
o = s:option(ListValue, "multiplex_protocol", translate("Protocol"))
o.rmempty = true
o:value("smux")
o:value("yamux")
o:value("h2mux")
o.default = "smux"
o:depends("multiplex", "true")
o = s:option(Value, "multiplex_max_connections", translate("Max-connections"))
o.rmempty = true
o.placeholder = "4"
o.default = "4"
o.datatype = "uinteger"
o:depends("multiplex", "true")
o = s:option(Value, "multiplex_min_streams", translate("Min-streams"))
o.rmempty = true
o.placeholder = "4"
o.default = "4"
o.datatype = "uinteger"
o:depends("multiplex", "true")
o = s:option(Value, "multiplex_max_streams", translate("Max-streams"))
o.rmempty = true
o.placeholder = "0"
o.default = "0"
o.datatype = "uinteger"
o:depends("multiplex", "true")
o = s:option(ListValue, "multiplex_padding", translate("Padding"))
o.rmempty = false
o:value("true")
o:value("false")
o.default = "false"
o:depends("multiplex", "true")
o = s:option(ListValue, "multiplex_statistic", translate("Statistic"))
o.rmempty = false
o:value("true")
o:value("false")
o.default = "false"
o:depends("multiplex", "true")
o = s:option(ListValue, "multiplex_only_tcp", translate("Only-tcp"))
o.rmempty = false
o:value("true")
o:value("false")
o.default = "false"
o:depends("multiplex", "true")
-- [[ interface-name ]]--
o = s:option(Value, "interface_name", translate("interface-name"))
o.rmempty = true

View File

@ -791,6 +791,40 @@ o.template = "openclash/other_stream_option"
o.value = "Google"
o:depends("stream_auto_select_google_not_cn", "1")
--ChatGPT
o = s:taboption("stream_enhance", Flag, "stream_auto_select_chatgpt", font_red..translate("ChatGPT")..font_off)
o.default = 0
o:depends("stream_auto_select", "1")
o = s:taboption("stream_enhance", Value, "stream_auto_select_group_key_chatgpt", translate("Group Filter"))
o.default = "ChatGPT"
o.placeholder = "ChatGPT"
o.description = translate("It Will Be Searched According To The Regex When Auto Search Group Fails")
o:depends("stream_auto_select_chatgpt", "1")
o = s:taboption("stream_enhance", Value, "stream_auto_select_region_key_chatgpt", translate("Unlock Region Filter"))
o.default = ""
o.placeholder = "US"
o.description = translate("It Will Be Selected Region(Country Shortcode) According To The Regex")
o:depends("stream_auto_select_chatgpt", "1")
function o.validate(self, value)
if value ~= m.uci:get("openclash", "config", "stream_auto_select_region_key_chatgpt") then
fs.unlink("/tmp/openclash_ChatGPT_region")
end
return value
end
o = s:taboption("stream_enhance", Value, "stream_auto_select_node_key_chatgpt", translate("Unlock Nodes Filter"))
o.default = ""
o.description = translate("It Will Be Selected Nodes According To The Regex")
o:depends("stream_auto_select_chatgpt", "1")
o = s:taboption("stream_enhance", DummyValue, "ChatGPT", translate("Manual Test"))
o.rawhtml = true
o.template = "openclash/other_stream_option"
o.value = "ChatGPT"
o:depends("stream_auto_select_chatgpt", "1")
---- update Settings
o = s:taboption("rules_update", Flag, "other_rule_auto_update", translate("Auto Update"))
o.description = font_red..bold_on..translate("Auto Update Other Rules")..bold_off..font_off

View File

@ -6,7 +6,7 @@
<b><%:Note: if the update fails, you can manually download and upload%></b>
</p>
</td></tr>
<tr><td width="25%"><%:Compiled Version Selected%></td>
<tr><td width="25%"><%:Compiled Version Selected (Auto-save when you click to update or download)%></td>
<td width="25%" align="left"><select id="CORE_VERSION">
<option value="linux-386"><%:linux-386%></option>
<option value="linux-amd64"><%:linux-amd64(x86-64)%></option>

View File

@ -783,9 +783,15 @@ msgstr "别名(请勿重名)"
msgid "Rule Behavior"
msgstr "规则类型"
msgid "Rule Format"
msgstr "规则格式"
msgid "Choose The Rule Behavior"
msgstr "选择规则类型"
msgid "Choose The Rule File Format, For More Info:"
msgstr "选择规则格式, 了解使用方式请前往:"
msgid "Rule Providers Path"
msgstr "规则集路径"
@ -1323,8 +1329,8 @@ msgstr "注意:如更新失败可手动下载并上传"
msgid "Note: the client may not support update, because the firmware with squashfs format will not release flash space after updating"
msgstr "注意客户端可能无法更新因为squashfs格式的固件更新后不会释放闪存空间"
msgid "Compiled Version Selected"
msgstr "已选择编译版本"
msgid "Compiled Version Selected (Auto-save when you click to update or download)"
msgstr "已选择编译版本(点击更新或下载时自动保存)"
msgid "Release Branch Selected"
msgstr "已选择更新分支"
@ -2622,6 +2628,9 @@ msgstr "提示开始自动选择检测Bilibili 解锁节点..."
msgid "Tip: Start Auto Select Proxy For Google Not CN Unlock..."
msgstr "提示开始自动选择检测Google 非送中节点..."
msgid "Tip: Start Auto Select Proxy For ChatGPT Unlock..."
msgstr "提示开始自动选择检测ChatGPT 解锁节点..."
msgid "Netflix Group:"
msgstr "Netflix 策略组:"
@ -2661,6 +2670,9 @@ msgstr "Bilibili 策略组:"
msgid "Google Group:"
msgstr "Google 策略组:"
msgid "ChatGPT Group:"
msgstr "ChatGPT 策略组:"
msgid "full support"
msgstr "完整解锁"
@ -3378,8 +3390,8 @@ msgstr "提示IPv6 代理模式为 TProxy..."
msgid "Warning: Only Meta Core Support IPv6 Tun Mode, Use TProxy Instead..."
msgstr "提示:只有 Meta 内核支持 IPv6 Tun 模式,使用 TProxy 模式代替..."
msgid "Tip: Can't Get IPv4 WAN Interfaces, Please Verify The Firewall's WAN Zone Name is wan, Ignore This IF The Device Does not Have a WAN Interfaces..."
msgstr "提示:无法获取 IPv4 的 WAN 接口名称,请确保防火墙设置中 IPv6 WAN 区域的名称为 wan如设备无 WAN 口请忽略此提示..."
msgid "Warning: Can't Settting Only Intranet Allowed Function, Get IPv4 WAN Interfaces error, Please Verify The Firewall's WAN Zone Name is wan, Ignore This IF The Device Does not Have a WAN Interfaces..."
msgstr "警告:设置仅允许内网功能失败,无法获取 IPv4 的 WAN 接口名称,请确保防火墙设置中 IPv4 WAN 区域的名称为 wan如设备无 WAN 口请忽略此提示..."
msgid "Tip: Can't Get IPv6 WAN Interfaces, Please Verify The Firewall's WAN Zone Name is wan, Ignore This IF The Device Does not Have a WAN Interfaces..."
msgstr "提示:无法获取 IPv6 的 WAN 接口名称,请确保防火墙设置中 IPv6 WAN 区域的名称为 wan如设备无 WAN 口请忽略此提示..."
msgid "Warning: Can't Settting Only Intranet Allowed Function, Get IPv6 WAN Interfaces error, Please Verify The Firewall's WAN Zone Name is wan, Ignore This IF The Device Does not Have a WAN Interfaces..."
msgstr "警告:设置仅允许内网功能失败,无法获取 IPv6 的 WAN 接口名称,请确保防火墙设置中 IPv6 WAN 区域的名称为 wan如设备无 WAN 口请忽略此提示..."

View File

@ -106,6 +106,7 @@ change_dns() {
uci -q set openclash.config.dnsmasq_resolvfile="$(uci -q get dhcp.@dnsmasq[0].resolvfile)"
uci -q delete dhcp.@dnsmasq[0].resolvfile
uci -q set dhcp.@dnsmasq[0].noresolv=1
uci -q set dhcp.@dnsmasq[0].localuse=1
uci -q set openclash.config.redirect_dns=1
else
uci -q set openclash.config.redirect_dns=0
@ -146,24 +147,35 @@ revert_dns() {
if [ "$4" == "0" ] || [ -z "$4" ] || [ -z "$(uci -q show dhcp.@dnsmasq[0].server)" ]; then
uci -q set dhcp.@dnsmasq[0].noresolv=0
if [ -n "$5" ]; then
if [ -n "$5" ] && [ -n "$(grep nameserver $5)" ]; then
uci -q set dhcp.@dnsmasq[0].resolvfile="$5"
elif [ -n "$3" ]; then
elif [ -n "$3" ] && [ -n "$(grep nameserver $3)" ]; then
uci -q set dhcp.@dnsmasq[0].resolvfile="$3"
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
uci -q set openclash.config.default_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
uci -q set openclash.config.default_resolvfile=/tmp/resolv.conf.auto
else
uci -q set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.d/resolv.conf.auto
uci -q set openclash.config.default_resolvfile=/tmp/resolv.conf.d/resolv.conf.auto
fi
uci -q set dhcp.@dnsmasq[0].localuse=1
uci -q commit dhcp
/etc/init.d/dnsmasq restart >/dev/null 2>&1
masq_port=$(uci -q get dhcp.@dnsmasq[0].port)
if [ "$(nslookup www.baidu.com 127.0.0.1:${masq_port} >/dev/null 2>&1 || echo $?)" = "1" ]; then
uci -q set openclash.config.default_resolvfile="/tmp/resolv.conf.auto"
rm -rf /tmp/resolv.conf.auto
touch /tmp/resolv.conf.auto 2>/dev/null
cat >> "/tmp/resolv.conf.auto" <<-EOF
if [ "$(nslookup www.apple.com 127.0.0.1:${masq_port} >/dev/null 2>&1 || echo $?)" = "1" ]; then
uci -q set openclash.config.default_resolvfile="/tmp/resolv.conf.d/resolv.conf.auto"
mkdir -p /tmp/resolv.conf.d
rm -rf /tmp/resolv.conf.d/resolv.conf.auto
touch /tmp/resolv.conf.d/resolv.conf.auto 2>/dev/null
cat >> "/tmp/resolv.conf.d/resolv.conf.auto" <<-EOF
# Interface lan
nameserver 114.114.114.114
nameserver 119.29.29.29
nameserver 8.8.8.8
EOF
uci -q set dhcp.@dnsmasq[0].resolvfile="/tmp/resolv.conf.auto"
uci -q set dhcp.@dnsmasq[0].resolvfile="/tmp/resolv.conf.d/resolv.conf.auto"
fi
fi
}
@ -1432,12 +1444,6 @@ if [ -n "$FW4" ]; then
nft 'add element inet fw4 localnetwork { 0.0.0.0/8, 127.0.0.0/8, 10.0.0.0/8, 169.254.0.0/16, 192.168.0.0/16, 224.0.0.0/4, 240.0.0.0/4, 172.16.0.0/12, 100.64.0.0/10}'
fi
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
@ -1477,7 +1483,7 @@ if [ -n "$FW4" ]; then
nft add rule inet fw4 openclash_wan_input udp dport {$proxy_port,$tproxy_port,$cn_port,$http_port,$socks_port,$mixed_port,$dns_port} counter reject
nft add rule inet fw4 openclash_wan_input tcp dport {$proxy_port,$tproxy_port,$cn_port,$http_port,$socks_port,$mixed_port,$dns_port} counter reject
else
LOG_OUT "Tip: Can't Get IPv4 WAN Interfaces, Please Verify The Firewall's WAN Zone Name is wan, Ignore This IF The Device Does not Have a WAN Interfaces..."
LOG_OUT "Warning: Can't Settting Only Intranet Allowed Function, Get IPv4 WAN Interfaces error, Please Verify The Firewall's WAN Zone Name is wan, Ignore This IF The Device Does not Have a WAN Interfaces..."
fi
fi
@ -1906,12 +1912,6 @@ if [ -n "$FW4" ]; then
nft 'add element inet fw4 localnetwork6 { ::/128, ::1/128, ::ffff:0:0/96, ::ffff:0:0:0/96, 64:ff9b::/96, 100::/64, 2001::/32, 2001:20::/28, 2001:db8::/32, 2002::/16, fc00::/7, fe80::/10, ff00::/8}'
fi
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
@ -2056,7 +2056,7 @@ if [ -n "$FW4" ]; then
#route
if [ "$ipv6_mode" -ne 2 ]; then
if [ "$enable_v6_udp_proxy" -eq 1 ] || [ "$ipv6_mode" -eq 0 ]; then
modprobe xt_TPROXY >/dev/null 2>&1
modprobe nft_tproxy >/dev/null 2>&1
ip -6 rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE"
ip -6 route add local ::/0 dev lo table "$PROXY_ROUTE_TABLE"
fi
@ -2104,7 +2104,7 @@ if [ -n "$FW4" ]; then
nft add rule inet fw4 openclash_wan6_input udp dport {$proxy_port,$tproxy_port,$cn_port,$http_port,$socks_port,$mixed_port,$dns_port} counter reject 2>/dev/null
nft add rule inet fw4 openclash_wan6_input tcp dport {$proxy_port,$tproxy_port,$cn_port,$http_port,$socks_port,$mixed_port,$dns_port} counter reject 2>/dev/null
else
LOG_OUT "Tip: Can't Get IPv6 WAN Interfaces, Please Verify The Firewall's WAN Zone Name is wan, Ignore This IF The Device Does not Have a WAN Interfaces..."
LOG_OUT "Warning: Can't Settting Only Intranet Allowed Function, Get IPv6 WAN Interfaces error, Please Verify The Firewall's WAN Zone Name is wan, Ignore This IF The Device Does not Have a WAN Interfaces..."
fi
fi
fi 2>/dev/null
@ -2183,12 +2183,6 @@ else
ipset add localnetwork 100.64.0.0/10
fi
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
@ -2226,7 +2220,7 @@ else
iptables -t filter -A openclash_wan_input -p udp -m multiport --dport "$proxy_port,$tproxy_port,$cn_port,$http_port,$socks_port,$mixed_port,$dns_port" -j REJECT >/dev/null 2>&1
iptables -t filter -A openclash_wan_input -p tcp -m multiport --dport "$proxy_port,$tproxy_port,$cn_port,$http_port,$socks_port,$mixed_port,$dns_port" -j REJECT >/dev/null 2>&1
else
LOG_OUT "Tip: Can't Get IPv4 WAN Interfaces, Please Verify The Firewall's WAN Zone Name is wan, Ignore This IF The Device Does not Have a WAN Interfaces..."
LOG_OUT "Warning: Can't Settting Only Intranet Allowed Function, Get IPv4 WAN Interfaces error, Please Verify The Firewall's WAN Zone Name is wan, Ignore This IF The Device Does not Have a WAN Interfaces..."
fi
fi
@ -2672,12 +2666,6 @@ else
ipset add localnetwork6 ff00::/8
fi
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"
@ -2863,7 +2851,7 @@ else
ip6tables -t filter -A openclash_wan_input -p udp -m multiport --dport "$proxy_port,$tproxy_port,$cn_port,$http_port,$socks_port,$mixed_port,$dns_port" -j REJECT >/dev/null 2>&1
ip6tables -t filter -A openclash_wan_input -p tcp -m multiport --dport "$proxy_port,$tproxy_port,$cn_port,$http_port,$socks_port,$mixed_port,$dns_port" -j REJECT >/dev/null 2>&1
else
LOG_OUT "Tip: Can't Get IPv6 WAN Interfaces, Please Verify The Firewall's WAN Zone Name is wan, Ignore This IF The Device Does not Have a WAN Interfaces..."
LOG_OUT "Warning: Can't Settting Only Intranet Allowed Function, Get IPv6 WAN Interfaces error, Please Verify The Firewall's WAN Zone Name is wan, Ignore This IF The Device Does not Have a WAN Interfaces..."
fi
fi
fi 2>/dev/null
@ -3001,9 +2989,7 @@ get_config()
fi
[ -z "$fakeip_range" ] && fakeip_range="198.18.0.1/16"
lan_ip=$(uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
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)
wan_ip4s=$(/usr/share/openclash/openclash_get_network.lua "wanip" 2>/dev/null)
wan_ip6s=$(ifconfig | grep 'inet6 addr' | awk '{print $3}' 2>/dev/null)
disable_masq_cache=$(uci -q get openclash.config.disable_masq_cache)
log_level=$(uci -q get openclash.config.log_level)

View File

@ -46,6 +46,7 @@ core_type=$(uci -q get openclash.config.core_type || echo "Dev")
da_password=$(uci -q get openclash.config.dashboard_password)
cn_port=$(uci -q get openclash.config.cn_port)
lan_ip=$(uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
dnsmasq_default_resolvfile=$(uci -q get openclash.config.default_resolvfile)
if [ -z "$RAW_CONFIG_FILE" ] || [ ! -f "$RAW_CONFIG_FILE" ]; then
CONFIG_NAME=$(ls -lt /etc/openclash/config/ | grep -E '.yaml|.yml' | head -n 1 |awk '{print $9}')
@ -376,7 +377,7 @@ 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
for nft in "openclash" "openclash_mangle" "openclash_mangle_output" "openclash_output" "openclash_post" "openclash_wan_input" "openclash_dns_hijack" "openclash_dns_redirect" "openclash_mangle_v6" "openclash_mangle_output_v6" "openclash_post_v6" "openclash_wan6_input"; do
nft list chain inet fw4 "$nft" >> "$DEBUG_LOG" 2>/dev/null
done >/dev/null 2>&1
fi
@ -386,19 +387,34 @@ cat >> "$DEBUG_LOG" <<-EOF
#===================== IPSET状态 =====================#
EOF
ipset list |grep "Name:" >> "$DEBUG_LOG"
ipset list -t >> "$DEBUG_LOG"
cat >> "$DEBUG_LOG" <<-EOF
#===================== 路由表状态 =====================#
EOF
echo "#IPv4" >> "$DEBUG_LOG"
echo "" >> "$DEBUG_LOG"
echo "#route -n" >> "$DEBUG_LOG"
route -n >> "$DEBUG_LOG" 2>/dev/null
echo "" >> "$DEBUG_LOG"
echo "#ip route list" >> "$DEBUG_LOG"
ip route list >> "$DEBUG_LOG" 2>/dev/null
echo "" >> "$DEBUG_LOG"
echo "#ip rule show" >> "$DEBUG_LOG"
ip rule show >> "$DEBUG_LOG" 2>/dev/null
echo "" >> "$DEBUG_LOG"
echo "#IPv6" >> "$DEBUG_LOG"
echo "" >> "$DEBUG_LOG"
echo "#route -A inet6" >> "$DEBUG_LOG"
route -A inet6 >> "$DEBUG_LOG" 2>/dev/null
echo "" >> "$DEBUG_LOG"
echo "#ip -6 route list" >> "$DEBUG_LOG"
ip -6 route list >> "$DEBUG_LOG" 2>/dev/null
echo "" >> "$DEBUG_LOG"
echo "#ip -6 rule show" >> "$DEBUG_LOG"
ip -6 rule show >> "$DEBUG_LOG" 2>/dev/null
if [ "$en_mode" != "fake-ip" ] && [ "$en_mode" != "redir-host" ]; then
cat >> "$DEBUG_LOG" <<-EOF
@ -430,10 +446,15 @@ cat >> "$DEBUG_LOG" <<-EOF
EOF
/usr/share/openclash/openclash_debug_dns.lua "www.instagram.com" >> "$DEBUG_LOG" 2>/dev/null
cat >> "$DEBUG_LOG" <<-EOF
Dnsmasq 当前默认 resolv 文件:$dnsmasq_default_resolvfile
EOF
if [ -s "/tmp/resolv.conf.auto" ]; then
cat >> "$DEBUG_LOG" <<-EOF
#===================== resolv.conf.auto =====================#
#===================== /tmp/resolv.conf.auto =====================#
EOF
cat /tmp/resolv.conf.auto >> "$DEBUG_LOG"
@ -442,7 +463,7 @@ fi
if [ -s "/tmp/resolv.conf.d/resolv.conf.auto" ]; then
cat >> "$DEBUG_LOG" <<-EOF
#===================== resolv.conf.d =====================#
#===================== /tmp/resolv.conf.d/resolv.conf.auto =====================#
EOF
cat /tmp/resolv.conf.d/resolv.conf.auto >> "$DEBUG_LOG"

View File

@ -115,6 +115,8 @@ function unlock_auto_select()
key_group = UCI:get("openclash", "config", "stream_auto_select_group_key_bilibili") or "bilibili"
elseif type == "Google" then
key_group = UCI:get("openclash", "config", "stream_auto_select_group_key_google_not_cn") or "google|谷歌"
elseif type == "ChatGPT" then
key_group = UCI:get("openclash", "config", "stream_auto_select_group_key_chatgpt") or "ChatGPT"
end
if not key_group then key_group = type end
else
@ -713,6 +715,8 @@ function nodes_filter(t, info)
regex = UCI:get("openclash", "config", "stream_auto_select_node_key_bilibili") or ""
elseif type == "Google" then
regex = UCI:get("openclash", "config", "stream_auto_select_node_key_google_not_cn") or ""
elseif type == "ChatGPT" then
regex = UCI:get("openclash", "config", "stream_auto_select_node_key_chatgpt") or ""
end
if class_type(t) == "table" then
@ -775,6 +779,8 @@ function proxy_unlock_test()
region, old_region = bilibili_unlock_test()
elseif type == "Google" then
region, old_region = google_not_cn_test()
elseif type == "ChatGPT" then
region, old_region = chatgpt_unlock_test()
end
return region, old_region
end
@ -808,6 +814,8 @@ function auto_get_policy_group(passwd, ip, port)
SYS.call('curl -sL -m 5 --limit-rate 1k -o /dev/null https://www.bilibili.com/ &')
elseif type == "Google" then
SYS.call('curl -sL -m 5 --limit-rate 1k -o /dev/null https://timeline.google.com &')
elseif type == "ChatGPT" then
SYS.call('curl -sL -m 5 --limit-rate 1k -o /dev/null https://chat.openai.com/ &')
end
os.execute("sleep 1")
con = SYS.exec(string.format('curl -sL -m 5 --retry 2 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -XGET http://%s:%s/connections', passwd, ip, port))
@ -881,6 +889,11 @@ function auto_get_policy_group(passwd, ip, port)
auto_get_group = con.connections[i].chains[#(con.connections[i].chains)]
break
end
elseif type == "ChatGPT" then
if string.match(con.connections[i].metadata.host, "chat%.openai%.com") then
auto_get_group = con.connections[i].chains[#(con.connections[i].chains)]
break
end
end
end
end
@ -1483,4 +1496,39 @@ function google_not_cn_test()
end
end
function chatgpt_unlock_test()
status = 0
local url = "https://chat.openai.com/"
local region_url = "https://chat.openai.com/cdn-cgi/trace"
local regex = UCI:get("openclash", "config", "stream_auto_select_region_key_chatgpt") or ""
local region = ""
local old_region = ""
local data = SYS.exec(string.format("curl -sIL --connect-timeout 5 -m 5 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' '%s'", UA, url))
if data then
if string.find(data, "text/html") then
status = 2
local region_data = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' '%s'", UA, region_url))
if region_data and string.match(region_data, "loc=%a+") then
region = string.upper(string.sub(string.match(region_data, "loc=%a+"), 5, -1))
end
if region then
if FS.isfile(string.format("/tmp/openclash_%s_region", type)) then
old_region = FS.readfile(string.format("/tmp/openclash_%s_region", type))
end
if not datamatch(region, regex) then
status = 3
elseif old_region ~= "" and region ~= old_region and not all_test then
status = 4
end
if status == 2 and not all_test and ((old_region ~= "" and region ~= old_region) or (old_region == "")) then
FS.writefile(string.format("/tmp/openclash_%s_region", type), region)
end
end
else
status = 1
end
return region, old_region
end
end
unlock_auto_select()

View File

@ -107,6 +107,7 @@ do
stream_auto_select_discovery_plus=$(uci -q get openclash.config.stream_auto_select_discovery_plus || echo 0)
stream_auto_select_bilibili=$(uci -q get openclash.config.stream_auto_select_bilibili || echo 0)
stream_auto_select_google_not_cn=$(uci -q get openclash.config.stream_auto_select_google_not_cn || echo 0)
stream_auto_select_chatgpt=$(uci -q get openclash.config.stream_auto_select_chatgpt || echo 0)
upnp_lease_file=$(uci -q get upnpd.config.upnp_lease_file)
enable=$(uci -q get openclash.config.enable)
@ -183,16 +184,9 @@ fi
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)
wan_ip4s=$(/usr/share/openclash/openclash_get_network.lua "wanip" 2>/dev/null)
wan_ip6s=$(ifconfig | grep 'inet6 addr' | awk '{print $3}' 2>/dev/null)
if [ -n "$FW4" ]; then
if [ -n "$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
@ -200,12 +194,6 @@ fi
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
@ -213,24 +201,12 @@ fi
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
@ -376,6 +352,10 @@ fi
LOG_OUT "Tip: Start Auto Select Proxy For Bilibili Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "Bilibili" >> $LOG_FILE
fi
if [ "$stream_auto_select_chatgpt" -eq 1 ]; then
LOG_OUT "Tip: Start Auto Select Proxy For ChatGPT Unlock..."
/usr/share/openclash/openclash_streaming_unlock.lua "ChatGPT" >> $LOG_FILE
fi
fi
fi
STREAM_AUTO_SELECT=$(expr "$STREAM_AUTO_SELECT" + 1)

View File

@ -56,6 +56,7 @@ Bilibili-Intl,ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/St
BilibiliHMT,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,BilibiliHMT.yaml
Blizzard(By ConnersHua),ConnersHua,classical,DivineEngine/Profiles/master/Clash/RuleSet/Extra/Game/,Blizzard.yaml,Blizzard-ConnersHua.yaml
Blizzard,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/,Blizzard.yaml
ChatGPT,lhie1,classical,dler-io/Rules/master/Clash/Provider/,ChatGPT.yaml
ChinaCompanyIp,ACL4SSR,ipcidr,ACL4SSR/ACL4SSR/master/Clash/Providers/,ChinaCompanyIp.yaml
ChinaDomain,ACL4SSR,classical,ACL4SSR/ACL4SSR/master/Clash/Providers/,ChinaDomain.yaml
ChinaIp(By ACL4SSR),ACL4SSR,ipcidr,ACL4SSR/ACL4SSR/master/Clash/Providers/,ChinaIp.yaml,ChinaIp-ACL4SSR.yaml

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -8,9 +8,9 @@
<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-5e90ca00.js"></script>
<link rel="modulepreload" crossorigin href="./assets/vendor-827b5617.js">
<link rel="stylesheet" href="./assets/index-6d88662b.css">
<script type="module" crossorigin src="./assets/index-a1967476.js"></script>
<link rel="modulepreload" crossorigin href="./assets/vendor-0606363c.js">
<link rel="stylesheet" href="./assets/index-9ebfe719.css">
<link rel="manifest" href="./manifest.webmanifest"><script id="vite-plugin-pwa:inline-sw">if('serviceWorker' in navigator) {window.addEventListener('load', () => {navigator.serviceWorker.register('./sw.js', { scope: './' })})}</script></head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>

View File

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

View File

@ -26,11 +26,11 @@ ruby_read()
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)
servers_update=$(uci -q get openclash.config.servers_update)
servers_if_update=$(uci -q get openclash.config.servers_if_update)
CONFIG_FILE=$(uci -q get openclash.config.config_path)
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_FILE=$(uci -q get openclash.config.config_update_path)
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"
@ -65,7 +65,7 @@ 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
uci -q commit openclash
SLOG_CLEAN
del_lock
exit 0
@ -94,19 +94,19 @@ cfg_delete()
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
if [ "$(uci -q get openclash.@groups["$i"].config)" = "$CONFIG_NAME" ] || [ "$(uci -q get openclash.@groups["$i"].config)" = "all" ]; then
uci -q delete openclash.@groups["$i"]
uci -q 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
if [ "$(uci -q get openclash.@servers["$i"].config)" = "$CONFIG_NAME" ] || [ "$(uci -q get openclash.@servers["$i"].config)" = "all" ]; then
if [ "$(uci -q get openclash.@servers["$i"].enabled)" = "1" ] && [ "$(uci -q get openclash.@servers["$i"].manual)" = "0" ]; then
uci -q delete openclash.@servers["$i"]
uci -q commit openclash
fi
fi
done
@ -114,10 +114,10 @@ cfg_delete()
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
if [ "$(uci -q get openclash.@proxy-provider["$i"].config)" = "$CONFIG_NAME" ] || [ "$(uci -q get openclash.@proxy-provider["$i"].config)" = "all" ]; then
if [ "$(uci -q get openclash.@proxy-provider["$i"].enabled)" = "1" ] && [ "$(uci -q get openclash.@proxy-provider["$i"].manual)" = "0" ]; then
uci -q delete openclash.@proxy-provider["$i"]
uci -q commit openclash
fi
fi
done
@ -162,7 +162,7 @@ do
LOG_OUT "Start Getting【$CONFIG_NAME - $group_type - $group_name】Group Setting..."
name=openclash
uci_name_tmp=$(uci add $name groups)
uci_name_tmp=$(uci -q add $name groups)
uci_set="uci -q set $name.$uci_name_tmp."
uci_add="uci -q add_list $name.$uci_name_tmp."
@ -262,6 +262,6 @@ do
done
wait
uci commit openclash
uci -q commit openclash
/usr/share/openclash/yml_proxys_get.sh
del_lock

View File

@ -26,12 +26,12 @@ cfg_groups_set()
if [ -z "$old_name_cfg" ]; then
uci -q set openclash."$section".old_name_cfg="$name"
uci commit openclash
uci -q commit openclash
fi
if [ -z "$old_name" ]; then
uci -q set openclash."$section".old_name="$name"
uci commit openclash
uci -q commit openclash
fi
#名字变化时处理配置文件

View File

@ -1,8 +1,8 @@
#!/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)
CFG_FILE=$(uci -q get openclash.config.config_path)
UPDATE_CONFIG_FILE=$(uci -q get openclash.config.config_update_path)
if [ ! -z "$UPDATE_CONFIG_FILE" ]; then
CFG_FILE="$UPDATE_CONFIG_FILE"

View File

@ -15,10 +15,10 @@ del_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)
servers_update=$(uci -q get openclash.config.servers_update)
CONFIG_FILE=$(uci -q get openclash.config.config_path)
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_FILE=$(uci -q get openclash.config.config_update_path)
UPDATE_CONFIG_NAME=$(echo "$UPDATE_CONFIG_FILE" |awk -F '/' '{print $5}' 2>/dev/null)
if [ -n "$UPDATE_CONFIG_FILE" ]; then
@ -285,22 +285,20 @@ yml_groups_set()
}
}
create_config=$(uci get openclash.config.create_config 2>/dev/null)
servers_if_update=$(uci get openclash.config.servers_if_update 2>/dev/null)
create_config=$(uci -q get openclash.config.create_config)
servers_if_update=$(uci -q get openclash.config.servers_if_update)
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
uci -q commit openclash
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"

View File

@ -24,9 +24,9 @@ ruby_read()
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "$RUBY_YAML_PARSE" 2>/dev/null
}
CONFIG_FILE=$(uci get openclash.config.config_path 2>/dev/null)
CONFIG_FILE=$(uci -q get openclash.config.config_path)
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_FILE=$(uci -q get openclash.config.config_update_path)
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"
@ -62,8 +62,8 @@ proxy_hash=$(ruby_read "$CONFIG_FILE" ".select {|x| 'proxies' == x or 'proxy-pro
CFG_FILE="/etc/config/openclash"
match_servers="/tmp/match_servers.list"
match_provider="/tmp/match_provider.list"
servers_update=$(uci get openclash.config.servers_update 2>/dev/null)
servers_if_update=$(uci get openclash.config.servers_if_update 2>/dev/null)
servers_update=$(uci -q get openclash.config.servers_update)
servers_if_update=$(uci -q get openclash.config.servers_if_update)
#proxy
num=$(ruby_read_hash "$proxy_hash" "['proxies'].count")
@ -468,6 +468,51 @@ do
end
}.join
Thread.new{
#Multiplex
if Value['proxies'][$count].key?('smux') then
if Value['proxies'][$count]['smux'].key?('enabled') then
smux = '${uci_set}multiplex=' + Value['proxies'][$count]['smux']['enabled'].to_s
system(smux)
end;
#multiplex_protocol
if Value['proxies'][$count]['smux'].key?('protocol') then
multiplex_protocol = '${uci_set}multiplex_protocol=' + Value['proxies'][$count]['smux']['protocol'].to_s
system(multiplex_protocol)
end;
#multiplex_max_connections
if Value['proxies'][$count]['smux'].key?('max-connections') then
multiplex_max_connections = '${uci_set}multiplex_max_connections=' + Value['proxies'][$count]['smux']['max-connections'].to_s
system(multiplex_max_connections)
end;
#multiplex_min_streams
if Value['proxies'][$count]['smux'].key?('min-streams') then
multiplex_min_streams = '${uci_set}multiplex_min_streams=' + Value['proxies'][$count]['smux']['min-streams'].to_s
system(multiplex_min_streams)
end;
#multiplex_max_streams
if Value['proxies'][$count]['smux'].key?('max-streams') then
multiplex_max_streams = '${uci_set}multiplex_max_streams=' + Value['proxies'][$count]['smux']['max-streams'].to_s
system(multiplex_max_streams)
end;
#multiplex_padding
if Value['proxies'][$count]['smux'].key?('padding') then
multiplex_padding = '${uci_set}multiplex_padding=' + Value['proxies'][$count]['smux']['padding'].to_s
system(multiplex_padding)
end;
#multiplex_statistic
if Value['proxies'][$count]['smux'].key?('statistic') then
multiplex_statistic = '${uci_set}multiplex_statistic=' + Value['proxies'][$count]['smux']['statistic'].to_s
system(multiplex_statistic)
end;
#multiplex_only_tcp
if Value['proxies'][$count]['smux'].key?('only-tcp') then
multiplex_only_tcp = '${uci_set}multiplex_only_tcp=' + Value['proxies'][$count]['smux']['only-tcp'].to_s
system(multiplex_only_tcp)
end;
end;
}.join
if '$server_type' == 'ss' then
Thread.new{
#cipher
@ -1496,15 +1541,15 @@ if [ "$servers_if_update" = "1" ]; then
if [ -z "$line" ]; then
continue
fi
if [ "$(uci get openclash.@servers["$line"].manual 2>/dev/null)" = "0" ] && [ "$(uci get openclash.@servers["$line"].config 2>/dev/null)" = "$CONFIG_NAME" ]; then
uci delete openclash.@servers["$line"] 2>/dev/null
if [ "$(uci -q get openclash.@servers["$line"].manual)" = "0" ] && [ "$(uci -q get openclash.@servers["$line"].config)" = "$CONFIG_NAME" ]; then
uci -q delete openclash.@servers["$line"]
fi
done 2>/dev/null
fi
uci set openclash.config.servers_if_update=0
uci -q set openclash.config.servers_if_update=0
wait
uci commit openclash
uci -q commit openclash
LOG_OUT "Config File【$CONFIG_NAME】Read Successful!"
sleep 3
SLOG_CLEAN

View File

@ -15,16 +15,16 @@ del_lock() {
SERVER_FILE="/tmp/yaml_servers.yaml"
PROXY_PROVIDER_FILE="/tmp/yaml_provider.yaml"
servers_if_update=$(uci get openclash.config.servers_if_update 2>/dev/null)
config_auto_update=$(uci get openclash.config.auto_update 2>/dev/null)
CONFIG_FILE=$(uci get openclash.config.config_path 2>/dev/null)
servers_if_update=$(uci -q get openclash.config.servers_if_update)
config_auto_update=$(uci -q get openclash.config.auto_update)
CONFIG_FILE=$(uci -q get openclash.config.config_path)
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_FILE=$(uci -q get openclash.config.config_update_path)
UPDATE_CONFIG_NAME=$(echo "$UPDATE_CONFIG_FILE" |awk -F '/' '{print $5}' 2>/dev/null)
UCI_DEL_LIST="uci del_list openclash.config.new_servers_group"
UCI_ADD_LIST="uci add_list openclash.config.new_servers_group"
UCI_SET="uci set openclash.config."
MIX_PROXY=$(uci get openclash.config.mix_proxies 2>/dev/null)
UCI_DEL_LIST="uci -q del_list openclash.config.new_servers_group"
UCI_ADD_LIST="uci -q add_list openclash.config.new_servers_group"
UCI_SET="uci -q set openclash.config."
MIX_PROXY=$(uci -q get openclash.config.mix_proxies)
servers_name="/tmp/servers_name.list"
proxy_provider_name="/tmp/provider_name.list"
set_lock
@ -55,7 +55,7 @@ yml_other_rules_del()
if [ "$enabled" = "0" ] || [ "$config" != "$2" ] || [ "$rule_name" != "$3" ]; then
return
else
uci set openclash."$section".enabled=0 2>/dev/null
uci -q set openclash."$section".enabled=0
fi
}
#写入代理集到配置文件
@ -287,6 +287,14 @@ yml_servers_set()
config_get "reality_short_id" "$section" "reality_short_id" ""
config_get "obfs_version_hint" "$section" "obfs_version_hint" ""
config_get "obfs_restls_script" "$section" "obfs_restls_script" ""
config_get "multiplex" "$section" "multiplex" ""
config_get "multiplex_protocol" "$section" "multiplex_protocol" ""
config_get "multiplex_max_connections" "$section" "multiplex_max_connections" ""
config_get "multiplex_min_streams" "$section" "multiplex_min_streams" ""
config_get "multiplex_max_streams" "$section" "multiplex_max_streams" ""
config_get "multiplex_padding" "$section" "multiplex_padding" ""
config_get "multiplex_statistic" "$section" "multiplex_statistic" ""
config_get "multiplex_only_tcp" "$section" "multiplex_only_tcp" ""
if [ "$enabled" = "0" ]; then
return
@ -339,10 +347,6 @@ yml_servers_set()
fi
LOG_OUT "Start Writing【$CONFIG_NAME - $type - $name】Proxy To Config File..."
if [ "$cipher_ssr" == "none" ]; then
cipher_ssr="dummy"
fi
if [ "$obfs" != "none" ] && [ -n "$obfs" ]; then
if [ "$obfs" = "websocket" ]; then
obfss="plugin: v2ray-plugin"
@ -1205,6 +1209,49 @@ cat >> "$SERVER_FILE" <<-EOF
EOF
fi
#Multiplex
if [ ! -z "$multiplex" ]; then
cat >> "$SERVER_FILE" <<-EOF
smux:
enabled: $multiplex
EOF
if [ -n "$multiplex_protocol" ]; then
cat >> "$SERVER_FILE" <<-EOF
protocol: $multiplex_protocol
EOF
fi
if [ -n "$multiplex_max_connections" ]; then
cat >> "$SERVER_FILE" <<-EOF
max-connections: $multiplex_max_connections
EOF
fi
if [ -n "$multiplex_min_streams" ]; then
cat >> "$SERVER_FILE" <<-EOF
min-streams: $multiplex_min_streams
EOF
fi
if [ -n "$multiplex_max_streams" ]; then
cat >> "$SERVER_FILE" <<-EOF
max-streams: $multiplex_max_streams
EOF
fi
if [ -n "$multiplex_padding" ]; then
cat >> "$SERVER_FILE" <<-EOF
padding: $multiplex_padding
EOF
fi
if [ -n "$multiplex_statistic" ]; then
cat >> "$SERVER_FILE" <<-EOF
statistic: $multiplex_statistic
EOF
fi
if [ -n "$multiplex_only_tcp" ]; then
cat >> "$SERVER_FILE" <<-EOF
only-tcp: $multiplex_only_tcp
EOF
fi
fi
#interface-name
if [ -n "$interface_name" ]; then
cat >> "$SERVER_FILE" <<-EOF
@ -1278,8 +1325,8 @@ fi
rm -rf $proxy_provider_name
#proxy
rule_sources=$(uci get openclash.config.rule_sources 2>/dev/null)
create_config=$(uci get openclash.config.create_config 2>/dev/null)
rule_sources=$(uci -q get openclash.config.rule_sources)
create_config=$(uci -q get openclash.config.create_config)
LOG_OUT "Start Writing【$CONFIG_NAME】Proxies Setting..."
echo "proxies:" >$SERVER_FILE
config_foreach yml_servers_set "servers"
@ -1370,7 +1417,7 @@ fi
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
config_load "openclash"
config_foreach yml_other_rules_del "other_rules" "$CONFIG_NAME" "ConnersHua"
uci_name_tmp=$(uci add openclash other_rules)
uci_name_tmp=$(uci -q add openclash other_rules)
uci_set="uci -q set openclash.$uci_name_tmp."
${UCI_SET}rule_source="1"
${uci_set}enable="1"
@ -1790,7 +1837,7 @@ fi
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
config_load "openclash"
config_foreach yml_other_rules_del "other_rules" "$CONFIG_NAME" "lhie1"
uci_name_tmp=$(uci add openclash other_rules)
uci_name_tmp=$(uci -q add openclash other_rules)
uci_set="uci -q set openclash.$uci_name_tmp."
${UCI_SET}rule_source="1"
${uci_set}enable="1"
@ -1901,7 +1948,7 @@ cat >> "$SERVER_FILE" <<-EOF
EOF
config_load "openclash"
config_foreach yml_other_rules_del "other_rules" "$CONFIG_NAME" "ConnersHua_return"
uci_name_tmp=$(uci add openclash other_rules)
uci_name_tmp=$(uci -q add openclash other_rules)
uci_set="uci -q set openclash.$uci_name_tmp."
${UCI_SET}rule_source="1"
${uci_set}enable="1"
@ -1946,6 +1993,6 @@ rm -rf /tmp/Proxy_Server 2>/dev/null
rm -rf /tmp/Proxy_Provider 2>/dev/null
del_lock
${UCI_SET}enable=1 2>/dev/null
[ "$(uci get openclash.config.servers_if_update)" == "0" ] && [ -z "$if_game_proxy" ] && /etc/init.d/openclash restart >/dev/null 2>&1
[ "$(uci -q get openclash.config.servers_if_update)" == "0" ] && [ -z "$if_game_proxy" ] && /etc/init.d/openclash restart >/dev/null 2>&1
${UCI_SET}servers_if_update=0
uci commit openclash
uci -q commit openclash

View File

@ -28,6 +28,7 @@ yml_set_custom_rule_provider()
config_get "interval" "$section" "interval" ""
config_get "group" "$section" "group" ""
config_get "position" "$section" "position" ""
config_get "format" "$section" "format" ""
if [ "$enabled" = "0" ]; then
return
@ -69,6 +70,11 @@ cat >> "$RULE_PROVIDER_FILE" <<-EOF
behavior: $behavior
path: $path
EOF
if [ -n "$format" ]; then
cat >> "$RULE_PROVIDER_FILE" <<-EOF
format: $format
EOF
fi
if [ "$type" = "http" ]; then
cat >> "$RULE_PROVIDER_FILE" <<-EOF
url: $url
@ -115,7 +121,7 @@ yml_gen_rule_provider_file()
RULE_PROVIDER_FILE_URL="https://raw.githubusercontent.com/${RULE_PROVIDER_FILE_URL_PATH}"
else
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
RULE_PROVIDER_FILE_URL="https://cdn.jsdelivr.net/gh/"$(echo "$RULE_PROVIDER_FILE_URL_PATH" |awk -F '/master' '{print $1}' 2>/dev/null)"@master"$(echo "$RULE_PROVIDER_FILE_URL_PATH" |awk -F 'master' '{print $2}')""
RULE_PROVIDER_FILE_URL="${github_address_mod}gh/"$(echo "$RULE_PROVIDER_FILE_URL_PATH" |awk -F '/master' '{print $1}' 2>/dev/null)"@master"$(echo "$RULE_PROVIDER_FILE_URL_PATH" |awk -F 'master' '{print $2}')""
elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then
RULE_PROVIDER_FILE_URL="https://raw.fastgit.org/"$(echo "$RULE_PROVIDER_FILE_URL_PATH" |awk -F '/master' '{print $1}' 2>/dev/null)"/master"$(echo "$RULE_PROVIDER_FILE_URL_PATH" |awk -F 'master' '{print $2}')""
else
@ -136,7 +142,7 @@ cat >> "$RULE_PROVIDER_FILE" <<-EOF
EOF
if [ -z "$3" ]; then
cat >> "$RULE_PROVIDER_FILE" <<-EOF
interval=86400
interval: 86400
EOF
else
cat >> "$RULE_PROVIDER_FILE" <<-EOF
@ -795,7 +801,7 @@ yml_other_set()
if '$github_address_mod' != '0' then
if '$github_address_mod' == 'https://cdn.jsdelivr.net/' or '$github_address_mod' == 'https://fastly.jsdelivr.net/' or '$github_address_mod' == 'https://testingcf.jsdelivr.net/'then
if x['url'] and x['url'] =~ /^https:\/\/raw.githubusercontent.com/ then
x['url'] = '$github_address_mod' + x['url'].split('/')[3] + '/' + x['url'].split('/')[4] + '@' + x['url'].split(x['url'].split('/')[2] + '/' + x['url'].split('/')[3] + '/' + x['url'].split('/')[4] + '/')[1];
x['url'] = '$github_address_mod' + 'gh/' + x['url'].split('/')[3] + '/' + x['url'].split('/')[4] + '@' + x['url'].split(x['url'].split('/')[2] + '/' + x['url'].split('/')[3] + '/' + x['url'].split('/')[4] + '/')[1];
end;
elsif '$github_address_mod' == 'https://raw.fastgit.org/' then
if x['url'] and x['url'] =~ /^https:\/\/raw.githubusercontent.com/ then
@ -822,7 +828,7 @@ yml_other_set()
Value['proxy-groups'].each{
|x|
if x['type'] == 'url-test' then
x['tolerance']='${tolerance}';
x['tolerance']=${tolerance};
end
};
end;
@ -839,7 +845,7 @@ yml_other_set()
Value['proxy-groups'].each{
|x|
if x['type'] == 'url-test' or x['type'] == 'fallback' or x['type'] == 'load-balance' then
x['interval']='${urltest_interval_mod}';
x['interval']=${urltest_interval_mod};
end
};
end;
@ -847,7 +853,7 @@ yml_other_set()
Value['proxy-providers'].values.each{
|x|
if x['health-check'] and x['health-check']['enable'] and x['health-check']['enable'] == 'true' then
x['health-check']['interval']='${urltest_interval_mod}';
x['health-check']['interval']=${urltest_interval_mod};
end;
};
end;

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="186" height="20" role="img" aria-label="Current Version: v0.45.91-beta"><title>Current Version: v0.45.91-beta</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="186" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="97" height="20" fill="#555"/><rect x="97" width="89" height="20" fill="#007ec6"/><rect width="186" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="495" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="870">Current Version</text><text x="495" y="140" transform="scale(.1)" fill="#fff" textLength="870">Current Version</text><text aria-hidden="true" x="1405" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="790">v0.45.91-beta</text><text x="1405" y="140" transform="scale(.1)" fill="#fff" textLength="790">v0.00.00-beta</text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="186" height="20" role="img" aria-label="Current Version: v0.00.00-beta"><title>Current Version: v0.00.00-beta</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="186" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="97" height="20" fill="#555"/><rect x="97" width="89" height="20" fill="#007ec6"/><rect width="186" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="495" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="870">Current Version</text><text x="495" y="140" transform="scale(.1)" fill="#fff" textLength="870">Current Version</text><text aria-hidden="true" x="1405" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="790">v0.00.00-beta</text><text x="1405" y="140" transform="scale(.1)" fill="#fff" textLength="790">v0.00.00-beta</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB