OpenClash: bump to latest git HEAD

This commit is contained in:
CN_SZTL 2019-10-30 23:36:56 +08:00
parent a267d1c533
commit 39a7898a84
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
18 changed files with 148 additions and 5199 deletions

View File

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

View File

@ -22,6 +22,7 @@ config openclash 'config'
option servers_update '0'
option log_level 'silent'
option proxy_mode 'Rule'
option intranet_allowed '0'
config dns_servers
option group 'nameserver'

View File

@ -48,19 +48,29 @@ change_dns() {
uci add_list dhcp.@dnsmasq[0].server=127.0.0.1#"$dns_port"
uci delete dhcp.@dnsmasq[0].resolvfile
uci set dhcp.@dnsmasq[0].noresolv=1
[ "$2" -eq "1" ] && {
uci set dhcp.@dnsmasq[0].cachesize=0
}
uci commit dhcp
uci set openclash.config.redirect_dns=1
else
uci delete openclash.config.redirect_dns
fi
if [ "$2" -eq "1" ]; then
uci set dhcp.@dnsmasq[0].cachesize=0
uci set openclash.config.masq_cache=1
else
uci delete openclash.config.masq_cache
fi
uci commit dhcp
uci commit openclash
}
revert_dns() {
dns_port=$(uci get openclash.config.dns_port 2>/dev/null)
uci del_list dhcp.@dnsmasq[0].server=127.0.0.1#"$dns_port" >/dev/null 2>&1
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto
uci set dhcp.@dnsmasq[0].noresolv=0
uci delete dhcp.@dnsmasq[0].cachesize
uci del_list dhcp.@dnsmasq[0].server=127.0.0.1#"$3" >/dev/null 2>&1
[ "$1" = "1" ] && {
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto
uci set dhcp.@dnsmasq[0].noresolv=0
}
[ "$2" = "1" ] && {
uci delete dhcp.@dnsmasq[0].cachesize
}
uci commit dhcp
rm -rf /tmp/dnsmasq.d/dnsmasq_openclash.conf >/dev/null 2>&1
}
@ -176,9 +186,9 @@ yml_dns_check()
fi
if [ ! -z "$(grep "^ \{0,\}listen:" "$CONFIG_FILE")" ]; then
sed -i "/^ \{0,\}listen:/c\ listen: 127.0.0.1:${dns_port}" "$CONFIG_FILE" 2>/dev/null
sed -i "/^ \{0,\}listen:/c\ listen: 0.0.0.0:${dns_port}" "$CONFIG_FILE" 2>/dev/null
else
sed -i "/^dns:/a\ listen: 127.0.0.1:${dns_port}" "$CONFIG_FILE" 2>/dev/null
sed -i "/^dns:/a\ listen: 0.0.0.0:${dns_port}" "$CONFIG_FILE" 2>/dev/null
fi
uci set openclash.config.dns_port="$dns_port" && uci commit openclash
@ -381,11 +391,12 @@ if [ "$enable" -eq 1 ] && [ -f "$CONFIG_FILE" ]; then
http_port=$(uci get openclash.config.http_port 2>/dev/null)
socks_port=$(uci get openclash.config.socks_port 2>/dev/null)
enable_redirect_dns=$(uci get openclash.config.enable_redirect_dns 2>/dev/null)
lan_ip=$(uci get network.lan.ipaddr 2>/dev/null)
lan_ip=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null)
direct_dns=$(uci get openclash.config.direct_dns 2>/dev/null)
disable_masq_cache=$(uci get openclash.config.disable_masq_cache 2>/dev/null)
log_level=$(uci get openclash.config.log_level 2>/dev/null)
proxy_mode=$(uci get openclash.config.proxy_mode 2>/dev/null)
intranet_allowed=$(uci get openclash.config.intranet_allowed 2>/dev/null)
echo "第二步: 配置文件检查..." >$START_LOG
yml_check "$en_mode" "$enable_custom_dns" "$CONFIG_FILE" "$BACKUP_FILE" "$START_BACKUP"
grep "^ \{0,\}Proxy:" $CONFIG_FILE >/dev/null 2>&1 && grep "^ \{0,\}Proxy Group:" $CONFIG_FILE >/dev/null 2>&1 && grep "^ \{0,\}Rule:" $CONFIG_FILE >/dev/null 2>&1
@ -403,7 +414,7 @@ if [ "$enable" -eq 1 ] && [ -f "$CONFIG_FILE" ]; then
yml_auth_custom "$CONFIG_FILE"
yml_cut "$CHANGE_FILE" "$RULE_FILE" "$DNS_FILE" "$CONFIG_FILE" "$PROXY_FILE"
yml_dns_custom "$enable_custom_dns" "$DNS_FILE"
sh /usr/share/openclash/yml_change.sh "$LOGTIME" "$en_mode" "$enable_custom_dns" "$da_password" "$cn_port" "$proxy_port" "$CHANGE_FILE" "$ipv6_enable" "$http_port" "$socks_port" "$lan_ip" "$log_level" "$proxy_mode" &
sh /usr/share/openclash/yml_change.sh "$LOGTIME" "$en_mode" "$enable_custom_dns" "$da_password" "$cn_port" "$proxy_port" "$CHANGE_FILE" "$ipv6_enable" "$http_port" "$socks_port" "$lan_ip" "$log_level" "$proxy_mode" "$intranet_allowed" &
sh /usr/share/openclash/yml_rules_change.sh "$LOGTIME" "$rule_source" "$enable_custom_clash_rules" "$RULE_FILE" &
wait
cat "$CHANGE_FILE" "$DNS_FILE" "$PROXY_FILE" "$RULE_FILE" >$CONFIG_FILE 2>/dev/null
@ -585,7 +596,10 @@ stop()
kill -9 "$(pidof clash|sed 's/$//g')" 2>/dev/null
echo "第四步: 重启 Dnsmasq 程序..." >$START_LOG
revert_dns
dns_port=$(uci get openclash.config.dns_port 2>/dev/null)
redirect_dns=$(uci get openclash.config.redirect_dns 2>/dev/null)
masq_cache=$(uci get openclash.config.masq_cache 2>/dev/null)
revert_dns "$redirect_dns" "$masq_cache" "$dns_port"
/etc/init.d/dnsmasq restart >/dev/null 2>&1
echo "第五步:删除 OpenClash 残留文件..." >$START_LOG

File diff suppressed because one or more lines are too long

View File

@ -122,7 +122,7 @@ local function ConnersHua_return()
end
local function daip()
return luci.sys.exec("uci get network.lan.ipaddr 2>/dev/null |tr -d '\n'")
return luci.sys.exec("uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
end
local function dase()

View File

@ -67,6 +67,12 @@ o:value("debug", translate("Debug Mode"))
o:value("silent", translate("Silent Mode"))
o.default = "silent"
o = s:taboption("settings", ListValue, "intranet_allowed", translate("Only intranet allowed"))
o.description = translate("When enabled, the control panel and the connection broker port will not be accessible from the public network")
o:value("0", translate("Disable"))
o:value("1", translate("Enable"))
o.default = 0
o = s:taboption("settings", Value, "proxy_port")
o.title = translate("Redir Port")
o.default = 7892
@ -348,7 +354,7 @@ o.write = function()
end
---- Dashboard Settings
local lan_ip=SYS.exec("uci get network.lan.ipaddr 2>/dev/null |tr -d '\n'")
local lan_ip=SYS.exec("uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
o = s:taboption("dashboard", Value, "cn_port")
o.title = translate("Dashboard Port")
o.default = 9090

View File

@ -11,12 +11,14 @@
</td></tr>
<tr><td colspan="4" width="100%">
<p align="center">
<img id="star" src="https://img.shields.io/badge/Star--lightgrey?logo=github&style=social" alt="star" onerror="return imgerrorfuns(this,this.src)" onclick="return homepage()" />
&nbsp;&nbsp;&nbsp;
<img id="wiki" src="https://img.shields.io/badge/Tutorials--lightgrey?logo=Wikipedia&style=social" alt="Wiki" onerror="return imgerrorfuns(this,this.src)" onclick="return wikipage()" />
&nbsp;&nbsp;&nbsp;
<img id="star" src="https://img.shields.io/badge/Star--lightgrey?logo=github&style=social" alt="star" onerror="return imgerrorfuns(this,this.src)" onclick="return homepage()" />
&nbsp;&nbsp;&nbsp;
<!--
<img id="telegram" src="https://img.shields.io/badge/Telegram--lightgrey?logo=Telegram&style=social" alt="Telegram" onerror="return imgerrorfuns(this,this.src)" onclick="return telegrampage()" />
&nbsp;&nbsp;&nbsp;
-->
<img id="sponsor" src="https://img.shields.io/badge/Sponsor--lightgrey?logo=ko-fi&style=social" alt="Sponsor" onerror="return imgerrorfuns(this,this.src)" onclick="return sponsorpage()" />
</p>
</td></tr>

View File

@ -5,8 +5,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="icon" type="image/x-icon" href="https://cdn.jsdelivr.net/gh/Dreamacro/clash/docs/logo.png" />
<title>Clash</title>
<link href="main.713d27062536ff3ce5dc.css" rel="stylesheet"></head>
<link href="main.bb3fb413cdb4f6e6f970.css" rel="stylesheet"></head>
<body>
<div id="root"></div>
<script type="text/javascript" src="js/1.bundle.713d27062536ff3ce5dc.min.js"></script><script type="text/javascript" src="js/bundle.713d27062536ff3ce5dc.min.js"></script></body>
<script type="text/javascript" src="js/1.bundle.bb3fb413cdb4f6e6f970.min.js"></script><script type="text/javascript" src="js/bundle.bb3fb413cdb4f6e6f970.min.js"></script></body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,54 @@
/*!
Copyright (c) 2017 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
/** @license React v16.11.0
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v16.11.0
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v0.17.0
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v16.8.6
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,6 @@
#!/bin/sh
CLASH="/etc/openclash/clash"
CLASH_CONFIG="/etc/openclash"
LOG_FILE="/tmp/openclash.log"
enable_redirect_dns=$(uci get openclash.config.enable_redirect_dns 2>/dev/null)
dns_port=$(uci get openclash.config.dns_port 2>/dev/null)
@ -12,12 +13,12 @@ do
if [ "$enable" -eq 1 ]; then
if ! pidof clash >/dev/null; then
echo "${LOGTIME} Watchdog: OpenClash Problem, Restart " >>$LOG_FILE
echo "${LOGTIME} Watchdog: Clash Core Problem, Restart." >>$LOG_FILE
nohup $CLASH -d "$CLASH_CONFIG" >> $LOG_FILE 2>&1 &
fi
fi
## Log File Size Manage:
LOGSIZE=`ls -l /tmp/openclash.log |awk '{print int($5/1024)}'`
if [ "$LOGSIZE" -gt 90 ]; then
echo "$LOGTIME Watchdog: Size Limit, Clean Up All Log Records." >$LOG_FILE
@ -29,7 +30,7 @@ fi
if [ "$last_line" -ne "$op_line" ]; then
iptables -t nat -D PREROUTING -p tcp -j openclash
iptables -t nat -A PREROUTING -p tcp -j openclash
echo "$LOGTIME Watchdog: Restart For Enable Firewall Redirect." >>$LOG_FILE
echo "$LOGTIME Watchdog: Reset Firewall For Enabling Redirect." >>$LOG_FILE
fi
## DNS转发劫持

View File

@ -76,11 +76,19 @@
fi
fi
if [ -z "$(grep '^external-controller: $11:$5' "$7")" ]; then
if [ "$14" -ne 1 ]; then
controller_address="0.0.0.0"
bind_address="*"
else
controller_address="$11"
bind_address="$11"
fi
if [ -z "$(grep '^external-controller: $controller_address:$5' "$7")" ]; then
if [ ! -z "$(grep "^ \{0,\}external-controller:" "$7")" ]; then
sed -i "/^ \{0,\}external-controller:/c\external-controller: ${11}:${5}" "$7"
sed -i "/^ \{0,\}external-controller:/c\external-controller: ${controller_address}:${5}" "$7"
else
sed -i "/^dns:/i\external-controller: ${11}:${5}" "$7"
sed -i "/^dns:/i\external-controller: ${controller_address}:${5}" "$7"
fi
fi
@ -109,7 +117,7 @@
fi
sed -i '/bind-address:/d' "$7" 2>/dev/null
sed -i "/^allow-lan:/a\bind-address: \"${11}\"" "$7"
sed -i "/^allow-lan:/a\bind-address: \"${bind_address}\"" "$7"
if [ -z "$(grep '^external-ui: "/usr/share/openclash/dashboard"' "$7")" ]; then
if [ ! -z "$(grep "^ \{0,\}external-ui:" "$7")" ]; then

View File

@ -134,6 +134,12 @@ msgstr "Silent【静默】"
msgid "Select Core's Log Level"
msgstr "选择内核日志的默认输出模式"
msgid "Only intranet allowed"
msgstr "仅允许内网"
msgid "When enabled, the control panel and the connection broker port will not be accessible from the public network"
msgstr "启用后将禁止从公网访问控制面板和连接代理端口"
msgid "Redirect Local DNS Setting"
msgstr "*本地DNS劫持"