Merge Mainline
This commit is contained in:
commit
093f5840b5
@ -1,45 +1,45 @@
|
||||
#
|
||||
# Copyright (C) 2019 OpenWrt.org
|
||||
# Copyright (C) 2020 CTCGFW Project-OpenWrt
|
||||
# (https://project-openwrt.eu.org)
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=jpcre2
|
||||
PKG_VERSION:=10.32.01
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/jpcre2/jpcre2/tar.gz/$(PKG_VERSION)?
|
||||
PKG_HASH:=668cbc6d2c0a065bb6abe8494d5a1bb3549a14cd956a44a2df9095045623ea47
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=BSD 3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=[CTCGFW]Project OpenWrt
|
||||
PKG_MAINTAINER:=CN_SZTL <cnsztl@project-openwrt.eu.org>
|
||||
|
||||
PKG_INSTALL:=1
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_USE_MIPS16:=0
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_BUILD_DEPENDS:=pcre2
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
define Package/jpcre2
|
||||
SECTION:=lib
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=C++ wrapper for PCRE2 Library
|
||||
URL:=https://github.com/jpcre2/jpcre2
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
This provides some C++ wrapper classes/functions to perform regex operations such as regex match and regex replace.
|
||||
define Package/jpcre2/description
|
||||
This provides some C++ wrapper classes/functions to perform
|
||||
regex operations such as regex match and regex replace.
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/src/jpcre2.hpp $(1)/usr/include/jpcre2.hpp
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/jpcre2.hpp $(1)/usr/include/jpcre2.hpp
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
$(eval $(call BuildPackage,jpcre2))
|
||||
|
||||
@ -1,31 +1,28 @@
|
||||
#
|
||||
# Copyright (C) 2019 OpenWrt.org
|
||||
# Copyright (C) 2020 CTCGFW Project-OpenWrt
|
||||
# (https://project-openwrt.eu.org)
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=rapidjson
|
||||
PKG_VERSION:=1.1.0-ce81bc9
|
||||
PKG_RELEASE:=2
|
||||
PKG_VERSION:=1.1.0
|
||||
PKG_RELEASE:=4
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/Tencent/rapidjson.git
|
||||
PKG_SOURCE_VERSION:=ce81bc9edfe773667a7a4454ba81dac72ed4364c
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=1a74a411aff88bd770c80bd0b797ccb50207a64bccf7f98dbb1abf71498f3e8e
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_DATE:=2021-01-06
|
||||
PKG_SOURCE_VERSION:=585042c02ba6350e10fc43df8beee1bc097f4c5f
|
||||
PKG_MIRROR_HASH:=ef7d015b91f58355b02ce8356214ec7d6bdc3807d01b220834faa00afbcd7a7f
|
||||
|
||||
PKG_LICENSE:=BSD 3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=[CTCGFW]Project OpenWrt
|
||||
PKG_MAINTAINER:=CN_SZTL <cnsztl@project-openwrt.eu.org>
|
||||
|
||||
PKG_INSTALL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
CMAKE_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
@ -34,20 +31,15 @@ CMAKE_OPTIONS+= -DRAPIDJSON_BUILD_DOC=OFF \
|
||||
-DRAPIDJSON_BUILD_EXAMPLES=OFF \
|
||||
-DRAPIDJSON_BUILD_TESTS=OFF
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
define Package/rapidjson
|
||||
SECTION:=lib
|
||||
CATEGORY:=Libraries
|
||||
URL:=https://github.com/Tencent/rapidjson
|
||||
TITLE:=rapidjson JSON parser/generator for C++
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
define Package/rapidjson/description
|
||||
A fast JSON parser/generator for C++ with both SAX/DOM style API
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(CP) $(PKG_BUILD_DIR)/include/rapidjson $(1)/usr/include/rapidjson
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
$(eval $(call BuildPackage,rapidjson))
|
||||
|
||||
@ -1,45 +1,42 @@
|
||||
#
|
||||
# Copyright (C) 2019 OpenWrt.org
|
||||
# Copyright (C) 2020 CTCGFW Project-OpenWrt
|
||||
# <https://project-openwrt.eu.org>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=subconverter
|
||||
PKG_VERSION:=0.6.4
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/tindy2013/subconverter.git
|
||||
PKG_SOURCE_VERSION:=ab4d7543cec46cd9e45680f3b43d82de16f38a3d
|
||||
PKG_MIRROR_HASH:=c5dc3c224d9229df09428a28a1306bba28790b328f8d644ae41e929bee58426c
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_DATE:=2020-12-19
|
||||
PKG_SOURCE_VERSION:=a57906c9a6edd04da869b12ffb88f397c3ea8af6
|
||||
PKG_MIRROR_HASH:=07815478cbfa1644ad016ea4b68a2edc9316f9aa23edf699d82c4c9026e17462
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPLv3
|
||||
PKG_LICENSE:=GPL-3.0
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=[CTCGFW]Project OpenWrt
|
||||
PKG_MAINTAINER:=CN_SZTL <cnsztl@project-openwrt.eu.org>
|
||||
|
||||
PKG_USE_MIPS16:=0
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_BUILD_DEPENDS:=duktape jpcre2 rapidjson
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
define Package/subconverter
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Utility to convert between various subscription format.
|
||||
TITLE:=Utility to convert between various subscription format
|
||||
URL:=https://github.com/tindy2013/subconverter
|
||||
DEPENDS:=+libpthread +libstdcpp +libevent2 +libyaml-cpp +libpcre2 +libcurl +zlib
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Utility to convert between various subscription format.
|
||||
define Package/subconverter/description
|
||||
Utility to convert between various proxy subscription formats.
|
||||
endef
|
||||
|
||||
TARGET_CXXFLAGS := $(FPIC) $(filter-out -O%,$(TARGET_CXXFLAGS)) -O3
|
||||
@ -48,7 +45,7 @@ TARGET_LDFLAGS += -Wl,--gc-sections -flto
|
||||
|
||||
CMAKE_OPTIONS += -DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
define Package/subconverter/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/subconverter $(1)/usr/bin/subconverter
|
||||
$(INSTALL_DIR) $(1)/etc/subconverter
|
||||
@ -57,4 +54,4 @@ define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_BIN) ./files/subconverter.init $(1)/etc/init.d/subconverter
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
$(eval $(call BuildPackage,subconverter))
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
diff --git a/src/misc.h b/src/misc.h
|
||||
index b98cdc9..484c1e1 100644
|
||||
--- a/src/misc.h
|
||||
+++ b/src/misc.h
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <algorithm>
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
+#include <string.h>
|
||||
|
||||
#include <yaml-cpp/yaml.h>
|
||||
|
||||
@ -299,6 +299,7 @@ function import_ssr_url(btn, urlname, sid) {
|
||||
ssm.type = "none"
|
||||
}
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.tcp_guise')[0].value = ssm.type;
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.tcp_guise')[0].dispatchEvent(event);
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.http_host')[0].value = ssm.host;
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.http_path')[0].value = ssm.path;
|
||||
}
|
||||
|
||||
@ -738,7 +738,7 @@ start_rules() {
|
||||
esac
|
||||
}
|
||||
if [ "$(uci_get_by_type global dports 1)" == "2" ]; then
|
||||
local proxyport="-m multiport --dports 22,53,587,465,995,993,143,80,443,853"
|
||||
local proxyport="-m multiport --dports 22,53,587,465,995,993,143,80,443,853,9418"
|
||||
fi
|
||||
get_arg_out() {
|
||||
case "$(uci_get_by_type access_control router_proxy 1)" in
|
||||
|
||||
@ -204,8 +204,8 @@ ac_rule() {
|
||||
create ssr_gen_router hash:net
|
||||
$(gen_spec_iplist | sed -e "s/^/add ssr_gen_router /")
|
||||
EOF
|
||||
$IPT -N SS_SPEC_ROUTER
|
||||
$IPT -A SS_SPEC_ROUTER -m set --match-set ssr_gen_router dst -j RETURN
|
||||
$IPT -N SS_SPEC_ROUTER && \
|
||||
$IPT -A SS_SPEC_ROUTER -m set --match-set ssr_gen_router dst -j RETURN && \
|
||||
$IPT -A SS_SPEC_ROUTER -j SS_SPEC_WAN_FW
|
||||
$IPT -I OUTPUT 1 -p tcp -m comment --comment "$TAG" -j SS_SPEC_ROUTER
|
||||
;;
|
||||
@ -236,7 +236,7 @@ tp_rule() {
|
||||
$ipt -A SS_SPEC_TPROXY -p udp $PROXY_PORTS -m set --match-set fplan src -j TPROXY --on-port "$LOCAL_PORT" --tproxy-mark 0x01/0x01
|
||||
case "$RUNMODE" in
|
||||
router)
|
||||
$IPT -A SS_SPEC_TPROXY -p udp -m set --match-set ss_spec_wan_ac dst -j RETURN
|
||||
$ipt -A SS_SPEC_TPROXY -p udp -m set --match-set ss_spec_wan_ac dst -j RETURN
|
||||
$ipt -A SS_SPEC_TPROXY -p udp -m set --match-set china dst -j RETURN
|
||||
$ipt -A SS_SPEC_TPROXY -p udp -m set --match-set gmlan src -m set ! --match-set china dst -j TPROXY --on-port "$LOCAL_PORT" --tproxy-mark 0x01/0x01
|
||||
$ipt -A SS_SPEC_TPROXY -p udp $PROXY_PORTS -m set ! --match-set ss_spec_wan_ac dst -j TPROXY --on-port "$LOCAL_PORT" --tproxy-mark 0x01/0x01
|
||||
|
||||
@ -35,11 +35,11 @@ PKG_NAME:=verysync
|
||||
ifneq ($(LATEST_VERSION),)
|
||||
PKG_VERSION:=$(LATEST_VERSION)
|
||||
else
|
||||
PKG_VERSION:=v1.5.5
|
||||
PKG_VERSION:=v2.4.2
|
||||
endif
|
||||
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-linux-$(PKG_ARCH_VERYSYNC)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://dl.verysync.com/releases/$(PKG_VERSION)/
|
||||
PKG_HASH:=skip
|
||||
|
||||
@ -1,171 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-clash
|
||||
PKG_VERSION:=v1.7.5.7
|
||||
PKG_MAINTAINER:=frainzy1477
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=luci
|
||||
CATEGORY:=LuCI
|
||||
SUBMENU:=3. Applications
|
||||
TITLE:=LuCI app for clash
|
||||
DEPENDS:=+luci-base +wget-ssl +iptables +coreutils-base64 +coreutils +coreutils-nohup +bash +ipset +libustream-openssl +curl +jsonfilter +ca-certificates +iptables-mod-tproxy +kmod-tun
|
||||
PKGARCH:=all
|
||||
MAINTAINER:=frainzy1477
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Luci Interface for clash.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
po2lmo ${CURDIR}/po/zh-cn/clash.po ${CURDIR}/po/zh-cn/clash.zh-cn.lmo
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/clash
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/prerm
|
||||
#!/bin/sh
|
||||
# check if we are on real system
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
echo "Removing rc.d symlink for clash"
|
||||
/etc/init.d/clash disable
|
||||
/etc/init.d/clash stop
|
||||
echo "Removing firewall rule for clash"
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete firewall.clash
|
||||
commit firewall
|
||||
EOF
|
||||
fi
|
||||
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/preinst
|
||||
#!/bin/sh
|
||||
/etc/init.d/clash disable 2>/dev/null
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
rm -rf /tmp/dnsmasq.d/custom_list.conf 2>/dev/null
|
||||
rm -rf /tmp/dnsmasq.clash 2>/dev/null
|
||||
mv /etc/config/clash /etc/config/clash.bak 2>/dev/null
|
||||
rm -rf /usr/lib/lua/luci/model/cbi/clash 2>/dev/null
|
||||
rm -rf /usr/lib/lua/luci/view/clash 2>/dev/null
|
||||
rm -rf /usr/share/clash/new_core_version 2>/dev/null
|
||||
rm -rf /usr/share/clash/new_clashr_core_version 2>/dev/null
|
||||
rm -rf /usr/share/clash/new_luci_version 2>/dev/null
|
||||
rm -rf /usr/share/clash/web 2>/dev/null
|
||||
mv /usr/share/clash/config/sub/config.yaml /usr/share/clashbackup/config.bak1 2>/dev/null
|
||||
mv /usr/share/clash/config/upload/config.yaml /usr/share/clashbackup/config.bak2 2>/dev/null
|
||||
mv /usr/share/clash/config/custom/config.yaml /usr/share/clashbackup/config.bak3 2>/dev/null
|
||||
mv /usr/share/clash/rule.yaml /usr/share/clashbackup/rule.bak 2>/dev/null
|
||||
fi
|
||||
|
||||
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/postinst
|
||||
#!/bin/sh
|
||||
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
rm -rf /tmp/luci*
|
||||
mv /etc/config/clash.bak /etc/config/clash 2>/dev/null
|
||||
mv /usr/share/clashbackup/config.bak1 /usr/share/clash/config/sub/config.yaml 2>/dev/null
|
||||
mv /usr/share/clashbackup/config.bak2 /usr/share/clash/config/upload/config.yaml 2>/dev/null
|
||||
mv /usr/share/clashbackup/config.bak3 /usr/share/clash/config/custom/config.yaml 2>/dev/null
|
||||
mv /usr/share/clashbackup/rule.bak /usr/share/clash/rule.yaml 2>/dev/null
|
||||
/etc/init.d/clash disable 2>/dev/null
|
||||
fi
|
||||
/etc/init.d/clash disable 2>/dev/null
|
||||
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/clash
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/clash/config
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/clash/dns
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/clash/client
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/clash/game
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/clash/geoip
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/clash/logs
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/clash/update
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/clash
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/clash
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci
|
||||
$(INSTALL_DIR) $(1)/usr/share/
|
||||
$(INSTALL_DIR) $(1)/usr/share/clash
|
||||
$(INSTALL_DIR) $(1)/usr/share/clash/rules
|
||||
$(INSTALL_DIR) $(1)/usr/share/clash/rules/g_rules
|
||||
$(INSTALL_DIR) $(1)/etc/clash/dashboard
|
||||
$(INSTALL_DIR) $(1)/etc/clash/dashboard/img
|
||||
$(INSTALL_DIR) $(1)/etc/clash/dashboard/js
|
||||
$(INSTALL_DIR) $(1)/usr/share/clash/yacd
|
||||
$(INSTALL_DIR) $(1)/etc/clash/clashtun
|
||||
$(INSTALL_DIR) $(1)/etc/clash/dtun
|
||||
$(INSTALL_DIR) $(1)/usr/share/clashbackup
|
||||
$(INSTALL_DIR) $(1)/usr/share/clash/create
|
||||
$(INSTALL_DIR) $(1)/etc/clash/provider
|
||||
$(INSTALL_DIR) $(1)/etc/clash/proxyprovider
|
||||
$(INSTALL_DIR) $(1)/etc/clash/ruleprovider
|
||||
$(INSTALL_DIR) $(1)/usr/share/clash/config
|
||||
$(INSTALL_DIR) $(1)/usr/share/clash/config/sub
|
||||
$(INSTALL_DIR) $(1)/usr/share/clash/config/upload
|
||||
$(INSTALL_DIR) $(1)/usr/share/clash/config/custom
|
||||
|
||||
|
||||
$(INSTALL_BIN) ./root/etc/init.d/clash $(1)/etc/init.d/clash
|
||||
$(INSTALL_CONF) ./root/etc/config/clash $(1)/etc/config/clash
|
||||
$(INSTALL_CONF) ./root/etc/clash/Country.mmdb $(1)/etc/clash
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/create/* $(1)/usr/share/clash/create
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/*.sh $(1)/usr/share/clash
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/rules/g_rules/Steam.rules $(1)/usr/share/clash/rules/g_rules
|
||||
$(INSTALL_BIN) ./root//usr/share/clash/rules/rules.list $(1)/usr/share/clash/rules
|
||||
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/luci_version $(1)/usr/share/clash
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/rule.yaml $(1)/usr/share/clash
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/server.list $(1)/usr/share/clash
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/clash_real.txt $(1)/usr/share/clash
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/logstatus_check $(1)/usr/share/clash
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/clash.txt $(1)/usr/share/clash
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/chinaipset.sh $(1)/usr/share/clash
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/china_ip.txt $(1)/usr/share/clash
|
||||
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/index.html $(1)/etc/clash/dashboard
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/main.658aa6a6e3feec8f168b.css $(1)/etc/clash/dashboard
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/img/ffac0fa1d89f15922b4594863b8b32e9.png $(1)/etc/clash/dashboard/img
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/js/1.bundle.658aa6a6e3feec8f168b.min.js $(1)/etc/clash/dashboard/js
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/js/bundle.658aa6a6e3feec8f168b.min.js $(1)/etc/clash/dashboard/js
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/yacd/* $(1)/usr/share/clash/yacd
|
||||
|
||||
$(INSTALL_DATA) ./luasrc/clash.lua $(1)/usr/lib/lua/luci
|
||||
$(INSTALL_DATA) ./luasrc/controller/*.lua $(1)/usr/lib/lua/luci/controller
|
||||
$(INSTALL_DATA) ./luasrc/model/cbi/clash/*.lua $(1)/usr/lib/lua/luci/model/cbi/clash
|
||||
$(INSTALL_DATA) ./luasrc/model/cbi/clash/config/*.lua $(1)/usr/lib/lua/luci/model/cbi/clash/config
|
||||
$(INSTALL_DATA) ./luasrc/model/cbi/clash/client/*.lua $(1)/usr/lib/lua/luci/model/cbi/clash/client
|
||||
$(INSTALL_DATA) ./luasrc/model/cbi/clash/dns/*.lua $(1)/usr/lib/lua/luci/model/cbi/clash/dns
|
||||
$(INSTALL_DATA) ./luasrc/model/cbi/clash/game/*.lua $(1)/usr/lib/lua/luci/model/cbi/clash/game
|
||||
$(INSTALL_DATA) ./luasrc/model/cbi/clash/geoip/*.lua $(1)/usr/lib/lua/luci/model/cbi/clash/geoip
|
||||
$(INSTALL_DATA) ./luasrc/model/cbi/clash/logs/*.lua $(1)/usr/lib/lua/luci/model/cbi/clash/logs
|
||||
$(INSTALL_DATA) ./luasrc/model/cbi/clash/update/*.lua $(1)/usr/lib/lua/luci/model/cbi/clash/update
|
||||
$(INSTALL_DATA) ./luasrc/view/clash/* $(1)/usr/lib/lua/luci/view/clash
|
||||
$(INSTALL_DATA) ./po/zh-cn/clash.zh-cn.lmo $(1)/usr/lib/lua/luci/i18n
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
@ -1,244 +0,0 @@
|
||||
--[[
|
||||
LuCI - Filesystem tools
|
||||
|
||||
Description:
|
||||
A module offering often needed filesystem manipulation functions
|
||||
|
||||
FileId:
|
||||
$Id$
|
||||
|
||||
License:
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
]]--
|
||||
|
||||
local io = require "io"
|
||||
local os = require "os"
|
||||
local ltn12 = require "luci.ltn12"
|
||||
local fs = require "nixio.fs"
|
||||
local nutil = require "nixio.util"
|
||||
|
||||
local type = type
|
||||
|
||||
--- LuCI filesystem library.
|
||||
module "luci.clash"
|
||||
|
||||
--- Test for file access permission on given path.
|
||||
-- @class function
|
||||
-- @name access
|
||||
-- @param str String value containing the path
|
||||
-- @return Number containing the return code, 0 on sucess or nil on error
|
||||
-- @return String containing the error description (if any)
|
||||
-- @return Number containing the os specific errno (if any)
|
||||
access = fs.access
|
||||
|
||||
--- Evaluate given shell glob pattern and return a table containing all matching
|
||||
-- file and directory entries.
|
||||
-- @class function
|
||||
-- @name glob
|
||||
-- @param filename String containing the path of the file to read
|
||||
-- @return Table containing file and directory entries or nil if no matches
|
||||
-- @return String containing the error description (if no matches)
|
||||
-- @return Number containing the os specific errno (if no matches)
|
||||
function glob(...)
|
||||
local iter, code, msg = fs.glob(...)
|
||||
if iter then
|
||||
return nutil.consume(iter)
|
||||
else
|
||||
return nil, code, msg
|
||||
end
|
||||
end
|
||||
|
||||
--- Checks wheather the given path exists and points to a regular file.
|
||||
-- @param filename String containing the path of the file to test
|
||||
-- @return Boolean indicating wheather given path points to regular file
|
||||
function isfile(filename)
|
||||
return fs.stat(filename, "type") == "reg"
|
||||
end
|
||||
|
||||
--- Checks wheather the given path exists and points to a directory.
|
||||
-- @param dirname String containing the path of the directory to test
|
||||
-- @return Boolean indicating wheather given path points to directory
|
||||
function isdirectory(dirname)
|
||||
return fs.stat(dirname, "type") == "dir"
|
||||
end
|
||||
|
||||
--- Read the whole content of the given file into memory.
|
||||
-- @param filename String containing the path of the file to read
|
||||
-- @return String containing the file contents or nil on error
|
||||
-- @return String containing the error message on error
|
||||
readfile = fs.readfile
|
||||
|
||||
--- Write the contents of given string to given file.
|
||||
-- @param filename String containing the path of the file to read
|
||||
-- @param data String containing the data to write
|
||||
-- @return Boolean containing true on success or nil on error
|
||||
-- @return String containing the error message on error
|
||||
writefile = fs.writefile
|
||||
|
||||
--- Copies a file.
|
||||
-- @param source Source file
|
||||
-- @param dest Destination
|
||||
-- @return Boolean containing true on success or nil on error
|
||||
copy = fs.datacopy
|
||||
|
||||
--- Renames a file.
|
||||
-- @param source Source file
|
||||
-- @param dest Destination
|
||||
-- @return Boolean containing true on success or nil on error
|
||||
rename = fs.move
|
||||
|
||||
--- Get the last modification time of given file path in Unix epoch format.
|
||||
-- @param path String containing the path of the file or directory to read
|
||||
-- @return Number containing the epoch time or nil on error
|
||||
-- @return String containing the error description (if any)
|
||||
-- @return Number containing the os specific errno (if any)
|
||||
function mtime(path)
|
||||
return fs.stat(path, "mtime")
|
||||
end
|
||||
|
||||
--- Set the last modification time of given file path in Unix epoch format.
|
||||
-- @param path String containing the path of the file or directory to read
|
||||
-- @param mtime Last modification timestamp
|
||||
-- @param atime Last accessed timestamp
|
||||
-- @return 0 in case of success nil on error
|
||||
-- @return String containing the error description (if any)
|
||||
-- @return Number containing the os specific errno (if any)
|
||||
function utime(path, mtime, atime)
|
||||
return fs.utimes(path, atime, mtime)
|
||||
end
|
||||
|
||||
--- Return the last element - usually the filename - from the given path with
|
||||
-- the directory component stripped.
|
||||
-- @class function
|
||||
-- @name basename
|
||||
-- @param path String containing the path to strip
|
||||
-- @return String containing the base name of given path
|
||||
-- @see dirname
|
||||
basename = fs.basename
|
||||
|
||||
--- Return the directory component of the given path with the last element
|
||||
-- stripped of.
|
||||
-- @class function
|
||||
-- @name dirname
|
||||
-- @param path String containing the path to strip
|
||||
-- @return String containing the directory component of given path
|
||||
-- @see basename
|
||||
dirname = fs.dirname
|
||||
|
||||
--- Return a table containing all entries of the specified directory.
|
||||
-- @class function
|
||||
-- @name dir
|
||||
-- @param path String containing the path of the directory to scan
|
||||
-- @return Table containing file and directory entries or nil on error
|
||||
-- @return String containing the error description on error
|
||||
-- @return Number containing the os specific errno on error
|
||||
function dir(...)
|
||||
local iter, code, msg = fs.dir(...)
|
||||
if iter then
|
||||
local t = nutil.consume(iter)
|
||||
t[#t+1] = "."
|
||||
t[#t+1] = ".."
|
||||
return t
|
||||
else
|
||||
return nil, code, msg
|
||||
end
|
||||
end
|
||||
|
||||
--- Create a new directory, recursively on demand.
|
||||
-- @param path String with the name or path of the directory to create
|
||||
-- @param recursive Create multiple directory levels (optional, default is true)
|
||||
-- @return Number with the return code, 0 on sucess or nil on error
|
||||
-- @return String containing the error description on error
|
||||
-- @return Number containing the os specific errno on error
|
||||
function mkdir(path, recursive)
|
||||
return recursive and fs.mkdirr(path) or fs.mkdir(path)
|
||||
end
|
||||
|
||||
--- Remove the given empty directory.
|
||||
-- @class function
|
||||
-- @name rmdir
|
||||
-- @param path String containing the path of the directory to remove
|
||||
-- @return Number with the return code, 0 on sucess or nil on error
|
||||
-- @return String containing the error description on error
|
||||
-- @return Number containing the os specific errno on error
|
||||
rmdir = fs.rmdir
|
||||
|
||||
local stat_tr = {
|
||||
reg = "regular",
|
||||
dir = "directory",
|
||||
lnk = "link",
|
||||
chr = "character device",
|
||||
blk = "block device",
|
||||
fifo = "fifo",
|
||||
sock = "socket"
|
||||
}
|
||||
--- Get information about given file or directory.
|
||||
-- @class function
|
||||
-- @name stat
|
||||
-- @param path String containing the path of the directory to query
|
||||
-- @return Table containing file or directory properties or nil on error
|
||||
-- @return String containing the error description on error
|
||||
-- @return Number containing the os specific errno on error
|
||||
function stat(path, key)
|
||||
local data, code, msg = fs.stat(path)
|
||||
if data then
|
||||
data.mode = data.modestr
|
||||
data.type = stat_tr[data.type] or "?"
|
||||
end
|
||||
return key and data and data[key] or data, code, msg
|
||||
end
|
||||
|
||||
--- Set permissions on given file or directory.
|
||||
-- @class function
|
||||
-- @name chmod
|
||||
-- @param path String containing the path of the directory
|
||||
-- @param perm String containing the permissions to set ([ugoa][+-][rwx])
|
||||
-- @return Number with the return code, 0 on sucess or nil on error
|
||||
-- @return String containing the error description on error
|
||||
-- @return Number containing the os specific errno on error
|
||||
chmod = fs.chmod
|
||||
|
||||
--- Create a hard- or symlink from given file (or directory) to specified target
|
||||
-- file (or directory) path.
|
||||
-- @class function
|
||||
-- @name link
|
||||
-- @param path1 String containing the source path to link
|
||||
-- @param path2 String containing the destination path for the link
|
||||
-- @param symlink Boolean indicating wheather to create a symlink (optional)
|
||||
-- @return Number with the return code, 0 on sucess or nil on error
|
||||
-- @return String containing the error description on error
|
||||
-- @return Number containing the os specific errno on error
|
||||
function link(src, dest, sym)
|
||||
return sym and fs.symlink(src, dest) or fs.link(src, dest)
|
||||
end
|
||||
|
||||
--- Remove the given file.
|
||||
-- @class function
|
||||
-- @name unlink
|
||||
-- @param path String containing the path of the file to remove
|
||||
-- @return Number with the return code, 0 on sucess or nil on error
|
||||
-- @return String containing the error description on error
|
||||
-- @return Number containing the os specific errno on error
|
||||
unlink = fs.unlink
|
||||
|
||||
--- Retrieve target of given symlink.
|
||||
-- @class function
|
||||
-- @name readlink
|
||||
-- @param path String containing the path of the symlink to read
|
||||
-- @return String containing the link target or nil on error
|
||||
-- @return String containing the error description on error
|
||||
-- @return Number containing the os specific errno on error
|
||||
readlink = fs.readlink
|
||||
@ -1,442 +0,0 @@
|
||||
module("luci.controller.clash", package.seeall)
|
||||
local fs=require"nixio.fs"
|
||||
local http=require"luci.http"
|
||||
local uci=require"luci.model.uci".cursor()
|
||||
|
||||
|
||||
|
||||
function index()
|
||||
|
||||
if not nixio.fs.access("/etc/config/clash") then
|
||||
return
|
||||
end
|
||||
|
||||
local page = entry({"admin", "services", "clash"},alias("admin", "services", "clash", "overview"), _("Clash"), 1)
|
||||
page.dependent = true
|
||||
page.acl_depends = {"luci-app-clash"}
|
||||
|
||||
entry({"admin", "services", "clash", "overview"},cbi("clash/overview"),_("Overview"), 10).leaf = true
|
||||
entry({"admin", "services", "clash", "client"},cbi("clash/client/client"),_("Client"), 20).leaf = true
|
||||
|
||||
entry({"admin", "services", "clash", "config"}, firstchild(),_("Config"), 25)
|
||||
entry({"admin", "services", "clash", "config", "import"},cbi("clash/config/import"),_("Import Config"), 25).leaf = true
|
||||
entry({"admin", "services", "clash", "config", "config"},cbi("clash/config/config"),_("Select Config"), 30).leaf = true
|
||||
|
||||
entry({"admin", "services", "clash", "config", "create"},cbi("clash/config/create"),_("Create Config"), 35).leaf = true
|
||||
entry({"admin", "services", "clash", "proxyprovider"},cbi("clash/config/proxy_provider"), nil).leaf = true
|
||||
entry({"admin", "services", "clash", "servers"},cbi("clash/config/servers-config"), nil).leaf = true
|
||||
entry({"admin", "services", "clash", "ruleprovider"},cbi("clash/config/rule_provider"), nil).leaf = true
|
||||
entry({"admin", "services", "clash", "rules"},cbi("clash/config/rules"), nil).leaf = true
|
||||
entry({"admin", "services", "clash", "pgroups"},cbi("clash/config/groups"), nil).leaf = true
|
||||
entry({"admin", "services", "clash", "rulemanager"},cbi("clash/config/ruleprovider_manager"), nil).leaf = true
|
||||
|
||||
|
||||
entry({"admin", "services", "clash", "settings"}, firstchild(),_("Settings"), 40)
|
||||
entry({"admin", "services", "clash", "settings", "port"},cbi("clash/dns/port"),_("Proxy Ports"), 60).leaf = true
|
||||
entry({"admin", "services", "clash", "settings", "geoip"},cbi("clash/geoip/geoip"),_("Update GeoIP"), 80).leaf = true
|
||||
entry({"admin", "services", "clash", "settings", "grules"},cbi("clash/game/game-settings"),_("Game Rules"), 91).dependent = false
|
||||
entry({"admin", "services", "clash", "g-rules"},cbi("clash/game/game-rule"), nil).leaf = true
|
||||
entry({"admin", "services", "clash", "settings", "other"},cbi("clash/other"),_("Other Settings"), 92).leaf = true
|
||||
entry({"admin", "services", "clash", "ip-rules"},cbi("clash/config/ip-rules"), nil).leaf = true
|
||||
entry({"admin", "services", "clash", "settings", "dns"},firstchild(),_("DNS Settings"), 65)
|
||||
entry({"admin", "services", "clash", "settings", "dns", "dns"},cbi("clash/dns/dns"),_("Clash DNS"), 70).leaf = true
|
||||
entry({"admin", "services", "clash", "settings", "dns", "advance"},cbi("clash/dns/advance"),_("Advance DNS"), 75).leaf = true
|
||||
|
||||
|
||||
|
||||
entry({"admin", "services", "clash", "update"},cbi("clash/update/update"),_("Update"), 45).leaf = true
|
||||
entry({"admin", "services", "clash", "log"},cbi("clash/logs/log"),_("Log"), 50).leaf = true
|
||||
|
||||
|
||||
entry({"admin","services","clash","check_status"},call("check_status")).leaf=true
|
||||
entry({"admin", "services", "clash", "ping"}, call("act_ping")).leaf=true
|
||||
entry({"admin", "services", "clash", "readlog"},call("action_read")).leaf=true
|
||||
entry({"admin","services","clash", "status"},call("action_status")).leaf=true
|
||||
entry({"admin", "services", "clash", "check"}, call("check_update_log")).leaf=true
|
||||
entry({"admin", "services", "clash", "doupdate"}, call("do_update")).leaf=true
|
||||
entry({"admin", "services", "clash", "start"}, call("do_start")).leaf=true
|
||||
entry({"admin", "services", "clash", "stop"}, call("do_stop")).leaf=true
|
||||
entry({"admin", "services", "clash", "reload"}, call("do_reload")).leaf=true
|
||||
entry({"admin", "services", "clash", "geo"}, call("geoip_check")).leaf=true
|
||||
entry({"admin", "services", "clash", "geoipupdate"}, call("geoip_update")).leaf=true
|
||||
entry({"admin", "services", "clash", "check_geoip"}, call("check_geoip_log")).leaf=true
|
||||
entry({"admin", "services", "clash", "corelog"},call("down_check")).leaf=true
|
||||
entry({"admin", "services", "clash", "logstatus"},call("logstatus_check")).leaf=true
|
||||
entry({"admin", "services", "clash", "conf"},call("action_conf")).leaf=true
|
||||
entry({"admin", "services", "clash", "update_config"},call("action_update")).leaf=true
|
||||
entry({"admin", "services", "clash", "game_rule"},call("action_update_rule")).leaf=true
|
||||
entry({"admin", "services", "clash", "ruleproviders"},call("action_update_rule_providers")).leaf=true
|
||||
entry({"admin", "services", "clash", "ping_check"},call("action_ping_status")).leaf=true
|
||||
|
||||
end
|
||||
|
||||
local fss = require "luci.clash"
|
||||
|
||||
local function download_rule_provider()
|
||||
local filename = luci.http.formvalue("filename")
|
||||
local status = luci.sys.call(string.format('/usr/share/clash/create/clash_rule_provider.sh "%s" >/dev/null 2>&1',filename))
|
||||
return status
|
||||
end
|
||||
|
||||
|
||||
function action_update_rule_providers()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({
|
||||
rulep = download_rule_provider();
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
local function uhttp_port()
|
||||
local uhttp_port = luci.sys.exec("uci get uhttpd.main.listen_http |awk -F ':' '{print $NF}'")
|
||||
if uhttp_port ~= "80" then
|
||||
return ":" .. uhttp_port
|
||||
end
|
||||
end
|
||||
|
||||
local function download_rule()
|
||||
local filename = luci.http.formvalue("filename")
|
||||
local rule_file_dir="/usr/share/clash/rules/g_rules/" .. filename
|
||||
luci.sys.call(string.format('sh /usr/share/clash/clash_game_rule.sh "%s" >/dev/null 2>&1',filename))
|
||||
if not fss.isfile(rule_file_dir) then
|
||||
return "0"
|
||||
else
|
||||
return "1"
|
||||
end
|
||||
end
|
||||
|
||||
function action_update_rule()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({
|
||||
game_rule = download_rule()
|
||||
})
|
||||
end
|
||||
|
||||
function action_update()
|
||||
luci.sys.exec("kill $(pgrep /usr/share/clash/update.sh) ; (bash /usr/share/clash/update.sh >/usr/share/clash/clash.txt 2>&1) &")
|
||||
end
|
||||
|
||||
|
||||
local function in_use()
|
||||
return luci.sys.exec("uci get clash.config.config_type")
|
||||
end
|
||||
|
||||
|
||||
local function conf_path()
|
||||
if nixio.fs.access(string.sub(luci.sys.exec("uci get clash.config.use_config"), 1, -2)) then
|
||||
return fss.basename(string.sub(luci.sys.exec("uci get clash.config.use_config"), 1, -2))
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
local function typeconf()
|
||||
return luci.sys.exec("uci get clash.config.config_type")
|
||||
end
|
||||
|
||||
|
||||
function action_conf()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({
|
||||
conf_path = conf_path(),
|
||||
typeconf = typeconf()
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
local function dash_port()
|
||||
return luci.sys.exec("uci get clash.config.dash_port 2>/dev/null")
|
||||
end
|
||||
local function dash_pass()
|
||||
return luci.sys.exec("uci get clash.config.dash_pass 2>/dev/null")
|
||||
end
|
||||
|
||||
local function is_running()
|
||||
return luci.sys.call("pidof clash >/dev/null") == 0
|
||||
end
|
||||
|
||||
local function is_web()
|
||||
return luci.sys.call("pidof clash >/dev/null") == 0
|
||||
end
|
||||
|
||||
local function localip()
|
||||
return luci.sys.exec("uci get network.lan.ipaddr")
|
||||
end
|
||||
|
||||
local function check_version()
|
||||
return luci.sys.exec("sh /usr/share/clash/check_luci_version.sh")
|
||||
end
|
||||
|
||||
local function check_core()
|
||||
return luci.sys.exec("sh /usr/share/clash/check_core_version.sh")
|
||||
end
|
||||
|
||||
|
||||
local function check_clashtun_core()
|
||||
return luci.sys.exec("sh /usr/share/clash/check_clashtun_core_version.sh")
|
||||
end
|
||||
|
||||
local function current_version()
|
||||
return luci.sys.exec("sed -n 1p /usr/share/clash/luci_version")
|
||||
end
|
||||
|
||||
local function new_version()
|
||||
return luci.sys.exec("sed -n 1p /usr/share/clash/new_luci_version")
|
||||
end
|
||||
|
||||
local function new_core_version()
|
||||
return luci.sys.exec("sed -n 1p /usr/share/clash/new_core_version")
|
||||
end
|
||||
|
||||
|
||||
local function new_clashtun_core_version()
|
||||
return luci.sys.exec("sed -n 1p /usr/share/clash/new_clashtun_core_version")
|
||||
end
|
||||
|
||||
local function check_dtun_core()
|
||||
return luci.sys.call(string.format("sh /usr/share/clash/check_dtun_core_version.sh"))
|
||||
end
|
||||
|
||||
local function new_dtun_core()
|
||||
return luci.sys.exec("sed -n 1p /usr/share/clash/new_clashdtun_core_version")
|
||||
end
|
||||
|
||||
local function e_mode()
|
||||
return luci.sys.exec("egrep '^ {0,}enhanced-mode' /etc/clash/config.yaml |grep enhanced-mode: |awk -F ': ' '{print $2}'")
|
||||
end
|
||||
|
||||
|
||||
local function clash_core()
|
||||
if nixio.fs.access("/etc/clash/clash") then
|
||||
local core=luci.sys.exec("/etc/clash/clash -v 2>/dev/null |awk -F ' ' '{print $2}'")
|
||||
if core ~= "" then
|
||||
return luci.sys.exec("/etc/clash/clash -v 2>/dev/null |awk -F ' ' '{print $2}'")
|
||||
else
|
||||
return luci.sys.exec("sed -n 1p /usr/share/clash/core_version")
|
||||
end
|
||||
else
|
||||
return "0"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
local function clashtun_core()
|
||||
if nixio.fs.access("/etc/clash/clashtun/clash") then
|
||||
local tun=luci.sys.exec("/etc/clash/clashtun/clash -v 2>/dev/null |awk -F ' ' '{print $2}'")
|
||||
if tun ~= "" then
|
||||
return luci.sys.exec("/etc/clash/clashtun/clash -v 2>/dev/null |awk -F ' ' '{print $2}'")
|
||||
else
|
||||
return luci.sys.exec("sed -n 1p /usr/share/clash/tun_version")
|
||||
end
|
||||
else
|
||||
return "0"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function dtun_core()
|
||||
if nixio.fs.access("/etc/clash/dtun/clash") then
|
||||
local tun=luci.sys.exec("/etc/clash/dtun/clash -v 2>/dev/null |awk -F ' ' '{print $2}'")
|
||||
if tun ~= "" then
|
||||
return luci.sys.exec("/etc/clash/dtun/clash -v 2>/dev/null |awk -F ' ' '{print $2}'")
|
||||
else
|
||||
return luci.sys.exec("sed -n 1p /usr/share/clash/dtun_core_version")
|
||||
end
|
||||
else
|
||||
return "0"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function readlog()
|
||||
return luci.sys.exec("sed -n '$p' /usr/share/clash/clash_real.txt 2>/dev/null")
|
||||
end
|
||||
|
||||
local function geo_data()
|
||||
return os.date("%Y-%m-%d %H:%M:%S",fss.mtime("/etc/clash/Country.mmdb"))
|
||||
end
|
||||
|
||||
local function downcheck()
|
||||
if nixio.fs.access("/var/run/core_update_error") then
|
||||
return "0"
|
||||
elseif nixio.fs.access("/var/run/core_update") then
|
||||
return "1"
|
||||
elseif nixio.fs.access("/usr/share/clash/core_down_complete") then
|
||||
return "2"
|
||||
end
|
||||
end
|
||||
|
||||
function action_read()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({
|
||||
readlog = readlog();
|
||||
})
|
||||
end
|
||||
|
||||
function down_check()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({
|
||||
downcheck = downcheck();
|
||||
})
|
||||
end
|
||||
|
||||
local function geoipcheck()
|
||||
if nixio.fs.access("/var/run/geoip_update_error") then
|
||||
return "0"
|
||||
elseif nixio.fs.access("/var/run/geoip_update") then
|
||||
return "1"
|
||||
elseif nixio.fs.access("/var/run/geoip_down_complete") then
|
||||
return "2"
|
||||
end
|
||||
end
|
||||
|
||||
function geoip_check()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({
|
||||
geoipcheck = geoipcheck();
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
function check_status()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({
|
||||
check_version = check_version(),
|
||||
check_core = check_core(),
|
||||
current_version = current_version(),
|
||||
new_version = new_version(),
|
||||
clash_core = clash_core(),
|
||||
check_dtun_core = check_dtun_core(),
|
||||
new_dtun_core = new_dtun_core(),
|
||||
clashtun_core = clashtun_core(),
|
||||
dtun_core = dtun_core(),
|
||||
new_core_version = new_core_version(),
|
||||
new_clashtun_core_version =new_clashtun_core_version(),
|
||||
check_clashtun_core = check_clashtun_core(),
|
||||
conf_path = conf_path(),
|
||||
typeconf = typeconf()
|
||||
})
|
||||
end
|
||||
function action_status()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({
|
||||
web = is_web(),
|
||||
clash = is_running(),
|
||||
localip = localip(),
|
||||
dash_port = dash_port(),
|
||||
current_version = current_version(),
|
||||
new_dtun_core = new_dtun_core(),
|
||||
new_core_version = new_core_version(),
|
||||
new_clashtun_core_version =new_clashtun_core_version(),
|
||||
new_version = new_version(),
|
||||
clash_core = clash_core(),
|
||||
dtun_core = dtun_core(),
|
||||
dash_pass = dash_pass(),
|
||||
clashtun_core = clashtun_core(),
|
||||
e_mode = e_mode(),
|
||||
in_use = in_use(),
|
||||
conf_path = conf_path(),
|
||||
uhttp_port = uhttp_port(),
|
||||
typeconf = typeconf()
|
||||
})
|
||||
end
|
||||
|
||||
function action_ping_status()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({
|
||||
ping_enable = ping_enable()
|
||||
})
|
||||
end
|
||||
|
||||
function act_ping()
|
||||
local e={}
|
||||
e.index=luci.http.formvalue("index")
|
||||
e.ping=luci.sys.exec("ping -c 1 -W 1 -w 5 %q 2>&1 | grep -o 'time=[0-9]*.[0-9]' | awk -F '=' '{print$2}'"%luci.http.formvalue("domain"))
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
||||
|
||||
function geoip_update()
|
||||
fs.writefile("/var/run/geoiplog","0")
|
||||
luci.sys.exec("(rm /var/run/geoip_update_error ; touch /var/run/geoip_update ; sh /usr/share/clash/geoip.sh >/tmp/geoip_update.txt 2>&1 || touch /var/run/geoip_update_error ;rm /var/run/geoip_update) &")
|
||||
end
|
||||
|
||||
|
||||
function do_update()
|
||||
fs.writefile("/var/run/clashlog","0")
|
||||
luci.sys.exec("(rm /var/run/core_update_error ; touch /var/run/core_update ; sh /usr/share/clash/core_download.sh >/tmp/clash_update.txt 2>&1 || touch /var/run/core_update_error ;rm /var/run/core_update) &")
|
||||
end
|
||||
|
||||
function do_start()
|
||||
luci.sys.exec('uci set clash.config.enable="1" && uci commit clash')
|
||||
luci.sys.exec("/etc/init.d/clash restart 2>&1 &")
|
||||
end
|
||||
|
||||
function do_stop()
|
||||
luci.sys.exec('uci set clash.config.enable="0" && uci commit clash')
|
||||
luci.sys.exec("/etc/init.d/clash stop 2>&1 &")
|
||||
end
|
||||
|
||||
function do_reload()
|
||||
if luci.sys.call("pidof clash >/dev/null") == 0 then
|
||||
luci.sys.exec("/etc/init.d/clash reload 2>&1 &")
|
||||
end
|
||||
end
|
||||
|
||||
function check_update_log()
|
||||
luci.http.prepare_content("text/plain; charset=utf-8")
|
||||
local fdp=tonumber(fs.readfile("/var/run/clashlog")) or 0
|
||||
local f=io.open("/tmp/clash_update.txt", "r+")
|
||||
f:seek("set",fdp)
|
||||
local a=f:read(2048000) or ""
|
||||
fdp=f:seek()
|
||||
fs.writefile("/var/run/clashlog",tostring(fdp))
|
||||
f:close()
|
||||
if fs.access("/var/run/core_update") then
|
||||
luci.http.write(a)
|
||||
else
|
||||
luci.http.write(a.."\0")
|
||||
end
|
||||
end
|
||||
|
||||
function check_geoip_log()
|
||||
luci.http.prepare_content("text/plain; charset=utf-8")
|
||||
local fdp=tonumber(fs.readfile("/var/run/geoiplog")) or 0
|
||||
local f=io.open("/tmp/geoip_update.txt", "r+")
|
||||
f:seek("set",fdp)
|
||||
local a=f:read(2048000) or ""
|
||||
fdp=f:seek()
|
||||
fs.writefile("/var/run/geoiplog",tostring(fdp))
|
||||
f:close()
|
||||
if fs.access("/var/run/geoip_update") then
|
||||
luci.http.write(a)
|
||||
else
|
||||
luci.http.write(a.."\0")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function logstatus_check()
|
||||
luci.http.prepare_content("text/plain; charset=utf-8")
|
||||
local fdp=tonumber(fs.readfile("/usr/share/clash/logstatus_check")) or 0
|
||||
local f=io.open("/usr/share/clash/clash.txt", "r+")
|
||||
f:seek("set",fdp)
|
||||
local a=f:read(2048000) or ""
|
||||
fdp=f:seek()
|
||||
fs.writefile("/usr/share/clash/logstatus_check",tostring(fdp))
|
||||
f:close()
|
||||
if fs.access("/var/run/logstatus") then
|
||||
luci.http.write(a)
|
||||
else
|
||||
luci.http.write(a.."\0")
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,56 +0,0 @@
|
||||
local NXFS = require "nixio.fs"
|
||||
local SYS = require "luci.sys"
|
||||
local HTTP = require "luci.http"
|
||||
local DISP = require "luci.dispatcher"
|
||||
local UTIL = require "luci.util"
|
||||
local uci = require("luci.model.uci").cursor()
|
||||
local fs = require "luci.clash"
|
||||
local clash = "clash"
|
||||
|
||||
|
||||
m = Map("clash")
|
||||
s = m:section(TypedSection, "clash")
|
||||
s.anonymous = true
|
||||
m.pageaction = false
|
||||
|
||||
o = s:option(ListValue, "core", translate("Core"))
|
||||
o.default = "clashcore"
|
||||
if nixio.fs.access("/etc/clash/clash") then
|
||||
o:value("1", translate("Clash"))
|
||||
end
|
||||
if nixio.fs.access("/etc/clash/clashtun/clash") then
|
||||
o:value("3", translate("Clash(cTun)"))
|
||||
end
|
||||
if nixio.fs.access("/etc/clash/dtun/clash") then
|
||||
o:value("4", translate("Clash(premium)"))
|
||||
end
|
||||
|
||||
|
||||
o = s:option(ListValue, "g_rules", translate("Game Rules"))
|
||||
o.default = "0"
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o.description = translate("Set rules under Setting=>Game Rules, will take effect when client start")
|
||||
|
||||
|
||||
o = s:option(ListValue, "append_rules", translate("Append Customs Rules"))
|
||||
o.default = "0"
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o.description = translate("Set custom rules under Setting=>Others , will take effect when client start")
|
||||
|
||||
o = s:option(Button, "Apply")
|
||||
o.title = luci.util.pcdata(translate("Save & Apply"))
|
||||
o.inputtitle = translate("Save & Apply")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
m.uci:commit("clash")
|
||||
end
|
||||
|
||||
o = s:option(Button,"action")
|
||||
o.title = translate("Operation")
|
||||
o.template = "clash/start_stop"
|
||||
|
||||
|
||||
return m
|
||||
|
||||
@ -1,365 +0,0 @@
|
||||
|
||||
local NXFS = require "nixio.fs"
|
||||
local SYS = require "luci.sys"
|
||||
local HTTP = require "luci.http"
|
||||
local DISP = require "luci.dispatcher"
|
||||
local UTIL = require "luci.util"
|
||||
local uci = luci.model.uci.cursor()
|
||||
local fs = require "luci.clash"
|
||||
local http = luci.http
|
||||
local clash = "clash"
|
||||
|
||||
|
||||
c = Map("clash")
|
||||
c.template="clash/conf"
|
||||
|
||||
|
||||
m = Map("clash")
|
||||
s = m:section(TypedSection, "clash")
|
||||
m.pageaction = false
|
||||
s.anonymous = true
|
||||
s.addremove=false
|
||||
|
||||
local conf = string.sub(luci.sys.exec("uci get clash.config.use_config"), 1, -2)
|
||||
sev = s:option(TextValue, "conf")
|
||||
sev.rows = 20
|
||||
sev.wrap = "off"
|
||||
sev.cfgvalue = function(self, section)
|
||||
return NXFS.readfile(conf) or ""
|
||||
end
|
||||
sev.write = function(self, section, value)
|
||||
NXFS.writefile(conf, value:gsub("\r\n", "\n"))
|
||||
end
|
||||
|
||||
o=s:option(Button,"apply")
|
||||
o.inputtitle = translate("Save & Apply")
|
||||
o.inputstyle = "reload"
|
||||
o.write = function()
|
||||
m.uci:commit("clash")
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
local e,a={}
|
||||
for t,o in ipairs(fs.glob("/usr/share/clash/config/sub/*.yaml"))do
|
||||
a=fs.stat(o)
|
||||
if a then
|
||||
e[t]={}
|
||||
e[t].name=fs.basename(o)
|
||||
e[t].mtime=os.date("%Y-%m-%d %H:%M:%S",a.mtime)
|
||||
e[t].size=tostring(a.size)
|
||||
e[t].remove1=0
|
||||
e[t].enable=false
|
||||
end
|
||||
end
|
||||
|
||||
function IsYamlFile(e)
|
||||
e=e or""
|
||||
local e=string.lower(string.sub(e,-5,-1))
|
||||
return e==".yaml"
|
||||
end
|
||||
|
||||
|
||||
f=Form("config_listst")
|
||||
f.reset=false
|
||||
f.submit=false
|
||||
tb=f:section(Table,e, translate("Subcription Config List"))
|
||||
nm=tb:option(DummyValue,"name",translate("File Name"))
|
||||
mt=tb:option(DummyValue,"mtime",translate("Update Time"))
|
||||
sz=tb:option(DummyValue,"size",translate("Size"))
|
||||
|
||||
btnis=tb:option(Button,"switch1",translate("Use Config"))
|
||||
btnis.template="clash/other_button"
|
||||
btnis.render=function(o,t,a)
|
||||
if not e[t]then return false end
|
||||
if IsYamlFile(e[t].name)then
|
||||
a.display=""
|
||||
else
|
||||
a.display="none"
|
||||
end
|
||||
o.inputstyle="apply"
|
||||
Button.render(o,t,a)
|
||||
end
|
||||
btnis.write=function(a,t)
|
||||
luci.sys.exec(string.format('uci set clash.config.use_config="/usr/share/clash/config/sub/%s"',e[t].name ))
|
||||
luci.sys.exec('uci set clash.config.config_type="1"')
|
||||
luci.sys.exec('uci commit clash')
|
||||
if luci.sys.call("pidof clash >/dev/null") == 0 then
|
||||
SYS.call("/etc/init.d/clash restart >/dev/null 2>&1 &")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash"))
|
||||
else
|
||||
HTTP.redirect(luci.dispatcher.build_url("admin", "services", "clash", "config","config"))
|
||||
end
|
||||
end
|
||||
|
||||
btnist=tb:option(Button,"update1",translate("Update"))
|
||||
btnist.template="clash/other_button"
|
||||
btnist.render=function(o,t,a)
|
||||
if not e[t]then return false end
|
||||
o.inputstyle="apply"
|
||||
Button.render(o,t,a)
|
||||
end
|
||||
btnist.write=function(a,t)
|
||||
luci.sys.exec(string.format('uci set clash.config.config_update_name="%s"',e[t].name))
|
||||
luci.sys.exec('uci commit clash')
|
||||
luci.sys.exec('bash /usr/share/clash/update.sh >>/usr/share/clash/clash.txt 2>&1 &')
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash"))
|
||||
end
|
||||
|
||||
|
||||
|
||||
btndl = tb:option(Button,"download1",translate("Download"))
|
||||
btndl.template="clash/other_button"
|
||||
btndl.render=function(e,t,a)
|
||||
e.inputstyle="remove"
|
||||
Button.render(e,t,a)
|
||||
end
|
||||
btndl.write = function (a,t)
|
||||
local sPath, sFile, fd, block
|
||||
sPath = "/usr/share/clash/config/sub/"..e[t].name
|
||||
sFile = NXFS.basename(sPath)
|
||||
if fs.isdirectory(sPath) then
|
||||
fd = io.popen('yaml -C "%s" -cz .' % {sPath}, "r")
|
||||
sFile = sFile .. ".yaml"
|
||||
else
|
||||
fd = nixio.open(sPath, "r")
|
||||
end
|
||||
if not fd then
|
||||
return
|
||||
end
|
||||
HTTP.header('Content-Disposition', 'attachment; filename="%s"' % {sFile})
|
||||
HTTP.prepare_content("application/octet-stream")
|
||||
while true do
|
||||
block = fd:read(nixio.const.buffersize)
|
||||
if (not block) or (#block ==0) then
|
||||
break
|
||||
else
|
||||
HTTP.write(block)
|
||||
end
|
||||
end
|
||||
fd:close()
|
||||
HTTP.close()
|
||||
end
|
||||
|
||||
|
||||
btnrm=tb:option(Button,"remove1",translate("Remove"))
|
||||
btnrm.render=function(e,t,a)
|
||||
e.inputstyle="remove"
|
||||
Button.render(e,t,a)
|
||||
end
|
||||
btnrm.write=function(a,t)
|
||||
local a=fs.unlink("/usr/share/clash/config/sub/"..fs.basename(e[t].name))
|
||||
luci.sys.exec(string.format('uci set clash.config.config_name_remove="%s"',e[t].name))
|
||||
luci.sys.exec('uci commit clash')
|
||||
luci.sys.exec('bash /usr/share/clash/rmlist.sh 2>&1 &')
|
||||
if a then table.remove(e,t)end
|
||||
return a
|
||||
end
|
||||
|
||||
|
||||
|
||||
local p,x={}
|
||||
for q,v in ipairs(fs.glob("/usr/share/clash/config/upload/*.yaml"))do
|
||||
x=fs.stat(v)
|
||||
if x then
|
||||
p[q]={}
|
||||
p[q].name=fs.basename(v)
|
||||
p[q].mtime=os.date("%Y-%m-%d %H:%M:%S",x.mtime)
|
||||
p[q].size=tostring(x.size)
|
||||
p[q].remove2=0
|
||||
p[q].enable=false
|
||||
end
|
||||
end
|
||||
|
||||
fr=Form("config_list")
|
||||
fr.reset=false
|
||||
fr.submit=false
|
||||
tb=fr:section(Table,p, translate("Upload Config List"))
|
||||
nm=tb:option(DummyValue,"name",translate("File Name"))
|
||||
mt=tb:option(DummyValue,"mtime",translate("Update Time"))
|
||||
sz=tb:option(DummyValue,"size",translate("Size"))
|
||||
|
||||
function IsYamlFile(p)
|
||||
p=p or""
|
||||
local p=string.lower(string.sub(p,-5,-1))
|
||||
return p==".yaml"
|
||||
end
|
||||
|
||||
btniss=tb:option(Button,"switch2",translate("Use Config"))
|
||||
btniss.template="clash/other_button"
|
||||
btniss.render=function(v,q,x)
|
||||
if not p[q]then return false end
|
||||
if IsYamlFile(p[q].name)then
|
||||
x.display=""
|
||||
else
|
||||
x.display="none"
|
||||
end
|
||||
v.inputstyle="apply"
|
||||
Button.render(v,q,x)
|
||||
end
|
||||
btniss.write=function(x,q)
|
||||
luci.sys.exec(string.format('uci set clash.config.use_config="/usr/share/clash/config/upload/%s"',p[q].name ))
|
||||
luci.sys.exec('uci set clash.config.config_type="2"')
|
||||
luci.sys.exec('uci commit clash')
|
||||
if luci.sys.call("pidof clash >/dev/null") == 0 then
|
||||
SYS.call("/etc/init.d/clash restart >/dev/null 2>&1 &")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash"))
|
||||
else
|
||||
HTTP.redirect(luci.dispatcher.build_url("admin", "services", "clash", "config" ,"config"))
|
||||
end
|
||||
end
|
||||
|
||||
btndll = tb:option(Button,"download2",translate("Download"))
|
||||
btndll.template="clash/other_button"
|
||||
btndll.render=function(p,q,x)
|
||||
p.inputstyle="remove"
|
||||
Button.render(p,q,x)
|
||||
end
|
||||
btndll.write = function (x,q)
|
||||
local sPath, sFile, fd, block
|
||||
sPath = "/usr/share/clash/config/upload/"..p[q].name
|
||||
sFile = NXFS.basename(sPath)
|
||||
if fs.isdirectory(sPath) then
|
||||
fd = io.popen('yaml -C "%s" -cz .' % {sPath}, "r")
|
||||
sFile = sFile .. ".yaml"
|
||||
else
|
||||
fd = nixio.open(sPath, "r")
|
||||
end
|
||||
if not fd then
|
||||
return
|
||||
end
|
||||
HTTP.header('Content-Disposition', 'attachment; filename="%s"' % {sFile})
|
||||
HTTP.prepare_content("application/octet-stream")
|
||||
while true do
|
||||
block = fd:read(nixio.const.buffersize)
|
||||
if (not block) or (#block ==0) then
|
||||
break
|
||||
else
|
||||
HTTP.write(block)
|
||||
end
|
||||
end
|
||||
fd:close()
|
||||
HTTP.close()
|
||||
end
|
||||
|
||||
|
||||
btnrml=tb:option(Button,"remove2",translate("Remove"))
|
||||
btnrml.render=function(p,q,x)
|
||||
p.inputstyle="remove"
|
||||
Button.render(p,q,x)
|
||||
end
|
||||
btnrml.write=function(x,q)
|
||||
local x=fs.unlink("/usr/share/clash/config/upload/"..fs.basename(p[q].name))
|
||||
luci.sys.exec(string.format('uci set clash.config.config_up_remove="%s"',p[q].name))
|
||||
luci.sys.exec('uci commit clash')
|
||||
luci.sys.exec('bash /usr/share/clash/uplist.sh 2>&1 &')
|
||||
if x then table.remove(p,q)end
|
||||
return x
|
||||
end
|
||||
|
||||
|
||||
local k,v={}
|
||||
for c,z in ipairs(fs.glob("/usr/share/clash/config/custom/*.yaml"))do
|
||||
v=fs.stat(z)
|
||||
if v then
|
||||
k[c]={}
|
||||
k[c].name=fs.basename(z)
|
||||
k[c].mtime=os.date("%Y-%m-%d %H:%M:%S",v.mtime)
|
||||
k[c].size=tostring(v.size)
|
||||
k[c].remove3=0
|
||||
k[c].enable=false
|
||||
end
|
||||
end
|
||||
|
||||
fro=Form("config_listts")
|
||||
fro.reset=false
|
||||
fro.submit=false
|
||||
tb=fro:section(Table,k,translate("Custom Config List"))
|
||||
nm=tb:option(DummyValue,"name",translate("File Name"))
|
||||
mt=tb:option(DummyValue,"mtime",translate("Update Time"))
|
||||
sz=tb:option(DummyValue,"size",translate("Size"))
|
||||
|
||||
function IsYamlFile(k)
|
||||
k=k or""
|
||||
local k=string.lower(string.sub(k,-5,-1))
|
||||
return k==".yaml"
|
||||
end
|
||||
|
||||
btnisz=tb:option(Button,"switch3",translate("Use Config"))
|
||||
btnisz.template="clash/other_button"
|
||||
btnisz.render=function(z,c,v)
|
||||
if not k[c]then return false end
|
||||
if IsYamlFile(k[c].name)then
|
||||
v.display=""
|
||||
else
|
||||
v.display="none"
|
||||
end
|
||||
z.inputstyle="apply"
|
||||
Button.render(z,c,v)
|
||||
end
|
||||
btnisz.write=function(v,c)
|
||||
luci.sys.exec(string.format('uci set clash.config.use_config="/usr/share/clash/config/custom/%s"',k[c].name ))
|
||||
luci.sys.exec('uci set clash.config.config_type="3"')
|
||||
luci.sys.exec('uci commit clash')
|
||||
if luci.sys.call("pidof clash >/dev/null") == 0 then
|
||||
SYS.call("/etc/init.d/clash restart >/dev/null 2>&1 &")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash"))
|
||||
else
|
||||
HTTP.redirect(luci.dispatcher.build_url("admin", "services", "clash", "config", "config"))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
btndlz = tb:option(Button,"download3",translate("Download"))
|
||||
btndlz.template="clash/other_button"
|
||||
btndlz.render=function(k,c,v)
|
||||
k.inputstyle="remove"
|
||||
Button.render(k,c,v)
|
||||
end
|
||||
btndlz.write = function (v,c)
|
||||
local sPath, sFile, fd, block
|
||||
sPath = "/usr/share/clash/config/custom/"..k[c].name
|
||||
sFile = NXFS.basename(sPath)
|
||||
if fs.isdirectory(sPath) then
|
||||
fd = io.popen('yaml -C "%s" -cz .' % {sPath}, "r")
|
||||
sFile = sFile .. ".yaml"
|
||||
else
|
||||
fd = nixio.open(sPath, "r")
|
||||
end
|
||||
if not fd then
|
||||
return
|
||||
end
|
||||
HTTP.header('Content-Disposition', 'attachment; filename="%s"' % {sFile})
|
||||
HTTP.prepare_content("application/octet-stream")
|
||||
while true do
|
||||
block = fd:read(nixio.const.buffersize)
|
||||
if (not block) or (#block ==0) then
|
||||
break
|
||||
else
|
||||
HTTP.write(block)
|
||||
end
|
||||
end
|
||||
fd:close()
|
||||
HTTP.close()
|
||||
end
|
||||
|
||||
|
||||
btnrmz=tb:option(Button,"remove3",translate("Remove"))
|
||||
btnrmz.render=function(k,c,v)
|
||||
k.inputstyle="remove"
|
||||
Button.render(k,c,v)
|
||||
end
|
||||
btnrmz.write=function(v,c)
|
||||
local v=fs.unlink("/usr/share/clash/config/custom/"..fs.basename(k[c].name))
|
||||
luci.sys.exec(string.format('uci set clash.config.config_cus_remove="%s"',k[c].name))
|
||||
luci.sys.exec('uci commit clash')
|
||||
luci.sys.exec('/usr/share/clash/cuslist.sh 2>&1 &')
|
||||
|
||||
if v then table.remove(k,c)end
|
||||
return v
|
||||
end
|
||||
|
||||
return c,f,fr,fro,m
|
||||
@ -1,386 +0,0 @@
|
||||
local clash = "clash"
|
||||
local NXFS = require "nixio.fs"
|
||||
local SYS = require "luci.sys"
|
||||
local HTTP = require "luci.http"
|
||||
local DISP = require "luci.dispatcher"
|
||||
local UTIL = require "luci.util"
|
||||
local fs = require "luci.clash"
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local s, o, krk, z, r
|
||||
local http = luci.http
|
||||
|
||||
font_blue = [[<font color="blue">]]
|
||||
font_off = [[</font>]]
|
||||
bold_on = [[<strong>]]
|
||||
bold_off = [[</strong>]]
|
||||
|
||||
krk = Map(clash)
|
||||
s = krk:section(TypedSection, "clash", translate("Create Config"))
|
||||
s.anonymous = true
|
||||
--krk.pageaction = false
|
||||
|
||||
o = s:option(Flag, "provider_config", translate("Enable Create"))
|
||||
o.default = 1
|
||||
o.description = translate("Enable to create configuration")
|
||||
|
||||
o = s:option(Flag, "prox", translate("Use Proxy"))
|
||||
o.description = translate("Use Proxy")
|
||||
|
||||
|
||||
o = s:option(Flag, "ppro", translate("Use Proxy Provider"))
|
||||
o.description = translate("Use Proxy Provider")
|
||||
|
||||
o = s:option(Flag, "rulprp", translate("Use Rule Provider"))
|
||||
o.description = translate("Use Rule Provider")
|
||||
o:depends("orul", 0)
|
||||
|
||||
o = s:option(Flag, "rul", translate("Use Rules"))
|
||||
o.description = translate("Use Rules")
|
||||
o:depends("orul", 0)
|
||||
|
||||
o = s:option(Flag, "orul", translate("Use Other Rules"))
|
||||
o.description = translate("Use Other Rules")
|
||||
o:depends("rul", 0)
|
||||
|
||||
|
||||
o = s:option(Flag, "script", translate("Use Script"))
|
||||
o.description = translate("Use Script")
|
||||
o:depends("rul", 1)
|
||||
o:depends("rulprp", 1)
|
||||
|
||||
o = s:option(Value, "name_tag")
|
||||
o.title = translate("Config Name")
|
||||
o.rmempty = true
|
||||
o.description = translate("Give a name for your config")
|
||||
|
||||
cc = s:option(Flag, "same_tag", translate("Force Same Name"))
|
||||
cc.default = 1
|
||||
cc.description = translate("Enable to overwrite config file")
|
||||
|
||||
o = s:option(Button,"Manager")
|
||||
o.title = translate("Rule Providers Manager")
|
||||
o.inputtitle = translate("Rule Providers Manager")
|
||||
o.inputstyle = "reload"
|
||||
o.write = function()
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash", "rulemanager"))
|
||||
end
|
||||
|
||||
|
||||
local t = {
|
||||
{Creat_Config, Delete_Groups, Delete_ProxyPro, Delete_RulePro,Delete_Rules}
|
||||
}
|
||||
|
||||
b = krk:section(Table, t)
|
||||
|
||||
|
||||
o = b:option(Button,"Creat_Config")
|
||||
o.inputtitle = translate("Create Config")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
krk.uci:commit("clash")
|
||||
luci.sys.call("bash /usr/share/clash/create/create.sh >/dev/null 2>&1 &")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash"))
|
||||
end
|
||||
|
||||
o = b:option(Button,"Delete Severs")
|
||||
o.inputtitle = translate("Delete Severs")
|
||||
o.inputstyle = "reset"
|
||||
o.write = function()
|
||||
krk.uci:delete_all("clash", "servers", function(s) return true end)
|
||||
krk.uci:commit("clash")
|
||||
end
|
||||
|
||||
o = b:option(Button,"Delete_ProxyPro")
|
||||
o.inputtitle = translate("Delete Proxy Provider")
|
||||
o.inputstyle = "reset"
|
||||
o.write = function()
|
||||
krk.uci:delete_all("clash", "proxyprovider", function(s) return true end)
|
||||
krk.uci:commit("clash")
|
||||
end
|
||||
|
||||
o = b:option(Button,"Delete_RulePro")
|
||||
o.inputtitle = translate("Delete Rule Provider")
|
||||
o.inputstyle = "reset"
|
||||
o.write = function()
|
||||
krk.uci:delete_all("clash", "ruleprovider", function(s) return true end)
|
||||
krk.uci:commit("clash")
|
||||
end
|
||||
|
||||
|
||||
o = b:option(Button,"Delete_Rules")
|
||||
o.inputtitle = translate("Delete Rules")
|
||||
o.inputstyle = "reset"
|
||||
o.write = function()
|
||||
krk.uci:delete_all("clash", "rules", function(s) return true end)
|
||||
krk.uci:commit("clash")
|
||||
end
|
||||
|
||||
o = b:option(Button,"Delete_Groups")
|
||||
o.inputtitle = translate("Delete Groups")
|
||||
o.inputstyle = "reset"
|
||||
o.write = function()
|
||||
krk.uci:delete_all("clash", "pgroups", function(s) return true end)
|
||||
krk.uci:commit("clash")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash", "config", "create"))
|
||||
end
|
||||
|
||||
|
||||
-- [[ Proxies ]]--
|
||||
s = krk:section(TypedSection, "servers", translate("Proxies"))
|
||||
s.anonymous = true
|
||||
s.addremove = true
|
||||
s.sortable = false
|
||||
s.template = "cbi/tblsection"
|
||||
s.extedit = luci.dispatcher.build_url("admin/services/clash/servers/%s")
|
||||
function s.create(...)
|
||||
local sid = TypedSection.create(...)
|
||||
if sid then
|
||||
luci.http.redirect(s.extedit % sid)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
o = s:option(Flag, "enabled", translate("Enable"))
|
||||
o.rmempty = false
|
||||
o.default = o.enabled
|
||||
o.cfgvalue = function(...)
|
||||
return Flag.cfgvalue(...) or "1"
|
||||
end
|
||||
|
||||
o = s:option(DummyValue, "type", translate("Type"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
o = s:option(DummyValue, "name", translate("Alias"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
o = s:option(DummyValue, "server", translate("Server Address"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
o = s:option(DummyValue, "port", translate("Server Port"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
o = s:option(DummyValue, "server" ,translate("Latency"))
|
||||
o.template="clash/ping"
|
||||
o.width="10%"
|
||||
|
||||
|
||||
-- [[ Groups Manage ]]--
|
||||
x = krk:section(TypedSection, "pgroups", translate("Policy Groups"))
|
||||
x.description = font_blue..bold_on..translate(" https://lancellc.gitbook.io/clash/clash-config-file/proxy-groups")..bold_off..font_off..' '
|
||||
x.anonymous = true
|
||||
x.addremove = true
|
||||
x.sortable = true
|
||||
x.template = "cbi/tblsection"
|
||||
x.extedit = luci.dispatcher.build_url("admin/services/clash/pgroups/%s")
|
||||
function x.create(...)
|
||||
local sid = TypedSection.create(...)
|
||||
if sid then
|
||||
luci.http.redirect(x.extedit % sid)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
o = x:option(Flag, "enabled", translate("Enable"))
|
||||
o.rmempty = false
|
||||
o.default = o.enabled
|
||||
o.cfgvalue = function(...)
|
||||
return Flag.cfgvalue(...) or "1"
|
||||
end
|
||||
|
||||
o = x:option(DummyValue, "type", translate("Group Type"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
|
||||
o = x:option(DummyValue, "name", translate("Group Name"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
|
||||
-- [[ Proxy-Provider Manage ]]--
|
||||
z = krk:section(TypedSection, "proxyprovider", translate("Proxy Provider"))
|
||||
z.description = font_blue..bold_on..translate(" https://lancellc.gitbook.io/clash/clash-config-file/proxy-provider")..bold_off..font_off..' '
|
||||
z.anonymous = true
|
||||
z.addremove = true
|
||||
z.sortable = true
|
||||
z.template = "cbi/tblsection"
|
||||
z.extedit = luci.dispatcher.build_url("admin/services/clash/proxyprovider/%s")
|
||||
function z.create(...)
|
||||
local sid = TypedSection.create(...)
|
||||
if sid then
|
||||
luci.http.redirect(z.extedit % sid)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
o = z:option(Flag, "enabled", translate("Enable"))
|
||||
o.rmempty = false
|
||||
o.default = o.enabled
|
||||
o.cfgvalue = function(...)
|
||||
return Flag.cfgvalue(...) or "1"
|
||||
end
|
||||
|
||||
o = z:option(DummyValue, "name", translate("Provider Name"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
o = z:option(DummyValue, "type", translate("Provider Type"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- [[ Rule-Provider Manage ]]--
|
||||
r = krk:section(TypedSection, "ruleprovider", translate("Rule Provider"))
|
||||
r.description = font_blue..bold_on..translate(" https://lancellc.gitbook.io/clash/clash-config-file/rule-provider")..bold_off..font_off..' '
|
||||
r.anonymous = true
|
||||
r.addremove = true
|
||||
r.sortable = true
|
||||
r.template = "cbi/tblsection"
|
||||
r.extedit = luci.dispatcher.build_url("admin/services/clash/ruleprovider/%s")
|
||||
function r.create(...)
|
||||
local sid = TypedSection.create(...)
|
||||
if sid then
|
||||
luci.http.redirect(r.extedit % sid)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
o = r:option(Flag, "enabled", translate("Enable"))
|
||||
o.rmempty = false
|
||||
o.default = o.enabled
|
||||
o.cfgvalue = function(...)
|
||||
return Flag.cfgvalue(...) or "1"
|
||||
end
|
||||
|
||||
|
||||
o = r:option(DummyValue, "name", translate("Provider Name"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
o = r:option(DummyValue, "type", translate("Provider Type"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
o = r:option(DummyValue, "behavior", translate("Provider Behavior"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
|
||||
-- [[ Rule Manage ]]--
|
||||
q = krk:section(TypedSection, "rules", translate("Rules"))
|
||||
q.description = font_blue..bold_on..translate(" https://lancellc.gitbook.io/clash/clash-config-file/rules")..bold_off..font_off..' '
|
||||
q.anonymous = true
|
||||
q.addremove = true
|
||||
q.sortable = true
|
||||
q.template = "cbi/tblsection"
|
||||
q.extedit = luci.dispatcher.build_url("admin/services/clash/rules/%s")
|
||||
function q.create(...)
|
||||
local sid = TypedSection.create(...)
|
||||
if sid then
|
||||
luci.http.redirect(q.extedit % sid)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
o = q:option(Flag, "enabled", translate("Enable"))
|
||||
o.rmempty = false
|
||||
o.default = o.enabled
|
||||
o.cfgvalue = function(...)
|
||||
return Flag.cfgvalue(...) or "1"
|
||||
end
|
||||
|
||||
o = q:option(DummyValue, "type", translate("Rule Type"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
o = q:option(DummyValue, "rulename", translate("Description"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("-")
|
||||
end
|
||||
|
||||
|
||||
o = q:option(DummyValue, "rulegroups", translate("Groups"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
|
||||
m = Map("clash")
|
||||
y = m:section(TypedSection, "clash" , translate("Script"))
|
||||
y.anonymous = true
|
||||
y.addremove=false
|
||||
|
||||
|
||||
local script="/usr/share/clash/create/script.yaml"
|
||||
sev = y:option(TextValue, "scriptt")
|
||||
sev.description =translate("NB: Set Clash Mode to Script if want to use")..font_blue..bold_on..translate(" https://lancellc.gitbook.io/clash/clash-config-file/script")..bold_off..font_off..' '
|
||||
sev.rows = 10
|
||||
sev.wrap = "off"
|
||||
sev.cfgvalue = function(self, section)
|
||||
return NXFS.readfile(script) or ""
|
||||
end
|
||||
sev.write = function(self, section, value)
|
||||
NXFS.writefile(script, value:gsub("\r\n", "\n"))
|
||||
end
|
||||
|
||||
|
||||
l = Map("clash")
|
||||
v = l:section(TypedSection, "clash" , translate("Other Rules"))
|
||||
v.anonymous = true
|
||||
v.addremove=false
|
||||
|
||||
|
||||
o = v:option(Value, "rule_url")
|
||||
o.title = translate("Custom Rule Url")
|
||||
o.description = translate("Insert your custom rule Url and click download")
|
||||
o.rmempty = true
|
||||
|
||||
o = v:option(Button,"rule_update")
|
||||
o.title = translate("Download Rule")
|
||||
o.inputtitle = translate("Download Rule")
|
||||
o.description = translate("Download Rule")
|
||||
o.inputstyle = "reload"
|
||||
o.write = function()
|
||||
uci:commit("clash")
|
||||
luci.sys.call("bash /usr/share/clash/rule.sh >>/usr/share/clash/clash.txt >/dev/null 2>&1 &")
|
||||
end
|
||||
|
||||
local rule = "/usr/share/clash/rule.yaml"
|
||||
sev = v:option(TextValue, "rule")
|
||||
sev.description = translate("NB: Attention to Proxy Group and Rule when making changes to this section")
|
||||
sev.rows = 20
|
||||
sev.wrap = "off"
|
||||
sev.cfgvalue = function(self, section)
|
||||
return NXFS.readfile(rule) or ""
|
||||
end
|
||||
sev.write = function(self, section, value)
|
||||
NXFS.writefile(rule, value:gsub("\r\n", "\n"))
|
||||
end
|
||||
|
||||
o = v:option(Button,"del_rule")
|
||||
o.inputtitle = translate("Delete Rule")
|
||||
o.write = function()
|
||||
SYS.call("rm -rf /usr/share/clash/rule.yaml >/dev/null 2>&1 &")
|
||||
end
|
||||
|
||||
krk:append(Template("clash/list"))
|
||||
|
||||
return krk,m,l
|
||||
|
||||
@ -1,94 +0,0 @@
|
||||
|
||||
local m, s, o
|
||||
local clash = "clash"
|
||||
local uci = luci.model.uci.cursor()
|
||||
local fs = require "nixio.fs"
|
||||
local sys = require "luci.sys"
|
||||
local sid = arg[1]
|
||||
|
||||
|
||||
m = Map(clash, translate("Edit Group"))
|
||||
m.pageaction = false
|
||||
m.redirect = luci.dispatcher.build_url("admin/services/clash/config/create")
|
||||
if m.uci:get(clash, sid) ~= "pgroups" then
|
||||
luci.http.redirect(m.redirect)
|
||||
return
|
||||
end
|
||||
|
||||
-- [[ Groups Setting ]]--
|
||||
s = m:section(NamedSection, sid, "pgroups")
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
|
||||
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("url-test", translate("URL-Test"))
|
||||
o:value("fallback", translate("Fallback"))
|
||||
o:value("load-balance", translate("Load-Balance"))
|
||||
o:value("relay", translate("Relay"))
|
||||
|
||||
o = s:option(Value, "name", translate("Group Name"))
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "test_url", translate("Test URL"))
|
||||
o.default = "http://www.gstatic.com/generate_204"
|
||||
o.rmempty = true
|
||||
o:depends("type", "url-test")
|
||||
o:depends("type", "fallback")
|
||||
o:depends("type", "load-balance")
|
||||
|
||||
o = s:option(Value, "test_interval", translate("Test Interval(s)"))
|
||||
o.default = "300"
|
||||
o.rmempty = true
|
||||
o:depends("type", "url-test")
|
||||
o:depends("type", "fallback")
|
||||
o:depends("type", "load-balance")
|
||||
|
||||
o = s:option(DynamicList, "other_group", translate("Other Group"))
|
||||
o.rmempty = true
|
||||
o.description = translate("Proxy Groups Must Exist In Rule")
|
||||
o:value("ALL", translate("All Servers"))
|
||||
uci:foreach("clash", "pgroups",
|
||||
function(s)
|
||||
if s.name ~= "" and s.name ~= nil and s.name ~= m.uci:get(clash, sid, "name") then
|
||||
o:value(s.name)
|
||||
end
|
||||
end)
|
||||
uci:foreach("clash", "servers",
|
||||
function(s)
|
||||
if s.name ~= "" and s.name ~= nil and s.name ~= m.uci:get(clash, sid, "name") then
|
||||
o:value(s.name)
|
||||
end
|
||||
end)
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
|
||||
|
||||
local t = {
|
||||
{Apply, Return}
|
||||
}
|
||||
|
||||
b = m:section(Table, t)
|
||||
|
||||
o = b:option(Button,"Apply")
|
||||
o.inputtitle = translate("Save & Apply")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
m.uci:commit("clash")
|
||||
sys.call("/usr/share/clash/create/pgroups.sh start >/dev/null 2>&1 &")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash", "config", "create"))
|
||||
end
|
||||
|
||||
o = b:option(Button,"Return")
|
||||
o.inputtitle = translate("Back to Overview")
|
||||
o.inputstyle = "reset"
|
||||
o.write = function()
|
||||
m.uci:revert(clash)
|
||||
luci.http.redirect(m.redirect)
|
||||
--luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash", "config", "providers"))
|
||||
end
|
||||
|
||||
|
||||
return m
|
||||
@ -1,156 +0,0 @@
|
||||
|
||||
local NXFS = require "nixio.fs"
|
||||
local SYS = require "luci.sys"
|
||||
local HTTP = require "luci.http"
|
||||
local DISP = require "luci.dispatcher"
|
||||
local UTIL = require "luci.util"
|
||||
local uci = luci.model.uci.cursor()
|
||||
local fs = require "luci.clash"
|
||||
local http = luci.http
|
||||
local clash = "clash"
|
||||
|
||||
|
||||
|
||||
|
||||
kr = Map(clash)
|
||||
s = kr:section(TypedSection, "clash", translate("Subscription Config"))
|
||||
s.anonymous = true
|
||||
kr.pageaction = false
|
||||
|
||||
o = s:option(ListValue, "subcri", translate("Subcription Type"))
|
||||
o.default = clash
|
||||
o:value("clash", translate("clash"))
|
||||
o:value("ssr2clash", translate("ssr2clash"))
|
||||
o:value("v2clash", translate("v2clash"))
|
||||
o.description = translate("Select Subcription Type")
|
||||
|
||||
o = s:option(Value, "config_name")
|
||||
o.title = translate("Config Name")
|
||||
o.description = translate("Config Name. Do not use a config name that already exist")
|
||||
|
||||
o = s:option(Value, "clash_url")
|
||||
o.title = translate("Subcription Url")
|
||||
o.description = translate("Clash Subscription Address")
|
||||
o.rmempty = true
|
||||
o:depends("subcri", 'clash')
|
||||
|
||||
|
||||
o = s:option(Button,"update")
|
||||
o.title = translate("Download Config")
|
||||
o.inputtitle = translate("Download Config")
|
||||
o.inputstyle = "reload"
|
||||
o.write = function()
|
||||
kr.uci:commit("clash")
|
||||
SYS.call("sh /usr/share/clash/clash.sh >>/usr/share/clash/clash.txt 2>&1 &")
|
||||
SYS.call("sleep 1")
|
||||
HTTP.redirect(DISP.build_url("admin", "services", "clash"))
|
||||
end
|
||||
o:depends("subcri", 'clash')
|
||||
|
||||
o = s:option(Value, "ssr_url")
|
||||
o.title = translate("Subcription Url")
|
||||
o.placeholder = translate("https://www.example.com/link/QkjokZXktyyr35gfj")
|
||||
o.rmempty = true
|
||||
o:depends("subcri", 'ssr2clash')
|
||||
|
||||
|
||||
o = s:option(Button,"updatee")
|
||||
o.title = translate("Download Config")
|
||||
o.inputtitle = translate("Download Config")
|
||||
o.inputstyle = "reload"
|
||||
o.write = function()
|
||||
kr.uci:commit("clash")
|
||||
luci.sys.call("bash /usr/share/clash/clash.sh >>/usr/share/clash/clash.txt 2>&1 &")
|
||||
HTTP.redirect(DISP.build_url("admin", "services", "clash"))
|
||||
end
|
||||
o:depends("subcri", 'ssr2clash')
|
||||
|
||||
o = s:option(Value, "v2_url")
|
||||
o.title = translate("Subcription Url")
|
||||
o.placeholder = translate("https://www.example.com/link/QkjokZXktyyr35gfj")
|
||||
o.rmempty = true
|
||||
o:depends("subcri", 'v2clash')
|
||||
|
||||
|
||||
o = s:option(Button,"updateee")
|
||||
o.title = translate("Download Config")
|
||||
o.inputtitle = translate("Download Config")
|
||||
o.inputstyle = "reload"
|
||||
o.write = function()
|
||||
kr.uci:commit("clash")
|
||||
luci.sys.call("bash /usr/share/clash/clash.sh >>/usr/share/clash/clash.txt 2>&1 &")
|
||||
HTTP.redirect(DISP.build_url("admin", "services", "clash"))
|
||||
end
|
||||
o:depends("subcri", 'v2clash')
|
||||
|
||||
|
||||
function IsYamlFile(e)
|
||||
e=e or""
|
||||
local e=string.lower(string.sub(e,-5,-1))
|
||||
return e == ".yaml"
|
||||
end
|
||||
|
||||
function IsYmlFile(e)
|
||||
e=e or""
|
||||
local e=string.lower(string.sub(e,-4,-1))
|
||||
return e == ".yml"
|
||||
end
|
||||
|
||||
|
||||
ko = Map(clash)
|
||||
ko.reset = false
|
||||
ko.submit = false
|
||||
sul =ko:section(TypedSection, "clash", translate("Upload Config"))
|
||||
sul.anonymous = true
|
||||
sul.addremove=false
|
||||
o = sul:option(FileUpload, "")
|
||||
--o.description = translate("NB: Only upload file with name .yaml.It recommended to rename each upload file name to avoid overwrite")
|
||||
o.title = translate(" ")
|
||||
o.template = "clash/clash_upload"
|
||||
um = sul:option(DummyValue, "", nil)
|
||||
um.template = "clash/clash_dvalue"
|
||||
|
||||
local dir, fd
|
||||
dir = "/usr/share/clash/config/upload/"
|
||||
http.setfilehandler(
|
||||
|
||||
function(meta, chunk, eof)
|
||||
if not fd then
|
||||
if not meta then return end
|
||||
|
||||
if meta and chunk then fd = nixio.open(dir .. meta.file, "w") end
|
||||
|
||||
if not fd then
|
||||
um.value = translate("upload file error.")
|
||||
return
|
||||
end
|
||||
end
|
||||
if chunk and fd then
|
||||
fd:write(chunk)
|
||||
end
|
||||
if eof and fd then
|
||||
fd:close()
|
||||
fd = nil
|
||||
local e=string.lower(string.sub(meta.file,-4,-1))
|
||||
local yml2=string.lower(string.sub(meta.file,0,-5))
|
||||
if e == '.yml' then
|
||||
local yml=string.lower(string.sub(meta.file,0,-5))
|
||||
local c=fs.rename(dir .. meta.file,"/usr/share/clash/config/upload/".. yml .. ".yaml")
|
||||
um.value = translate("File saved to") .. ' "/usr/share/clash/config/upload/'..yml..'.yaml"'
|
||||
else
|
||||
um.value = translate("File saved to") .. ' "/usr/share/clash/config/upload/'..yml2..'yaml"'
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
if luci.http.formvalue("upload") then
|
||||
local f = luci.http.formvalue("ulfile")
|
||||
if #f <= 0 then
|
||||
um.value = translate("No specify upload file.")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return kr,ko
|
||||
@ -1,59 +0,0 @@
|
||||
local m, s, o
|
||||
local clash = "clash"
|
||||
local uci = luci.model.uci.cursor()
|
||||
local fs = require "nixio.fs"
|
||||
local sys = require "luci.sys"
|
||||
local sid = arg[1]
|
||||
|
||||
|
||||
m = Map(clash, translate("Edit Custom Rule & Group"))
|
||||
--m.pageaction = false
|
||||
m.redirect = luci.dispatcher.build_url("admin/services/clash/settings/other")
|
||||
if m.uci:get(clash, sid) ~= "addtype" then
|
||||
luci.http.redirect(m.redirect)
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
s = m:section(NamedSection, sid, "addtype")
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
|
||||
|
||||
o = s:option(ListValue, "type", translate("Rule Type"))
|
||||
o.rmempty = false
|
||||
o.description = translate("Choose Type")
|
||||
o:value("DST-PORT", translate("DST-PORT"))
|
||||
o:value("SRC-PORT", translate("SRC-PORT"))
|
||||
o:value("SRC-IP-CIDR", translate("SRC-IP-CIDR"))
|
||||
o:value("IP-CIDR", translate("IP-CIDR"))
|
||||
o:value("IP-CIDR6", translate("IP-CIDR6"))
|
||||
o:value("DOMAIN", translate("DOMAIN"))
|
||||
o:value("DOMAIN-KEYWORD", translate("DOMAIN-KEYWORD"))
|
||||
o:value("DOMAIN-SUFFIX", translate("DOMAIN-SUFFIX"))
|
||||
o:value("GEOIP", translate("GEOIP"))
|
||||
|
||||
|
||||
o = s:option(ListValue, "pgroup", translate("Select Proxy Group"))
|
||||
uci:foreach("clash", "conf_groups",
|
||||
function(s)
|
||||
if s.name ~= "" and s.name ~= nil then
|
||||
o:value(s.name)
|
||||
end
|
||||
end)
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
o.rmempty = false
|
||||
o.description = translate("Select a policy group to add rule")
|
||||
|
||||
|
||||
o = s:option(Value, "ipaaddr", translate("IP/Domain/Address/Keyword/Port"))
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Flag, "res", translate("No Resolve"))
|
||||
o.default = 0
|
||||
o:depends("type", "IP-CIDR")
|
||||
o:depends("type", "IP-CIDR6")
|
||||
o:depends("type", "GEOIP")
|
||||
|
||||
return m
|
||||
@ -1,160 +0,0 @@
|
||||
|
||||
local m, s, o
|
||||
local clash = "clash"
|
||||
local uci = luci.model.uci.cursor()
|
||||
local fs = require "nixio.fs"
|
||||
local sys = require "luci.sys"
|
||||
local sid = arg[1]
|
||||
local http = luci.http
|
||||
local fss = require "luci.clash"
|
||||
|
||||
function IsYamlFile(e)
|
||||
e=e or""
|
||||
local e=string.lower(string.sub(e,-5,-1))
|
||||
return e == ".yaml"
|
||||
end
|
||||
function IsYmlFile(e)
|
||||
e=e or""
|
||||
local e=string.lower(string.sub(e,-4,-1))
|
||||
return e == ".yml"
|
||||
end
|
||||
|
||||
|
||||
m = Map(clash, translate("Edit Proxy Provider"))
|
||||
m.pageaction = false
|
||||
m.redirect = luci.dispatcher.build_url("admin/services/clash/config/create")
|
||||
if m.uci:get(clash, sid) ~= "proxyprovider" then
|
||||
luci.http.redirect(m.redirect)
|
||||
return
|
||||
end
|
||||
|
||||
s = m:section(NamedSection, sid, "proxyprovider")
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
|
||||
o = s:option(ListValue, "type", translate("Provider Type"))
|
||||
o.rmempty = false
|
||||
o.description = translate("Provider Type")
|
||||
o:value("http")
|
||||
o:value("file")
|
||||
|
||||
o = s:option(FileUpload, "",translate("Upload Provider File"))
|
||||
o.title = translate("Provider File")
|
||||
o.template = "clash/clash_upload"
|
||||
o:depends("type", "file")
|
||||
um = s:option(DummyValue, "", nil)
|
||||
um.template = "clash/clash_dvalue"
|
||||
|
||||
local dir, fd
|
||||
dir = "/etc/clash/proxyprovider/"
|
||||
http.setfilehandler(
|
||||
function(meta, chunk, eof)
|
||||
if not fd then
|
||||
if not meta then return end
|
||||
|
||||
if meta and chunk then fd = nixio.open(dir .. meta.file, "w") end
|
||||
|
||||
if not fd then
|
||||
um.value = translate("upload file error.")
|
||||
return
|
||||
end
|
||||
end
|
||||
if chunk and fd then
|
||||
fd:write(chunk)
|
||||
end
|
||||
if eof and fd then
|
||||
fd:close()
|
||||
fd = nil
|
||||
um.value = translate("File saved to") .. ' "/etc/clash/proxyprovider/"'
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
if luci.http.formvalue("upload") then
|
||||
local f = luci.http.formvalue("ulfile")
|
||||
if #f <= 0 then
|
||||
um.value = translate("No specify upload file.")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
o = s:option(Value, "name", translate("Provider Name"))
|
||||
o.rmempty = false
|
||||
|
||||
|
||||
o = s:option(ListValue, "path", translate("Provider Path"))
|
||||
o.description = translate("Upload Provider File If Empty")
|
||||
local p,h={}
|
||||
for t,f in ipairs(fss.glob("/etc/clash/proxyprovider/*"))do
|
||||
h=fss.stat(f)
|
||||
if h then
|
||||
p[t]={}
|
||||
p[t].name=fss.basename(f)
|
||||
if IsYamlFile(p[t].name) or IsYmlFile(p[t].name) then
|
||||
o:value("./proxyprovider/"..p[t].name)
|
||||
end
|
||||
end
|
||||
end
|
||||
o.rmempty = true
|
||||
o:depends("type", "file")
|
||||
|
||||
|
||||
o = s:option(Value, "provider_url", translate("Provider URL"))
|
||||
o.description = translate("【HTTP】./hk.yaml")
|
||||
o.rmempty = true
|
||||
o:depends("type", "http")
|
||||
|
||||
o = s:option(Value, "provider_interval", translate("Provider Interval"))
|
||||
o.default = "3600"
|
||||
o.rmempty = true
|
||||
o:depends("type", "http")
|
||||
|
||||
o = s:option(ListValue, "health_check", translate("Provider Health Check"))
|
||||
o:value("false", translate("Disable"))
|
||||
o:value("true", translate("Enable"))
|
||||
o.default=true
|
||||
|
||||
o = s:option(Value, "health_check_url", translate("Health Check URL"))
|
||||
o.default = "http://www.gstatic.com/generate_204"
|
||||
o.rmempty = true
|
||||
|
||||
o = s:option(Value, "health_check_interval", translate("Health Check Interval"))
|
||||
o.default = "300"
|
||||
o.rmempty = true
|
||||
|
||||
o = s:option(DynamicList, "pgroups", translate("Policy Group"))
|
||||
o.rmempty = true
|
||||
m.uci:foreach("clash", "pgroups",
|
||||
function(s)
|
||||
if s.name ~= "" and s.name ~= nil and s.type ~= "relay" then
|
||||
o:value(s.name)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
local t = {
|
||||
{Apply, Return}
|
||||
}
|
||||
|
||||
b = m:section(Table, t)
|
||||
|
||||
o = b:option(Button,"Apply")
|
||||
o.inputtitle = translate("Save & Apply")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
m.uci:commit("clash")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash", "config", "create"))
|
||||
end
|
||||
|
||||
o = b:option(Button,"Return")
|
||||
o.inputtitle = translate("Back to Overview")
|
||||
o.inputstyle = "reset"
|
||||
o.write = function()
|
||||
m.uci:revert(clash)
|
||||
luci.http.redirect(m.redirect)
|
||||
--luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash", "config", "providers"))
|
||||
end
|
||||
|
||||
|
||||
return m
|
||||
@ -1,150 +0,0 @@
|
||||
|
||||
local m, s, o
|
||||
local clash = "clash"
|
||||
local uci = luci.model.uci.cursor()
|
||||
local fs = require "nixio.fs"
|
||||
local sys = require "luci.sys"
|
||||
local sid = arg[1]
|
||||
local http = luci.http
|
||||
local fss = require "luci.clash"
|
||||
|
||||
function IsYamlFile(e)
|
||||
e=e or""
|
||||
local e=string.lower(string.sub(e,-5,-1))
|
||||
return e == ".yaml"
|
||||
end
|
||||
function IsYmlFile(e)
|
||||
e=e or""
|
||||
local e=string.lower(string.sub(e,-4,-1))
|
||||
return e == ".yml"
|
||||
end
|
||||
function IsFile(e)
|
||||
e=e or""
|
||||
local e=string.lower(string.sub(e,-5,-1))
|
||||
return e == ".list"
|
||||
end
|
||||
|
||||
|
||||
m = Map(clash, translate("Edit Rule Provider"))
|
||||
m.pageaction = false
|
||||
m.redirect = luci.dispatcher.build_url("admin/services/clash/config/create")
|
||||
if m.uci:get(clash, sid) ~= "ruleprovider" then
|
||||
luci.http.redirect(m.redirect)
|
||||
return
|
||||
end
|
||||
|
||||
s = m:section(NamedSection, sid, "ruleprovider")
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
|
||||
o = s:option(Value, "name", translate("Rule Provider Name"))
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(ListValue, "type", translate("Provider Type"))
|
||||
o.rmempty = false
|
||||
o.description = translate("Provider Type")
|
||||
o:value("http")
|
||||
o:value("file")
|
||||
|
||||
|
||||
o = s:option(ListValue, "behavior", translate("Provider Behavior"))
|
||||
o.rmempty = false
|
||||
o.description = translate("ipcidr # or domain")
|
||||
o:value("ipcidr")
|
||||
o:value("domain")
|
||||
o:value("classical")
|
||||
|
||||
o = s:option(FileUpload, "",translate("Upload Provider File"))
|
||||
o.title = translate("Provider File")
|
||||
o.template = "clash/clash_upload"
|
||||
o:depends("type", "file")
|
||||
um = s:option(DummyValue, "", nil)
|
||||
um.template = "clash/clash_dvalue"
|
||||
|
||||
local dir, fd
|
||||
dir = "/etc/clash/ruleprovider/"
|
||||
http.setfilehandler(
|
||||
function(meta, chunk, eof)
|
||||
if not fd then
|
||||
if not meta then return end
|
||||
|
||||
if meta and chunk then fd = nixio.open(dir .. meta.file, "w") end
|
||||
|
||||
if not fd then
|
||||
um.value = translate("upload file error.")
|
||||
return
|
||||
end
|
||||
end
|
||||
if chunk and fd then
|
||||
fd:write(chunk)
|
||||
end
|
||||
if eof and fd then
|
||||
fd:close()
|
||||
fd = nil
|
||||
um.value = translate("File saved to") .. ' "/etc/clash/ruleprovider/"'
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
if luci.http.formvalue("upload") then
|
||||
local f = luci.http.formvalue("ulfile")
|
||||
if #f <= 0 then
|
||||
um.value = translate("No specify upload file.")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
o = s:option(ListValue, "path", translate("Provider Path"))
|
||||
o.description = translate("Upload Provider File If Empty")
|
||||
local p,h={}
|
||||
for t,f in ipairs(fss.glob("/etc/clash/ruleprovider/*"))do
|
||||
h=fss.stat(f)
|
||||
if h then
|
||||
p[t]={}
|
||||
p[t].name=fss.basename(f)
|
||||
if IsYamlFile(p[t].name) or IsYmlFile(p[t].name) or IsFile(p[t].name) then
|
||||
o:value("./ruleprovider/"..p[t].name)
|
||||
end
|
||||
end
|
||||
end
|
||||
o:depends("type", "file")
|
||||
|
||||
|
||||
o = s:option(Value, "url", translate("Provider URL"))
|
||||
o.description = translate("【HTTP】./hk.yaml")
|
||||
o:depends("type", "http")
|
||||
|
||||
o = s:option(Value, "interval", translate("Provider Interval"))
|
||||
o.default = "3600"
|
||||
o:depends("type", "http")
|
||||
|
||||
|
||||
|
||||
local t = {
|
||||
{Apply, Return}
|
||||
}
|
||||
|
||||
b = m:section(Table, t)
|
||||
|
||||
o = b:option(Button,"Apply")
|
||||
o.inputtitle = translate("Save & Apply")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
m.uci:commit("clash")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash", "config", "create"))
|
||||
end
|
||||
|
||||
o = b:option(Button,"Return")
|
||||
o.inputtitle = translate("Back to Overview")
|
||||
o.inputstyle = "reset"
|
||||
o.write = function()
|
||||
m.uci:revert(clash)
|
||||
luci.http.redirect(m.redirect)
|
||||
--luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash", "config", "providers"))
|
||||
end
|
||||
|
||||
|
||||
return m
|
||||
@ -1,96 +0,0 @@
|
||||
|
||||
local f, s, o
|
||||
local clash = "clash"
|
||||
local uci = luci.model.uci.cursor()
|
||||
local fs = require "nixio.fs"
|
||||
local sys = require "luci.sys"
|
||||
local sid = arg[1]
|
||||
local http = luci.http
|
||||
local fss = require "luci.clash"
|
||||
local NXFS = require "nixio.fs"
|
||||
local HTTP = require "luci.http"
|
||||
local DISP = require "luci.dispatcher"
|
||||
local UTIL = require "luci.util"
|
||||
|
||||
|
||||
m = Map("clash", translate("Rule Providers List"))
|
||||
m.reset = false
|
||||
m.submit = false
|
||||
|
||||
local t = {
|
||||
{Apply}
|
||||
}
|
||||
|
||||
a = m:section(Table, t)
|
||||
|
||||
o = a:option(Button, "Apply")
|
||||
o.inputtitle = translate("Back to Overview")
|
||||
o.inputstyle = "reset"
|
||||
o.write = function()
|
||||
HTTP.redirect(DISP.build_url("admin", "services", "clash", "config", "create"))
|
||||
end
|
||||
|
||||
|
||||
sys.call("awk -F ',' '{print $4}' /usr/share/clash/create/rule_provider.list > /tmp/rule_providers 2>/dev/null")
|
||||
file = io.open("/tmp/rule_providers", "r");
|
||||
local e={},a,o,t
|
||||
a=nixio.fs.access("/tmp/rule_providers")
|
||||
if a then
|
||||
for o in file:lines() do
|
||||
table.insert(e,o)
|
||||
end
|
||||
for t,o in ipairs(e) do
|
||||
e[t]={}
|
||||
e[t].num=string.format(t)
|
||||
|
||||
|
||||
e[t].name=string.sub(luci.sys.exec(string.format("grep -F ',%s' /usr/share/clash/create/rule_provider.list |awk -F ',' '{print $1}' 2>/dev/null",o)),1,-2)
|
||||
|
||||
e[t].behaviour=string.sub(luci.sys.exec(string.format("grep -F ',%s' /usr/share/clash/create/rule_provider.list |awk -F ',' '{print $2}' 2>/dev/null",o)),1,-2)
|
||||
|
||||
e[t].filename=string.sub(luci.sys.exec(string.format("grep -F '%s,' /usr/share/clash/create/rule_provider.list |awk -F ',' '{print $4}' 2>/dev/null",o)),1,-2)
|
||||
|
||||
if e[t].filename == "" then
|
||||
e[t].filename=o
|
||||
end
|
||||
|
||||
RULE_FILE="/etc/clash/ruleprovider/".. e[t].filename
|
||||
if fss.mtime(RULE_FILE) then
|
||||
e[t].mtime=os.date("%Y-%m-%d %H:%M:%S",fss.mtime(RULE_FILE))
|
||||
else
|
||||
e[t].mtime="/"
|
||||
end
|
||||
if fss.isfile(RULE_FILE) then
|
||||
e[t].exist=translate("Exist")
|
||||
else
|
||||
e[t].exist=translate("Not Exist")
|
||||
end
|
||||
e[t].remove=0
|
||||
end
|
||||
end
|
||||
file:close()
|
||||
|
||||
|
||||
f=Form("filelist")
|
||||
tb=f:section(Table,e)
|
||||
nu=tb:option(DummyValue,"num",translate("Order Number"))
|
||||
st=tb:option(DummyValue,"exist",translate("State"))
|
||||
nm=tb:option(DummyValue,"name",translate("Rule Name"))
|
||||
tp=tb:option(DummyValue,"behaviour",translate("Type"))
|
||||
fm=tb:option(DummyValue,"filename",translate("File Name"))
|
||||
mt=tb:option(DummyValue,"mtime",translate("Update Time"))
|
||||
|
||||
btnis=tb:option(DummyValue,"filename",translate("Download Rule"))
|
||||
btnis.template="clash/rulep"
|
||||
|
||||
btnrm=tb:option(Button,"remove",translate("Remove"))
|
||||
btnrm.render=function(e,t,a)
|
||||
e.inputstyle="reset"
|
||||
Button.render(e,t,a)
|
||||
end
|
||||
btnrm.write=function(a,t)
|
||||
local a=fs.unlink("/etc/clash/ruleprovider/"..e[t].filename)
|
||||
HTTP.redirect(luci.dispatcher.build_url("admin", "services", "clash", "rulemanager"))
|
||||
end
|
||||
|
||||
return m, f
|
||||
@ -1,105 +0,0 @@
|
||||
local m, s, o
|
||||
local clash = "clash"
|
||||
local uci = luci.model.uci.cursor()
|
||||
local fs = require "nixio.fs"
|
||||
local sys = require "luci.sys"
|
||||
local sid = arg[1]
|
||||
|
||||
|
||||
m = Map(clash, translate("Edit Rules"))
|
||||
--m.pageaction = false
|
||||
m.redirect = luci.dispatcher.build_url("admin/services/clash/config/create")
|
||||
if m.uci:get(clash, sid) ~= "rules" then
|
||||
luci.http.redirect(m.redirect)
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
s = m:section(NamedSection, sid, "rules")
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
m.pageaction = false
|
||||
|
||||
o = s:option(ListValue, "type", translate("Rule Type"))
|
||||
o.rmempty = false
|
||||
o.description = translate("Choose Type")
|
||||
o:value("RULE-SET", translate("RULE-SET"))
|
||||
o:value("DST-PORT", translate("DST-PORT"))
|
||||
o:value("SRC-PORT", translate("SRC-PORT"))
|
||||
o:value("SRC-IP-CIDR", translate("SRC-IP-CIDR"))
|
||||
o:value("IP-CIDR", translate("IP-CIDR"))
|
||||
o:value("IP-CIDR6", translate("IP-CIDR6"))
|
||||
o:value("DOMAIN", translate("DOMAIN"))
|
||||
o:value("DOMAIN-KEYWORD", translate("DOMAIN-KEYWORD"))
|
||||
o:value("DOMAIN-SUFFIX", translate("DOMAIN-SUFFIX"))
|
||||
o:value("GEOIP", translate("GEOIP"))
|
||||
o:value("MATCH", translate("MATCH"))
|
||||
|
||||
|
||||
o = s:option(ListValue, "rulename", translate("Description"))
|
||||
uci:foreach("clash", "ruleprovider",
|
||||
function(s)
|
||||
if s.name ~= "" and s.name ~= nil then
|
||||
o:value(s.name)
|
||||
end
|
||||
end)
|
||||
o.description = translate("Select rule provider name")
|
||||
o:depends("type", "RULE-SET")
|
||||
|
||||
|
||||
o = s:option(ListValue, "rulegroups", translate("Select Proxy Group"))
|
||||
uci:foreach("clash", "pgroups",
|
||||
function(s)
|
||||
if s.name ~= "" and s.name ~= nil then
|
||||
o:value(s.name)
|
||||
end
|
||||
end)
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
o.description = translate("Select a policy group to add rule")
|
||||
|
||||
|
||||
|
||||
o = s:option(Value, "rulenamee", translate("Description"))
|
||||
o:depends("type", "DST-PORT")
|
||||
o:depends("type", "SRC-PORT")
|
||||
o:depends("type", "SRC-IP-CIDR")
|
||||
o:depends("type", "IP-CIDR")
|
||||
o:depends("type", "DOMAIN")
|
||||
o:depends("type", "DOMAIN-KEYWORD")
|
||||
o:depends("type", "DOMAIN-SUFFIX")
|
||||
o:depends("type", "GEOIP")
|
||||
o:depends("type", "IP-CIDR6")
|
||||
|
||||
o = s:option(Flag, "res", translate("No Resolve"))
|
||||
o.default = 0
|
||||
o:depends("type", "IP-CIDR")
|
||||
o:depends("type", "IP-CIDR6")
|
||||
o:depends("type", "GEOIP")
|
||||
|
||||
local t = {
|
||||
{Apply, Return}
|
||||
}
|
||||
|
||||
b = m:section(Table, t)
|
||||
|
||||
o = b:option(Button,"Apply")
|
||||
o.inputtitle = translate("Save & Apply")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
m.uci:commit("clash")
|
||||
sys.call("/usr/share/clash/create/rules.sh start >/dev/null 2>&1 &")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash", "config", "create"))
|
||||
end
|
||||
|
||||
o = b:option(Button,"Return")
|
||||
o.inputtitle = translate("Back to Overview")
|
||||
o.inputstyle = "reset"
|
||||
o.write = function()
|
||||
m.uci:revert(clash)
|
||||
luci.http.redirect(m.redirect)
|
||||
--luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash", "config", "providers"))
|
||||
end
|
||||
|
||||
|
||||
return m
|
||||
@ -1,319 +0,0 @@
|
||||
|
||||
local m, s, o
|
||||
local clash = "clash"
|
||||
local uci = luci.model.uci.cursor()
|
||||
local fs = require "nixio.fs"
|
||||
local sys = require "luci.sys"
|
||||
local sid = arg[1]
|
||||
local uuid = luci.sys.exec("cat /proc/sys/kernel/random/uuid")
|
||||
|
||||
|
||||
local server_table = {}
|
||||
|
||||
local encrypt_methods_ss = {
|
||||
|
||||
"rc4-md5",
|
||||
"aes-128-cfb",
|
||||
"aes-192-cfb",
|
||||
"aes-256-cfb",
|
||||
"aes-128-ctr",
|
||||
"aes-192-ctr",
|
||||
"aes-256-ctr",
|
||||
"aes-128-gcm",
|
||||
"aes-192-gcm",
|
||||
"aes-256-gcm",
|
||||
"chacha20-ietf",
|
||||
"xchacha20",
|
||||
"chacha20-ietf-poly1305",
|
||||
"xchacha20-ietf-poly1305",
|
||||
}
|
||||
|
||||
local securitys = {
|
||||
"auto",
|
||||
"none",
|
||||
"aes-128-gcm",
|
||||
"chacha20-poly1305"
|
||||
}
|
||||
|
||||
local encrypt_methods_ssr = {
|
||||
|
||||
"aes-128-cfb",
|
||||
"aes-192-cfb",
|
||||
"aes-256-cfb",
|
||||
"aes-128-ctr",
|
||||
"aes-192-ctr",
|
||||
"aes-256-ctr",
|
||||
"rc4-md5",
|
||||
"chacha20-ietf",
|
||||
"xchacha20",
|
||||
|
||||
}
|
||||
|
||||
|
||||
local protocol_ssr = {
|
||||
|
||||
"origin",
|
||||
"auth_sha1_v4",
|
||||
"auth_aes128_md5",
|
||||
"auth_aes128_sha1",
|
||||
"auth_chain_a",
|
||||
"auth_chain_b",
|
||||
}
|
||||
|
||||
|
||||
local obfs_ssr_list = {
|
||||
|
||||
"plain",
|
||||
"http_simple",
|
||||
"http_post",
|
||||
"tls1.2_ticket_auth",
|
||||
"tls1.2_ticket_fastauth",
|
||||
"random_head",
|
||||
}
|
||||
|
||||
m = Map(clash, translate("Edit Server"))
|
||||
m.redirect = luci.dispatcher.build_url("admin/services/clash/config/create")
|
||||
if m.uci:get(clash, sid) ~= "servers" then
|
||||
luci.http.redirect(m.redirect)
|
||||
return
|
||||
end
|
||||
|
||||
-- [[ Servers Setting ]]--
|
||||
s = m:section(NamedSection, sid, "servers")
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
|
||||
o = s:option(DummyValue,"ssr_url",translate("Import config info"))
|
||||
o.rawhtml = true
|
||||
o.template = "clash/ssrurl"
|
||||
o.value =sid
|
||||
|
||||
o = s:option(ListValue, "type", translate("Server Node Type"))
|
||||
o:value("ss", translate("Shadowsocks"))
|
||||
o:value("ssr", translate("ShadowsocksR"))
|
||||
o:value("vmess", translate("Vmess"))
|
||||
o:value("socks5", translate("Socks5"))
|
||||
o:value("http", translate("HTTP(S)"))
|
||||
o:value("snell", translate("Snell"))
|
||||
o:value("trojan", translate("trojan"))
|
||||
|
||||
o.description = translate("Using incorrect encryption mothod may causes service fail to start")
|
||||
|
||||
o = s:option(Value, "name", translate("Alias"))
|
||||
o.default = "Server"
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "server", translate("Server Address"))
|
||||
o.datatype = "host"
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "port", translate("Server Port"))
|
||||
o.datatype = "port"
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "password", translate("Password"))
|
||||
o.password = true
|
||||
o.rmempty = true
|
||||
o:depends("type", "ss")
|
||||
o:depends("type", "ssr")
|
||||
o:depends("type", "trojan")
|
||||
|
||||
o = s:option(Value, "psk", translate("Psk"))
|
||||
o.rmempty = false
|
||||
o:depends("type", "snell")
|
||||
|
||||
o = s:option(ListValue, "cipher", translate("Encrypt Method"))
|
||||
for _, v in ipairs(encrypt_methods_ss) do o:value(v) end
|
||||
o.rmempty = true
|
||||
o:depends("type", "ss")
|
||||
|
||||
o = s:option(ListValue, "cipher_ssr", translate("Encrypt Method"))
|
||||
for _, v in ipairs(encrypt_methods_ssr) do o:value(v) end
|
||||
o.rmempty = true
|
||||
o:depends("type", "ssr")
|
||||
|
||||
o = s:option(ListValue, "protocol", translate("Protocol"))
|
||||
for _, v in ipairs(protocol_ssr) do o:value(v) end
|
||||
o.rmempty = true
|
||||
o:depends("type", "ssr")
|
||||
|
||||
o = s:option(Value, "protocolparam", translate("Protocol Param"))
|
||||
o.rmempty = true
|
||||
o:depends("type", "ssr")
|
||||
|
||||
o = s:option(ListValue, "obfs_ssr", translate("Obfs"))
|
||||
for _, v in ipairs(obfs_ssr_list) do o:value(v) end
|
||||
o.rmempty = true
|
||||
o:depends("type", "ssr")
|
||||
|
||||
o = s:option(ListValue, "obfs_snell", translate("obfs-mode"))
|
||||
o.rmempty = true
|
||||
o.default = "none"
|
||||
o:value("none")
|
||||
o:value("tls")
|
||||
o:value("http")
|
||||
o:depends("type", "snell")
|
||||
|
||||
o = s:option(Value, "obfsparam", translate("Obfs Param"))
|
||||
o.rmempty = true
|
||||
o:depends("type", "ssr")
|
||||
|
||||
|
||||
o = s:option(ListValue, "securitys", translate("Encrypt Method"))
|
||||
for _, v in ipairs(securitys) do o:value(v, v:upper()) end
|
||||
o.rmempty = true
|
||||
o:depends("type", "vmess")
|
||||
|
||||
|
||||
o = s:option(ListValue, "obfs", translate("obfs-mode"))
|
||||
o.default = " "
|
||||
o:value(" ", translate("none"))
|
||||
o:value("tls")
|
||||
o:value("http")
|
||||
o:value("websocket", translate("websocket (ws)"))
|
||||
o:depends("type", "ss")
|
||||
|
||||
o = s:option(ListValue, "obfs_vmess", translate("obfs-mode"))
|
||||
o.default = "none"
|
||||
o:value("none")
|
||||
o:value("websocket", translate("websocket (ws)"))
|
||||
o:value("http", translate("http"))
|
||||
o:depends("type", "vmess")
|
||||
|
||||
o = s:option(Value, "host", translate("hosts"))
|
||||
o.datatype = "host"
|
||||
o.rmempty = true
|
||||
o:depends("obfs", "tls")
|
||||
o:depends("obfs", "http")
|
||||
o:depends("obfs", "websocket")
|
||||
o:depends("obfs_snell", "tls")
|
||||
o:depends("obfs_snell", "http")
|
||||
|
||||
o = s:option(ListValue, "udp", translate("udp"))
|
||||
o:value("true")
|
||||
o:value("false")
|
||||
o:depends("type", "ss")
|
||||
o:depends("type", "ssr")
|
||||
o:depends("type", "vmess")
|
||||
o:depends("type", "socks5")
|
||||
o:depends("type", "trojan")
|
||||
|
||||
o = s:option(ListValue, "tls_custom", translate("tls"))
|
||||
o.default = "false"
|
||||
o:value("true")
|
||||
o:value("false")
|
||||
o:depends("obfs", "websocket")
|
||||
|
||||
|
||||
|
||||
-- [[ WS部分 ]]--
|
||||
|
||||
-- WS路径
|
||||
o = s:option(Value, "path", translate("Path"))
|
||||
o.rmempty = true
|
||||
o:depends("obfs", "websocket")
|
||||
o:depends("obfs_vmess", "websocket")
|
||||
|
||||
o = s:option(DynamicList, "http_path", translate("path"))
|
||||
o.rmempty = true
|
||||
o:value("/")
|
||||
o:value("/video")
|
||||
o:depends("obfs_vmess", "http")
|
||||
|
||||
o = s:option(Value, "custom", translate("headers"))
|
||||
o.rmempty = true
|
||||
o:depends("obfs", "websocket")
|
||||
o:depends("obfs_vmess", "websocket")
|
||||
|
||||
o = s:option(Value, "keep_alive", translate("keep-alive"))
|
||||
o.rmempty = true
|
||||
o.default = "true"
|
||||
o:value("true")
|
||||
o:value("false")
|
||||
o:depends("obfs_vmess", "http")
|
||||
|
||||
o = s:option(ListValue, "mux", translate("Mux"))
|
||||
o.default = "false"
|
||||
o:value("true")
|
||||
o:value("false")
|
||||
o:depends("obfs", "websocket")
|
||||
|
||||
|
||||
-- AlterId
|
||||
o = s:option(Value, "alterId", translate("AlterId"))
|
||||
o.datatype = "port"
|
||||
o.default = 32
|
||||
o.rmempty = true
|
||||
o:depends("type", "vmess")
|
||||
|
||||
-- VmessId
|
||||
o = s:option(Value, "uuid", translate("VmessId (UUID)"))
|
||||
o.rmempty = true
|
||||
o.default = uuid
|
||||
o:depends("type", "vmess")
|
||||
|
||||
-- 验证用户名
|
||||
o = s:option(Value, "auth_name", translate("Auth Username"))
|
||||
o:depends("type", "socks5")
|
||||
o:depends("type", "http")
|
||||
o.rmempty = true
|
||||
|
||||
-- 验证密码
|
||||
o = s:option(Value, "auth_pass", translate("Auth Password"))
|
||||
o:depends("type", "socks5")
|
||||
o:depends("type", "http")
|
||||
o.rmempty = true
|
||||
|
||||
-- [[ skip-cert-verify ]]--
|
||||
o = s:option(ListValue, "skip_cert_verify", translate("Skip Cert Verify"))
|
||||
o.rmempty = true
|
||||
o.default = "false"
|
||||
o:value("true")
|
||||
o:value("false")
|
||||
o:depends("obfs", "websocket")
|
||||
o:depends("type", "vmess")
|
||||
o:depends("type", "socks5")
|
||||
o:depends("type", "http")
|
||||
o:depends("obfs_vmess", "none")
|
||||
o:depends("type", "trojan")
|
||||
o:depends("obfs_vmess", "websocket")
|
||||
|
||||
-- [[ TLS ]]--
|
||||
o = s:option(ListValue, "tls", translate("TLS"))
|
||||
o.rmempty = true
|
||||
o.default = "false"
|
||||
o:value("true")
|
||||
o:value("false")
|
||||
o:depends("obfs", "websocket")
|
||||
o:depends("obfs_vmess", "none")
|
||||
o:depends("obfs_vmess", "websocket")
|
||||
o:depends("obfs_vmess", "http")
|
||||
o:depends("type", "socks5")
|
||||
o:depends("type", "http")
|
||||
|
||||
o = s:option(Value, "servername", translate("Custom TLS Host"))
|
||||
o.rmempty = true
|
||||
o.placeholder = translate("example.com")
|
||||
o:depends("obfs_vmess", "websocket")
|
||||
|
||||
-- [[ sni ]]--
|
||||
o = s:option(Value, "sni", translate("sni"))
|
||||
o.datatype = "host"
|
||||
o.placeholder = translate("example.com")
|
||||
o.rmempty = true
|
||||
o:depends("type", "trojan")
|
||||
|
||||
-- [[ alpn ]]--
|
||||
o = s:option(Flag, "alpn_h2", translate("alpn-h2"))
|
||||
o:depends("type", "trojan")
|
||||
|
||||
o = s:option(Flag, "alpn_http", translate("alpn-http/1.1"))
|
||||
o:depends("type", "trojan")
|
||||
|
||||
|
||||
local apply = luci.http.formvalue("cbi.apply")
|
||||
if apply then
|
||||
m.uci:commit("clash")
|
||||
end
|
||||
|
||||
return m
|
||||
@ -1,70 +0,0 @@
|
||||
local NXFS = require "nixio.fs"
|
||||
local SYS = require "luci.sys"
|
||||
local HTTP = require "luci.http"
|
||||
local DISP = require "luci.dispatcher"
|
||||
local UTIL = require "luci.util"
|
||||
local uci = require("luci.model.uci").cursor()
|
||||
local clash = "clash"
|
||||
local http = luci.http
|
||||
|
||||
|
||||
m = Map("clash")
|
||||
s = m:section(TypedSection, "clash")
|
||||
m.pageaction = false
|
||||
s.anonymous = true
|
||||
s.addremove=false
|
||||
|
||||
y = s:option(ListValue, "dnsforwader", translate("DNS Forwarding"))
|
||||
y:value("0", translate("disabled"))
|
||||
y:value("1", translate("enabled"))
|
||||
y.description = translate("Set custom DNS forwarder in DHCP and DNS Settings and forward all dns traffic to clash")
|
||||
|
||||
|
||||
y = s:option(ListValue, "dnscache", translate("DNS Cache"))
|
||||
y:value("0", translate("disabled"))
|
||||
y:value("1", translate("enabled"))
|
||||
y.description = translate("Set to enable or disable dns cache")
|
||||
|
||||
y = s:option(ListValue, "access_control", translate("Access Control"))
|
||||
y:value("0", translate("disabled"))
|
||||
y:value("1", translate("Whitelist IPs"))
|
||||
y:value("2", translate("Blacklist Ips"))
|
||||
y.description = translate("Whitelist or Blacklist IPs to use Clash ( Only support enhanced-mode: redir-host )")
|
||||
|
||||
o = s:option(DynamicList, "proxy_lan_ips", translate("Proxy Lan List"))
|
||||
o.datatype = "ipaddr"
|
||||
o.description = translate("Only selected IPs will be proxied")
|
||||
luci.ip.neighbors({ family = 4 }, function(entry)
|
||||
if entry.reachable then
|
||||
o:value(entry.dest:string())
|
||||
end
|
||||
end)
|
||||
o:depends("access_control", 1)
|
||||
|
||||
|
||||
o = s:option(DynamicList, "reject_lan_ips", translate("Bypass Lan List"))
|
||||
o.datatype = "ipaddr"
|
||||
o.description = translate("Selected IPs will not be proxied")
|
||||
luci.ip.neighbors({ family = 4 }, function(entry)
|
||||
if entry.reachable then
|
||||
o:value(entry.dest:string())
|
||||
end
|
||||
end)
|
||||
o:depends("access_control", 2)
|
||||
|
||||
|
||||
o = s:option(Button, "Apply")
|
||||
o.title = luci.util.pcdata(translate("Save & Apply"))
|
||||
o.inputtitle = translate("Save & Apply")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
m.uci:commit("clash")
|
||||
if luci.sys.call("pidof clash >/dev/null") == 0 then
|
||||
SYS.call("/etc/init.d/clash restart >/dev/null 2>&1 &")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash"))
|
||||
else
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash" , "settings", "dns", "advance"))
|
||||
end
|
||||
end
|
||||
|
||||
return m
|
||||
@ -1,189 +0,0 @@
|
||||
local NXFS = require "nixio.fs"
|
||||
local SYS = require "luci.sys"
|
||||
local HTTP = require "luci.http"
|
||||
local DISP = require "luci.dispatcher"
|
||||
local UTIL = require "luci.util"
|
||||
local uci = require("luci.model.uci").cursor()
|
||||
local clash = "clash"
|
||||
local http = luci.http
|
||||
|
||||
|
||||
m = Map("clash")
|
||||
s = m:section(TypedSection, "clash")
|
||||
--m.pageaction = false
|
||||
s.anonymous = true
|
||||
s.addremove=false
|
||||
|
||||
|
||||
y = s:option(Flag, "interf", translate("Interface Name"))
|
||||
y.default = 1
|
||||
y.description = translate("Enable Interface Name")
|
||||
|
||||
y = s:option(Value, "interf_name", translate("Set Interface Name"))
|
||||
y.description = translate("Set Interface Name")
|
||||
y:depends("interf", 1)
|
||||
|
||||
y = s:option(Flag, "tun_mode", translate("Tun Mode"))
|
||||
y.default = 0
|
||||
y.description = translate("Enable Tun and make sure you are using tun supported core")
|
||||
|
||||
y = s:option(ListValue, "stack", translate("Stack"))
|
||||
y:value("system", translate("system"))
|
||||
y:value("gvisor", translate("gvisor"))
|
||||
y.description = translate("Select Stack Mode")
|
||||
y:depends("tun_mode", 1)
|
||||
|
||||
y = s:option(Flag, "enable_dns", translate("Enable Clash DNS"))
|
||||
y.default = 1
|
||||
y.description = translate("Enable Clash DNS")
|
||||
|
||||
y = s:option(Value, "listen_port", translate("DNS Listen Port"))
|
||||
y.description = translate("Set DNS Listen Port")
|
||||
y.default = "5300"
|
||||
|
||||
|
||||
y = s:option(DynamicList, "default_nameserver", translate("Default NameServer"))
|
||||
y.description = translate("Default Nameserver List")
|
||||
|
||||
|
||||
y = s:option(ListValue, "enhanced_mode", translate("Enhanced Mode"))
|
||||
y:value("redir-host", translate("Redir Host"))
|
||||
y:value("fake-ip", translate("Fake IP"))
|
||||
y.description = translate("Select Enhanced Mode")
|
||||
|
||||
y = s:option(Value, "fake_ip_range", translate("Fake IP Range"))
|
||||
y.description = translate("Set Fake IP Range")
|
||||
y.default = "198.18.0.1/16"
|
||||
y:depends("enhanced_mode", "fake-ip")
|
||||
|
||||
y = s:option(DynamicList, "fake_ip_filter", translate("Fake IP Filter"))
|
||||
y.description = translate("Fake IP Filter List")
|
||||
y.default = "*.lan"
|
||||
y:depends("enhanced_mode", "fake-ip")
|
||||
|
||||
s = m:section(TypedSection, "dnshijack", translate("DNS Hijack"))
|
||||
s.anonymous = true
|
||||
s.addremove = true
|
||||
s.sortable = false
|
||||
s.template = "cbi/tblsection"
|
||||
s.rmempty = false
|
||||
|
||||
o = s:option(Flag, "enabled", translate("Enable"))
|
||||
o.rmempty = false
|
||||
o.default = o.enabled
|
||||
o.cfgvalue = function(...)
|
||||
return Flag.cfgvalue(...) or "1"
|
||||
end
|
||||
|
||||
o = s:option(ListValue, "type", translate("Protocol"))
|
||||
o:value("none", translate("No Protocol"))
|
||||
o:value("tcp://", translate("TCP"))
|
||||
o:value("udp://", translate("UDP"))
|
||||
o:value("tls://", translate("TLS"))
|
||||
o:value("https://", translate("HTTPS"))
|
||||
o.default = "none"
|
||||
o.rempty = false
|
||||
|
||||
o = s:option(Value, "ip", translate("Address"))
|
||||
o.placeholder = translate("Not Null")
|
||||
o.datatype = "or(host, string)"
|
||||
o.rmempty = true
|
||||
|
||||
o = s:option(Value, "port", translate("Port"))
|
||||
o.datatype = "port"
|
||||
o.rempty = true
|
||||
|
||||
|
||||
s = m:section(TypedSection, "authentication", translate("Authentication"))
|
||||
s.anonymous = true
|
||||
s.addremove = true
|
||||
s.sortable = false
|
||||
s.template = "cbi/tblsection"
|
||||
s.rmempty = false
|
||||
|
||||
o = s:option(Flag, "enabled", translate("Enable"))
|
||||
o.rmempty = false
|
||||
o.default = o.enabled
|
||||
o.cfgvalue = function(...)
|
||||
return Flag.cfgvalue(...) or "1"
|
||||
end
|
||||
|
||||
o = s:option(Value, "username", translate("Username"))
|
||||
o.placeholder = translate("Cannot be Empty")
|
||||
o.rempty = true
|
||||
|
||||
o = s:option(Value, "password", translate("Password"))
|
||||
o.placeholder = translate("Cannot be Empty")
|
||||
o.rmempty = true
|
||||
|
||||
|
||||
|
||||
s = m:section(TypedSection, "hosts", translate("Hosts"))
|
||||
s.anonymous = true
|
||||
s.addremove = true
|
||||
s.sortable = false
|
||||
s.template = "cbi/tblsection"
|
||||
s.rmempty = false
|
||||
|
||||
o = s:option(Flag, "enabled", translate("Enable"))
|
||||
o.rmempty = false
|
||||
o.default = o.enabled
|
||||
o.cfgvalue = function(...)
|
||||
return Flag.cfgvalue(...) or "1"
|
||||
end
|
||||
|
||||
o = s:option(Value, "address", translate("Address"))
|
||||
o.placeholder = translate("Cannot be Empty")
|
||||
o.rempty = true
|
||||
|
||||
o = s:option(Value, "ip", translate("IP"))
|
||||
o.placeholder = translate("Cannot be Empty")
|
||||
o.rmempty = true
|
||||
|
||||
|
||||
|
||||
s = m:section(TypedSection, "dnsservers", translate("Nameservers & Fallback"))
|
||||
s.anonymous = true
|
||||
s.addremove = true
|
||||
s.sortable = false
|
||||
s.template = "cbi/tblsection"
|
||||
s.rmempty = false
|
||||
|
||||
o = s:option(Flag, "enabled", translate("Enable"))
|
||||
o.rmempty = false
|
||||
o.default = o.enabled
|
||||
o.cfgvalue = function(...)
|
||||
return Flag.cfgvalue(...) or "1"
|
||||
end
|
||||
|
||||
o = s:option(ListValue, "ser_type", translate("Type"))
|
||||
o:value("nameserver", translate("NameServer"))
|
||||
o:value("fallback", translate("FallBack"))
|
||||
|
||||
o = s:option(ListValue, "protocol", translate("Protocol"))
|
||||
o:value("none", translate("No Protocol"))
|
||||
o:value("tcp://", translate("TCP"))
|
||||
o:value("udp://", translate("UDP"))
|
||||
o:value("tls://", translate("TLS"))
|
||||
o:value("https://", translate("HTTPS"))
|
||||
|
||||
o = s:option(Value, "ser_address", translate("Address"))
|
||||
o.placeholder = translate("Not Empty")
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "ser_port", translate("Port"))
|
||||
|
||||
|
||||
local apply = luci.http.formvalue("cbi.apply")
|
||||
if apply then
|
||||
m.uci:commit("clash")
|
||||
if luci.sys.call("pidof clash >/dev/null") == 0 then
|
||||
SYS.call("/etc/init.d/clash restart >/dev/null 2>&1 &")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash"))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
return m
|
||||
|
||||
@ -1,117 +0,0 @@
|
||||
local NXFS = require "nixio.fs"
|
||||
local SYS = require "luci.sys"
|
||||
local HTTP = require "luci.http"
|
||||
local DISP = require "luci.dispatcher"
|
||||
local UTIL = require "luci.util"
|
||||
local uci = require("luci.model.uci").cursor()
|
||||
|
||||
m = Map("clash")
|
||||
s = m:section(TypedSection, "clash")
|
||||
m.pageaction = false
|
||||
s.anonymous = true
|
||||
|
||||
o = s:option(Value, "http_port")
|
||||
o.title = translate("Http Port")
|
||||
o.default = 7890
|
||||
o.datatype = "port"
|
||||
o.rmempty = false
|
||||
o.description = translate("Http Port")
|
||||
|
||||
o = s:option(Value, "socks_port")
|
||||
o.title = translate("Socks Port")
|
||||
o.default = 7891
|
||||
o.datatype = "port"
|
||||
o.rmempty = false
|
||||
o.description = translate("Socks Port")
|
||||
|
||||
o = s:option(Value, "redir_port")
|
||||
o.title = translate("Redir Port")
|
||||
o.default = 7892
|
||||
o.datatype = "port"
|
||||
o.rmempty = false
|
||||
o.description = translate("Redir Port")
|
||||
|
||||
o = s:option(Value, "mixed_port")
|
||||
o.title = translate("Mixed Port")
|
||||
o.default = 7893
|
||||
o.datatype = "port"
|
||||
o.rmempty = false
|
||||
o.description = translate("Mixed Port")
|
||||
|
||||
o = s:option(ListValue, "allow_lan")
|
||||
o.title = translate("Allow Lan")
|
||||
o.default = true
|
||||
o.rmempty = false
|
||||
o:value("true", "true")
|
||||
o:value("false", "false")
|
||||
o.description = translate("Allow Lan")
|
||||
|
||||
o = s:option(ListValue, "enable_ipv6")
|
||||
o.title = translate("Enable IPv6")
|
||||
o.default = false
|
||||
o.rmempty = false
|
||||
o:value("true", "true")
|
||||
o:value("false", "false")
|
||||
o.description = translate("Enable IPv6")
|
||||
|
||||
o = s:option(Value, "bind_addr")
|
||||
o.title = translate("Bind Address")
|
||||
o:value("*", translate("Bind All IP Addresses"))
|
||||
luci.ip.neighbors({ family = 4 }, function(entry)
|
||||
if entry.reachable then
|
||||
o:value(entry.dest:string())
|
||||
end
|
||||
end)
|
||||
luci.ip.neighbors({ family = 6 }, function(entry)
|
||||
if entry.reachable then
|
||||
o:value(entry.dest:string())
|
||||
end
|
||||
end)
|
||||
o.description = translate("Bind Address")
|
||||
o:depends("allow_lan", "true")
|
||||
|
||||
|
||||
o = s:option(Value, "dash_port")
|
||||
o.title = translate("Dashboard Port")
|
||||
o.default = 9090
|
||||
o.datatype = "port"
|
||||
o.rmempty = false
|
||||
o.description = translate("Dashboard Port")
|
||||
|
||||
o = s:option(Value, "dash_pass")
|
||||
o.title = translate("Dashboard Secret")
|
||||
o.default = 123456
|
||||
o.rmempty = false
|
||||
o.description = translate("Dashboard Secret")
|
||||
|
||||
o = s:option(ListValue, "p_mode", translate("Proxy Mode"))
|
||||
o.description = translate("Choose proxy mode")
|
||||
o:value("rule", translate("RULE"))
|
||||
o:value("global", translate("GLOBAL"))
|
||||
o:value("Script", translate("SCRIPT"))
|
||||
o:value("direct", translate("DIRECT"))
|
||||
o.default = "Rule"
|
||||
|
||||
o = s:option(ListValue, "level", translate("Log level"))
|
||||
o.description = translate("Choose Log Level")
|
||||
o:value("info", "info")
|
||||
o:value("silent", "silent")
|
||||
o:value("warning", "warning")
|
||||
o:value("error", "error")
|
||||
o:value("debug", "debug")
|
||||
|
||||
o = s:option(Button, "Apply")
|
||||
o.title = luci.util.pcdata(translate("Save & Apply"))
|
||||
o.inputtitle = translate("Save & Apply")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
m.uci:commit("clash")
|
||||
if luci.sys.call("pidof clash >/dev/null") == 0 then
|
||||
SYS.call("/etc/init.d/clash restart >/dev/null 2>&1 &")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash"))
|
||||
else
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash" , "settings", "port"))
|
||||
end
|
||||
end
|
||||
|
||||
return m
|
||||
@ -1,64 +0,0 @@
|
||||
local m, s, o
|
||||
local clash = "clash"
|
||||
local uci = luci.model.uci.cursor()
|
||||
--local fs = require "nixio.fs"
|
||||
local sys = require "luci.sys"
|
||||
local sid = arg[1]
|
||||
local fs = require "luci.clash"
|
||||
|
||||
m = Map(clash, translate("Edit Game Rule & Group"))
|
||||
--m.pageaction = false
|
||||
m.redirect = luci.dispatcher.build_url("admin/services/clash/settings/grules")
|
||||
if m.uci:get(clash, sid) ~= "game" then
|
||||
luci.http.redirect(m.redirect)
|
||||
return
|
||||
end
|
||||
|
||||
function IsRuleFile(e)
|
||||
e=e or""
|
||||
local e=string.lower(string.sub(e,-6,-1))
|
||||
return e==".rules"
|
||||
end
|
||||
|
||||
-- [[ Groups Setting ]]--
|
||||
s = m:section(NamedSection, sid, "game")
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
|
||||
o = s:option(Value, "tag")
|
||||
o.title = translate("Rule Tag")
|
||||
o.rmempty = false
|
||||
o.description = translate("Give a special name for your rules")
|
||||
|
||||
---- Proxy Group
|
||||
o = s:option(ListValue, "group", translate("Select Proxy Group"))
|
||||
uci:foreach("clash", "conf_groups",
|
||||
function(s)
|
||||
if s.name ~= "" and s.name ~= nil then
|
||||
o:value(s.name)
|
||||
end
|
||||
end)
|
||||
o:value("DIRECT")
|
||||
o:value("REJECT")
|
||||
o.rmempty = true
|
||||
o.description = translate("Select a policy group to add rule")
|
||||
|
||||
---- rule name
|
||||
o = s:option(DynamicList, "rule_name", translate("Game Rule's Name"))
|
||||
local e,a={}
|
||||
for t,f in ipairs(fs.glob("/usr/share/clash/rules/g_rules/*"))do
|
||||
a=fs.stat(f)
|
||||
if a then
|
||||
e[t]={}
|
||||
e[t].filename=fs.basename(f)
|
||||
if IsRuleFile(e[t].filename) then
|
||||
e[t].name=luci.sys.exec(string.format("grep -F '%s' /usr/share/clash/rules/rules.list | awk -F ',' '{print $2}'",e[t].filename))
|
||||
o:value(e[t].filename)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
o.rmempty = true
|
||||
|
||||
|
||||
return m
|
||||
@ -1,179 +0,0 @@
|
||||
|
||||
local k, m, s, o, f
|
||||
local clash = "clash"
|
||||
local NXFS = require "nixio.fs"
|
||||
local SYS = require "luci.sys"
|
||||
local HTTP = require "luci.http"
|
||||
local DISP = require "luci.dispatcher"
|
||||
local UTIL = require "luci.util"
|
||||
local fs = require "luci.clash"
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
|
||||
font_red = [[<font color="red">]]
|
||||
font_blue = [[<font color="blue">]]
|
||||
font_off = [[</font>]]
|
||||
bold_on = [[<strong>]]
|
||||
bold_off = [[</strong>]]
|
||||
|
||||
|
||||
m = Map(clash)
|
||||
m.pageaction = false
|
||||
m.description=''..font_red..bold_on..translate("Usage Steps:")..bold_off..font_off..' '
|
||||
.."<br />"
|
||||
..font_blue..bold_on..translate("1.Load Policy Group, make sure you have selected a config on config page")..bold_off..font_off..' '
|
||||
.."<br />"
|
||||
..font_blue..bold_on..translate("2.Download the game rules you want to use from the game rules list on this page")..bold_off..font_off..' '
|
||||
.."<br />"
|
||||
..font_blue..bold_on..translate("3. Make sure your game and servers support UDP")..bold_off..font_off..' '
|
||||
.."<br />"
|
||||
..font_blue..bold_on..translate("4.Click on ADD, Set the corresponding policy group of the downloaded game rules and save, recommended: FallBack")..bold_off..font_off..' '
|
||||
.."<br />"
|
||||
..font_blue..bold_on..translate("5.Select ClashTun Core type and start client")..bold_off..font_off..' '
|
||||
|
||||
|
||||
SYS.call("awk -F ',' '{print $1}' /usr/share/clash/rules/rules.list > /tmp/rules_name 2>/dev/null")
|
||||
file = io.open("/tmp/rules_name", "r");
|
||||
|
||||
|
||||
r = m:section(TypedSection, "conf_groups", translate("Policy Groups"))
|
||||
r.anonymous = true
|
||||
r.addremove = false
|
||||
r.sortable = false
|
||||
r.template = "cbi/tblsection"
|
||||
--r.extedit = luci.dispatcher.build_url("admin/services/clash/g-groups/%s")
|
||||
function r.create(...)
|
||||
local sid = TypedSection.create(...)
|
||||
if sid then
|
||||
luci.http.redirect(r.extedit % sid)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
o = r:option(DummyValue, "type", translate("Group Type"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
|
||||
o = r:option(DummyValue, "name", translate("Group Name"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- [[ Edit Game Rule ]] --
|
||||
r = m:section(TypedSection, "game", translate("Game Rules & Groups"))
|
||||
r.anonymous = true
|
||||
r.addremove = true
|
||||
r.sortable = false
|
||||
r.template = "cbi/tblsection"
|
||||
r.extedit = luci.dispatcher.build_url("admin/services/clash/g-rules/%s")
|
||||
function r.create(...)
|
||||
local sid = TypedSection.create(...)
|
||||
if sid then
|
||||
luci.http.redirect(r.extedit % sid)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
o = r:option(DummyValue, "tag", translate("Game Rule Tag"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
|
||||
o = r:option(DummyValue, "group", translate("Policy Groups"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
|
||||
---- Rules List
|
||||
local e={},a,o,t
|
||||
a=nixio.fs.access("/tmp/rules_name")
|
||||
if a then
|
||||
for o in file:lines() do
|
||||
table.insert(e,o)
|
||||
end
|
||||
for t,o in ipairs(e) do
|
||||
e[t]={}
|
||||
e[t].num=string.format(t)
|
||||
e[t].name=o
|
||||
e[t].filename=string.sub(luci.sys.exec(string.format("grep -F '%s,' /usr/share/clash/rules/rules.list |awk -F ',' '{print $3}' 2>/dev/null",e[t].name)),1,-2)
|
||||
if e[t].filename == "" then
|
||||
e[t].filename=string.sub(luci.sys.exec(string.format("grep -F '%s,' /usr/share/clash/rules/rules.list |awk -F ',' '{print $2}' 2>/dev/null",e[t].name)),1,-2)
|
||||
end
|
||||
RULE_FILE="/usr/share/clash/rules/g_rules/".. e[t].filename
|
||||
if fs.mtime(RULE_FILE) then
|
||||
e[t].mtime=os.date("%Y-%m-%d %H:%M:%S",fs.mtime(RULE_FILE))
|
||||
else
|
||||
e[t].mtime="/"
|
||||
end
|
||||
if fs.isfile(RULE_FILE) then
|
||||
e[t].exist=translate("Exist")
|
||||
else
|
||||
e[t].exist=translate("Not Exist")
|
||||
end
|
||||
e[t].remove=0
|
||||
end
|
||||
end
|
||||
file:close()
|
||||
|
||||
|
||||
f=Form("filelist", translate("Game Rules List"))
|
||||
tb=f:section(Table,e)
|
||||
nu=tb:option(DummyValue,"num",translate("Order Number"))
|
||||
st=tb:option(DummyValue,"exist",translate("State"))
|
||||
--nm=tb:option(DummyValue,"name",translate("Rule Name"))
|
||||
fm=tb:option(DummyValue,"filename",translate("File Name"))
|
||||
mt=tb:option(DummyValue,"mtime",translate("Update Time"))
|
||||
|
||||
btnis=tb:option(DummyValue,"filename",translate("Download Rule"))
|
||||
btnis.template="clash/game_rule"
|
||||
|
||||
btnrm=tb:option(Button,"remove",translate("Remove"))
|
||||
btnrm.render=function(e,t,a)
|
||||
e.inputstyle="reset"
|
||||
Button.render(e,t,a)
|
||||
end
|
||||
btnrm.write=function(a,t)
|
||||
local a=fs.unlink("/usr/share/clash/rules/g_rules/"..e[t].filename)
|
||||
HTTP.redirect(luci.dispatcher.build_url("admin", "services", "clash", "settings", "grules"))
|
||||
end
|
||||
|
||||
local t = {
|
||||
{Load,Apply}
|
||||
}
|
||||
|
||||
k = Form("apply")
|
||||
k.reset = false
|
||||
k.submit = false
|
||||
s = k:section(Table, t)
|
||||
|
||||
|
||||
o = s:option(Button, "Load")
|
||||
o.inputtitle = translate("Load Groups")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
m.uci:commit("clash")
|
||||
luci.sys.call("bash /usr/share/clash/load_groups.sh >/dev/null 2>&1 &")
|
||||
luci.sys.call("sleep 3")
|
||||
HTTP.redirect(luci.dispatcher.build_url("admin", "services", "clash", "settings", "grules"))
|
||||
end
|
||||
|
||||
o = s:option(Button, "Apply")
|
||||
o.inputtitle = translate("Save & Apply")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
m.uci:commit("clash")
|
||||
if luci.sys.call("pidof clash >/dev/null") == 0 then
|
||||
SYS.call("/etc/init.d/clash restart >/dev/null 2>&1 &")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash"))
|
||||
else
|
||||
HTTP.redirect(luci.dispatcher.build_url("admin", "services", "clash", "settings", "grules"))
|
||||
end
|
||||
end
|
||||
|
||||
return m, k, f
|
||||
|
||||
@ -1,143 +0,0 @@
|
||||
|
||||
local NXFS = require "nixio.fs"
|
||||
local SYS = require "luci.sys"
|
||||
local HTTP = require "luci.http"
|
||||
local DISP = require "luci.dispatcher"
|
||||
local UTIL = require "luci.util"
|
||||
local uci = require("luci.model.uci").cursor()
|
||||
local clash = "clash"
|
||||
local http = luci.http
|
||||
|
||||
font_red = [[<font color="red">]]
|
||||
font_off = [[</font>]]
|
||||
bold_on = [[<strong>]]
|
||||
bold_off = [[</strong>]]
|
||||
|
||||
|
||||
k = Map(clash)
|
||||
k.reset = false
|
||||
k.submit = false
|
||||
s=k:section(TypedSection, "clash", translate("Local Update GeoIP"))
|
||||
s.anonymous = true
|
||||
s.addremove=false
|
||||
o = s:option(FileUpload, "")
|
||||
o.description = translate("NB: Upload GEOIP Database file Country.mmdb")
|
||||
.."<br />"
|
||||
..translate("https://github.com/Dreamacro/maxmind-geoip/releases")
|
||||
.."<br />"
|
||||
..translate("https://raw.githubusercontent.com/alecthw/mmdb_china_ip_list/release/Country.mmdb")
|
||||
|
||||
o.title = translate(" ")
|
||||
o.template = "clash/clash_upload"
|
||||
um = s:option(DummyValue, "", nil)
|
||||
um.template = "clash/clash_dvalue"
|
||||
|
||||
local dir, fd
|
||||
dir = "/etc/clash/"
|
||||
http.setfilehandler(
|
||||
function(meta, chunk, eof)
|
||||
if not fd then
|
||||
if not meta then return end
|
||||
|
||||
if meta and chunk then fd = nixio.open(dir .. meta.file, "w") end
|
||||
|
||||
if not fd then
|
||||
um.value = translate("upload file error.")
|
||||
return
|
||||
end
|
||||
end
|
||||
if chunk and fd then
|
||||
fd:write(chunk)
|
||||
end
|
||||
if eof and fd then
|
||||
fd:close()
|
||||
fd = nil
|
||||
um.value = translate("File saved to") .. ' "/etc/clash/"'
|
||||
SYS.call("chmod + x /etc/clash/Country.mmdb")
|
||||
if luci.sys.call("pidof clash >/dev/null") == 0 then
|
||||
SYS.call("/etc/init.d/clash restart >/dev/null 2>&1 &")
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
if luci.http.formvalue("upload") then
|
||||
local f = luci.http.formvalue("ulfile")
|
||||
if #f <= 0 then
|
||||
um.value = translate("No specify upload file.")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
m = Map("clash")
|
||||
s = m:section(TypedSection, "clash" , translate("Online Update GeoIP"))
|
||||
m.pageaction = false
|
||||
s.anonymous = true
|
||||
s.addremove=false
|
||||
|
||||
o = s:option(Flag, "auto_update_geoip", translate("Auto Update"))
|
||||
o.description = translate("Auto Update GeoIP Database")
|
||||
|
||||
o = s:option(ListValue, "auto_update_geoip_time", translate("Update time (every day)"))
|
||||
for t = 0,23 do
|
||||
o:value(t, t..":00")
|
||||
end
|
||||
o.default=0
|
||||
o.description = translate("GeoIP Update Time")
|
||||
|
||||
|
||||
o = s:option(ListValue, "up_time", translate("Update Every (Week/Month)"))
|
||||
o.rmempty = false
|
||||
o.description = translate("Time For Update (Once a week/Month)")
|
||||
o:value("weekly", translate("Weekly"))
|
||||
o:value("monthly", translate("Monthly"))
|
||||
|
||||
o = s:option(ListValue, "geoip_update_day", translate("Update Day (Day of Week)"))
|
||||
o:value("1", translate("Every Monday"))
|
||||
o:value("2", translate("Every Tuesday"))
|
||||
o:value("3", translate("Every Wednesday"))
|
||||
o:value("4", translate("Every Thursday"))
|
||||
o:value("5", translate("Every Friday"))
|
||||
o:value("6", translate("Every Saturday"))
|
||||
o:value("0", translate("Every Sunday"))
|
||||
update_time = SYS.exec("ls -l --full-time /etc/clash/Country.mmdb|awk '{print $6,$7;}'")
|
||||
o.description = translate("Update Time")..'- ' ..font_red..bold_on..update_time..bold_off..font_off..' '
|
||||
o:depends("up_time", "weekly")
|
||||
|
||||
o = s:option(ListValue, "geo_update_week", translate("Update Day (Day of Month)"))
|
||||
o:value("1", translate("Every 1st Day"))
|
||||
o:value("7", translate("Every 7th Day"))
|
||||
o:value("14", translate("Every 14th Day"))
|
||||
o:value("21", translate("Every 21st Day"))
|
||||
o:value("28", translate("Every 28th Day"))
|
||||
update_time = SYS.exec("ls -l --full-time /etc/clash/Country.mmdb|awk '{print $6,$7;}'")
|
||||
o.description = translate("Update Time")..'- ' ..font_red..bold_on..update_time..bold_off..font_off..' '
|
||||
o:depends("up_time", "monthly")
|
||||
|
||||
o = s:option(ListValue, "geoip_source", translate("GeoIP Source"))
|
||||
o:value("1", translate("MaxMind"))
|
||||
o:value("2", translate("Github"))
|
||||
|
||||
o = s:option(Value, "license_key")
|
||||
o.title = translate("License Key")
|
||||
o.description = translate("MaxMind License Key")..translate(" https://www.maxmind.com/en/geolite2/signup")
|
||||
o.rmempty = true
|
||||
o:depends("geoip_source", "1")
|
||||
|
||||
o=s:option(Button,"update_geoip")
|
||||
o.inputtitle = translate("Save & Apply")
|
||||
o.title = luci.util.pcdata(translate("Save & Apply"))
|
||||
o.inputstyle = "reload"
|
||||
o.write = function()
|
||||
m.uci:commit("clash")
|
||||
end
|
||||
|
||||
o = s:option(Button,"download")
|
||||
o.title = translate("Download")
|
||||
o.template = "clash/geoip"
|
||||
|
||||
|
||||
return m, k
|
||||
|
||||
@ -1,50 +0,0 @@
|
||||
|
||||
local NXFS = require "nixio.fs"
|
||||
local SYS = require "luci.sys"
|
||||
local HTTP = require "luci.http"
|
||||
local DISP = require "luci.dispatcher"
|
||||
local UTIL = require "luci.util"
|
||||
local uci = require("luci.model.uci").cursor()
|
||||
local fs = require "luci.clash"
|
||||
local http = luci.http
|
||||
|
||||
m = Map("clash")
|
||||
s = m:section(TypedSection, "clash")
|
||||
m.pageaction = false
|
||||
s.anonymous = true
|
||||
s.addremove=false
|
||||
|
||||
log = s:option(TextValue, "clog")
|
||||
log.template = "clash/status_log"
|
||||
|
||||
o = s:option(Button, "Download")
|
||||
o.inputtitle = translate("Download logs")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function ()
|
||||
local sPath, sFile, fd, block
|
||||
sPath = "/usr/share/clash/clash.txt"
|
||||
sFile = NXFS.basename(sPath)
|
||||
if fs.isdirectory(sPath) then
|
||||
fd = io.popen('txt -C "%s" -cz .' % {sPath}, "r")
|
||||
sFile = sFile .. ".txt"
|
||||
else
|
||||
fd = nixio.open(sPath, "r")
|
||||
end
|
||||
if not fd then
|
||||
return
|
||||
end
|
||||
HTTP.header('Content-Disposition', 'attachment; filename="%s"' % {sFile})
|
||||
HTTP.prepare_content("application/octet-stream")
|
||||
while true do
|
||||
block = fd:read(nixio.const.buffersize)
|
||||
if (not block) or (#block ==0) then
|
||||
break
|
||||
else
|
||||
HTTP.write(block)
|
||||
end
|
||||
end
|
||||
fd:close()
|
||||
HTTP.close()
|
||||
end
|
||||
|
||||
return m
|
||||
@ -1,141 +0,0 @@
|
||||
|
||||
local NXFS = require "nixio.fs"
|
||||
local SYS = require "luci.sys"
|
||||
local HTTP = require "luci.http"
|
||||
local DISP = require "luci.dispatcher"
|
||||
local UTIL = require "luci.util"
|
||||
local uci = luci.model.uci.cursor()
|
||||
local fs = require "luci.clash"
|
||||
local http = luci.http
|
||||
local clash = "clash"
|
||||
|
||||
kk = Map(clash)
|
||||
s = kk:section(TypedSection, "clash", translate("Auto Update Config"))
|
||||
s.anonymous = true
|
||||
kk.pageaction = false
|
||||
|
||||
o = s:option(Flag, "auto_update", translate("Auto Update"))
|
||||
o.description = translate("Auto Update Server subscription")
|
||||
|
||||
o = s:option(ListValue, "auto_update_time", translate("Update time (every day)"))
|
||||
o:value("1", translate("Every Hour"))
|
||||
o:value("6", translate("Every 6 Hours"))
|
||||
o:value("12", translate("Every 12 Hours"))
|
||||
o:value("24", translate("Every 24 Hours"))
|
||||
o.description = translate("Daily Server subscription update time. Only update config in use")
|
||||
|
||||
o = s:option(Button, "Apply")
|
||||
o.title = luci.util.pcdata(translate("Save & Apply"))
|
||||
o.inputtitle = translate("Save & Apply")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
kk.uci:commit("clash")
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
m = Map("clash")
|
||||
s = m:section(TypedSection, "clash" , translate("Clear Clash Log"))
|
||||
s.anonymous = true
|
||||
|
||||
o = s:option(Flag, "auto_clear_log", translate("Auto Clear Log"))
|
||||
o.description = translate("Auto Clear Log")
|
||||
|
||||
|
||||
o = s:option(ListValue, "clear_time", translate("Clear Time (Time of Day)"))
|
||||
o:value("1", translate("Every Hour"))
|
||||
o:value("6", translate("Every 6 Hours"))
|
||||
o:value("12", translate("Every 12 Hours"))
|
||||
o:value("24", translate("Every 24 Hours"))
|
||||
o.description = translate("Clear Log Time")
|
||||
|
||||
o=s:option(Button,"clear_clear")
|
||||
o.inputtitle = translate("Save & Apply")
|
||||
o.title = luci.util.pcdata(translate("Save & Apply"))
|
||||
o.inputstyle = "reload"
|
||||
o.write = function()
|
||||
m.uci:commit("clash")
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
w = Map("clash")
|
||||
s = w:section(TypedSection, "clash" , translate("Load Groups"))
|
||||
s.anonymous = true
|
||||
|
||||
|
||||
o = s:option(Button, "Load")
|
||||
o.inputtitle = translate("Load Groups")
|
||||
o.title = translate("Load Groups")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
w.uci:commit("clash")
|
||||
luci.sys.call("bash /usr/share/clash/load_groups.sh >/dev/null 2>&1 &")
|
||||
luci.sys.call("sleep 4")
|
||||
HTTP.redirect(luci.dispatcher.build_url("admin", "services", "clash", "settings", "other"))
|
||||
end
|
||||
|
||||
|
||||
r = w:section(TypedSection, "conf_groups", translate("Policy Groups"))
|
||||
r.anonymous = true
|
||||
r.addremove = false
|
||||
r.sortable = false
|
||||
r.template = "cbi/tblsection"
|
||||
function r.create(...)
|
||||
local sid = TypedSection.create(...)
|
||||
if sid then
|
||||
luci.http.redirect(r.extedit % sid)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
o = r:option(DummyValue, "type", translate("Group Type"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
|
||||
o = r:option(DummyValue, "name", translate("Group Name"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
|
||||
|
||||
y = Map("clash")
|
||||
x = y:section(TypedSection, "addtype", translate("Custom Rules"))
|
||||
x.anonymous = true
|
||||
x.addremove = true
|
||||
x.sortable = false
|
||||
x.template = "cbi/tblsection"
|
||||
x.extedit = luci.dispatcher.build_url("admin/services/clash/ip-rules/%s")
|
||||
function x.create(...)
|
||||
local sid = TypedSection.create(...)
|
||||
if sid then
|
||||
luci.http.redirect(x.extedit % sid)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
o = x:option(DummyValue, "type", translate("Rule Type"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
o = x:option(DummyValue, "ipaaddr", translate("IP/Domain/Address/Keyword/Port"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
|
||||
o = x:option(DummyValue, "pgroup", translate("Policy Groups"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
return kk, m,w,y
|
||||
@ -1,13 +0,0 @@
|
||||
|
||||
local m
|
||||
local sys = require "luci.sys"
|
||||
local uci = luci.model.uci.cursor()
|
||||
|
||||
|
||||
|
||||
m = Map("clash")
|
||||
m:section(SimpleSection).template = "clash/status"
|
||||
m.pageaction = false
|
||||
|
||||
return m
|
||||
|
||||
@ -1,147 +0,0 @@
|
||||
local NXFS = require "nixio.fs"
|
||||
local SYS = require "luci.sys"
|
||||
local HTTP = require "luci.http"
|
||||
local DISP = require "luci.dispatcher"
|
||||
local UTIL = require "luci.util"
|
||||
local uci = require("luci.model.uci").cursor()
|
||||
local m , r, k
|
||||
local http = luci.http
|
||||
|
||||
font_red = [[<font color="red">]]
|
||||
font_green = [[<font color="green">]]
|
||||
font_off = [[</font>]]
|
||||
bold_on = [[<strong>]]
|
||||
bold_off = [[</strong>]]
|
||||
|
||||
|
||||
|
||||
ko = Map("clash")
|
||||
ko.reset = false
|
||||
ko.submit = false
|
||||
sul =ko:section(TypedSection, "clash",translate("Manual Upload"))
|
||||
sul.anonymous = true
|
||||
sul.addremove=false
|
||||
o = sul:option(FileUpload, "")
|
||||
o.description =''..font_red..bold_on..translate("Manually download, unzip and rename clash core from links below and upload")..bold_off..font_off..' '
|
||||
.."<br />"
|
||||
..translatef("<a href=\"%s\" target=\"_blank\">" .. "Dreamacro clash core - clash</a>", translate("https://github.com/Dreamacro/clash/releases/latest"))
|
||||
.."<br />"
|
||||
..translatef("<a href=\"%s\" target=\"_blank\">" .. "Frainzy1477 clashr core - clash</a>", translate("https://github.com/frainzy1477/clash_dev/releases/latest"))
|
||||
.."<br />"
|
||||
..translatef("<a href=\"%s\" target=\"_blank\">" .. "comzyh clash tun core - clash(ctun)</a>", translate("https://github.com/comzyh/clash/releases/latest"))
|
||||
.."<br />"
|
||||
..translatef("<a href=\"%s\" target=\"_blank\">" .. "Dreamacro clash tun core - clash(premium)</a>", translate("https://github.com/Dreamacro/clash/releases/tag/premium"))
|
||||
|
||||
|
||||
o.title = translate(" ")
|
||||
o.template = "clash/upload_core"
|
||||
um = sul:option(DummyValue, "", nil)
|
||||
um.template = "clash/clash_dvalue"
|
||||
|
||||
local dir, fd,dtun,ctun,cssr
|
||||
dir = "/etc/clash/"
|
||||
dtun="/etc/clash/dtun/"
|
||||
ctun="/etc/clash/clashtun/"
|
||||
|
||||
http.setfilehandler(
|
||||
function(meta, chunk, eof)
|
||||
local fp = HTTP.formvalue("file_type")
|
||||
if not fd then
|
||||
if not meta then return end
|
||||
|
||||
if fp == "clash" then
|
||||
if meta and chunk then fd = nixio.open(dir .. meta.file, "w") end
|
||||
elseif fp == "clashctun" then
|
||||
if meta and chunk then fd = nixio.open(ctun .. meta.file, "w") end
|
||||
elseif fp == "clashdtun" then
|
||||
if meta and chunk then fd = nixio.open(dtun .. meta.file, "w") end
|
||||
end
|
||||
|
||||
if not fd then
|
||||
um.value = translate("upload file error.")
|
||||
return
|
||||
end
|
||||
end
|
||||
if chunk and fd then
|
||||
fd:write(chunk)
|
||||
end
|
||||
if eof and fd then
|
||||
fd:close()
|
||||
fd = nil
|
||||
|
||||
if fp == "clash" then
|
||||
SYS.exec("chmod 755 /etc/clash/clash 2>&1 &")
|
||||
SYS.exec("rm -rf /usr/share/clash/core_version 2>/dev/null && /etc/clash/clash -v | awk -F ' ' '{print $2}' >> /usr/share/clash/core_version 2>/dev/null")
|
||||
um.value = translate("File saved to") .. ' "/etc/clash/'..meta.file..'"'
|
||||
elseif fp == "clashctun" then
|
||||
SYS.exec("chmod 755 /etc/clash/clashtun/clash 2>&1 &")
|
||||
SYS.exec("rm -rf /usr/share/clash/tun_version 2>/dev/null && /etc/clash/clashtun/clash -v | awk -F ' ' '{print $2}' >> /usr/share/clash/tun_version 2>/dev/null")
|
||||
um.value = translate("File saved to") .. ' "/etc/clash/clashtun/'..meta.file..'"'
|
||||
elseif fp == "clashdtun" then
|
||||
SYS.exec("chmod 755 /etc/clash/dtun/clash 2>&1 &")
|
||||
SYS.exec("rm -rf /usr/share/clash/dtun_core_version 2>/dev/null && /etc/clash/dtun/clash -v | awk -F ' ' '{print $2}' >> /usr/share/clash/dtun_core_version 2>/dev/null")
|
||||
um.value = translate("File saved to") .. ' "/etc/clash/dtun/'..meta.file..'"'
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
if luci.http.formvalue("upload") then
|
||||
local f = luci.http.formvalue("ulfile")
|
||||
if #f <= 0 then
|
||||
um.value = translate("No specify upload file.")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
m = Map("clash")
|
||||
m:section(SimpleSection).template = "clash/update"
|
||||
m.pageaction = false
|
||||
|
||||
k = Map("clash")
|
||||
s = k:section(TypedSection, "clash",translate("Download Online"))
|
||||
s.anonymous = true
|
||||
o = s:option(ListValue, "dcore", translate("Core Type"))
|
||||
o.default = "clashcore"
|
||||
o:value("1", translate("clash"))
|
||||
o:value("3", translate("clash(ctun)"))
|
||||
o:value("4", translate("clash(premium)"))
|
||||
|
||||
|
||||
|
||||
local cpu_model=SYS.exec("opkg status libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' 2>/dev/null")
|
||||
o = s:option(ListValue, "download_core", translate("Select Core"))
|
||||
o.description = translate("CPU Model")..': '..font_green..bold_on..cpu_model..bold_off..font_off..' '
|
||||
o:value("linux-386")
|
||||
o:value("linux-amd64", translate("linux-amd64(x86-64)"))
|
||||
o:value("linux-armv5")
|
||||
o:value("linux-armv6")
|
||||
o:value("linux-armv7")
|
||||
o:value("linux-armv8")
|
||||
o:value("linux-mips-hardfloat")
|
||||
o:value("linux-mips-softfloat")
|
||||
o:value("linux-mips64")
|
||||
o:value("linux-mips64le")
|
||||
o:value("linux-mipsle-softfloat")
|
||||
o:value("linux-mipsle-hardfloat")
|
||||
|
||||
|
||||
o=s:option(Button,"down_core")
|
||||
o.inputtitle = translate("Save & Apply")
|
||||
o.title = luci.util.pcdata(translate("Save & Apply"))
|
||||
o.inputstyle = "reload"
|
||||
o.write = function()
|
||||
k.uci:commit("clash")
|
||||
end
|
||||
|
||||
o = s:option(Button,"download")
|
||||
o.title = translate("Download")
|
||||
o.template = "clash/core_check"
|
||||
|
||||
|
||||
return m, ko,k
|
||||
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
<span style="color: red">
|
||||
<%
|
||||
local val = self:cfgvalue(section) or self.default or ""
|
||||
write(pcdata(val))
|
||||
%>
|
||||
</span>
|
||||
<%+cbi/valuefooter%>
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
<label class="cbi-value" style="display:inline-block;" for="ulfile"></label>
|
||||
<input class="cbi-input-file" style="width: 80%" type="file" id="ulfile" name="ulfile" />
|
||||
<input type="submit" style="width: 100%" class="cbi-button cbi-input-apply" name="upload" value="<%:Upload%>" />
|
||||
<%+cbi/valuefooter%>
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
<fieldset class="cbi-section">
|
||||
<p width="100%" align="center"><font color="blue"><b><%:CONFIG IN USE%>:</b> <b id="_conf_path"></b></font></p>
|
||||
</fieldset>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
var conf_path = document.getElementById('_conf_path');
|
||||
XHR.poll(1, '<%=luci.dispatcher.build_url("admin", "services", "clash", "conf")%>', null, function(x, status) {
|
||||
if ( x && x.status == 200 ) {
|
||||
|
||||
if(status.typeconf==1){
|
||||
conf_path.innerHTML = status.conf_path ? '<b><font color="green"><%:SUBSCRIBE%> 【'+status.conf_path+'】</font></b>' : '<b><font color="red"><%:NOT SELECTED%></font></b>';
|
||||
}
|
||||
if(status.typeconf==2){
|
||||
conf_path.innerHTML = status.conf_path ? '<b><font color="green"><%:UPLOAD%> 【'+status.conf_path+'】</font></b>' : '<b><font color="red"><%:NOT SELECTED%></font></b>';
|
||||
}
|
||||
if(status.typeconf==3){
|
||||
conf_path.innerHTML = status.conf_path ? '<b><font color="green"><%:CUSTOM%> 【'+status.conf_path+'】</font></b>' : '<b><font color="red"><%:NOT SELECTED%></font></b>';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//]]></script>
|
||||
@ -1,71 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
<%local fs=require"nixio.fs"%>
|
||||
|
||||
<input type="button" class="cbi-button cbi-button-apply" id="apply_update_button" value="<%:Download%>" onclick=" return apply_update() "/>
|
||||
<br /><br />
|
||||
<textarea id="core_download" class="cbi-input-textarea" style="width: 100%;display:none" data-update="change" rows="10" cols="100" readonly="readonly" > </textarea>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
|
||||
function apply_update(){
|
||||
XHR.get('<%=url([[admin]], [[services]], [[clash]], [[doupdate]])%>',null,function(x, data){}
|
||||
);
|
||||
poll_check();
|
||||
return
|
||||
}
|
||||
|
||||
function poll_check(){
|
||||
var lv = document.getElementById('core_download');
|
||||
lv.style.display="inline"
|
||||
XHR.poll(2, '<%=url([[admin]], [[services]], [[clash]], [[check]])%>', null,
|
||||
function(x, data) {
|
||||
var lv = document.getElementById('core_download');
|
||||
if (x.responseText && lv) {
|
||||
lv.innerHTML += x.responseText;
|
||||
lv.scrollTop = lv.scrollHeight;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
XHR.poll(3, '<%=luci.dispatcher.build_url("admin", "services", "clash", "corelog")%>', null, function(x, status) {
|
||||
if ( x && x.status == 200 ) {
|
||||
if(status.downcheck==0||status.downcheck==2){
|
||||
hide();
|
||||
}
|
||||
if(status.downcheck==1){
|
||||
var btn = document.getElementById('apply_update_button');
|
||||
btn.disabled = false;
|
||||
btn.value = '<%:Download%>';
|
||||
poll_check();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
//]]>
|
||||
|
||||
function hide(){
|
||||
$('#core_download').hide();
|
||||
var btn = document.getElementById('apply_update_button');
|
||||
btn.disabled = false;
|
||||
btn.value = '<%:Download%>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
<% if fs.access("/var/run/core_update") then %>
|
||||
var btn = document.getElementById('apply_update_button');
|
||||
btn.disabled = true;
|
||||
btn.value = '<%:Downloading...%>';
|
||||
poll_check();
|
||||
<%end%>
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<%+cbi/valuefooter%>
|
||||
@ -1,38 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
function act_download_rule(btn,filename)
|
||||
{
|
||||
btn.disabled = true;
|
||||
btn.value = '<%:Downloading...%> ';
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "clash","game_rule")%>',
|
||||
{
|
||||
filename: filename
|
||||
},
|
||||
function(x,status)
|
||||
{
|
||||
if ( x && x.status == 200 ) {
|
||||
if(status.game_rule=="0")
|
||||
{
|
||||
btn.value = '<%:Error%>';
|
||||
}
|
||||
else
|
||||
{
|
||||
btn.value = '<%:Successful%>';
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
else {
|
||||
btn.value = '<%:Timeout%>';
|
||||
}
|
||||
}
|
||||
);
|
||||
btn.disabled = false;
|
||||
return false;
|
||||
}
|
||||
//]]></script>
|
||||
|
||||
|
||||
<input type="button" class="cbi-button cbi-input-reload" value="<%:Update Rule%>" onclick="return act_download_rule(this,'<%=self:cfgvalue(section)%>')" />
|
||||
|
||||
<%+cbi/valuefooter%>
|
||||
@ -1,72 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
<%local fs=require"nixio.fs"%>
|
||||
|
||||
<input type="button" class="cbi-button cbi-button-apply" id="apply_update_geoip" value="<%:Download%>" onclick=" return apply_update() "/>
|
||||
<br /><br />
|
||||
<textarea id="geoip_download" class="cbi-input-textarea" style="width: 100%;display:none" data-update="change" rows="10" cols="100" readonly="readonly" > </textarea>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
|
||||
function apply_update(){
|
||||
XHR.get('<%=url([[admin]], [[services]], [[clash]], [[geoipupdate]])%>',null,function(x, data){}
|
||||
);
|
||||
poll_check();
|
||||
return
|
||||
}
|
||||
|
||||
function poll_check(){
|
||||
var lv = document.getElementById('geoip_download');
|
||||
lv.style.display="inline"
|
||||
XHR.poll(2, '<%=url([[admin]], [[services]], [[clash]], [[check_geoip]])%>', null,
|
||||
function(x, data) {
|
||||
var lv = document.getElementById('geoip_download');
|
||||
if (x.responseText && lv) {
|
||||
lv.innerHTML += x.responseText;
|
||||
lv.scrollTop = lv.scrollHeight;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
XHR.poll(3, '<%=luci.dispatcher.build_url("admin", "services", "clash", "geo")%>', null, function(x, status) {
|
||||
if ( x && x.status == 200 ) {
|
||||
if(status.geoipcheck==0||status.geoipcheck==2){
|
||||
hide();
|
||||
}
|
||||
if(status.geoipcheck==1){
|
||||
var btn = document.getElementById('apply_update_geoip');
|
||||
btn.disabled = false;
|
||||
btn.value = '<%:Download%>';
|
||||
poll_check();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
//]]>
|
||||
|
||||
function hide(){
|
||||
$('#geoip_download').hide();
|
||||
var btn = document.getElementById('apply_update_geoip');
|
||||
btn.disabled = false;
|
||||
btn.value = '<%:Download%>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
<% if fs.access("/var/run/geoip_update") then %>
|
||||
var btn = document.getElementById('apply_update_geoip');
|
||||
btn.disabled = true;
|
||||
btn.value = '<%:Downloading...%>';
|
||||
poll_check();
|
||||
<%end%>
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<%+cbi/valuefooter%>
|
||||
@ -1,47 +0,0 @@
|
||||
|
||||
<%
|
||||
local dsp = require "luci.dispatcher"
|
||||
-%>
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
var pings = document.getElementsByClassName('ping');
|
||||
for(var i = 0; i < pings.length; i++) {
|
||||
XHR.get('<%=dsp.build_url("admin", "services", "clash", "ping")%>', {
|
||||
index: i,
|
||||
domain: pings[i].getAttribute("hint")
|
||||
},
|
||||
function(x, result) {
|
||||
if (result.ping < 500) {
|
||||
pings[result.index].innerHTML = (result.ping ? "<b><font color='#ee1010'>"+result.ping+"</font></b> ms" : "<b><font color=red><%:Error%></font></b>");
|
||||
}
|
||||
if (result.ping < 200){
|
||||
pings[result.index].innerHTML = (result.ping ? "<b><font color='#7acc03'>"+result.ping+"</font></b> ms" : "<b><font color=red><%:Error%></font></b>");
|
||||
}
|
||||
if (result.ping < 100){
|
||||
pings[result.index].innerHTML = (result.ping ? "<b><font color='#007e1a'>"+result.ping+"</font></b> ms" : "<b><font color=red><%:Error%></font></b>");
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
XHR.poll(20,'<%=dsp.build_url("admin", "services", "clash", "ping")%>',{
|
||||
index: i,
|
||||
domain: pings[i].getAttribute("hint")
|
||||
},
|
||||
function(x, result) {
|
||||
if (result.ping < 500) {
|
||||
pings[result.index].innerHTML = (result.ping ? "<b><font color='#ee1010'>"+result.ping+"</font></b> ms" : "<b><font color=red><%:Error%></font></b>");
|
||||
}
|
||||
if (result.ping < 200){
|
||||
pings[result.index].innerHTML = (result.ping ? "<b><font color='#7acc03'>"+result.ping+"</font></b> ms" : "<b><font color=red><%:Error%></font></b>");
|
||||
}
|
||||
if (result.ping < 100){
|
||||
pings[result.index].innerHTML = (result.ping ? "<b><font color='#007e1a'>"+result.ping+"</font></b> ms" : "<b><font color=red><%:Error%></font></b>");
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
<% if self:cfgvalue(section) ~= false then %>
|
||||
<input class="cbi-button cbi-input-<%=self.inputstyle or "button" %>" style="display: <%= display %>" type="submit"<%= attr("name", cbid) .. attr("id", cbid) .. attr("value", self.inputtitle or self.title)%> />
|
||||
<% else %>
|
||||
-
|
||||
<% end %>
|
||||
<%+cbi/valuefooter%>
|
||||
@ -1,5 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
<span class="ping" hint="<%=self:cfgvalue(section)%>"><%:Checking...%></span>
|
||||
<%+cbi/valuefooter%>
|
||||
|
||||
|
||||
@ -1,41 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
function act_download_rule(btn,filename)
|
||||
{
|
||||
btn.disabled = true;
|
||||
btn.value = '<%:Downloading...%> ';
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "clash","ruleproviders")%>',
|
||||
{
|
||||
filename: filename
|
||||
},
|
||||
function(x,status)
|
||||
{
|
||||
if ( x && x.status == 200 ) {
|
||||
if(status.rulep=="0")
|
||||
{
|
||||
btn.value = '<%:Error%>';
|
||||
}
|
||||
else if (status.rulep=="1")
|
||||
{
|
||||
btn.value = '<%:Successful%>';
|
||||
window.location.reload();
|
||||
}else if (status.rulep=="2")
|
||||
{
|
||||
btn.value = '<%:Not Updated%>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
btn.value = '<%:Timeout%>';
|
||||
}
|
||||
}
|
||||
);
|
||||
btn.disabled = false;
|
||||
return false;
|
||||
}
|
||||
//]]></script>
|
||||
|
||||
|
||||
<input type="button" class="cbi-button cbi-input-reload" value="<%:Update Rule Providers%>" onclick="return act_download_rule(this,'<%=self:cfgvalue(section)%>')" />
|
||||
|
||||
<%+cbi/valuefooter%>
|
||||
@ -1,252 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
function padright(str, cnt, pad) {
|
||||
return str + Array(cnt + 1).join(pad);
|
||||
}
|
||||
function b64EncodeUnicode(str) {
|
||||
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {
|
||||
return String.fromCharCode('0x' + p1);
|
||||
}));
|
||||
}
|
||||
function b64encutf8safe(str) {
|
||||
return b64EncodeUnicode(str).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, '');
|
||||
}
|
||||
function b64DecodeUnicode(str) {
|
||||
return decodeURIComponent(Array.prototype.map.call(atob(str), function (c) {
|
||||
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
||||
}).join(''));
|
||||
}
|
||||
function b64decutf8safe(str) {
|
||||
var l;
|
||||
str = str.replace(/-/g, "+").replace(/_/g, "/");
|
||||
l = str.length;
|
||||
l = (4 - l % 4) % 4;
|
||||
if (l)
|
||||
str = padright(str, l, "=");
|
||||
return b64DecodeUnicode(str);
|
||||
}
|
||||
function b64encsafe(str) {
|
||||
return btoa(str).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, '')
|
||||
}
|
||||
function b64decsafe(str) {
|
||||
var l;
|
||||
str = str.replace(/-/g, "+").replace(/_/g, "/");
|
||||
l = str.length;
|
||||
l = (4 - l % 4) % 4;
|
||||
if (l)
|
||||
str = padright(str, l, "=");
|
||||
return atob(str);
|
||||
}
|
||||
function dictvalue(d, key) {
|
||||
var v = d[key];
|
||||
if (typeof (v) == 'undefined' || v == '')
|
||||
return '';
|
||||
return b64decsafe(v);
|
||||
}
|
||||
|
||||
|
||||
function import_ssr_url(btn, urlname, sid) {
|
||||
var s = document.getElementById(urlname + '-status');
|
||||
if (!s)
|
||||
return false;
|
||||
var ssrurl = prompt("ssr:// | ss:// | vmess:// | trojan://", "");
|
||||
if (ssrurl == null || ssrurl == "") {
|
||||
s.innerHTML = "<font color='red'><%:Operation Aborted%></font>";
|
||||
return false;
|
||||
}
|
||||
s.innerHTML = "";
|
||||
//var ssu = ssrurl.match(/ssr:\/\/([A-Za-z0-9_-]+)/i);
|
||||
var ssu = ssrurl.split('://');
|
||||
console.log(ssu.length);
|
||||
if ((ssu[0] != "ssr" && ssu[0] != "ss" && ssu[0] != "vmess" && ssu[0] != "trojan") || ssu[1] == "") {
|
||||
s.innerHTML = "<font color='red'><%:Invalid link%></font>";
|
||||
return false;
|
||||
}
|
||||
|
||||
var event = document.createEvent("HTMLEvents");
|
||||
event.initEvent("change", true, true);
|
||||
if (ssu[0] == "ssr") {
|
||||
var sstr = b64decsafe(ssu[1]);
|
||||
var ploc = sstr.indexOf("/?");
|
||||
document.getElementById('cbid.clash.' + sid + '.type').value = "ssr";
|
||||
document.getElementById('cbid.clash.' + sid + '.type').dispatchEvent(event);
|
||||
var url0, param = "";
|
||||
if (ploc > 0) {
|
||||
url0 = sstr.substr(0, ploc);
|
||||
param = sstr.substr(ploc + 2);
|
||||
}
|
||||
var ssm = url0.match(/^(.+):([^:]+):([^:]*):([^:]+):([^:]*):([^:]+)/);
|
||||
if (!ssm || ssm.length < 7)
|
||||
return false;
|
||||
var pdict = {};
|
||||
if (param.length > 2)
|
||||
{
|
||||
var a = param.split('&');
|
||||
for (var i = 0; i < a.length; i++) {
|
||||
var b = a[i].split('=');
|
||||
pdict[decodeURIComponent(b[0])] = decodeURIComponent(b[1] || '');
|
||||
}
|
||||
}
|
||||
document.getElementById('cbid.clash.' + sid + '.server').value = ssm[1];
|
||||
document.getElementById('cbid.clash.' + sid + '.port').value = ssm[2];
|
||||
document.getElementById('cbid.clash.' + sid + '.protocol').value = ssm[3];
|
||||
document.getElementById('cbid.clash.' + sid + '.cipher_ssr').value = ssm[4];
|
||||
document.getElementById('cbid.clash.' + sid + '.obfs_ssr').value = ssm[5];
|
||||
document.getElementById('cbid.clash.' + sid + '.password').value = b64decsafe(ssm[6]);
|
||||
document.getElementById('cbid.clash.' + sid + '.obfsparam').value = dictvalue(pdict, 'obfsparam');
|
||||
document.getElementById('cbid.clash.' + sid + '.protocolparam').value = dictvalue(pdict, 'protoparam');
|
||||
var rem = pdict['remarks'];
|
||||
if (typeof (rem) != 'undefined' && rem != '' && rem.length > 0)
|
||||
document.getElementById('cbid.clash.' + sid + '.name').value = b64decutf8safe(rem);
|
||||
s.innerHTML = "<font color='green'><%:Import ShadowsocksR config info successful%></font>";
|
||||
return false;
|
||||
} else if (ssu[0] == "ss") {
|
||||
|
||||
|
||||
var sipIndex = ssu[1].split("@");
|
||||
var sstr = b64decsafe(sipIndex[0]);
|
||||
var ssm = sstr.split(':');
|
||||
var team = sipIndex[1].split(':');
|
||||
|
||||
//var obfs = port[1].split('=');
|
||||
var temp = ssu[1].split("?");
|
||||
|
||||
if (temp[1]) {
|
||||
var pluginInfo = decodeURIComponent(temp[1]);
|
||||
}
|
||||
|
||||
document.getElementById('cbid.clash.' + sid + '.type').value = "ss";
|
||||
document.getElementById('cbid.clash.' + sid + '.type').dispatchEvent(event);
|
||||
document.getElementById('cbid.clash.' + sid + '.server').value = team[0];
|
||||
document.getElementById('cbid.clash.' + sid + '.password').value = ssm[1];
|
||||
document.getElementById('cbid.clash.' + sid + '.cipher').value = ssm[0];
|
||||
|
||||
if (temp[1]) {
|
||||
var name = pluginInfo.split("#");
|
||||
var port = team[1].split('?');
|
||||
var obfslocal = name[0].split(';')
|
||||
var obfs = obfslocal[1].split('=')
|
||||
var obfshost = obfslocal[2].split('=')
|
||||
document.getElementById('cbid.clash.' + sid + '.port').value = port[0];
|
||||
document.getElementById('cbid.clash.' + sid + '.name').value = name[1];
|
||||
document.getElementById('cbid.clash.' + sid + '.obfs').value = obfs[1];
|
||||
document.getElementById('cbid.clash.' + sid + '.obfs').dispatchEvent(event);
|
||||
document.getElementById('cbid.clash.' + sid + '.host').value = obfshost[1];
|
||||
}
|
||||
if (!temp[1]) {
|
||||
var name2 = sipIndex[1].split('#');
|
||||
var port = name2[0].split(':');
|
||||
document.getElementById('cbid.clash.' + sid + '.port').value = port[1];
|
||||
document.getElementById('cbid.clash.' + sid + '.name').value = name2[1];
|
||||
document.getElementById('cbid.clash.' + sid + '.obfs').value = " ";
|
||||
document.getElementById('cbid.clash.' + sid + '.obfs').dispatchEvent(event);
|
||||
}
|
||||
|
||||
s.innerHTML = "<font color='green'><%:Import Shadowsocks config info successful%></font>";
|
||||
return false;
|
||||
|
||||
} else if (ssu[0] == "trojan") {
|
||||
|
||||
var url0, param = "";
|
||||
var ploc = ssu[1].indexOf("#");
|
||||
if (ploc > 0) {
|
||||
url0 = ssu[1].substr(0, ploc);
|
||||
param = ssu[1].substr(ploc + 1);
|
||||
} else {
|
||||
url0 = ssu[1]
|
||||
}
|
||||
var sstr = url0;
|
||||
var name = ssrurl.split('#');
|
||||
document.getElementById('cbid.clash.' + sid + '.type').value = "trojan";
|
||||
document.getElementById('cbid.clash.' + sid + '.type').dispatchEvent(event);
|
||||
var team = sstr.split('@');
|
||||
var password = team[0]
|
||||
var serverPart = team[1].split(':');
|
||||
var others = serverPart[1].split('?');
|
||||
var port = others[0]
|
||||
var queryParam = {}
|
||||
if(others.length > 1) {
|
||||
var queryParams = others[1]
|
||||
var queryArray = queryParams.split('&')
|
||||
for (i = 0; i < queryArray.length; i++) {
|
||||
var params = queryArray[i].split('=');
|
||||
queryParam[decodeURIComponent(params[0])] = decodeURIComponent(params[1] || '');
|
||||
}
|
||||
}
|
||||
document.getElementById('cbid.clash.' + sid + '.name').value = name[1];
|
||||
document.getElementById('cbid.clash.' + sid + '.server').value = serverPart[0];
|
||||
document.getElementById('cbid.clash.' + sid + '.port').value = port;
|
||||
document.getElementById('cbid.clash.' + sid + '.password').value = password;
|
||||
document.getElementById('cbid.clash.' + sid + '.sni').value = serverPart[0];
|
||||
document.getElementById('cbid.clash.' + sid + '.alpn_http').checked = true;
|
||||
document.getElementById('cbid.clash.' + sid + '.alpn_h2').checked = false;
|
||||
|
||||
|
||||
|
||||
s.innerHTML = "<font color='green'><%:Import Trojan config info successful%></font>";
|
||||
return false;
|
||||
} else if (ssu[0] == "vmess") {
|
||||
var sstr = b64DecodeUnicode(ssu[1]);
|
||||
var ploc = sstr.indexOf("/?");
|
||||
document.getElementById('cbid.clash.' + sid + '.type').value = "vmess";
|
||||
document.getElementById('cbid.clash.' + sid + '.type').dispatchEvent(event);
|
||||
var url0, param = "";
|
||||
if (ploc > 0) {
|
||||
url0 = sstr.substr(0, ploc);
|
||||
param = sstr.substr(ploc + 2);
|
||||
}
|
||||
var ssm = JSON.parse(sstr);
|
||||
document.getElementById('cbid.clash.' + sid + '.name').value = ssm.ps;
|
||||
document.getElementById('cbid.clash.' + sid + '.server').value = ssm.add;
|
||||
document.getElementById('cbid.clash.' + sid + '.port').value = ssm.port;
|
||||
document.getElementById('cbid.clash.' + sid + '.alterId').value = ssm.aid;
|
||||
document.getElementById('cbid.clash.' + sid + '.uuid').value = ssm.id;
|
||||
|
||||
|
||||
|
||||
if (ssm.net == "tcp") {
|
||||
document.getElementById('cbid.clash.' + sid + '.obfs_vmess').value = "none";
|
||||
document.getElementById('cbid.clash.' + sid + '.obfs_vmess').dispatchEvent(event);
|
||||
|
||||
if (ssm.tls == "tls" || ssm.tls == "1" || ssm.tls == "true") {
|
||||
document.getElementById('cbid.clash.' + sid + '.tls').value = "true";
|
||||
document.getElementById('cbid.clash.' + sid + '.tls').dispatchEvent(event);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (ssm.net == "ws") {
|
||||
document.getElementById('cbid.clash.' + sid + '.obfs_vmess').value = "websocket";
|
||||
document.getElementById('cbid.clash.' + sid + '.obfs_vmess').dispatchEvent(event);
|
||||
document.getElementById('cbid.clash.' + sid + '.path').value = ssm.path;
|
||||
document.getElementById('cbid.clash.' + sid + '.custom').value = ssm.host;
|
||||
|
||||
if (ssm.tls == "tls" || ssm.tls == "1" || ssm.tls == "true") {
|
||||
document.getElementById('cbid.clash.' + sid + '.tls').value = "true";
|
||||
document.getElementById('cbid.clash.' + sid + '.tls').dispatchEvent(event);
|
||||
}
|
||||
|
||||
}
|
||||
if (ssm.net == "h2") {
|
||||
document.getElementById('cbid.clash.' + sid + '.obfs_vmess').value = "http";
|
||||
document.getElementById('cbid.clash.' + sid + '.obfs_vmess').dispatchEvent(event);
|
||||
document.getElementById('cbid.clash.' + sid + '.http_path').value = ssm.path;
|
||||
document.getElementById('cbid.clash.' + sid + '.keep_alive').checked = true;
|
||||
document.getElementById('cbid.clash.' + sid + '.keep_alive').dispatchEvent(event);
|
||||
|
||||
if (ssm.tls == "tls" || ssm.tls == "1" || ssm.tls == "true") {
|
||||
document.getElementById('cbid.clash.' + sid + '.tls').value = "true";
|
||||
document.getElementById('cbid.clash.' + sid + '.tls').dispatchEvent(event);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
s.innerHTML = "<font color='green'><%:Import V2ray config info successful%></font>";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//]]></script>
|
||||
<input type="button" class="cbi-button cbi-button-apply" value="<%:Import config info%>" onclick="return import_ssr_url(this, '<%=self.option%>', '<%=self.value%>')" />
|
||||
<span id="<%=self.option%>-status"></span>
|
||||
<%+cbi/valuefooter%>
|
||||
@ -1,34 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
|
||||
<input type="button" class="cbi-button cbi-button-apply" value="<%:Start%>" onclick=" return start() "/>
|
||||
<input type="button" class="cbi-button cbi-button-apply" value="<%:Stop%>" onclick=" return stop() "/>
|
||||
<input type="button" class="cbi-button cbi-button-apply" value="<%:Reload%>" onclick=" return reload() "/>
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
function start(){
|
||||
XHR.get('<%=url([[admin]], [[services]], [[clash]], [[start]])%>',null,function(x, data){}
|
||||
);
|
||||
window.setTimeout("location.href='/cgi-bin/luci/admin/services/clash/'", 500);
|
||||
return
|
||||
}
|
||||
|
||||
function stop(){
|
||||
XHR.get('<%=url([[admin]], [[services]], [[clash]], [[stop]])%>',null,function(x, data){}
|
||||
);
|
||||
window.setTimeout("location.href='/cgi-bin/luci/admin/services/clash/'", 500);
|
||||
return
|
||||
}
|
||||
|
||||
function reload(){
|
||||
XHR.get('<%=url([[admin]], [[services]], [[clash]], [[reload]])%>',null,function(x, data){}
|
||||
);
|
||||
window.setTimeout("location.href='/cgi-bin/luci/admin/services/clash/'", 500);
|
||||
return
|
||||
}
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
<%+cbi/valuefooter%>
|
||||
File diff suppressed because one or more lines are too long
@ -1,22 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
|
||||
<textarea id="log" class="cbi-input-textarea" style="width: 100%;" data-update="change" rows="29" readonly="readonly" > </textarea>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
|
||||
var lv = document.getElementById('log');
|
||||
lv.style.display="inline"
|
||||
XHR.poll(1, '<%=url([[admin]], [[services]], [[clash]], [[logstatus]])%>', null,
|
||||
function(x, data) {
|
||||
|
||||
var lv = document.getElementById('log');
|
||||
if (x.responseText && lv) {
|
||||
lv.innerHTML += x.responseText;
|
||||
lv.scrollTop = lv.scrollHeight;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
<%+cbi/valuefooter%>
|
||||
@ -1,6 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
<textarea class="cbi-input-textarea" style="width: 100%" rows="30" cols="45" data-update="change" <%= attr("name", cbid) .. attr("id", cbid) %>>
|
||||
<%-=pcdata(self:cfgvalue(section))-%>
|
||||
</textarea>
|
||||
<%+cbi/valuefooter%>
|
||||
|
||||
@ -1,94 +0,0 @@
|
||||
<fieldset class="cbi-section">
|
||||
<table width="100%" cellspacing="10">
|
||||
<thead align="center">
|
||||
<tr>
|
||||
<th align="center"><%:App Name%></th>
|
||||
<th align="center"><%:Installed Version%></th>
|
||||
<th align="center"><%:New Version%></th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td align="center" width="35%">clash</td> <td align="center" width="35%" id="_core"><%:Collecting data...%></td> <td width="35%" align="center" id="_corebutt"><font color="red"><%:Checking...%></font> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" width="35%">clash(ctun)</td> <td align="center" width="35%" id="_coretun"><%:Collecting data...%></td> <td width="35%" align="center" id="_coretunbutt"><font color="red"><%:Checking...%></font> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" width="35%">clash(premium)</td> <td align="center" width="35%" id="_coredtun"><%:Collecting data...%></td> <td width="35%" align="center" id="_coredtunbutt"><font color="red"><%:Checking...%></font> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" width="35%">luci-app-clash</td> <td align="center" width="35%" id="_version"><%:Collecting data...%> </td> <td width="35%" align="center" id="_versionbutt"><font color="red"><%:Checking...%></font> </td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
|
||||
|
||||
var version = document.getElementById('_version');
|
||||
var core = document.getElementById('_core');
|
||||
var coretun = document.getElementById('_coretun');
|
||||
var version_butt = document.getElementById('_versionbutt');
|
||||
var core_butt = document.getElementById('_corebutt');
|
||||
var corer_butt = document.getElementById('_corerbutt');
|
||||
var coretun_butt = document.getElementById('_coretunbutt');
|
||||
var coredtun = document.getElementById('_coredtun');
|
||||
var coredtun_butt = document.getElementById('_coredtunbutt');
|
||||
|
||||
XHR.poll(1, '<%=luci.dispatcher.build_url("admin", "services", "clash", "status")%>', null, function(x, status) {
|
||||
if ( x && x.status == 200 ) {
|
||||
|
||||
if(status.clash_core==0){
|
||||
core.innerHTML = status.clash_core ? '<b><font color="red"><%:Not Installed%></font> </b>' : '<em><b><font color="red"><%:Checking...%></font></b></em>';
|
||||
}else{
|
||||
core.innerHTML = status.clash_core ? '<b><font color="green">'+status.clash_core+'</font> </b>' : '<em><b><font color="red"><%:Checking...%></font></b></em>';
|
||||
}
|
||||
if(status.clashtun_core==0){
|
||||
coretun.innerHTML = status.clashtun_core ? '<b><font color="red"><%:Not Installed%></font> </b>' : '<em><b><font color="red"><%:Checking...%></font></b></em>';
|
||||
}else{
|
||||
coretun.innerHTML = status.clashtun_core ? '<b><font color="green">'+status.clashtun_core+'</font> </b>' : '<em><b><font color="red"><%:Checking...%></font></b></em>';
|
||||
}
|
||||
if(status.dtun_core==0){
|
||||
coredtun.innerHTML = status.dtun_core ? '<b><font color="red"><%:Not Installed%></font> </b>' : '<em><b><font color="red"><%:Checking...%></font></b></em>';
|
||||
}else{
|
||||
coredtun.innerHTML = status.dtun_core ? '<b><font color="green">'+status.dtun_core+'</font> </b>' : '<em><b><font color="red"><%:Checking...%></font></b></em>';
|
||||
}
|
||||
version.innerHTML = status.current_version ? '<b><font color="green">'+status.current_version+'</font> </b>' : '<em><b><font color="red"><%:Checking...%></font></b></em>';
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
XHR.poll(5,'<%=luci.dispatcher.build_url("admin", "services", "clash", "check_status")%>', null, function(x, status) {});
|
||||
|
||||
|
||||
XHR.poll(1,'<%=luci.dispatcher.build_url("admin", "services", "clash", "status")%>', null, function(x, status) {
|
||||
if ( x && x.status == 200 ) {
|
||||
version_butt.innerHTML = status.current_version ? '<b><font color="green">'+status.new_version+'</font> </b>' : '<em><b><font color="red"><%:Checking...%></font></b></em>';
|
||||
core_butt.innerHTML = status.current_version ? '<b><font color="green">'+status.new_core_version+'</font> </b>' : '<em><b><font color="red"><%:Checking...%></font></b></em>';
|
||||
coretun_butt.innerHTML = status.current_version ? '<b><font color="green">'+status.new_clashtun_core_version+'</font> </b>' : '<em><b><font color="red"><%:Checking...%></font></b></em>';
|
||||
coredtun_butt.innerHTML = status.current_version ? '<b><font color="green">'+status.new_dtun_core+'</font> </b>' : '<em><b><font color="red"><%:Checking...%></font></b></em>';
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
//]]></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
<select name="file_type" style="width:20%">
|
||||
<option value="clash" selected="selected"><%:clash%></option>
|
||||
<option value="clashctun"><%:clash(ctun)%></option>
|
||||
<option value="clashdtun"><%:clash(premium)%></option>
|
||||
</select>
|
||||
<input class="cbi-input-file" style="width: 60%" type="file" id="ulfile" name="ulfile" />
|
||||
<input type="submit" style="width: 100%" class="cbi-button cbi-input-apply" name="upload" value="<%:Upload%>" />
|
||||
|
||||
<%+cbi/valuefooter%>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -1,116 +0,0 @@
|
||||
config clash 'config'
|
||||
option redir_port '7892'
|
||||
option http_port '7890'
|
||||
option socks_port '7891'
|
||||
option mixed_port '7893'
|
||||
option enable_ipv6 'false'
|
||||
option tun_mode '0'
|
||||
option enable '0'
|
||||
option dash_port '9090'
|
||||
option dash_pass '123456'
|
||||
option auto_update '0'
|
||||
option auto_update_time '0'
|
||||
option level 'info'
|
||||
option core '1'
|
||||
option allow_lan 'true'
|
||||
option bind_addr '*'
|
||||
option dnsforwader '1'
|
||||
option subcri 'clash'
|
||||
option cusrule '0'
|
||||
option dnscache '0'
|
||||
option config_type '1'
|
||||
option p_mode 'rule'
|
||||
option auto_clear_log '1'
|
||||
option auto_update '1'
|
||||
option auto_update_time '12'
|
||||
option clear_time '12'
|
||||
option append_rules '0'
|
||||
option enable_udp '0'
|
||||
option dnscache '0'
|
||||
option stack 'system'
|
||||
option enhanced_mode 'fake-ip'
|
||||
option fake_ip_range '198.18.0.1/16'
|
||||
list fake_ip_filter '*.lan'
|
||||
list fake_ip_filter 'localhost.ptlogin2.qq.com'
|
||||
list defaul_nameserver '114.114.114.114'
|
||||
list defaul_nameserver '8.8.8.8'
|
||||
option listen_port '5300'
|
||||
option interf '0'
|
||||
option enable_dns '1'
|
||||
|
||||
|
||||
config dnshijack
|
||||
option enabled '1'
|
||||
option ip '8.8.8.8'
|
||||
option port '53'
|
||||
option type 'tcp://'
|
||||
|
||||
config dnshijack
|
||||
option enabled '1'
|
||||
option ip '8.8.8.8'
|
||||
option port '53'
|
||||
option type 'udp://'
|
||||
|
||||
config hosts
|
||||
option enabled '0'
|
||||
option adress '*.clash.dev'
|
||||
option ip '127.0.0.1'
|
||||
|
||||
config hosts
|
||||
option enabled '0'
|
||||
option adress 'alpha.clash.dev'
|
||||
option ip '::1'
|
||||
|
||||
config dnsservers
|
||||
option enabled '1'
|
||||
option ser_type 'nameserver'
|
||||
option ser_address '114.114.114.114'
|
||||
option protocol 'udp://'
|
||||
|
||||
config dnsservers
|
||||
option enabled '1'
|
||||
option ser_port '853'
|
||||
option protocol 'tls://'
|
||||
option ser_type 'nameserver'
|
||||
option ser_address '47.96.179.163'
|
||||
|
||||
config dnsservers
|
||||
option enabled '1'
|
||||
option ser_type 'nameserver'
|
||||
option ser_address '118.89.110.78'
|
||||
option ser_port '853'
|
||||
option protocol 'tls://'
|
||||
|
||||
config dnsservers
|
||||
option enabled '1'
|
||||
option ser_type 'nameserver'
|
||||
option ser_address '8.8.8.8'
|
||||
option ser_port '53'
|
||||
option protocol 'udp://'
|
||||
|
||||
config dnsservers
|
||||
option enabled '1'
|
||||
option ser_type 'nameserver'
|
||||
option ser_address '1.1.1.1'
|
||||
option ser_port '853'
|
||||
option protocol 'tls://'
|
||||
|
||||
config dnsservers
|
||||
option enabled '1'
|
||||
option ser_type 'fallback'
|
||||
option ser_address '114.114.114.114'
|
||||
option protocol 'udp://'
|
||||
|
||||
config dnsservers
|
||||
option enabled '1'
|
||||
option ser_type 'fallback'
|
||||
option ser_address '118.89.110.78'
|
||||
option ser_port '853'
|
||||
option protocol 'tls://'
|
||||
|
||||
config dnsservers
|
||||
option enabled '1'
|
||||
option ser_type 'fallback'
|
||||
option ser_address '1.1.1.1'
|
||||
option protocol 'tcp://'
|
||||
|
||||
@ -1,966 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
STOP=15
|
||||
|
||||
CLASH="/etc/clash/clash"
|
||||
CLASHT="/etc/clash/clashtun/clash"
|
||||
CLASHD="/etc/clash/dtun/clash"
|
||||
CLASH_CONFIG="/etc/clash"
|
||||
CRON_FILE="/etc/crontabs/root"
|
||||
CONFIG_YAML="/etc/clash/config.yaml"
|
||||
CONFIG_YAML_PATH=$(uci get clash.config.use_config 2>/dev/null)
|
||||
|
||||
CUSLIST="/tmp/dnsmasq.d/custom_list.conf"
|
||||
CUSLITT="/tmp/dnsmasq.clash"
|
||||
CUSLISTV="/var/dnsmasq.d/custom_list.conf"
|
||||
CUSLITTV="/var/dnsmasq.clash"
|
||||
REAL_LOG="/usr/share/clash/clash_real.txt"
|
||||
|
||||
revert_dns() {
|
||||
#===========================================================================================================================
|
||||
dns_port=$(grep "^ \{0,\}listen:" $CONFIG_YAML |awk -F ':' '{print $3}' 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].noresolv=0
|
||||
uci delete dhcp.@dnsmasq[0].cachesize
|
||||
rm -rf $CUSLIST $CUSLITT $CUSLISTV $CUSLITTV 2>/dev/null
|
||||
uci commit dhcp
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||
#===========================================================================================================================
|
||||
}
|
||||
|
||||
add_cron(){
|
||||
config_type=$(uci get clash.config.config_type 2>/dev/null)
|
||||
#===========================================================================================================================
|
||||
[ -z "$(grep -w "/usr/share/clash/clash-watchdog.sh" $CRON_FILE)" ] && echo "*/3 * * * * /usr/share/clash/clash-watchdog.sh" >> $CRON_FILE
|
||||
[ -z "$(grep -w "/usr/share/clash/kill_watchdog.sh" $CRON_FILE)" ] && echo "*/1 * * * * /usr/share/clash/kill_watchdog.sh" >> $CRON_FILE
|
||||
clear=$(uci get clash.config.auto_clear_log 2>/dev/null)
|
||||
if [ "${clear}" -eq 1 ]; then
|
||||
[ -z "$(grep -w "/usr/share/clash/clash.txt" $CRON_FILE)" ] && echo "0 */$(uci get clash.config.clear_time 2>/dev/null) * * * echo '' >/usr/share/clash/clash.txt" >> $CRON_FILE
|
||||
fi
|
||||
|
||||
auto=$(uci get clash.config.auto_update 2>/dev/null)
|
||||
if [ "${auto}" -eq 1 ]; then
|
||||
[ -z "$(grep -w "/usr/share/clash/update_all.sh" $CRON_FILE)" ] && echo "0 */$(uci get clash.config.auto_update_time 2>/dev/null) * * * bash /usr/share/clash/update_all.sh >/usr/share/clash/clash.txt 2>&1 &" >> $CRON_FILE
|
||||
fi
|
||||
|
||||
auto_geoip=$(uci get clash.config.auto_update_geoip 2>/dev/null)
|
||||
if [ "${auto_geoip}" -eq 1 ]; then
|
||||
day=$(uci get clash.config.geoip_update_day 2>/dev/null)
|
||||
week=$(uci get clash.config.geo_update_week 2>/dev/null)
|
||||
if [ -z $week ];then
|
||||
update_week="*"
|
||||
else
|
||||
update_week=$week
|
||||
fi
|
||||
if [ -z $day ];then
|
||||
update_day="*"
|
||||
else
|
||||
update_day=$day
|
||||
fi
|
||||
|
||||
[ -z "$(grep -w "/usr/share/clash/geoip.sh" $CRON_FILE)" ] && echo "0 $(uci get clash.config.auto_update_geoip_time 2>/dev/null) $update_week * $update_day /usr/share/clash/geoip.sh" >> $CRON_FILE
|
||||
fi
|
||||
crontab $CRON_FILE
|
||||
#===========================================================================================================================
|
||||
}
|
||||
|
||||
del_cron(){
|
||||
#===========================================================================================================================
|
||||
sed -i '/clash-watchdog.sh/d' $CRON_FILE
|
||||
sed -i '/update_all.sh/d' $CRON_FILE
|
||||
sed -i '/clash.txt/d' $CRON_FILE
|
||||
/etc/init.d/cron restart
|
||||
#===========================================================================================================================
|
||||
}
|
||||
|
||||
|
||||
select_config(){
|
||||
#===========================================================================================================================
|
||||
config_type=$(uci get clash.config.config_type 2>/dev/null)
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Checking Config file" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "正在检查配置文件" >$REAL_LOG
|
||||
fi
|
||||
|
||||
if [ -f $CONFIG_YAML_PATH ] && [ "$(ls -l $CONFIG_YAML_PATH|awk '{print int($5)}')" -ne 0 ];then
|
||||
|
||||
cp $CONFIG_YAML_PATH $CONFIG_YAML 2>/dev/null
|
||||
|
||||
elif [ ! -f "$CONFIG_YAML_PATH" ] && [ ! -f "$CONFIG_YAML" ];then
|
||||
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "No config found" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "找不到配置文章" >$REAL_LOG
|
||||
fi
|
||||
sleep 5
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
exit 0
|
||||
|
||||
elif [ "$(ls -l $CONFIG_YAML_PATH|awk '{print int($5)}')" -eq 0 ] && [ "$(ls -l $CONFIG_YAML|awk '{print int($5)}')" -eq 0 ];then
|
||||
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Your Config File is Empty" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "你的config.yaml有问题还是为了空" >$REAL_LOG
|
||||
fi
|
||||
sleep 5
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
exit 0
|
||||
|
||||
fi
|
||||
|
||||
#===========================================================================================================================
|
||||
}
|
||||
|
||||
|
||||
|
||||
yml_change() {
|
||||
#===========================================================================================================================
|
||||
sh /usr/share/clash/yum_change.sh 2>/dev/null
|
||||
#===========================================================================================================================
|
||||
}
|
||||
|
||||
game_rules() {
|
||||
#===========================================================================================================================
|
||||
sh /usr/share/clash/game.sh 2>/dev/null
|
||||
#===========================================================================================================================
|
||||
}
|
||||
|
||||
ip_rules() {
|
||||
#===========================================================================================================================
|
||||
sh /usr/share/clash/iprules.sh 2>/dev/null
|
||||
#===========================================================================================================================
|
||||
}
|
||||
|
||||
|
||||
yml_dns_change(){
|
||||
#===========================================================================================================================
|
||||
dns_port=$(grep "^ \{0,\}listen:" /etc/clash/config.yaml |awk -F ':' '{print $3}' 2>/dev/null)
|
||||
dnsforwader=$(uci get clash.config.dnsforwader 2>/dev/null)
|
||||
dnscache=$(uci get clash.config.dnscache 2>/dev/null)
|
||||
if [ "${dns_port}" -eq 53 ]; then
|
||||
sed -i 's/^0.0.0.0:53/0.0.0.0:5300/g' $CONFIG_YAML
|
||||
fi
|
||||
|
||||
if [ "$dnsforwader" -ne 0 ]; then
|
||||
if [ "${dns_port}" -eq 53 ]; then
|
||||
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Setting dns forwarder" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "设置dns转发器" >$REAL_LOG
|
||||
fi
|
||||
|
||||
uci del_list dhcp.@dnsmasq[0].server=127.0.0.1#$dns_port >/dev/null 2>&1
|
||||
uci add_list dhcp.@dnsmasq[0].server=127.0.0.1#5300 >/dev/null 2>&1
|
||||
uci delete dhcp.@dnsmasq[0].resolvfile
|
||||
uci set dhcp.@dnsmasq[0].noresolv=1
|
||||
uci commit dhcp
|
||||
if [ "$dnscache" -eq 0 ];then
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Disabling dns cache" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "禁用dns缓存" >$REAL_LOG
|
||||
fi
|
||||
uci set dhcp.@dnsmasq[0].cachesize=0
|
||||
uci commit dhcp
|
||||
fi
|
||||
else
|
||||
echo "Setting dns forwarder" >$REAL_LOG
|
||||
uci del_list dhcp.@dnsmasq[0].server=127.0.0.1#$dns_port >/dev/null 2>&1
|
||||
uci add_list dhcp.@dnsmasq[0].server=127.0.0.1#$dns_port >/dev/null 2>&1
|
||||
uci delete dhcp.@dnsmasq[0].resolvfile
|
||||
uci set dhcp.@dnsmasq[0].noresolv=1
|
||||
uci commit dhcp
|
||||
if [ "$dnscache" -eq 0 ];then
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Disabling dns cache" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "禁用dns缓存" >$REAL_LOG
|
||||
fi
|
||||
|
||||
uci set dhcp.@dnsmasq[0].cachesize=0
|
||||
uci commit dhcp
|
||||
fi
|
||||
fi
|
||||
elif [ "$dnsforwader" -ne 1 ]; then
|
||||
if [ "$dnscache" -eq 0 ];then
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Disabling dns cache" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "禁用dns缓存" >$REAL_LOG
|
||||
fi
|
||||
|
||||
uci set dhcp.@dnsmasq[0].cachesize=0
|
||||
uci commit dhcp
|
||||
fi
|
||||
fi
|
||||
#===========================================================================================================================
|
||||
}
|
||||
|
||||
|
||||
check(){
|
||||
|
||||
sed -i 's/^Proxy Group:/proxy-groups:/g' "$CONFIG_YAML"
|
||||
sed -i 's/^proxy-provider:/proxy-providers:/g' "$CONFIG_YAML"
|
||||
sed -i 's/^Proxy:/proxies:/g' "$CONFIG_YAML"
|
||||
sed -i 's/^Rule:/rules:/g' "$CONFIG_YAML"
|
||||
sed -i 's/^rule-provider:/rule-providers:/g' "$CONFIG_YAML"
|
||||
|
||||
}
|
||||
|
||||
rules(){
|
||||
#===========================================================================================================================
|
||||
|
||||
dns_port=$(grep listen: $CONFIG_YAML |awk -F ':' '{print $3}' |tr -cd "[0-9]")
|
||||
redir_port=$(uci get clash.config.redir_port 2>/dev/null)
|
||||
#fake_ip_range=$(uci get clash.config.fake_ip_range 2>/dev/null)
|
||||
ipv6=$(uci get clash.config.enable_ipv6 2>/dev/null)
|
||||
core=$(uci get clash.config.core 2>/dev/null)
|
||||
tun_mode=$(uci get clash.config.tun_mode 2>/dev/null)
|
||||
#lan_ip=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null)
|
||||
wan=$(ifconfig | grep 'inet addr' | awk '{print $2}' | cut -d: -f2 2>/dev/null)
|
||||
ip6=$(ifconfig | grep 'inet6 addr' | awk '{print $3}' 2>/dev/null)
|
||||
enable_udp=$(uci get clash.config.enable_udp 2>/dev/null)
|
||||
fake_ip=$(egrep '^ {0,}enhanced-mode' /etc/clash/config.yaml |grep enhanced-mode: |awk -F ': ' '{print $2}')
|
||||
PROXY_FWMARK="0x162"
|
||||
PROXY_ROUTE_TABLE="0x162"
|
||||
PROXY_BYPASS_USER="root"
|
||||
dnsforwader=$(uci get clash.config.dnsforwader 2>/dev/null)
|
||||
|
||||
|
||||
redir_host=$(egrep '^ {0,}enhanced-mode' /etc/clash/config.yaml |grep enhanced-mode: |awk -F ': ' '{print $2}')
|
||||
if [ "$redir_host" == "redir-host" ];then
|
||||
if [ "$(uci get clash.config.access_control 2>/dev/null)" = "1" ] && [ -n "$(uci get clash.config.proxy_lan_ips 2>/dev/null)" ]; then
|
||||
proxy_ips=$(uci get clash.config.proxy_lan_ips)
|
||||
ipset -! -R <<-EOF
|
||||
create proxy_lan hash:net
|
||||
$(for ip in $proxy_ips; do echo "add proxy_lan $ip"; done)
|
||||
EOF
|
||||
elif [ "$(uci get clash.config.access_control 2>/dev/null)" = "2" ] && [ -n "$(uci get clash.config.reject_lan_ips 2>/dev/null)" ]; then
|
||||
reject_ips=$(uci get clash.config.reject_lan_ips)
|
||||
ipset -! -R <<-EOF
|
||||
create reject_lan hash:net
|
||||
$(for ip in $reject_ips; do echo "add reject_lan $ip"; done)
|
||||
EOF
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
ipset create localnetwork hash:net
|
||||
ipset add localnetwork 127.0.0.0/8
|
||||
ipset add localnetwork 10.0.0.0/8
|
||||
ipset add localnetwork 169.254.0.0/16
|
||||
ipset add localnetwork 192.168.0.0/16
|
||||
ipset add localnetwork 224.0.0.0/4
|
||||
ipset add localnetwork 240.0.0.0/4
|
||||
ipset add localnetwork 172.16.0.0/12
|
||||
if [ -n "$wan" ]; then
|
||||
for wan_ip4s in $wan; do
|
||||
ipset add localnetwork "$wan_ip4s" 2>/dev/null
|
||||
done
|
||||
fi
|
||||
sh /usr/share/clash/chinaipset.sh >/dev/null 2>&1
|
||||
|
||||
|
||||
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 ] && [ "$dnsforwader" -eq "1" ]; then
|
||||
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)
|
||||
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
|
||||
fi
|
||||
|
||||
if [ -z "$(uci get firewall.clash 2>/dev/null)" ] || [ -z "$(uci get ucitrack.@clash[-1].init 2>/dev/null)" ]; then
|
||||
uci delete ucitrack.@clash[-1] >/dev/null 2>&1
|
||||
uci add ucitrack clash >/dev/null 2>&1
|
||||
uci set ucitrack.@clash[-1].init=clash >/dev/null 2>&1
|
||||
uci commit ucitrack >/dev/null 2>&1
|
||||
uci delete firewall.clash >/dev/null 2>&1
|
||||
uci set firewall.clash=include >/dev/null 2>&1
|
||||
uci set firewall.clash.type=script >/dev/null 2>&1
|
||||
uci set firewall.clash.path=/var/etc/clash.include >/dev/null 2>&1
|
||||
uci set firewall.clash.reload=1 >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [ "$(uci get firewall.@defaults[0].forward)" != "ACCEPT" ]; then
|
||||
uci set firewall.@defaults[0].forward=ACCEPT >/dev/null 2>&1
|
||||
uci commit firewall >/dev/null 2>&1
|
||||
/etc/init.d/firewall restart >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
mkdir -p /var/etc
|
||||
cat > "/var/etc/clash.include" <<-EOF
|
||||
/etc/init.d/clash reload >/dev/null 2>&1
|
||||
EOF
|
||||
|
||||
if [ "${core}" -eq 1 ] || [ "${core}" -eq 2 ];then
|
||||
|
||||
iptables -t nat -N clash
|
||||
iptables -t nat -F clash
|
||||
iptables -t nat -A clash -m set --match-set localnetwork dst -j RETURN
|
||||
iptables -t nat -A clash -m set --match-set reject_lan src -j RETURN
|
||||
iptables -t nat -A clash -m set ! --match-set proxy_lan src -j RETURN
|
||||
iptables -t nat -A clash -m set --match-set china dst -j RETURN
|
||||
iptables -t nat -A clash -p tcp -j REDIRECT --to-ports "${redir_port}"
|
||||
iptables -t nat -I PREROUTING -p tcp -d 8.8.8.8 -j REDIRECT --to-ports "${redir_port}"
|
||||
iptables -t nat -I PREROUTING -p tcp -d 8.8.4.4 -j REDIRECT --to-ports "${redir_port}"
|
||||
iptables -t nat -A PREROUTING -p tcp -j clash
|
||||
|
||||
|
||||
ip rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE"
|
||||
ip route add local 0.0.0.0/0 dev lo table "$PROXY_ROUTE_TABLE"
|
||||
iptables -t mangle -N clash
|
||||
iptables -t mangle -A clash -m set --match-set localnetwork dst -j RETURN
|
||||
iptables -t mangle -A clash -m set --match-set reject_lan src -j RETURN
|
||||
iptables -t mangle -A clash -m set ! --match-set proxy_lan src -j RETURN
|
||||
iptables -t mangle -A clash -m set --match-set china dst -j RETURN
|
||||
iptables -t mangle -A clash -p udp -j TPROXY --on-port "${redir_port}" --tproxy-mark "$PROXY_FWMARK"
|
||||
iptables -t mangle -A PREROUTING -p udp -j clash
|
||||
|
||||
|
||||
|
||||
if [ "${fake_ip}" == "fake-ip" ];then
|
||||
iptables -t nat -N clash_output
|
||||
iptables -t nat -F clash_output
|
||||
iptables -t nat -A clash_output -m set --match-set localnetwork dst -j RETURN
|
||||
|
||||
fake_ip_range=$(egrep '^ {0,}fake-ip-range' /etc/clash/config.yaml |grep fake-ip-range: |awk -F ': ' '{print $2}')
|
||||
if [ ! -z "${fake_ip_range}" ];then
|
||||
iptables -t nat -A clash_output -p tcp -d $fake_ip_range -j REDIRECT --to-ports "${redir_port}"
|
||||
else
|
||||
iptables -t nat -A clash_output -p tcp -d 198.18.0.0/16 -j REDIRECT --to-ports "${redir_port}"
|
||||
fi
|
||||
iptables -t nat -A OUTPUT -p tcp -j clash_output
|
||||
fi
|
||||
|
||||
|
||||
if [ "${ipv6}" == "true" ]; then
|
||||
ip6tables -t nat -N clash
|
||||
if [ -n "${ip6}" ]; then
|
||||
for lan_ip6s in $ip6; do
|
||||
ip6tables -t nat -A clash -d "$lan_ip6s" -j RETURN 2>/dev/null
|
||||
done
|
||||
fi
|
||||
ip6tables -t nat -A clash -p tcp -j REDIRECT --to-ports "$proxy_port"
|
||||
ip6tables -t nat -A PREROUTING -p tcp -j clash
|
||||
fi
|
||||
|
||||
|
||||
|
||||
elif [ "${core}" -eq 3 ] || [ "${core}" -eq 4 ];then
|
||||
natr=$(iptables -nvL PREROUTING -t nat | sed 1,2d | sed -n '/tcp dpt:53/=' | sort -r)
|
||||
for natx in $natr; do
|
||||
iptables -t nat -D PREROUTING $natx >/dev/null 2>&1
|
||||
done
|
||||
|
||||
TUN_DEVICE=$(egrep '^ {0,}device-url:' /etc/clash/config.yaml |grep device-url: |awk -F '//' '{print $2}')
|
||||
if [ -z $TUN_DEVICE ];then
|
||||
TUN_DEVICE_NAME="clash0"
|
||||
else
|
||||
TUN_DEVICE_NAME=$TUN_DEVICE
|
||||
fi
|
||||
|
||||
if [ "${core}" -eq 3 ];then
|
||||
ip tuntap add user root mode tun $TUN_DEVICE_NAME
|
||||
ip link set $TUN_DEVICE_NAME up
|
||||
ip route replace default dev $TUN_DEVICE_NAME table "$PROXY_ROUTE_TABLE"
|
||||
elif [ "${core}" -eq 4 ];then
|
||||
TUN_WAIT=0
|
||||
while ( [ -n "$(pidof clash)" ] && [ -z "$(ip route list |grep utun)" ] && [ "$TUN_WAIT" -le 3 ] )
|
||||
do
|
||||
TUN_WAIT=$(expr "$TUN_WAIT" + 1)
|
||||
sleep 2
|
||||
done
|
||||
ip route replace default dev utun table "$PROXY_ROUTE_TABLE"
|
||||
fi
|
||||
|
||||
ip rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE"
|
||||
iptables -t mangle -N clash
|
||||
iptables -t mangle -F clash
|
||||
iptables -t mangle -A clash -m set --match-set localnetwork dst -j RETURN
|
||||
iptables -t mangle -A TROJAN_GO -m set --match-set china dst -j RETURN
|
||||
if [ "${fake_ip}" == "fake-ip" ];then
|
||||
iptables -t mangle -A clash -d 198.18.0.0/16 -j MARK --set-mark "$PROXY_FWMARK"
|
||||
fi
|
||||
|
||||
iptables -t mangle -I OUTPUT -j clash
|
||||
iptables -t mangle -I PREROUTING -m set ! --match-set localnetwork dst -j MARK --set-mark "$PROXY_FWMARK"
|
||||
iptables -t mangle -I PREROUTING -m set ! --match-set china dst -j MARK --set-mark "$PROXY_FWMARK"
|
||||
iptables -t mangle -I PREROUTING -m set --match-set reject_lan src -j RETURN >/dev/null 2>&1
|
||||
iptables -t mangle -I PREROUTING -m set ! --match-set proxy_lan src -j RETURN >/dev/null 2>&1
|
||||
iptables -t nat -I PREROUTING -p tcp --dport 53 -j ACCEPT
|
||||
|
||||
if [ "${fake_ip}" == "fake-ip" ];then
|
||||
fake_ip_range=$(egrep '^ {0,}fake-ip-range' /etc/clash/config.yaml |grep fake-ip-range: |awk -F ': ' '{print $2}')
|
||||
if [ ! -z "${fake_ip_range}" ];then
|
||||
iptables -t nat -A OUTPUT -p tcp -d $fake_ip_range -j REDIRECT --to-ports "${redir_port}"
|
||||
else
|
||||
iptables -t nat -A OUTPUT -p tcp -d 198.18.0.1/16 -j REDIRECT --to-ports "${redir_port}"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
|
||||
#===========================================================================================================================
|
||||
}
|
||||
|
||||
|
||||
custom_list() {
|
||||
sh /usr/share/clash/list.sh >/dev/null 2>&1
|
||||
}
|
||||
|
||||
restore() {
|
||||
sh /usr/share/clash/restore.sh >/dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
start(){
|
||||
#===========================================================================================================================
|
||||
lang=$(uci get luci.main.lang 2>/dev/null)
|
||||
enable=$(uci get clash.config.enable 2>/dev/null)
|
||||
core=$(uci get clash.config.core 2>/dev/null)
|
||||
mode=$(uci get clash.config.mode 2>/dev/null)
|
||||
tun_mode=$(uci get clash.config.tun_mode 2>/dev/null)
|
||||
|
||||
|
||||
|
||||
if [ -f /etc/clash/config.yaml ];then
|
||||
rm -rf /etc/clash/config.yaml >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [ "${enable}" -eq 1 ]; then
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Starting Client" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "启动客户端" >$REAL_LOG
|
||||
fi
|
||||
sleep 1
|
||||
select_config >/dev/null 2>&1
|
||||
sleep 1
|
||||
|
||||
|
||||
if [ "${core}" -eq 1 ] && [ ! -f /etc/clash/clash ]; then
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo " $(date "+%Y-%m-%d %H:%M:%S") - clash core not found, download and install clash from update page " >> /usr/share/clash/clash.txt
|
||||
echo "clash core not found, download and install clash from update page" >> $REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo " $(date "+%Y-%m-%d %H:%M:%S") - 找不到/etc/clash/clash,请从更新页下载clash内核" >> /usr/share/clash/clash.txt
|
||||
echo "找不到/etc/clash/clash,请从更新页下载clash内核" >> $REAL_LOG
|
||||
fi
|
||||
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
exit 0
|
||||
elif [ "${core}" -eq 3 ] && [ ! -f /etc/clash/clashtun/clash ]; then
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo " $(date "+%Y-%m-%d %H:%M:%S") - clash Tun core not found in /etc/clash/clashtun/clash " >> /usr/share/clash/clash.txt
|
||||
echo "clash Tun core not found in /etc/clash/clashtun/clash" >> $REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo " $(date "+%Y-%m-%d %H:%M:%S") - 找不到/etc/clash/clashtun/clash, clash Tun内核" >> /usr/share/clash/clash.txt
|
||||
echo "找不到/etc/clash/clashtun/clash, clash Tun内核" >> $REAL_LOG
|
||||
fi
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
exit 0
|
||||
elif [ "${core}" -eq 4 ] && [ ! -f /etc/clash/dtun/clash ]; then
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo " $(date "+%Y-%m-%d %H:%M:%S") - clash Tun core not found in /etc/clash/dtun/clash " >> /usr/share/clash/clash.txt
|
||||
echo "clash Tun core not found in /etc/clash/dtun/clash" >> $REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo " $(date "+%Y-%m-%d %H:%M:%S") - 找不到/usr/bin/clash clash Tun" >> /usr/share/clash/clash.txt
|
||||
echo "找不到/etc/clash/dtun/clash,clash Tun" >> $REAL_LOG
|
||||
fi
|
||||
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
exit 0
|
||||
else
|
||||
if [ -f $CONFIG_YAML ] && [ "$(ls -l $CONFIG_YAML|awk '{print int($5)}')" -ne 0 ] ; then
|
||||
|
||||
check >/dev/null 2>&1
|
||||
|
||||
custom_list >/dev/null 2>&1
|
||||
|
||||
if [ "$core" -eq 4 ] || [ "$core" -eq 3 ];then
|
||||
|
||||
if [ $tun_mode -eq 0 ];then
|
||||
uci set clash.config.tun_mode="1" && uci set clash.config.stack="system" && uci commit clash
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Enabling TUN" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "启用TUN" >$REAL_LOG
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
|
||||
enable_dns=$(uci get clash.config.enable_dns 2>/dev/null)
|
||||
|
||||
if [ -z "$(grep "^ {0,}listen:" /etc/clash/config.yaml)" ] || [ -z "$(grep "^ {0,}enhanced-mode:" /etc/clash/config.yaml)" ] || [ -z "$(grep "^ {0,}dns:" /etc/clash/config.yaml)" ];then
|
||||
|
||||
if [ $enable_dns -eq 0 ];then
|
||||
uci set clash.config.enable_dns="1" && uci commit clash
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Enabling Custom Dns" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "启用自定义DNS" >$REAL_LOG
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if [ ! -z "$(egrep '^ {0,}rule-providers:' "/etc/clash/config.yaml")" ] && [ "$(uci get clash.config.core)" -ne 4 ];then
|
||||
|
||||
if [ -f /etc/clash/dtun/clash ];then
|
||||
uci set clash.config.core="4" && uci commit clash
|
||||
sleep 1
|
||||
else
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Your Current Config only support Clash Core(dtun)" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "你在使用配置不支持Clash内核,仅支持Clash(dtun)h内核" >$REAL_LOG
|
||||
fi
|
||||
remove_mark >/dev/null 2>&1
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -z "$(egrep '^ {0,}script:' "/etc/clash/config.yaml")" ] && [ "$(uci get clash.config.core)" -ne 4 ];then
|
||||
if [ -f /etc/clash/dtun/clash ];then
|
||||
uci set clash.config.core="4" && uci commit clash
|
||||
sleep 1
|
||||
else
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Your Current Config only support Clash Core(dtun)" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "你在使用配置不支持Clash内核,仅支持Clash(dtun)h内核" >$REAL_LOG
|
||||
fi
|
||||
remove_mark >/dev/null 2>&1
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -z "$(egrep '^ {0,}script:' "/etc/clash/config.yaml")" ] && [ "$(uci get clash.config.p_mode 2>/dev/null)" != "Script" ];then
|
||||
uci set clash.config.p_mode="Script"&& uci commit clash
|
||||
elif [ "$(uci get clash.config.p_mode)" == "Script" ] && [ -z "$(egrep '^ {0,}script:' "/etc/clash/config.yaml")" ];then
|
||||
uci set clash.config.p_mode="rule" && uci commit clash
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
yml_change >/dev/null 2>&1
|
||||
|
||||
|
||||
if [ ! -f /etc/clash/Country.mmdb ];then
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Cannot find Country.mmdb" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "找不到Country.mmdb" >$REAL_LOG
|
||||
fi
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/clash/config.yaml ];then
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Cannot find config.yaml" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "找不到config.yaml" >$REAL_LOG
|
||||
fi
|
||||
remove_mark >/dev/null 2>&1
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
exit 0
|
||||
fi
|
||||
|
||||
yml_dns_change >/dev/null 2>&1
|
||||
|
||||
game_rules >/dev/null 2>&1
|
||||
|
||||
ip_rules >/dev/null 2>&1
|
||||
|
||||
|
||||
if [ "$(uci get clash.config.core)" -eq 1 ];then
|
||||
nohup $CLASH -d "$CLASH_CONFIG" > /usr/share/clash/clash.txt 2>&1 &
|
||||
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Clash Core Started Successfully " >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "Clash 计划任务,启动进程守护程序..." >$REAL_LOG
|
||||
fi
|
||||
|
||||
elif [ "$(uci get clash.config.core)" -eq 3 ];then
|
||||
nohup $CLASHT -d "$CLASH_CONFIG" > /usr/share/clash/clash.txt 2>&1 &
|
||||
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Clash Core Started Successfully " >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "Clash 计划任务,启动进程守护程序..." >$REAL_LOG
|
||||
fi
|
||||
elif [ "$(uci get clash.config.core)" -eq 4 ];then
|
||||
nohup $CLASHD -d "$CLASH_CONFIG" > /usr/share/clash/clash.txt 2>&1 &
|
||||
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Clash Core Started Successfully " >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "Clash 计划任务,启动进程守护程序..." >$REAL_LOG
|
||||
fi
|
||||
fi
|
||||
ln -s /usr/share/clash/yacd /www/luci-static/yacd 2>/dev/null
|
||||
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Setting up clash iptables rules" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "设置 Clash iptables" >$REAL_LOG
|
||||
fi
|
||||
|
||||
rules >/dev/null 2>&1
|
||||
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Restarting Dnsmasq " >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "重启 Dnsmasq 程序" >$REAL_LOG
|
||||
fi
|
||||
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||
|
||||
restore >/dev/null 2>&1
|
||||
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Setting Cron Job" >$REAL_LOG
|
||||
add_cron
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "设置Cron" >$REAL_LOG
|
||||
add_cron
|
||||
|
||||
fi
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Clash Started Successfully " >$REAL_LOG
|
||||
sleep 1
|
||||
echo "Clash is Running " >$REAL_LOG
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "Clash 启动成功,请等待服务器上线!" >$REAL_LOG
|
||||
sleep 1
|
||||
echo "Clash运行中" >$REAL_LOG
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
fi
|
||||
if ! pidof clash >/dev/null; then
|
||||
remove_mark 2>/dev/null
|
||||
kill -9 `pidof clash|sed "s/$//g"` 2>/dev/null
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
fi
|
||||
else
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo " $(date "+%Y-%m-%d %H:%M:%S") - problem with config.yaml, config.yaml is either empty or not found " >> /usr/share/clash/clash.txt
|
||||
echo " problem with config file " >$REAL_LOG
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo " $(date "+%Y-%m-%d %H:%M:%S") - 你的config.yaml有问题还是为了空 0kb " >> /usr/share/clash/clash.txt
|
||||
echo " 你的config.yaml有问题还是为了空 0kb " >$REAL_LOG
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Enable Client and Start Client Again" >$REAL_LOG
|
||||
echo " $(date "+%Y-%m-%d %H:%M:%S") - Enable Client and Start Client Again" >>/usr/share/clash/clash.txt
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "启用客户端并重新启动客户端" >$REAL_LOG
|
||||
echo " $(date "+%Y-%m-%d %H:%M:%S") - 启用客户端并重新启动客户端" >>/usr/share/clash/clash.txt
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
fi
|
||||
fi
|
||||
#===========================================================================================================================
|
||||
}
|
||||
|
||||
|
||||
remove_mark(){
|
||||
rm -rf /var/etc/clash.include 2>/dev/null
|
||||
|
||||
core=$(uci get clash.config.core 2>/dev/null)
|
||||
ipv6=$(uci get clash.config.enable_ipv6 2>/dev/null)
|
||||
dns_port=$(grep "^ \{0,\}listen:" $CONFIG_YAML |awk -F ':' '{print $3}' 2>/dev/null)
|
||||
PROXY_FWMARK="0x162" 2>/dev/null
|
||||
PROXY_ROUTE_TABLE="0x162" 2>/dev/null
|
||||
|
||||
|
||||
ip rule del fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE" >/dev/null 2>&1
|
||||
ip route del local 0.0.0.0/0 dev lo table "$PROXY_ROUTE_TABLE" >/dev/null 2>&1
|
||||
|
||||
|
||||
TUN_DEVICE=$(egrep '^ {0,}device-url:' /etc/clash/config.yaml |grep device-url: |awk -F '//' '{print $2}')
|
||||
if [ -z $TUN_DEVICE ];then
|
||||
TUN_DEVICE_NAME="clash0"
|
||||
else
|
||||
TUN_DEVICE_NAME=$TUN_DEVICE
|
||||
fi
|
||||
if [ "${core}" -eq 3 ];then
|
||||
ip link set dev $TUN_DEVICE_NAME down 2>/dev/null
|
||||
ip tuntap del $TUN_DEVICE_NAME mode tun 2>/dev/null
|
||||
ip route del default dev $TUN_DEVICE_NAME table "$PROXY_ROUTE_TABLE" 2>/dev/null
|
||||
fi
|
||||
ip route del default dev utun table "$PROXY_ROUTE_TABLE" >/dev/null 2>&1
|
||||
#ip rule del fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE" 2>/dev/null
|
||||
ip rule del fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE" >/dev/null 2>&1
|
||||
|
||||
|
||||
mangle=$(iptables -nvL OUTPUT -t mangle | sed 1,2d | sed -n '/clash/=' | sort -r)
|
||||
for mangles in $mangle; do
|
||||
iptables -t mangle -D OUTPUT $mangles 2>/dev/null
|
||||
done
|
||||
|
||||
pre=$(iptables -nvL PREROUTING -t mangle | sed 1,2d | sed -n '/! match-set localnetwork dst MARK set 0x162/=' | sort -r)
|
||||
for prer in $pre; do
|
||||
iptables -t mangle -D PREROUTING $prer 2>/dev/null
|
||||
done
|
||||
|
||||
pre1=$(iptables -nvL PREROUTING -t mangle | sed 1,2d | sed -n '/! match-set china dst MARK set 0x162/=' | sort -r)
|
||||
for prer in $pre1; do
|
||||
iptables -t mangle -D PREROUTING $prer 2>/dev/null
|
||||
done
|
||||
|
||||
pre_lines=$(iptables -nvL PREROUTING -t nat |sed 1,2d |sed -n '/8\.8\./=' 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 -D PREROUTING -p tcp --dport 53 -j ACCEPT >/dev/null 2>&1
|
||||
iptables -t nat -D PREROUTING -p udp --dport 53 -j DNAT --to "127.0.0.1:$dns_port"
|
||||
|
||||
if [ "${ipv6}" == "true" ]; then
|
||||
ip6tables -t mangle -D PREROUTING -j MARK --set-mark "$PROXY_FWMARK" 2>/dev/null
|
||||
fi
|
||||
|
||||
iptables -t mangle -F clash 2>/dev/null
|
||||
iptables -t mangle -X clash 2>/dev/null
|
||||
|
||||
|
||||
iptables -t nat -F clash_output >/dev/null 2>&1
|
||||
iptables -t nat -X clash_output >/dev/null 2>&1
|
||||
|
||||
ipset -! flush proxy_lan >/dev/null 2>&1
|
||||
ipset -! flush reject_lan >/dev/null 2>&1
|
||||
ipset destroy reject_lan >/dev/null 2>&1
|
||||
ipset destroy proxy_lan >/dev/null 2>&1
|
||||
ipset -! flush china >/dev/null 2>&1
|
||||
ipset destroy china >/dev/null 2>&1
|
||||
|
||||
proxy_lan=$(iptables -nvL PREROUTING -t mangle | sed 1,2d | sed -n '/! match-set proxy_lan src/=' | sort -r)
|
||||
for natx in $proxy_lan; do
|
||||
iptables -t mangle -D PREROUTING $natx >/dev/null 2>&1
|
||||
done
|
||||
|
||||
reject_lan=$(iptables -nvL PREROUTING -t mangle | sed 1,2d | sed -n '/match-set reject_lan src/=' | sort -r)
|
||||
for natx in $reject_lan; do
|
||||
iptables -t mangle -D PREROUTING $natx >/dev/null 2>&1
|
||||
done
|
||||
|
||||
proxy_lann=$(iptables -nvL clash -t nat | sed 1,2d | sed -n '/! match-set proxy_lan src/=' | sort -r)
|
||||
for natx in $proxy_lann; do
|
||||
iptables -t nat -D PREROUTING $natx >/dev/null 2>&1
|
||||
done
|
||||
|
||||
reject_lann=$(iptables -nvL clash -t nat | sed 1,2d | sed -n '/match-set reject_lan src/=' | sort -r)
|
||||
for natx in $reject_lann; do
|
||||
iptables -t nat -D PREROUTING $natx >/dev/null 2>&1
|
||||
done
|
||||
|
||||
proxy_lannn=$(iptables -nvL clash -t nat | sed 1,2d | sed -n '/! match-set proxy_lan src/=' | sort -r)
|
||||
for natx in $proxy_lannn; do
|
||||
iptables -t mangle -D PREROUTING $natx >/dev/null 2>&1
|
||||
done
|
||||
|
||||
reject_lannn=$(iptables -nvL clash -t nat | sed 1,2d | sed -n '/match-set reject_lan src/=' | sort -r)
|
||||
for natx in $reject_lannn; do
|
||||
iptables -t mangle -D PREROUTING $natx >/dev/null 2>&1
|
||||
done
|
||||
|
||||
iptables -t nat -D OUTPUT -p tcp -j clash_output >/dev/null 2>&1
|
||||
|
||||
|
||||
china_lan2=$(iptables -nvL PREROUTING -t nat | sed 1,2d | sed -n '/match-set china/=' | sort -r)
|
||||
for natx in $china_lan2; do
|
||||
iptables -t mangle -D PREROUTING $natx >/dev/null 2>&1
|
||||
done
|
||||
|
||||
china_lan3$(iptables -nvL PREROUTING -t mangle | sed 1,2d | sed -n '/match-set china/=' | sort -r)
|
||||
for natx in $china_lan3; do
|
||||
iptables -t mangle -D PREROUTING $natx >/dev/null 2>&1
|
||||
done
|
||||
|
||||
ipset destroy localnetwork 2>/dev/null
|
||||
|
||||
nat_indexs=$(iptables -nvL PREROUTING -t nat | sed 1,2d | sed -n '/clash/=' | sort -r)
|
||||
for nat_index in $nat_indexs; do
|
||||
iptables -t nat -D PREROUTING $nat_index >/dev/null 2>&1
|
||||
iptables -t nat -F clash >/dev/null 2>&1
|
||||
iptables -t nat -X clash >/dev/null 2>&1
|
||||
iptables -t mangle -F clash >/dev/null 2>&1
|
||||
iptables -t mangle -D PREROUTING -p udp -j clash >/dev/null 2>&1
|
||||
iptables -t mangle -X clash >/dev/null 2>&1
|
||||
done
|
||||
|
||||
nat=$(iptables -nvL PREROUTING -t nat | sed 1,2d | sed -n '/tcp dpt:53/=' | sort -r)
|
||||
for natx in $nat; do
|
||||
iptables -t nat -D PREROUTING $natx >/dev/null 2>&1
|
||||
done
|
||||
|
||||
ip6tables -t mangle -F clash >/dev/null 2>&1
|
||||
ip6tables -t mangle -D PREROUTING -p udp -j clash >/dev/null 2>&1
|
||||
ip6tables -t mangle -X clash >/dev/null 2>&1
|
||||
|
||||
|
||||
out_linese=$(iptables -nvL OUTPUT -t mangle |sed 1,2d |sed -n '/198.18.0.1\/16/=' 2>/dev/null |sort -rn)
|
||||
for out_linee in $out_linese; do
|
||||
iptables -t mangle -D OUTPUT "$out_linee" >/dev/null 2>&1
|
||||
done
|
||||
|
||||
out_linesee=$(iptables -nvL OUTPUT -t mangle |sed 1,2d |sed -n '/198.18.0.0\/16/=' 2>/dev/null |sort -rn)
|
||||
for out_linees in $out_linesee; do
|
||||
iptables -t mangle -D OUTPUT "$out_linees" >/dev/null 2>&1
|
||||
done
|
||||
|
||||
nat_indexs=$(iptables -nvL PREROUTING -t nat | sed 1,2d | sed -n '/clash/=' | sort -r)
|
||||
for nat_index in $nat_indexs; do
|
||||
iptables -t nat -D PREROUTING $nat_index >/dev/null 2>&1
|
||||
done
|
||||
|
||||
|
||||
|
||||
fake=$(iptables -nvL OUTPUT -t nat |sed 1,2d |sed -n '/198.18.0.0\/16/=' |sort -r)
|
||||
for fake in $fake; do
|
||||
iptables -t nat -D OUTPUT $fake >/dev/null 2>&1
|
||||
done
|
||||
|
||||
fake2=$(iptables -nvL OUTPUT -t nat |sed 1,2d |sed -n '/198.18.0.1\/16/=' |sort -r)
|
||||
for fake2 in $fake2; do
|
||||
iptables -t nat -D OUTPUT $fake2 >/dev/null 2>&1
|
||||
done
|
||||
|
||||
iptables -t nat -I PREROUTING -p tcp --dport 53 -j ACCEPT
|
||||
|
||||
revert_dns >/dev/null 2>&1
|
||||
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Restarting Dnsmasq " >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "重启 Dnsmasq 程序" >$REAL_LOG
|
||||
fi
|
||||
}
|
||||
|
||||
stop(){
|
||||
#===========================================================================================================================
|
||||
|
||||
lang=$(uci get luci.main.lang 2>/dev/null)
|
||||
tun_mode=$(uci get clash.config.tun_mode 2>/dev/null)
|
||||
#ipv6=$(uci get clash.config.enable_ipv6 2>/dev/null)
|
||||
core=$(uci get clash.config.core 2>/dev/null)
|
||||
LIST="/usr/share/clash/server.list"
|
||||
|
||||
sed -i '/#START/,/#END/d' "$LIST" 2>/dev/null
|
||||
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Stopping Client..." >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "正在停止客户端..." >$REAL_LOG
|
||||
fi
|
||||
sleep 1
|
||||
remove_mark >/dev/null 2>&1
|
||||
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Removing clash iptables rules" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "删除clash iptables规则" >$REAL_LOG
|
||||
fi
|
||||
|
||||
bash /usr/share/clash/backup.sh >/dev/null 2>&1
|
||||
|
||||
kill -9 `pidof clash|sed "s/$//g"` 2>/dev/null
|
||||
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Clash Core Stoped Successfully " >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "Clash 停止进程守护程序" >$REAL_LOG
|
||||
fi
|
||||
|
||||
rm -rf /www/luci-static/yacd 2>/dev/null
|
||||
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Deleting Cron Job" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "删除Cron" >$REAL_LOG
|
||||
fi
|
||||
|
||||
del_cron >/dev/null 2>&1
|
||||
sleep 1
|
||||
|
||||
|
||||
echo "" >/usr/share/clash/clash.txt >/dev/null 2>&1
|
||||
|
||||
echo "0" > /usr/share/clash/logstatus_check >/dev/null 2>&1
|
||||
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo " $(date "+%Y-%m-%d %H:%M:%S") - CLIENT IS DISABLED " >> /usr/share/clash/clash.txt
|
||||
echo "Client is Disabled " >$REAL_LOG
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo " $(date "+%Y-%m-%d %H:%M:%S") - 客户端被禁用 " >> /usr/share/clash/clash.txt
|
||||
echo "客户端被禁用 " >$REAL_LOG
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
fi
|
||||
|
||||
if pidof clash >/dev/null; then
|
||||
kill $(pidof clash) >/dev/null 2>&1 || kill -9 $(ps | grep clash | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
|
||||
#===========================================================================================================================
|
||||
}
|
||||
|
||||
restart(){
|
||||
#===========================================================================================================================
|
||||
if pidof clash >/dev/null; then
|
||||
stop >/dev/null 2>&1
|
||||
start >/dev/null 2>&1
|
||||
echo "Clash Successfully Restarted"
|
||||
else
|
||||
start >/dev/null 2>&1
|
||||
echo "Clash Successfully Started"
|
||||
fi
|
||||
#===========================================================================================================================
|
||||
}
|
||||
|
||||
reload()
|
||||
{
|
||||
if pidof clash >/dev/null; then
|
||||
remove_mark 2>/dev/null
|
||||
yml_dns_change 2>/dev/null
|
||||
rules 2>/dev/null
|
||||
echo "Clash Reload Completed"
|
||||
fi
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
#!/bin/sh
|
||||
. /lib/functions.sh
|
||||
|
||||
CURL_GROUP_CACHE="/usr/share/clashbackup/clash_gorup.json"
|
||||
CURL_NOW_CACHE="/usr/share/clashbackup/clash_now.json"
|
||||
CURL_CACHE="/usr/share/clashbackup/clash_curl.json"
|
||||
HISTORY_PATH="/usr/share/clashbackup/history"
|
||||
SECRET=$(uci get clash.config.dash_pass 2>/dev/null)
|
||||
LAN_IP=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null)
|
||||
PORT=$(uci get clash.config.dash_port 2>/dev/null)
|
||||
|
||||
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
|
||||
if [ ! -d /usr/share/clashbackup ];then
|
||||
mkdir -p /usr/share/clashbackup 2>/dev/null
|
||||
fi
|
||||
cat "$CURL_CACHE" |jsonfilter -e '@["proxies"][@.type="Selector"]["name"]' > "$CURL_GROUP_CACHE" 2>/dev/null
|
||||
cat "$CURL_CACHE" |jsonfilter -e '@["proxies"][@.type="Selector"]["now"]' > "$CURL_NOW_CACHE" 2>/dev/null
|
||||
awk 'NR==FNR{a[i]=$0;i++}NR>FNR{print a[j]"#*#"$0;j++}' "$CURL_GROUP_CACHE" "$CURL_NOW_CACHE" > "$HISTORY_PATH" 2>/dev/null
|
||||
fi
|
||||
rm -rf /usr/share/clashbackup/clash_*.json 2>/dev/null
|
||||
@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
new_clashtun_core_version=`curl -sL "https://github.com/frainzy1477/clashtun/tags"| grep "/frainzy1477/clashtun/releases/"| head -n 1| awk -F "/tag/" '{print $2}'| sed 's/\">//'`
|
||||
if [ "$?" -eq "0" ]; then
|
||||
rm -rf /usr/share/clash/new_clashtun_core_version
|
||||
if [ $new_clashtun_core_version ]; then
|
||||
echo $new_clashtun_core_version > /usr/share/clash/new_clashtun_core_version 2>&1 & >/dev/null
|
||||
elif [ $new_clashtun_core_version =="" ]; then
|
||||
echo 0 > /usr/share/clash/new_clashtun_core_version 2>&1 & >/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
new_core_version=`curl -sL "https://github.com/frainzy1477/clash_dev/tags"| grep "/frainzy1477/clash_dev/releases/"| head -n 1| awk -F "/tag/" '{print $2}'| sed 's/\">//'`
|
||||
if [ "$?" -eq "0" ]; then
|
||||
rm -rf /usr/share/clash/new_core_version
|
||||
if [ $new_core_version ]; then
|
||||
echo $new_core_version > /usr/share/clash/new_core_version 2>&1 & >/dev/null
|
||||
elif [ $new_core_version =="" ]; then
|
||||
echo 0 > /usr/share/clash/new_core_version 2>&1 & >/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
new_clashdtun_core_version=`curl -sL "https://github.com/frainzy1477/clashdtun/tags"| grep "/frainzy1477/clashdtun/releases/"| head -n 1| awk -F "/tag/" '{print $2}'| sed 's/\">//'`
|
||||
sleep 2
|
||||
if [ "$?" -eq "0" ]; then
|
||||
rm -rf /usr/share/clash/new_clashdtun_core_version
|
||||
if [ $new_clashdtun_core_version ]; then
|
||||
echo $new_clashdtun_core_version > /usr/share/clash/new_clashdtun_core_version 2>&1 & >/dev/null
|
||||
elif [ $new_clashdtun_core_version =="" ]; then
|
||||
echo 0 > /usr/share/clash/new_clashdtun_core_version 2>&1 & >/dev/null
|
||||
fi
|
||||
fi
|
||||
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
new_version=`curl -sL "https://github.com/frainzy1477/luci-app-clash/tags"| grep "/frainzy1477/luci-app-clash/releases/"| head -n 1| awk -F "/tag/" '{print $2}'| sed 's/\">//'`
|
||||
if [ "$?" -eq "0" ]; then
|
||||
rm -rf /usr/share/clash/new_luci_version
|
||||
if [ $new_version ]; then
|
||||
echo $new_version > /usr/share/clash/new_luci_version 2>&1 & >/dev/null
|
||||
elif [ $new_version =="" ]; then
|
||||
echo 0 > /usr/share/clash/new_luci_version 2>&1 & >/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,6 +0,0 @@
|
||||
echo "create china hash:net family inet hashsize 1024 maxelem 65536" > /tmp/china.ipset
|
||||
awk '!/^$/&&!/^#/{printf("add china %s'" "'\n",$0)}' /usr/share/clash/china_ip.txt >> /tmp/china.ipset
|
||||
ipset -! flush china
|
||||
ipset -! restore < /tmp/china.ipset 2>/dev/null
|
||||
rm -f /tmp/china.ipset
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
enable=$(uci get clash.config.enable 2>/dev/null)
|
||||
if [ "${enable}" -eq 1 ];then
|
||||
if ! pidof clash>/dev/null; then
|
||||
/etc/init.d/clash restart 2>&1 &
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,125 +0,0 @@
|
||||
#!/bin/bash /etc/rc.common
|
||||
|
||||
clash_url=$(uci get clash.config.clash_url 2>/dev/null)
|
||||
ssr_url=$(uci get clash.config.ssr_url 2>/dev/null)
|
||||
v2_url=$(uci get clash.config.v2_url 2>/dev/null)
|
||||
|
||||
config_name=$(uci get clash.config.config_name 2>/dev/null)
|
||||
subtype=$(uci get clash.config.subcri 2>/dev/null)
|
||||
REAL_LOG="/usr/share/clash/clash_real.txt"
|
||||
lang=$(uci get luci.main.lang 2>/dev/null)
|
||||
CONFIG_YAML="/usr/share/clash/config/sub/${config_name}.yaml"
|
||||
|
||||
if [ $config_name == "" ] || [ -z $config_name ];then
|
||||
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Tag Your Config" >$REAL_LOG
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "标记您的配置" >$REAL_LOG
|
||||
fi
|
||||
sleep 5
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
exit 0
|
||||
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f "/usr/share/clashbackup/confit_list.conf" ];then
|
||||
touch /usr/share/clashbackup/confit_list.conf
|
||||
fi
|
||||
|
||||
|
||||
check_name=$(grep -F "${config_name}.yaml" "/usr/share/clashbackup/confit_list.conf")
|
||||
|
||||
|
||||
if [ ! -z $check_name ];then
|
||||
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Config with same name exist, please rename and download again" >$REAL_LOG
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "已存在同名配置,请重命名名配置重新下载" >$REAL_LOG
|
||||
fi
|
||||
sleep 5
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
exit 0
|
||||
|
||||
|
||||
else
|
||||
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Downloading Configuration..." >$REAL_LOG
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "开始下载配置" >$REAL_LOG
|
||||
fi
|
||||
sleep 1
|
||||
|
||||
if [ "$subtype" = "clash" ];then
|
||||
wget -c4 --no-check-certificate --user-agent="Clash/OpenWRT" "$clash_url" -O 2>&1 >1 $CONFIG_YAML
|
||||
if [ "$?" -eq "0" ]; then
|
||||
echo "${config_name}.yaml#$clash_url#$subtype" >>/usr/share/clashbackup/confit_list.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$subtype" = "ssr2clash" ];then
|
||||
wget -c4 --no-check-certificate --user-agent="Clash/OpenWRT" "https://gfwsb.114514.best/sub?target=clashr&url=$ssr_url" -O 2>&1 >1 $CONFIG_YAML
|
||||
if [ "$?" -eq "0" ]; then
|
||||
echo "${config_name}.yaml#$ssr_url#$subtype" >>/usr/share/clashbackup/confit_list.conf
|
||||
CONFIG_YAMLL="/tmp/conf"
|
||||
da_password=$(uci get clash.config.dash_pass 2>/dev/null)
|
||||
redir_port=$(uci get clash.config.redir_port 2>/dev/null)
|
||||
http_port=$(uci get clash.config.http_port 2>/dev/null)
|
||||
socks_port=$(uci get clash.config.socks_port 2>/dev/null)
|
||||
dash_port=$(uci get clash.config.dash_port 2>/dev/null)
|
||||
bind_addr=$(uci get clash.config.bind_addr 2>/dev/null)
|
||||
allow_lan=$(uci get clash.config.allow_lan 2>/dev/null)
|
||||
log_level=$(uci get clash.config.level 2>/dev/null)
|
||||
p_mode=$(uci get clash.config.p_mode 2>/dev/null)
|
||||
sed -i "/^Proxy:/i\#clash-openwrt" $CONFIG_YAML 2>/dev/null
|
||||
sed -i '1,/#clash-openwrt/d' $CONFIG_YAML 2>/dev/null
|
||||
|
||||
cat /usr/share/clash/dns.yaml $CONFIG_YAML > $CONFIG_YAMLL 2>/dev/null
|
||||
mv $CONFIG_YAMLL $CONFIG_YAML 2>/dev/null
|
||||
|
||||
sed -i "1i\#****CLASH-CONFIG-START****#" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "2i\port: ${http_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/port: ${http_port}/a\socks-port: ${socks_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/socks-port: ${socks_port}/a\redir-port: ${redir_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/redir-port: ${redir_port}/a\allow-lan: ${allow_lan}" $CONFIG_YAML 2>/dev/null
|
||||
if [ $allow_lan == "true" ]; then
|
||||
sed -i "/allow-lan: ${allow_lan}/a\bind-address: \"${bind_addr}\"" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/bind-address: \"${bind_addr}\"/a\mode: ${p_mode}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/mode: ${p_mode}/a\log-level: ${log_level}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/log-level: ${log_level}/a\external-controller: 0.0.0.0:${dash_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/external-controller: 0.0.0.0:${dash_port}/a\secret: \"${da_password}\"" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/secret: \"${da_password}\"/a\external-ui: \"/usr/share/clash/dashboard\"" $CONFIG_YAML 2>/dev/null
|
||||
|
||||
else
|
||||
sed -i "/allow-lan: ${allow_lan}/a\mode: Rule" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/mode: Rule/a\log-level: ${log_level}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/log-level: ${log_level}/a\external-controller: 0.0.0.0:${dash_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/external-controller: 0.0.0.0:${dash_port}/a\secret: \"${da_password}\"" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/secret: \"${da_password}\"/a\external-ui: \"/usr/share/clash/dashboard\"" $CONFIG_YAML 2>/dev/null
|
||||
fi
|
||||
sleep 1
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$subtype" = "v2clash" ];then
|
||||
wget -c4 --no-check-certificate --user-agent="Clash/OpenWRT" "https://tgbot.lbyczf.com/v2rayn2clash?url=$v2_url" -O 2>&1 >1 $CONFIG_YAML
|
||||
if [ "$?" -eq "0" ]; then
|
||||
echo "${config_name}.yaml#$v2_url#$subtype" >>/usr/share/clashbackup/confit_list.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Downloading Configuration Completed" >$REAL_LOG
|
||||
sleep 2
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "下载配置完成" >$REAL_LOG
|
||||
sleep 2
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
fi
|
||||
|
||||
fi
|
||||
@ -1,78 +0,0 @@
|
||||
#!/bin/bash /etc/rc.common
|
||||
. /lib/functions.sh
|
||||
|
||||
RULE_FILE_NAME="$1"
|
||||
RULE_FILE_ENNAME=$(grep -F $RULE_FILE_NAME /usr/share/clash/rules/rules.list |awk -F ',' '{print $3}' 2>/dev/null)
|
||||
if [ ! -z "$RULE_FILE_ENNAME" ]; then
|
||||
DOWNLOAD_PATH=$(grep -F $RULE_FILE_NAME /usr/share/clash/rules/rules.list |awk -F ',' '{print $2}' 2>/dev/null)
|
||||
else
|
||||
DOWNLOAD_PATH=$RULE_FILE_NAME
|
||||
fi
|
||||
RULE_FILE_DIR="/usr/share/clash/rules/g_rules/$RULE_FILE_NAME"
|
||||
TMP_RULE_DIR="/tmp/$RULE_FILE_NAME"
|
||||
LOG_FILE="/usr/share/clash/clash.txt"
|
||||
REAL_LOG="/usr/share/clash/clash_real.txt"
|
||||
|
||||
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Updating 【$RULE_FILE_NAME】 Rule..." >$REAL_LOG
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "开始下载【$RULE_FILE_NAME】规则..." >$REAL_LOG
|
||||
fi
|
||||
|
||||
wget --no-check-certificate -c4 https://raw.githubusercontent.com/FQrabbit/SSTap-Rule/master/rules/"$DOWNLOAD_PATH" -O 2>&1 >1 "$TMP_RULE_DIR"
|
||||
|
||||
if [ "$?" -eq "0" ] && [ "$(ls -l $TMP_RULE_DIR |awk '{print $5}')" -ne 0 ]; then
|
||||
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "【$RULE_FILE_NAME】 Downloaded successfully. Checking whether the rule version is updated.." >$REAL_LOG
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "【$RULE_FILE_NAME】规则下载成功,检查规则版本是否更新..." >$REAL_LOG
|
||||
fi
|
||||
|
||||
cmp -s $TMP_RULE_DIR $RULE_FILE_DIR
|
||||
if [ "$?" -ne "0" ]; then
|
||||
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Rule version has been updated. Start to replace the old rule version.." >$REAL_LOG
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "规则版本有更新,开始替换旧规则版本..." >$REAL_LOG
|
||||
fi
|
||||
mv $TMP_RULE_DIR $RULE_FILE_DIR >/dev/null 2>&1
|
||||
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Delete download cache" >$REAL_LOG
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "删除下载缓存..." >$REAL_LOG
|
||||
fi
|
||||
|
||||
rm -rf $TMP_RULE_DIR >/dev/null 2>&1
|
||||
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Rule File【$RULE_FILE_NAME】 Download Successful" >$REAL_LOG
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "【$RULE_FILE_NAME】规则更新成功!" >$REAL_LOG
|
||||
fi
|
||||
sleep 2
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
else
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Updated Rule File【$RULE_FILE_NAME】 No Change, Do Nothing" >$REAL_LOG
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "【$RULE_FILE_NAME】规则版本没有更新,停止继续操作..." >$REAL_LOG
|
||||
fi
|
||||
|
||||
rm -rf $TMP_RULE_DIR >/dev/null 2>&1
|
||||
sleep 2
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
fi
|
||||
else
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Rule File【$RULE_FILE_NAME】 Download Error" >$REAL_LOG
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "【$RULE_FILE_NAME】规则下载失败,请检查网络或稍后再试!" >$REAL_LOG
|
||||
fi
|
||||
rm -rf $TMP_RULE_DIR >/dev/null 2>&1
|
||||
sleep 2
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
fi
|
||||
@ -1 +0,0 @@
|
||||
Clash for OpenWRT
|
||||
@ -1,175 +0,0 @@
|
||||
#!/bin/sh
|
||||
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
LOG_FILE="/tmp/clash_update.txt"
|
||||
MODELTYPE=$(uci get clash.config.download_core 2>/dev/null)
|
||||
CORETYPE=$(uci get clash.config.dcore 2>/dev/null)
|
||||
CORE=$(uci get clash.config.core 2>/dev/null)
|
||||
lang=$(uci get luci.main.lang 2>/dev/null)
|
||||
if [ -f /tmp/clash.tar.gz ];then
|
||||
rm -rf /tmp/clash.tar.gz >/dev/null 2>&1
|
||||
fi
|
||||
echo '' >/tmp/clash_update.txt 2>/dev/null
|
||||
|
||||
if [ -f /usr/share/clash/core_down_complete ];then
|
||||
rm -rf /usr/share/clash/core_down_complete 2>/dev/null
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ $CORETYPE -eq 4 ];then
|
||||
if [ -f /usr/share/clash/download_dtun_version ];then
|
||||
rm -rf /usr/share/clash/download_dtun_version
|
||||
fi
|
||||
if [ $lang == "zh_cn" ];then
|
||||
echo " ${LOGTIME} - 正在检查最新版本。。" >$LOG_FILE
|
||||
elif [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo " ${LOGTIME} - Checking latest version.." >$LOG_FILE
|
||||
fi
|
||||
new_clashdtun_core_version=`wget -qO- "https://github.com/frainzy1477/clashdtun/tags"| grep "/frainzy1477/clashdtun/releases/"| head -n 1| awk -F "/tag/" '{print $2}'| sed 's/\">//'`
|
||||
|
||||
if [ $new_clashdtun_core_version ]; then
|
||||
echo $new_clashdtun_core_version > /usr/share/clash/download_dtun_version 2>&1 & >/dev/null
|
||||
elif [ $new_clashdtun_core_version =="" ]; then
|
||||
echo 0 > /usr/share/clash/download_dtun_version 2>&1 & >/dev/null
|
||||
fi
|
||||
sleep 5
|
||||
if [ -f /usr/share/clash/download_dtun_version ];then
|
||||
CLASHDTUNC=$(sed -n 1p /usr/share/clash/download_dtun_version 2>/dev/null)
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $CORETYPE -eq 3 ];then
|
||||
if [ -f /usr/share/clash/download_tun_version ];then
|
||||
rm -rf /usr/share/clash/download_tun_version
|
||||
fi
|
||||
if [ $lang == "zh_cn" ];then
|
||||
echo " ${LOGTIME} - 正在检查最新版本。。" >$LOG_FILE
|
||||
elif [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo " ${LOGTIME} - Checking latest version.." >$LOG_FILE
|
||||
fi
|
||||
new_clashtun_core_version=`wget -qO- "https://github.com/frainzy1477/clashtun/tags"| grep "/frainzy1477/clashtun/releases/"| head -n 1| awk -F "/tag/" '{print $2}'| sed 's/\">//'`
|
||||
|
||||
if [ $new_clashtun_core_version ]; then
|
||||
echo $new_clashtun_core_version > /usr/share/clash/download_tun_version 2>&1 & >/dev/null
|
||||
elif [ $new_clashtun_core_version =="" ]; then
|
||||
echo 0 > /usr/share/clash/download_tun_version 2>&1 & >/dev/null
|
||||
fi
|
||||
sleep 5
|
||||
if [ -f /usr/share/clash/download_tun_version ];then
|
||||
CLASHTUN=$(sed -n 1p /usr/share/clash/download_tun_version 2>/dev/null)
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $CORETYPE -eq 1 ];then
|
||||
if [ -f /usr/share/clash/download_core_version ];then
|
||||
rm -rf /usr/share/clash/download_core_version
|
||||
fi
|
||||
if [ $lang == "zh_cn" ];then
|
||||
echo " ${LOGTIME} - 正在检查最新版本。。" >$LOG_FILE
|
||||
elif [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo " ${LOGTIME} - Checking latest version.." >$LOG_FILE
|
||||
fi
|
||||
new_clashr_core_version=`wget -qO- "https://github.com/frainzy1477/clash_dev/tags"| grep "/frainzy1477/clash_dev/releases/"| head -n 1| awk -F "/tag/" '{print $2}'| sed 's/\">//'`
|
||||
|
||||
if [ $new_clashr_core_version ]; then
|
||||
echo $new_clashr_core_version > /usr/share/clash/download_core_version 2>&1 & >/dev/null
|
||||
elif [ $new_clashr_core_version =="" ]; then
|
||||
echo 0 > /usr/share/clash/download_core_version 2>&1 & >/dev/null
|
||||
fi
|
||||
sleep 5
|
||||
if [ -f /usr/share/clash/download_core_version ];then
|
||||
CLASHVER=$(sed -n 1p /usr/share/clash/download_core_version 2>/dev/null)
|
||||
fi
|
||||
fi
|
||||
|
||||
sleep 2
|
||||
|
||||
update(){
|
||||
if [ -f /tmp/clash.gz ];then
|
||||
rm -rf /tmp/clash.gz >/dev/null 2>&1
|
||||
fi
|
||||
if [ $lang == "zh_cn" ];then
|
||||
echo " ${LOGTIME} - 开始下载 Clash 内核..." >$LOG_FILE
|
||||
elif [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo " ${LOGTIME} - Starting Clash Core download" >$LOG_FILE
|
||||
fi
|
||||
if [ $CORETYPE -eq 1 ];then
|
||||
wget --no-check-certificate https://github.com/frainzy1477/clash_dev/releases/download/"$CLASHVER"/clash-"$MODELTYPE".gz -O 2>&1 >1 /tmp/clash.gz
|
||||
elif [ $CORETYPE -eq 3 ];then
|
||||
wget --no-check-certificate https://github.com/frainzy1477/clashtun/releases/download/"$CLASHTUN"/clash-"$MODELTYPE".gz -O 2>&1 >1 /tmp/clash.gz
|
||||
elif [ $CORETYPE -eq 4 ];then
|
||||
wget --no-check-certificate https://github.com/frainzy1477/clashdtun/releases/download/"$CLASHDTUNC"/clash-"$MODELTYPE".gz -O 2>&1 >1 /tmp/clash.gz
|
||||
fi
|
||||
|
||||
if [ "$?" -eq "0" ] && [ "$(ls -l /tmp/clash.gz |awk '{print int($5)}')" -ne 0 ]; then
|
||||
if [ $lang == "zh_cn" ];then
|
||||
echo " ${LOGTIME} - 开始解压缩文件" >$LOG_FILE
|
||||
elif [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo " ${LOGTIME} - Beginning to unzip file" >$LOG_FILE
|
||||
fi
|
||||
gunzip /tmp/clash.gz >/dev/null 2>&1\
|
||||
&& rm -rf /tmp/clash.gz >/dev/null 2>&1\
|
||||
&& chmod 755 /tmp/clash\
|
||||
&& chown root:root /tmp/clash
|
||||
|
||||
if [ $lang == "zh_cn" ];then
|
||||
echo " ${LOGTIME} - 完成下载内核,正在更新..." >$LOG_FILE
|
||||
elif [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo " ${LOGTIME} - Successfully downloaded core, updating now..." >$LOG_FILE
|
||||
fi
|
||||
|
||||
if [ $CORETYPE -eq 1 ];then
|
||||
rm -rf /etc/clash/clash >/dev/null 2>&1
|
||||
mv /tmp/clash /etc/clash/clash >/dev/null 2>&1
|
||||
rm -rf /usr/share/clash/core_version >/dev/null 2>&1
|
||||
mv /usr/share/clash/download_core_version /usr/share/clash/core_version >/dev/null 2>&1
|
||||
|
||||
if [ $lang == "zh_cn" ];then
|
||||
echo " ${LOGTIME} - Clash内核更新成功!" >$LOG_FILE
|
||||
elif [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo " ${LOGTIME} - Clash Core Update Successful" >$LOG_FILE
|
||||
fi
|
||||
|
||||
elif [ $CORETYPE -eq 3 ];then
|
||||
rm -rf /etc/clash/clashtun/clash >/dev/null 2>&1
|
||||
mv /tmp/clash /etc/clash/clashtun/clash >/dev/null 2>&1
|
||||
rm -rf /usr/share/clash/tun_version >/dev/null 2>&1
|
||||
mv /usr/share/clash/download_tun_version /usr/share/clash/tun_version >/dev/null 2>&1
|
||||
tun=$(sed -n 1p /usr/share/clash/tun_version 2>/dev/null)
|
||||
sed -i "s/${tun}/v${tun}/g" /usr/share/clash/tun_version 2>&1
|
||||
|
||||
|
||||
if [ $lang == "zh_cn" ];then
|
||||
echo " ${LOGTIME} - ClashTun内核更新成功!" >$LOG_FILE
|
||||
elif [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo " ${LOGTIME} - ClashTun Core Update Successful" >>$LOG_FILE
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
sleep 2
|
||||
touch /usr/share/clash/core_down_complete >/dev/null 2>&1
|
||||
sleep 2
|
||||
rm -rf /var/run/core_update >/dev/null 2>&1
|
||||
echo "" > /tmp/clash_update.txt >/dev/null 2>&1
|
||||
|
||||
else
|
||||
if [ $lang == "zh_cn" ];then
|
||||
echo " ${LOGTIME} - 核心程序下载失败,请检查网络或稍后再试!" >$LOG_FILE
|
||||
elif [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo " ${LOGTIME} - Core Update Error" >$LOG_FILE
|
||||
fi
|
||||
rm -rf /tmp/clash.tar.gz >/dev/null 2>&1
|
||||
echo "" > /tmp/clash_update.txt >/dev/null 2>&1
|
||||
fi
|
||||
if pidof clash >/dev/null; then
|
||||
if [ $CORETYPE == $CORE ];then
|
||||
/etc/init.d/clash restart >/dev/null
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if [ $CORETYPE -eq 1 ] || [ $CORETYPE -eq 3 ] || [ $CORETYPE -eq 4 ]; then
|
||||
update
|
||||
fi
|
||||
|
||||
@ -1,48 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
RULE_FILE_NAME="$1"
|
||||
|
||||
if [ -z "$(grep ",$RULE_FILE_NAME" /usr/share/clash/create/rule_provider.list 2>/dev/null)" ]; then
|
||||
DOWNLOAD_PATH=$(grep -F "$RULE_FILE_NAME" /usr/share/clash/create/rule_provider.list |awk -F ',' '{print $3$4}' 2>/dev/null)
|
||||
else
|
||||
DOWNLOAD_PATH=$(grep -F ",$RULE_FILE_NAME" /usr/share/clash/create/rule_provider.list |awk -F ',' '{print $3$4}' 2>/dev/null)
|
||||
fi
|
||||
|
||||
RULE_FILE_DIR="/etc/clash/ruleprovider/$RULE_FILE_NAME"
|
||||
TMP_RULE_DIR="/tmp/$RULE_FILE_NAME"
|
||||
LOG_FILE="/usr/share/clash/clash.txt"
|
||||
REAL_LOG="/usr/share/clash/clash_real.txt"
|
||||
|
||||
url="https://raw.githubusercontent.com/$DOWNLOAD_PATH"
|
||||
behavior=$(grep -F $RULE_FILE_NAME /usr/share/clash/create/rule_provider.list |awk -F ',' '{print $2}' 2>/dev/null)
|
||||
namee=$(grep -F ",$RULE_FILE_NAME" /usr/share/clash/create/rule_provider.list |awk -F ',' '{print $4}' | awk -F '.' '{print $1}' 2>/dev/null)
|
||||
path="./ruleprovider/"$RULE_FILE_NAME""
|
||||
|
||||
curl -sL --connect-timeout 5 --retry 2 https://raw.githubusercontent.com/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1
|
||||
|
||||
if [ "$?" -eq "0" ] && [ -s "$TMP_RULE_DIR" ] && [ -z "$(grep "404: Not Found" "$TMP_RULE_DIR")" ]; then
|
||||
cmp -s $TMP_RULE_DIR $RULE_FILE_DIR
|
||||
if [ "$?" -ne "0" ]; then
|
||||
mv $TMP_RULE_DIR $RULE_FILE_DIR >/dev/null 2>&1\
|
||||
&& rm -rf $TMP_RULE_DIR >/dev/null 2>&1
|
||||
name=clash
|
||||
uci_name_tmp=$(uci add $name ruleprovider)
|
||||
uci_set="uci -q set $name.$uci_name_tmp."
|
||||
uci_add="uci -q add_list $name.$uci_name_tmp."
|
||||
${uci_set}type="http"
|
||||
${uci_set}name="$namee"
|
||||
${uci_set}path="$path"
|
||||
${uci_set}behavior="$behavior"
|
||||
${uci_set}url="$url"
|
||||
${uci_set}interval="86400"
|
||||
uci commit clash
|
||||
return 1
|
||||
|
||||
else
|
||||
rm -rf $TMP_RULE_DIR >/dev/null 2>&1
|
||||
return 2
|
||||
fi
|
||||
else
|
||||
rm -rf $TMP_RULE_DIR >/dev/null 2>&1
|
||||
return 0
|
||||
fi
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,46 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
. /lib/functions.sh
|
||||
cfg_groups_set()
|
||||
{
|
||||
|
||||
CFG_FILE="/etc/config/clash"
|
||||
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 set clash."$section".old_name_cfg="$name"
|
||||
uci commit clash
|
||||
fi
|
||||
|
||||
if [ -z "$old_name" ]; then
|
||||
uci set clash."$section".old_name="$name"
|
||||
uci commit clash
|
||||
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/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
|
||||
config_load "clash"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
start(){
|
||||
status=$(ps|grep -c /usr/share/clash/create/pgroups.sh)
|
||||
[ "$status" -gt "3" ] && exit 0
|
||||
|
||||
config_load "clash"
|
||||
config_foreach cfg_groups_set "pgroups"
|
||||
}
|
||||
start
|
||||
@ -1,76 +0,0 @@
|
||||
All-4,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,All-4.yaml
|
||||
BBC-iPlayer,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,BBC-iPlayer.yaml
|
||||
Bahamut,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,Bahamut.yaml
|
||||
DAZN,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,DAZN.yaml
|
||||
DisneyPlus,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,DisneyPlus.yaml
|
||||
FOX,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,FOX.yaml
|
||||
HBO-GO-HKG,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,HBO-GO-HKG.yaml
|
||||
HBO,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,HBO.yaml
|
||||
HWTV,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,HWTV.yaml
|
||||
Hulu-JPN,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,Hulu-JPN.yaml
|
||||
Hulu,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,Hulu.yaml
|
||||
ITV,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,ITV.yaml
|
||||
KKTV,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,KKTV.yaml
|
||||
LINE-TV,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,LINE-TV.yaml
|
||||
LiTV,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,LiTV.yaml
|
||||
My5,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,My5.yaml
|
||||
Netflix,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,Netflix.yaml
|
||||
Now-E,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,Now-E.yaml
|
||||
PBS,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,PBS.yaml
|
||||
Pornhub,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,Pornhub.yaml
|
||||
Prime-Video,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,Prime-Video.yaml
|
||||
TaiwanGood,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,TaiwanGood.yaml
|
||||
TikTok,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,TikTok.yaml
|
||||
ViuTV,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,ViuTV.yaml
|
||||
YouTube,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,YouTube.yaml
|
||||
encoreTVB,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,encoreTVB.yaml
|
||||
myTV-SUPER,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,myTV-SUPER.yaml
|
||||
niconico,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Video/,niconico.yaml
|
||||
Himalaya,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Podcast/,Himalaya.yaml
|
||||
Deezer,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Music/,Deezer.yaml
|
||||
Instagram,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Music/,Instagram.yaml
|
||||
JOOX,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Music/,JOOX.yaml
|
||||
KKBOX,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Music/,KKBOX.yaml
|
||||
Pandora,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Music/,Pandora.yaml
|
||||
SoundCloud,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Music/,SoundCloud.yaml
|
||||
Spotify,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Music/,Spotify.yaml
|
||||
TIDAL,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Music/,TIDAL.yaml
|
||||
Twitch,classical,frainzy1477/clashrules/master/Clash/RuleSet/StreamingMedia/Live/,Twitch.yaml
|
||||
Advertising,classical,frainzy1477/clashrules/master/Clash/RuleSet/Guard/,Advertising.yaml
|
||||
Hijacking,classical,frainzy1477/clashrules/master/Clash/RuleSet/Guard/,Hijacking.yaml
|
||||
Privacy,classical,frainzy1477/clashrules/master/Clash/RuleSet/Guard/,Privacy.yaml
|
||||
ChinaIP,ipcidr,frainzy1477/clashrules/master/Clash/RuleSet/Extra/,ChinaIP.yaml
|
||||
IPBlackhole,ipcidr,frainzy1477/clashrules/master/Clash/RuleSet/Extra/,IP-Blackhole.yaml
|
||||
PayPal,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/,PayPal.yaml
|
||||
Scholar,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/,Scholar.yaml
|
||||
AppStore,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/Apple/,AppStore.yaml
|
||||
Apple,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/Apple/,Apple.yaml
|
||||
AppStoreConnect,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/Apple/,AppStoreConnect.yaml
|
||||
Apple-FindMy,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/Apple/,FindMy.yaml
|
||||
Apple-Mail,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/Apple/,Mail.yaml
|
||||
Apple-Music,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/Apple/,Music.yaml
|
||||
Apple-News,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/Apple/,News.yaml
|
||||
Apple-Siri,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/Apple/,Siri.yaml
|
||||
Apple-SoftwareUpdate,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/Apple/,SoftwareUpdate.yaml
|
||||
Apple-TV,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/Apple/,TV.yaml
|
||||
Apple-TestFlight,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/Apple/,TestFlight.yaml
|
||||
Apple-iCloud,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/Apple/,iCloud.yaml
|
||||
Steam,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/Game/,Steam.yaml
|
||||
Blizzard,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/Game/,Blizzard.yaml
|
||||
GoogleDrive,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/Google/,GoogleDrive.yaml
|
||||
GoogleSearch,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/Google/,GoogleSearch.yaml
|
||||
OneDrive,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/Microsoft/,OneDrive.yaml
|
||||
Telegram,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/Telegram/,Telegram.yaml
|
||||
TelegramNL,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/Telegram/,TelegramNL.yaml
|
||||
TelegramSG,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/Telegram/,TelegramSG.yaml
|
||||
TelegramUS,classical,frainzy1477/clashrules/master/Clash/RuleSet/Extra/Telegram/,TelegramUS.yaml
|
||||
广告(IP合集,ipcidr,frainzy1477/Clash-Ruleset/master/,Reject_IP.yaml
|
||||
广告(域名合集,domain,frainzy1477/Clash-Ruleset/master/,Reject_Domain.yaml
|
||||
网易云音乐域名,domain,frainzy1477/Clash-Ruleset/master/,Netease_Music_Domains.yaml
|
||||
苹果服务合集,domain,frainzy1477/Clash-Ruleset/master/,Apple_Domain.yaml
|
||||
国外流媒体(IP合集,ipcidr,frainzy1477/Clash-Ruleset/master/,Stream_IP.yaml
|
||||
国外流媒体(域名合集,domain,frainzy1477/Clash-Ruleset/master/,Stream_Domain.yaml
|
||||
国外IP代理合集,ipcidr,frainzy1477/Clash-Ruleset/master/,Global_IP.yaml
|
||||
国外域名代理合集,domain,frainzy1477/Clash-Ruleset/master/,Global_Domain.yaml
|
||||
国内IP合集,ipcidr,frainzy1477/Clash-Ruleset/master/,Domestic_IP.yaml
|
||||
国内常用域名,domain,frainzy1477/Clash-Ruleset/master/,Domestic_Domain.yaml
|
||||
@ -1,30 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
. /lib/functions.sh
|
||||
rules_set()
|
||||
{
|
||||
|
||||
CFG_FILE="/etc/config/clash"
|
||||
local section="$1"
|
||||
config_get "type" "$section" "type" ""
|
||||
config_get "rulename" "$section" "rulename" ""
|
||||
config_get "rulenamee" "$section" "rulenamee" ""
|
||||
|
||||
if [ -z "$type" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ -z "$rulename" ]; then
|
||||
uci set clash."$section".rulename="$rulenamee"
|
||||
uci commit clash
|
||||
fi
|
||||
|
||||
|
||||
}
|
||||
|
||||
start(){
|
||||
config_load "clash"
|
||||
config_foreach rules_set "rules"
|
||||
}
|
||||
|
||||
start
|
||||
@ -1,12 +0,0 @@
|
||||
script:
|
||||
code: |
|
||||
def main(ctx, metadata):
|
||||
ip = metadata["dst_ip"] = ctx.resolve_ip(metadata["host"])
|
||||
if ip == "":
|
||||
return "DIRECT"
|
||||
|
||||
code = ctx.geoip(ip)
|
||||
if code == "LAN" or code == "CN":
|
||||
return "DIRECT"
|
||||
|
||||
return "Proxy" # default policy for requests which are not matched by any other script
|
||||
@ -1,11 +0,0 @@
|
||||
#!/bin/bash /etc/rc.common
|
||||
. /lib/functions.sh
|
||||
|
||||
name=$(uci get clash.config.config_cus_remove 2>/dev/null)
|
||||
check_match_name=$(grep -F "$name" "/usr/share/clashbackup/create_list.conf")
|
||||
line_no=$(grep -n "$check_match_name" /usr/share/clashbackup/create_list.conf |awk -F ':' '{print $1}')
|
||||
if [ ! -z $check_match_name ];then
|
||||
sed -i "${line_no}d" /usr/share/clashbackup/create_list.conf
|
||||
rm -rf /usr/share/clash/config/custom/${name}
|
||||
sed -i '/^$/d' /usr/share/clashbackup/create_list.conf
|
||||
fi
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.0 KiB |
@ -1 +0,0 @@
|
||||
<!doctype html><html lang="en" dir="ltr"><head><meta charset="UTF-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 Dashboard</title><link href="main.658aa6a6e3feec8f168b.css" rel="stylesheet"></head><body><div id="root"></div><script src="js/1.bundle.658aa6a6e3feec8f168b.min.js"></script><script src="js/bundle.658aa6a6e3feec8f168b.min.js"></script></body></html>
|
||||
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
@ -1,31 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
. /lib/functions.sh
|
||||
cfg_groups_set()
|
||||
{
|
||||
|
||||
CFG_FILE="/etc/config/clash"
|
||||
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 [ "$name" != "$old_name_cfg" ]; then
|
||||
sed -i "s/\'${old_name_cfg}\'/\'${name}\'/g" $CFG_FILE 2>/dev/null
|
||||
sed -i "s/old_name \'${name}\'/old_name \'${old_name}\'/g" $CFG_FILE 2>/dev/null
|
||||
config_load "clash"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
start(){
|
||||
status=$(ps|grep -c /usr/share/clash/game-groups.sh)
|
||||
[ "$status" -gt "3" ] && exit 0
|
||||
|
||||
config_load "clash"
|
||||
config_foreach cfg_groups_set "conf_groups"
|
||||
}
|
||||
@ -1,103 +0,0 @@
|
||||
#!/bin/bash /etc/rc.common
|
||||
. /lib/functions.sh
|
||||
|
||||
GROUP_FILE="/tmp/yaml_group.yaml"
|
||||
GAME_RULE_FILE="/tmp/yaml_game_rule_group.yaml"
|
||||
game_rules=$(uci get clash.config.g_rules 2>/dev/null)
|
||||
|
||||
CUSTOM_RULE_FILE="/tmp/ipadd.conf"
|
||||
RULE="/tmp/rules_conf.yaml"
|
||||
CLASH="/tmp/conf.yaml"
|
||||
CONFIG_YAML="/etc/clash/config.yaml"
|
||||
CLASH_CONFIG="/tmp/config.yaml"
|
||||
|
||||
|
||||
if [ "${game_rules}" -eq 1 ];then
|
||||
|
||||
if [ -f $CLASH_CONFIG ];then
|
||||
rm -rf $CLASH_CONFIG 2>/dev/null
|
||||
fi
|
||||
|
||||
cp $CONFIG_YAML $CLASH_CONFIG 2>/dev/null
|
||||
if [ ! -z "$(grep "^Rule:" "$CLASH_CONFIG")" ]; then
|
||||
sed -i "/^Rule:/i\#RULESTART#" $CLASH_CONFIG 2>/dev/null
|
||||
elif [ ! -z "$(grep "^rules:" "$CLASH_CONFIG")" ]; then
|
||||
sed -i "/^rules:/i\#RULESTART#" $CLASH_CONFIG 2>/dev/null
|
||||
fi
|
||||
sed -i -e "\$a#RULEEND#" $CLASH_CONFIG 2>/dev/null
|
||||
|
||||
awk '/#RULESTART#/,/#RULEEND#/{print}' "$CLASH_CONFIG" 2>/dev/null |sed "s/\'//g" 2>/dev/null |sed 's/\"//g' 2>/dev/null |sed 's/\t/ /g' 2>/dev/null |grep - |awk -F '- ' '{print "- "$2}' | sed 's/^ \{0,\}//' 2>/dev/null |sed 's/ \{0,\}$//' 2>/dev/null >$RULE 2>&1
|
||||
|
||||
sed -i '/#RULESTART#/,/#RULEEND#/d' "$CLASH_CONFIG" 2>/dev/null
|
||||
|
||||
sed -i -e "\$a " $CLASH_CONFIG 2>/dev/null
|
||||
sed -i "1i\rules:" $RULE 2>/dev/null
|
||||
cat $CLASH_CONFIG $RULE >$CLASH 2>/dev/null
|
||||
mv $CLASH $CLASH_CONFIG 2>/dev/null
|
||||
rm -rf $RULE 2>/dev/null
|
||||
|
||||
|
||||
|
||||
|
||||
get_rule_file()
|
||||
{
|
||||
if [ -z "$1" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
GAME_RULE_FILE_NAME=$(grep -F $1 /usr/share/clash/rules/rules.list |awk -F ',' '{print $3}' 2>/dev/null)
|
||||
|
||||
if [ -z "$GAME_RULE_FILE_NAME" ]; then
|
||||
GAME_RULE_FILE_NAME=$(grep -F $1 /usr/share/clash/rules/rules.list |awk -F ',' '{print $2}' 2>/dev/null)
|
||||
fi
|
||||
|
||||
GAME_RULE_PATH="/usr/share/clash/rules/g_rules/$GAME_RULE_FILE_NAME"
|
||||
sed '/^#/d' $GAME_RULE_PATH 2>/dev/null |sed '/^ *$/d' |awk '{print "- IP-CIDR,"$0}' |awk -v tag="$2" '{print $0","'tag'""}' >> $GAME_RULE_FILE 2>/dev/null
|
||||
set_rule_file=1
|
||||
}
|
||||
|
||||
|
||||
yml_game_rule_get()
|
||||
{
|
||||
local section="$1"
|
||||
config_get "group" "$section" "group" ""
|
||||
|
||||
if [ -f $GAME_RULE_FILE ];then
|
||||
rm -rf $GAME_RULE_FILE 2>/dev/null
|
||||
fi
|
||||
|
||||
if [ -z "$group" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
config_list_foreach "$section" "rule_name" get_rule_file "$group"
|
||||
}
|
||||
|
||||
|
||||
|
||||
config_load "clash"
|
||||
config_foreach yml_game_rule_get "game"
|
||||
|
||||
if [ -f $GAME_RULE_FILE ];then
|
||||
|
||||
sed -i -e "\$a#GAMERULEEND#" $GAME_RULE_FILE 2>/dev/null
|
||||
sed -i '/#GAMERULESTART#/,/#GAMERULEEND#/d' "$CLASH_CONFIG" 2>/dev/null
|
||||
|
||||
if [ ! -z "$(grep "^ \{0,\}- GEOIP" "$CLASH_CONFIG")" ]; then
|
||||
sed -i '1,/^ \{0,\}- GEOIP,/{/^ \{0,\}- GEOIP,/s/^ \{0,\}- GEOIP,/#GAMERULESTART#\n&/}' "$CLASH_CONFIG" 2>/dev/null
|
||||
elif [ ! -z "$(grep "^ \{0,\}- MATCH," "$CLASH_CONFIG")" ]; then
|
||||
sed -i '1,/^ \{0,\}- MATCH,/{/^ \{0,\}- MATCH,/s/^ \{0,\}- MATCH,/#GAMERULESTART#\n&/}' "$CLASH_CONFIG" 2>/dev/null
|
||||
else
|
||||
echo "#GAMERULESTART#" >> "$CLASH_CONFIG" 2>/dev/null
|
||||
fi
|
||||
|
||||
sed -i '/GAMERULESTART/r/tmp/yaml_game_rule_group.yaml' "$CLASH_CONFIG" 2>/dev/null
|
||||
mv $CLASH_CONFIG $CONFIG_YAML 2>/dev/null
|
||||
fi
|
||||
rm -rf $GAME_RULE_FILE 2>/dev/null
|
||||
else
|
||||
sed -i '/#GAMERULESTART#/,/#GAMERULEEND#/d' "$CONFIG_YAML" 2>/dev/null
|
||||
rm -rf $GAME_RULE_FILE 2>/dev/null
|
||||
fi
|
||||
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
Key=$(uci get clash.config.license_key 2>/dev/null)
|
||||
geoip_source=$(uci get clash.config.geoip_source 2>/dev/null)
|
||||
if [ -f /var/run/geoip_down_complete ];then
|
||||
rm -rf /var/run/geoip_down_complete 2>/dev/null
|
||||
fi
|
||||
echo '' >/tmp/geoip_update.txt 2>/dev/null
|
||||
|
||||
if [ $geoip_source == 1 ];then
|
||||
wget -c4 --no-check-certificate --timeout=300 --user-agent="Mozilla" "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key="$Key"&suffix=tar.gz" -O /tmp/ipdb.tar.gz
|
||||
if [ "$?" -eq "0" ]; then
|
||||
tar zxvf /tmp/ipdb.tar.gz -C /tmp\
|
||||
&& rm -rf /tmp/ipdb.tar.gz >/dev/null 2>&1\
|
||||
&& mv /tmp/GeoLite2-Country_*/GeoLite2-Country.mmdb /etc/clash/Country.mmdb\
|
||||
&& rm -rf /tmp/GeoLite2-Country_* >/dev/null 2>&1
|
||||
fi
|
||||
else
|
||||
wget -c4 --no-check-certificate --timeout=300 --user-agent="Mozilla" https://raw.githubusercontent.com/alecthw/mmdb_china_ip_list/release/Country.mmdb -O /etc/clash/Country.mmdb
|
||||
fi
|
||||
|
||||
sleep 2
|
||||
touch /var/run/geoip_down_complete >/dev/null 2>&1
|
||||
sleep 2
|
||||
rm -rf /var/run/geoip_update >/dev/null 2>&1
|
||||
echo "" > /tmp/geoip_update.txt >/dev/null 2>&1
|
||||
|
||||
if pidof clash >/dev/null; then
|
||||
/etc/init.d/clash restart 2>/dev/null
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@ -1,45 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
. /lib/functions.sh
|
||||
cfg_groups_set()
|
||||
{
|
||||
|
||||
CFG_FILE="/etc/config/clash"
|
||||
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 set clash."$section".old_name_cfg="$name"
|
||||
uci commit clash
|
||||
fi
|
||||
|
||||
if [ -z "$old_name" ]; then
|
||||
uci set clash."$section".old_name="$name"
|
||||
uci commit clash
|
||||
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/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
|
||||
config_load "clash"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
start(){
|
||||
status=$(ps|grep -c /usr/share/clash/groups.sh)
|
||||
[ "$status" -gt "3" ] && exit 0
|
||||
|
||||
config_load "clash"
|
||||
config_foreach cfg_groups_set "groups"
|
||||
}
|
||||
@ -1,93 +0,0 @@
|
||||
#!/bin/bash /etc/rc.common
|
||||
. /lib/functions.sh
|
||||
|
||||
|
||||
CUSTOM_RULE_FILE="/tmp/ipadd.conf"
|
||||
RULE="/tmp/rules_conf.yaml"
|
||||
CLASH="/tmp/conf.yaml"
|
||||
CONFIG_YAML="/etc/clash/config.yaml"
|
||||
CLASH_CONFIG="/tmp/config.yaml"
|
||||
|
||||
|
||||
|
||||
append=$(uci get clash.config.append_rules 2>/dev/null)
|
||||
if [ "${append}" -eq 1 ];then
|
||||
|
||||
if [ -f $CLASH_CONFIG ];then
|
||||
rm -rf $CLASH_CONFIG 2>/dev/null
|
||||
fi
|
||||
|
||||
cp $CONFIG_YAML $CLASH_CONFIG 2>/dev/null
|
||||
if [ ! -z "$(grep "^Rule:" "$CLASH_CONFIG")" ]; then
|
||||
sed -i "/^Rule:/i\#RULESTART#" $CLASH_CONFIG 2>/dev/null
|
||||
elif [ ! -z "$(grep "^rules:" "$CLASH_CONFIG")" ]; then
|
||||
sed -i "/^rules:/i\#RULESTART#" $CLASH_CONFIG 2>/dev/null
|
||||
fi
|
||||
sed -i -e "\$a#RULEEND#" $CLASH_CONFIG 2>/dev/null
|
||||
|
||||
awk '/#RULESTART#/,/#RULEEND#/{print}' "$CLASH_CONFIG" 2>/dev/null |sed "s/\'//g" 2>/dev/null |sed 's/\"//g' 2>/dev/null |sed 's/\t/ /g' 2>/dev/null |grep '^ \{0,\}- '|awk -F '- ' '{print "- "$2}' | sed 's/^ \{0,\}//' 2>/dev/null |sed 's/ \{0,\}$//' 2>/dev/null >$RULE 2>&1
|
||||
|
||||
sed -i '/#RULESTART#/,/#RULEEND#/d' "$CLASH_CONFIG" 2>/dev/null
|
||||
|
||||
sed -i -e "\$a " $CLASH_CONFIG 2>/dev/null
|
||||
sed -i "1i\rules:" $RULE 2>/dev/null
|
||||
cat $CLASH_CONFIG $RULE >$CLASH 2>/dev/null
|
||||
mv $CLASH $CLASH_CONFIG 2>/dev/null
|
||||
rm -rf $RULE 2>/dev/null
|
||||
|
||||
|
||||
|
||||
if [ -f $CUSTOM_RULE_FILE ];then
|
||||
rm -rf $CUSTOM_RULE_FILE 2>/dev/null
|
||||
fi
|
||||
|
||||
|
||||
ipadd()
|
||||
{
|
||||
|
||||
|
||||
local section="$1"
|
||||
config_get "pgroup" "$section" "pgroup" ""
|
||||
config_get "ipaaddr" "$section" "ipaaddr" ""
|
||||
config_get "type" "$section" "type" ""
|
||||
config_get "res" "$section" "res" ""
|
||||
|
||||
if [ -z "$type" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -z "$pgroup" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "${res}" -eq 1 ];then
|
||||
echo "- $type,$ipaaddr,$pgroup,no-resolve">>/tmp/ipadd.conf
|
||||
else
|
||||
echo "- $type,$ipaaddr,$pgroup">>/tmp/ipadd.conf
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
config_load clash
|
||||
config_foreach ipadd "addtype"
|
||||
|
||||
|
||||
if [ -f $CUSTOM_RULE_FILE ];then
|
||||
|
||||
sed -i -e "\$a#CUSTOMRULEEND#" $CUSTOM_RULE_FILE 2>/dev/null
|
||||
sed -i '/#CUSTOMRULESTART#/,/#CUSTOMRULEEND#/d' "$CLASH_CONFIG" 2>/dev/null
|
||||
|
||||
if [ ! -z "$(grep "^ \{0,\}rules:" "$CLASH_CONFIG")" ]; then
|
||||
sed -i '/rules:/a\#CUSTOMRULESTART#' "$CLASH_CONFIG" 2>/dev/null
|
||||
else
|
||||
echo "#CUSTOMRULESTART#" >> "$CLASH_CONFIG" 2>/dev/null
|
||||
fi
|
||||
|
||||
sed -i '/CUSTOMRULESTART/r/tmp/ipadd.conf' "$CLASH_CONFIG" 2>/dev/null
|
||||
mv $CLASH_CONFIG $CONFIG_YAML 2>/dev/null
|
||||
|
||||
fi
|
||||
|
||||
else
|
||||
sed -i '/#CUSTOMRULESTART#/,/#CUSTOMRULEEND#/d' "$CONFIG_YAML" 2>/dev/null
|
||||
fi
|
||||
@ -1,19 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
enable=$(uci get clash.config.enable 2>/dev/null)
|
||||
if [ "${enable}" -eq 0 ];then
|
||||
|
||||
if [ -f /tmp/watchlist ];then
|
||||
rm -rf /tmp/watchlist
|
||||
fi
|
||||
line=$(ps | grep -n 'clash-watchdog.sh'|awk -F ':' '{print $2}' |awk -F ' ' '{print $1}'>/tmp/watchlist)
|
||||
line_no=$(grep -n '' /tmp/watchlist|awk -F ':' '{print $1}')
|
||||
num=$(grep -c '' /tmp/watchlist| awk '{print $1}')
|
||||
nums=1
|
||||
while [[ $nums -le $num ]]
|
||||
do
|
||||
kill -9 $(sed -n "$nums"p /tmp/watchlist| awk '{print $1}') >/dev/null 2>&1
|
||||
nums=$(( $nums + 1))
|
||||
done
|
||||
fi
|
||||
|
||||
@ -1,156 +0,0 @@
|
||||
#!/bin/bash /etc/rc.common
|
||||
. /lib/functions.sh
|
||||
|
||||
lang=$(uci get luci.main.lang 2>/dev/null)
|
||||
load="/tmp/config.yaml"
|
||||
CONFIG_YAML_PATH=$(uci get clash.config.use_config 2>/dev/null)
|
||||
|
||||
|
||||
if [ -f $CONFIG_YAML_PATH ] && [ "$(ls -l $CONFIG_YAML_PATH|awk '{print int($5)}')" -ne 0 ];then
|
||||
cp $CONFIG_YAML_PATH $load 2>/dev/null
|
||||
fi
|
||||
|
||||
if [ ! -f $load ] || [ "$(ls -l $load|awk '{print int($5)}')" -eq 0 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
CFG_FILE="/etc/config/clash"
|
||||
REAL_LOG="/usr/share/clash/clash_real.txt"
|
||||
|
||||
rm -rf /tmp/Proxy_Group /tmp/group_*.yaml /tmp/yaml_group.yaml 2>/dev/null
|
||||
|
||||
|
||||
if [ $lang == "zh_cn" ];then
|
||||
echo "开始更新策略组配置..." >$REAL_LOG
|
||||
elif [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Start updating policy group config" >$REAL_LOG
|
||||
fi
|
||||
|
||||
sed -i 's/^Proxy Group:/proxy-groups:/g' "$load"
|
||||
sed -i 's/^proxy-provider:/proxy-providers:/g' "$load"
|
||||
sed -i 's/^Proxy:/proxies:/g' "$load"
|
||||
sed -i 's/^Rule:/rules:/g' "$load"
|
||||
sed -i 's/^rule-provider:/rule-providers:/g' "$load"
|
||||
|
||||
|
||||
group_len=$(sed -n '/^ \{0,\}proxy-groups:/=' "$load" 2>/dev/null)
|
||||
provider_len=$(sed -n '/^ \{0,\}proxy-providers:/=' "$load" 2>/dev/null)
|
||||
if [ "$provider_len" -ge "$group_len" ]; then
|
||||
awk '/proxies:/,/proxy-providers:/{print}' "$load" 2>/dev/null |sed "s/\'//g" 2>/dev/null |sed 's/\"//g' 2>/dev/null |sed 's/\t/ /g' 2>/dev/null |grep name: |awk -F 'name:' '{print $2}' |sed 's/,.*//' |sed 's/^ \{0,\}//' 2>/dev/null |sed 's/ \{0,\}$//' 2>/dev/null |sed 's/ \{0,\}\}\{0,\}$//g' 2>/dev/null >/tmp/Proxy_Group 2>&1
|
||||
sed -i "s/proxy-providers://g" /tmp/Proxy_Group 2>&1
|
||||
else
|
||||
awk '/proxies:/,/rules:/{print}' "$load" 2>/dev/null |sed "s/\'//g" 2>/dev/null |sed 's/\"//g' 2>/dev/null |sed 's/\t/ /g' 2>/dev/null |grep name: |awk -F 'name:' '{print $2}' |sed 's/,.*//' |sed 's/^ \{0,\}//' 2>/dev/null |sed 's/ \{0,\}$//' 2>/dev/null |sed 's/ \{0,\}\}\{0,\}$//g' 2>/dev/null >/tmp/Proxy_Group 2>&1
|
||||
fi
|
||||
|
||||
|
||||
if [ "$?" -eq "0" ]; then
|
||||
echo 'DIRECT' >>/tmp/Proxy_Group
|
||||
echo 'REJECT' >>/tmp/Proxy_Group
|
||||
else
|
||||
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Read error, configuration file exception!" >/tmp/Proxy_Group
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo '读取错误,配置文件异常!' >/tmp/Proxy_Group
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
group_len=$(sed -n '/^ \{0,\}proxy-groups:/=' "$load" 2>/dev/null)
|
||||
provider_len=$(sed -n '/^ \{0,\}proxy-providers:/=' "$load" 2>/dev/null)
|
||||
ruleprovider_len=$(sed -n '/^ \{0,\}rule-providers:/=' "$load" 2>/dev/null)
|
||||
if [ "$provider_len" -ge "$group_len" ]; then
|
||||
awk '/proxy-groups:/,/proxy-providers:/{print}' "$load" 2>/dev/null |sed 's/\"//g' 2>/dev/null |sed "s/\'//g" 2>/dev/null |sed 's/\t/ /g' 2>/dev/null >/tmp/yaml_group.yaml 2>&1
|
||||
sed -i "s/proxy-providers://g" /tmp/yaml_group.yaml 2>&1
|
||||
elif [ "$ruleprovider_len" -ge "$group_len" ]; then
|
||||
awk '/proxy-groups:/,/rule-providers:/{print}' "$load" 2>/dev/null |sed 's/\"//g' 2>/dev/null |sed "s/\'//g" 2>/dev/null |sed 's/\t/ /g' 2>/dev/null >/tmp/yaml_group.yaml 2>&1
|
||||
sed -i "s/rule-providers://g" /tmp/yaml_group.yaml 2>&1
|
||||
else
|
||||
awk '/proxy-groups:/,/Rule:/{print}' "$load" 2>/dev/null |sed 's/\"//g' 2>/dev/null |sed "s/\'//g" 2>/dev/null |sed 's/\t/ /g' 2>/dev/null >/tmp/yaml_group.yaml 2>&1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
#######READ GROUPS START
|
||||
|
||||
|
||||
if [ -f /tmp/yaml_group.yaml ];then
|
||||
while [[ "$( grep -c "config conf_groups" $CFG_FILE )" -ne 0 ]]
|
||||
do
|
||||
uci delete clash.@conf_groups[0] && uci commit clash >/dev/null 2>&1
|
||||
done
|
||||
|
||||
|
||||
|
||||
count=1
|
||||
file_count=1
|
||||
match_group_file="/tmp/Proxy_Group"
|
||||
group_file="/tmp/yaml_group.yaml"
|
||||
line=$(sed -n '/name:/=' $group_file)
|
||||
num=$(grep -c "name:" $group_file)
|
||||
|
||||
cfg_get()
|
||||
{
|
||||
echo "$(grep "$1" "$2" 2>/dev/null |awk -v tag=$1 'BEGIN{FS=tag} {print $2}' 2>/dev/null |sed 's/,.*//' 2>/dev/null |sed 's/^ \{0,\}//g' 2>/dev/null |sed 's/ \{0,\}$//g' 2>/dev/null |sed 's/ \{0,\}\}\{0,\}$//g' 2>/dev/null)"
|
||||
}
|
||||
|
||||
|
||||
|
||||
for n in $line
|
||||
do
|
||||
single_group="/tmp/group_$file_count.yaml"
|
||||
|
||||
[ "$count" -eq 1 ] && {
|
||||
startLine="$n"
|
||||
}
|
||||
|
||||
count=$(expr "$count" + 1)
|
||||
if [ "$count" -gt "$num" ]; then
|
||||
endLine=$(sed -n '$=' $group_file)
|
||||
else
|
||||
endLine=$(expr $(echo "$line" | sed -n "${count}p") - 1)
|
||||
fi
|
||||
|
||||
sed -n "${startLine},${endLine}p" $group_file >$single_group
|
||||
startLine=$(expr "$endLine" + 1)
|
||||
|
||||
#type
|
||||
group_type="$(cfg_get "type:" "$single_group")"
|
||||
#name
|
||||
group_name="$(cfg_get "name:" "$single_group")"
|
||||
#test_url
|
||||
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Now Reading 【$group_type】-【$group_name】 Policy Group..." >$REAL_LOG
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "正在读取【$group_type】-【$group_name】策略组配置..." >$REAL_LOG
|
||||
fi
|
||||
|
||||
name=clash
|
||||
uci_name_tmp=$(uci add $name conf_groups)
|
||||
uci_set="uci -q set $name.$uci_name_tmp."
|
||||
uci_add="uci -q add_list $name.$uci_name_tmp."
|
||||
${uci_set}name="$group_name"
|
||||
${uci_set}type="$group_type"
|
||||
|
||||
|
||||
file_count=$(( $file_count + 1))
|
||||
|
||||
done
|
||||
|
||||
uci commit clash
|
||||
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Reading Policy Group Completed" >$REAL_LOG
|
||||
sleep 2
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "读取策略组配置完成" >$REAL_LOG
|
||||
sleep 2
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
fi
|
||||
|
||||
rm -rf /tmp/Proxy_Group /tmp/group_*.yaml /tmp/yaml_group.yaml $load 2>/dev/null
|
||||
fi
|
||||
#######READ GROUPS END
|
||||
@ -1 +0,0 @@
|
||||
v1.7.5.7
|
||||
@ -1,31 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
if [ -f /usr/share/clashbackup/history ];then
|
||||
|
||||
HISTORY_PATH="/usr/share/clashbackup/history"
|
||||
SECRET=$(uci get clash.config.dash_pass 2>/dev/null)
|
||||
LAN_IP=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null)
|
||||
PORT=$(uci get clash.config.dash_port 2>/dev/null)
|
||||
urlencode() {
|
||||
local data
|
||||
if [ "$#" != 1 ]; then
|
||||
return 1
|
||||
fi
|
||||
data=$(curl -s -o /dev/null -w %{url_effective} --get --data-urlencode "$1" "")
|
||||
if [ ! -z "$data" ]; then
|
||||
echo "${data##/?}"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
cat $HISTORY_PATH |while read line
|
||||
do
|
||||
if [ -z "$(echo $line |grep "#*#")" ]; then
|
||||
continue
|
||||
else
|
||||
GORUP_NAME=$(urlencode "$(echo $line |awk -F '#*#' '{print $1}')")
|
||||
NOW_NAME=$(echo $line |awk -F '#*#' '{print $3}')
|
||||
curl -H "Authorization: Bearer ${SECRET}" -H "Content-Type:application/json" -X PUT -d '{"name":"'"$NOW_NAME"'"}' http://"$LAN_IP":"$PORT"/proxies/"$GORUP_NAME" >/dev/null 2>&1
|
||||
fi
|
||||
done >/dev/null 2>&1
|
||||
|
||||
fi
|
||||
@ -1,13 +0,0 @@
|
||||
#!/bin/bash /etc/rc.common
|
||||
. /lib/functions.sh
|
||||
|
||||
name=$(uci get clash.config.config_name_remove 2>/dev/null)
|
||||
check_match_name=$(grep -F "$name" "/usr/share/clashbackup/confit_list.conf")
|
||||
line_no=$(grep -n "$check_match_name" /usr/share/clashbackup/confit_list.conf |awk -F ':' '{print $1}')
|
||||
if [ ! -z $check_match_name ];then
|
||||
sed -i "${line_no}d" /usr/share/clashbackup/confit_list.conf
|
||||
rm -rf /usr/share/clash/config/sub/${name}
|
||||
sed -i '/^$/d' /usr/share/clashbackup/confit_list.conf
|
||||
rm -rf /usr/share/clash/config/sub/${name}
|
||||
fi
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
rule=$(uci get clash.config.rule_url 2>/dev/null)
|
||||
RULE_YAML="/tmp/Rule"
|
||||
|
||||
wget -c4 --no-check-certificate --user-agent="Clash/OpenWRT" "$rule" -O 2>&1 >1 $RULE_YAML
|
||||
|
||||
if [ -f "$RULE_YAML" ]; then
|
||||
status=$(egrep '^ {0,}Rule:' /tmp/Rule)
|
||||
|
||||
if [ $status ];then
|
||||
sed -i "/Rule:/i\===" $RULE_YAML
|
||||
sed -i "1i\ " $RULE_YAML
|
||||
mv $RULE_YAML /tmp/test
|
||||
sed -i '1,/===/d' /tmp/test
|
||||
mv /tmp/test /usr/share/clash/rule.yaml
|
||||
else
|
||||
sed -i "1i\Rule:" $RULE_YAML
|
||||
mv $RULE_YAML /tmp/test
|
||||
sed -i "1i\ " /tmp/test
|
||||
mv /tmp/test /usr/share/clash/rule.yaml
|
||||
fi
|
||||
fi
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,949 +0,0 @@
|
||||
#Steam,Steam-社区(Beta),0,0,1,0,0,0,By-FQrabbit
|
||||
2.16.4.0/24
|
||||
2.16.10.0/24
|
||||
2.16.17.0/24
|
||||
2.16.21.0/24
|
||||
2.16.39.0/24
|
||||
2.16.59.0/24
|
||||
2.16.82.0/24
|
||||
2.16.95.0/24
|
||||
2.16.104.0/23
|
||||
2.16.111.0/24
|
||||
2.17.55.0/24
|
||||
2.17.98.0/24
|
||||
2.17.191.0/24
|
||||
2.18.119.0/24
|
||||
2.18.152.0/24
|
||||
2.18.199.0/24
|
||||
2.19.131.0/24
|
||||
2.19.147.0/24
|
||||
2.19.225.0/24
|
||||
2.20.57.0/24
|
||||
2.20.166.0/24
|
||||
2.20.177.0/24
|
||||
2.20.200.0/24
|
||||
2.20.214.0/24
|
||||
2.21.31.0/24
|
||||
2.21.46.0/24
|
||||
2.21.75.0/24
|
||||
2.21.131.0/24
|
||||
2.21.145.0/24
|
||||
2.21.150.0/24
|
||||
2.21.195.0/24
|
||||
2.21.205.0/24
|
||||
2.21.248.0/24
|
||||
2.22.13.0/24
|
||||
2.22.15.0/24
|
||||
2.22.36.0/24
|
||||
2.22.69.0/24
|
||||
2.22.73.0/24
|
||||
2.22.74.0/23
|
||||
2.22.146.0/24
|
||||
2.23.151.0/24
|
||||
2.23.181.0/24
|
||||
8.7.198.0/24
|
||||
14.21.78.0/24
|
||||
23.0.7.0/24
|
||||
23.0.21.0/24
|
||||
23.0.83.0/24
|
||||
23.0.146.0/24
|
||||
23.0.168.0/24
|
||||
23.0.178.0/24
|
||||
23.0.232.0/24
|
||||
23.0.252.0/24
|
||||
23.1.15.0/24
|
||||
23.1.26.0/24
|
||||
23.1.45.0/24
|
||||
23.1.227.0/24
|
||||
23.2.8.0/24
|
||||
23.2.11.0/24
|
||||
23.2.16.0/24
|
||||
23.2.18.0/24
|
||||
23.2.29.0/24
|
||||
23.2.42.0/24
|
||||
23.2.59.0/24
|
||||
23.2.92.0/24
|
||||
23.2.204.0/24
|
||||
23.2.206.0/24
|
||||
23.3.244.0/24
|
||||
23.4.168.0/24
|
||||
23.4.251.0/24
|
||||
23.5.114.0/24
|
||||
23.5.117.0/24
|
||||
23.5.156.0/24
|
||||
23.5.170.0/24
|
||||
23.5.241.0/24
|
||||
23.5.242.0/24
|
||||
23.7.39.0/24
|
||||
23.7.80.0/24
|
||||
23.7.128.0/24
|
||||
23.7.199.0/24
|
||||
23.7.246.0/24
|
||||
23.8.12.0/24
|
||||
23.8.117.0/24
|
||||
23.8.229.0/24
|
||||
23.9.9.0/24
|
||||
23.9.154.0/24
|
||||
23.10.0.0/16
|
||||
23.11.202.0/24
|
||||
23.11.204.0/24
|
||||
23.11.225.0/24
|
||||
23.11.236.0/24
|
||||
23.12.34.0/24
|
||||
23.12.109.0/24
|
||||
23.12.227.0/24
|
||||
23.12.229.0/24
|
||||
23.13.147.0/24
|
||||
23.14.6.0/24
|
||||
23.14.10.0/24
|
||||
23.14.68.0/24
|
||||
23.14.77.0/24
|
||||
23.14.85.0/24
|
||||
23.14.222.0/24
|
||||
23.14.229.0/24
|
||||
23.15.4.0/24
|
||||
23.15.81.0/24
|
||||
23.15.91.0/24
|
||||
23.15.94.0/24
|
||||
23.15.98.0/23
|
||||
23.15.184.0/24
|
||||
23.15.187.0/24
|
||||
23.15.224.0/24
|
||||
23.32.17.0/24
|
||||
23.32.86.0/24
|
||||
23.32.113.0/24
|
||||
23.32.131.0/24
|
||||
23.32.163.0/24
|
||||
23.32.215.0/24
|
||||
23.32.216.0/24
|
||||
23.32.248.0/24
|
||||
23.32.254.0/24
|
||||
23.33.75.0/24
|
||||
23.33.88.0/24
|
||||
23.33.112.0/24
|
||||
23.33.168.0/24
|
||||
23.33.255.0/24
|
||||
23.34.60.0/24
|
||||
23.34.65.0/24
|
||||
23.34.75.0/24
|
||||
23.35.225.0/24
|
||||
23.35.230.0/24
|
||||
23.36.26.0/24
|
||||
23.36.105.0/24
|
||||
23.36.141.0/24
|
||||
23.36.148.0/24
|
||||
23.36.165.0/24
|
||||
23.36.216.0/24
|
||||
23.36.220.0/24
|
||||
23.36.230.0/23
|
||||
23.37.53.0/24
|
||||
23.37.58.0/24
|
||||
23.37.67.0/24
|
||||
23.37.147.0/24
|
||||
23.37.148.0/24
|
||||
23.37.237.0/24
|
||||
23.37.239.0/24
|
||||
23.37.242.0/23
|
||||
23.37.249.0/24
|
||||
23.37.250.0/24
|
||||
23.38.3.0/24
|
||||
23.38.77.0/24
|
||||
23.38.109.0/24
|
||||
23.38.153.0/24
|
||||
23.38.155.0/24
|
||||
23.38.166.0/24
|
||||
23.39.136.0/24
|
||||
23.40.1.0/24
|
||||
23.40.4.0/24
|
||||
23.40.31.0/24
|
||||
23.40.247.0/24
|
||||
23.41.5.0/24
|
||||
23.41.59.0/24
|
||||
23.41.102.0/24
|
||||
23.41.132.0/24
|
||||
23.41.149.0/24
|
||||
23.41.165.0/24
|
||||
23.41.243.0/24
|
||||
23.42.6.0/24
|
||||
23.42.69.0/24
|
||||
23.42.83.0/24
|
||||
23.42.165.0/24
|
||||
23.42.212.0/24
|
||||
23.42.232.0/24
|
||||
23.42.248.0/24
|
||||
23.43.0.0/16
|
||||
23.44.193.0/24
|
||||
23.45.96.0/24
|
||||
23.45.201.0/24
|
||||
23.46.18.0/24
|
||||
23.46.24.0/24
|
||||
23.46.104.0/24
|
||||
23.46.241.0/24
|
||||
23.47.0.0/16
|
||||
23.48.4.0/24
|
||||
23.48.219.0/24
|
||||
23.49.4.0/24
|
||||
23.49.119.0/24
|
||||
23.49.135.0/24
|
||||
23.49.148.0/24
|
||||
23.49.224.0/24
|
||||
23.50.18.0/24
|
||||
23.50.37.0/24
|
||||
23.50.43.0/24
|
||||
23.50.69.0/24
|
||||
23.50.168.0/24
|
||||
23.51.39.0/24
|
||||
23.51.122.0/24
|
||||
23.51.131.0/24
|
||||
23.51.134.0/23
|
||||
23.51.154.0/24
|
||||
23.51.240.0/24
|
||||
23.51.246.0/24
|
||||
23.52.37.0/24
|
||||
23.52.51.0/24
|
||||
23.52.74.0/24
|
||||
23.52.82.0/24
|
||||
23.52.86.0/24
|
||||
23.53.33.0/24
|
||||
23.53.73.0/24
|
||||
23.53.195.0/24
|
||||
23.54.176.0/24
|
||||
23.54.179.0/24
|
||||
23.54.199.0/24
|
||||
23.54.247.0/24
|
||||
23.54.248.0/24
|
||||
23.54.250.0/24
|
||||
23.55.48.0/24
|
||||
23.55.53.0/24
|
||||
23.55.60.0/24
|
||||
23.55.139.0/24
|
||||
23.55.235.0/24
|
||||
23.56.115.0/24
|
||||
23.56.208.0/24
|
||||
23.57.32.0/24
|
||||
23.57.64.0/23
|
||||
23.57.230.0/24
|
||||
23.57.251.0/24
|
||||
23.58.0.0/24
|
||||
23.58.27.0/24
|
||||
23.58.36.0/24
|
||||
23.58.41.0/24
|
||||
23.58.75.0/24
|
||||
23.58.80.0/24
|
||||
23.58.154.0/24
|
||||
23.59.57.0/24
|
||||
23.59.96.0/24
|
||||
23.59.117.0/24
|
||||
23.60.41.0/24
|
||||
23.60.48.0/24
|
||||
23.60.123.0/24
|
||||
23.60.131.0/24
|
||||
23.61.10.0/24
|
||||
23.61.74.0/24
|
||||
23.61.161.0/24
|
||||
23.62.53.0/24
|
||||
23.62.102.0/24
|
||||
23.62.109.0/24
|
||||
23.62.145.0/24
|
||||
23.62.152.0/24
|
||||
23.63.11.0/24
|
||||
23.63.22.0/24
|
||||
23.63.32.0/24
|
||||
23.63.219.0/24
|
||||
23.63.228.0/24
|
||||
23.64.22.0/24
|
||||
23.64.34.0/24
|
||||
23.64.37.0/24
|
||||
23.64.38.0/24
|
||||
23.64.127.0/24
|
||||
23.64.158.0/24
|
||||
23.64.178.0/24
|
||||
23.65.80.0/24
|
||||
23.65.190.0/24
|
||||
23.65.225.0/24
|
||||
23.66.0.0/16
|
||||
23.67.65.0/24
|
||||
23.67.67.0/24
|
||||
23.67.69.0/24
|
||||
23.67.72.0/24
|
||||
23.67.76.0/24
|
||||
23.67.130.0/24
|
||||
23.67.161.0/24
|
||||
23.67.200.0/24
|
||||
23.67.204.0/24
|
||||
23.67.217.0/24
|
||||
23.72.20.0/24
|
||||
23.72.36.0/24
|
||||
23.72.58.0/24
|
||||
23.72.80.0/24
|
||||
23.72.92.0/24
|
||||
23.72.138.0/24
|
||||
23.72.156.0/24
|
||||
23.72.226.0/24
|
||||
23.72.250.0/24
|
||||
23.73.29.0/24
|
||||
23.73.77.0/24
|
||||
23.73.85.0/24
|
||||
23.73.137.0/24
|
||||
23.73.139.0/24
|
||||
23.73.144.0/24
|
||||
23.73.153.0/24
|
||||
23.73.168.0/24
|
||||
23.73.170.0/24
|
||||
23.73.199.0/24
|
||||
23.73.206.0/24
|
||||
23.74.15.0/24
|
||||
23.74.17.0/24
|
||||
23.74.57.0/24
|
||||
23.74.60.0/24
|
||||
23.74.138.0/24
|
||||
23.74.162.0/24
|
||||
23.74.170.0/24
|
||||
23.74.237.0/24
|
||||
23.75.12.0/24
|
||||
23.75.14.0/24
|
||||
23.75.30.0/24
|
||||
23.75.186.0/24
|
||||
23.75.210.0/24
|
||||
23.75.212.0/24
|
||||
23.75.216.0/23
|
||||
23.76.253.0/24
|
||||
23.77.32.0/24
|
||||
23.77.202.0/24
|
||||
23.77.208.0/24
|
||||
23.77.214.0/24
|
||||
23.78.23.0/24
|
||||
23.78.39.0/24
|
||||
23.78.54.0/24
|
||||
23.78.86.0/24
|
||||
23.78.117.0/24
|
||||
23.78.168.0/24
|
||||
23.79.15.0/24
|
||||
23.79.19.0/24
|
||||
23.79.68.0/24
|
||||
23.192.26.0/24
|
||||
23.192.38.0/24
|
||||
23.192.114.0/24
|
||||
23.192.116.0/24
|
||||
23.192.126.0/24
|
||||
23.192.168.0/24
|
||||
23.192.245.0/24
|
||||
23.193.64.0/24
|
||||
23.193.162.0/24
|
||||
23.193.168.0/24
|
||||
23.193.171.0/24
|
||||
23.193.175.0/24
|
||||
23.194.66.0/24
|
||||
23.194.88.0/24
|
||||
23.194.212.0/24
|
||||
23.194.216.0/24
|
||||
23.196.4.0/24
|
||||
23.196.56.0/24
|
||||
23.196.199.0/24
|
||||
23.196.214.0/24
|
||||
23.196.244.0/24
|
||||
23.197.49.0/24
|
||||
23.198.97.0/24
|
||||
23.198.108.0/24
|
||||
23.198.121.0/24
|
||||
23.198.213.0/24
|
||||
23.198.214.0/24
|
||||
23.199.7.0/24
|
||||
23.199.10.0/24
|
||||
23.199.67.0/24
|
||||
23.199.134.0/24
|
||||
23.199.138.0/24
|
||||
23.199.149.0/24
|
||||
23.199.152.0/24
|
||||
23.199.154.0/24
|
||||
23.199.207.0/24
|
||||
23.199.232.0/24
|
||||
23.199.234.0/24
|
||||
23.199.242.0/24
|
||||
23.199.248.0/24
|
||||
23.200.18.0/24
|
||||
23.200.26.0/24
|
||||
23.200.94.0/24
|
||||
23.200.103.0/24
|
||||
23.200.140.0/24
|
||||
23.201.23.0/24
|
||||
23.201.41.0/24
|
||||
23.201.103.0/24
|
||||
23.201.254.0/24
|
||||
23.202.39.0/24
|
||||
23.202.69.0/24
|
||||
23.202.70.0/24
|
||||
23.202.83.0/24
|
||||
23.202.117.0/24
|
||||
23.202.124.0/24
|
||||
23.202.128.0/24
|
||||
23.202.139.0/24
|
||||
23.202.143.0/24
|
||||
23.203.26.0/23
|
||||
23.203.50.0/24
|
||||
23.203.52.0/24
|
||||
23.203.62.0/24
|
||||
23.203.84.0/24
|
||||
23.203.132.0/24
|
||||
23.203.255.0/24
|
||||
23.204.36.0/24
|
||||
23.204.104.0/23
|
||||
23.204.148.0/24
|
||||
23.204.239.0/24
|
||||
23.205.26.0/24
|
||||
23.205.35.0/24
|
||||
23.205.132.0/24
|
||||
23.205.140.0/24
|
||||
23.205.226.0/24
|
||||
23.206.10.0/24
|
||||
23.206.13.0/24
|
||||
23.206.35.0/24
|
||||
23.206.51.0/24
|
||||
23.206.66.0/24
|
||||
23.206.90.0/24
|
||||
23.206.95.0/24
|
||||
23.206.112.0/24
|
||||
23.206.126.0/24
|
||||
23.206.169.0/24
|
||||
23.206.192.0/24
|
||||
23.206.197.0/24
|
||||
23.206.198.0/24
|
||||
23.206.211.0/24
|
||||
23.206.239.0/24
|
||||
23.206.246.0/24
|
||||
23.207.179.0/24
|
||||
23.208.28.0/24
|
||||
23.208.34.0/24
|
||||
23.208.36.0/24
|
||||
23.208.102.0/24
|
||||
23.208.123.0/24
|
||||
23.208.136.0/24
|
||||
23.208.138.0/24
|
||||
23.208.215.0/24
|
||||
23.208.228.0/24
|
||||
23.208.235.0/24
|
||||
23.209.75.0/24
|
||||
23.209.184.0/24
|
||||
23.210.0.0/24
|
||||
23.210.3.0/24
|
||||
23.210.203.0/24
|
||||
23.211.16.0/24
|
||||
23.211.40.0/24
|
||||
23.211.56.0/24
|
||||
23.211.106.0/24
|
||||
23.211.140.0/24
|
||||
23.211.150.0/24
|
||||
23.211.152.0/24
|
||||
23.212.53.0/24
|
||||
23.212.110.0/24
|
||||
23.212.141.0/24
|
||||
23.212.171.0/24
|
||||
23.213.53.0/24
|
||||
23.213.55.0/24
|
||||
23.213.138.0/24
|
||||
23.213.158.0/24
|
||||
23.213.176.0/24
|
||||
23.214.27.0/24
|
||||
23.214.43.0/24
|
||||
23.214.51.0/24
|
||||
23.214.66.0/24
|
||||
23.214.74.0/24
|
||||
23.214.102.0/23
|
||||
23.214.116.0/24
|
||||
23.214.165.0/24
|
||||
23.214.172.0/24
|
||||
23.215.0.0/24
|
||||
23.215.52.0/24
|
||||
23.215.57.0/24
|
||||
23.215.105.0/24
|
||||
23.215.130.0/24
|
||||
23.216.8.0/24
|
||||
23.216.202.0/24
|
||||
23.217.43.0/24
|
||||
23.217.106.0/24
|
||||
23.217.143.0/24
|
||||
23.217.226.0/24
|
||||
23.218.40.0/24
|
||||
23.218.144.0/24
|
||||
23.218.158.0/24
|
||||
23.218.215.0/24
|
||||
23.219.212.0/24
|
||||
23.220.38.0/24
|
||||
23.220.46.0/24
|
||||
23.220.181.0/24
|
||||
23.220.195.0/24
|
||||
23.220.206.0/24
|
||||
23.221.3.0/24
|
||||
23.221.17.0/24
|
||||
23.221.45.0/24
|
||||
23.221.46.0/24
|
||||
23.221.66.0/24
|
||||
23.221.154.0/24
|
||||
23.222.27.0/24
|
||||
23.222.61.0/24
|
||||
23.222.132.0/24
|
||||
23.222.161.0/24
|
||||
23.222.172.0/24
|
||||
23.222.195.0/24
|
||||
23.223.65.0/24
|
||||
23.223.75.0/24
|
||||
23.223.99.0/24
|
||||
31.13.0.0/16
|
||||
37.10.124.0/24
|
||||
45.121.186.0/24
|
||||
46.82.0.0/16
|
||||
59.24.0.0/16
|
||||
60.254.131.0/24
|
||||
60.254.171.0/24
|
||||
61.213.168.0/24
|
||||
63.146.69.0/24
|
||||
63.219.254.0/24
|
||||
63.243.244.0/24
|
||||
64.13.0.0/16
|
||||
65.158.114.0/24
|
||||
66.220.0.0/16
|
||||
67.15.0.0/16
|
||||
67.131.44.0/24
|
||||
67.228.0.0/16
|
||||
69.16.175.0/24
|
||||
69.63.0.0/16
|
||||
69.171.0.0/16
|
||||
69.192.12.0/24
|
||||
69.192.44.0/24
|
||||
72.165.61.0/24
|
||||
72.246.62.0/24
|
||||
72.246.91.0/24
|
||||
72.246.106.0/24
|
||||
72.246.167.0/24
|
||||
72.246.169.0/24
|
||||
72.246.174.0/24
|
||||
72.246.189.0/24
|
||||
72.246.190.0/24
|
||||
72.246.224.0/24
|
||||
72.247.90.0/24
|
||||
72.247.192.0/23
|
||||
72.247.198.0/24
|
||||
74.86.0.0/16
|
||||
74.201.99.0/24
|
||||
75.126.0.0/16
|
||||
78.16.49.0/24
|
||||
84.53.134.0/24
|
||||
85.190.158.0/24
|
||||
88.191.0.0/16
|
||||
88.221.34.0/24
|
||||
88.221.37.0/24
|
||||
88.221.71.0/24
|
||||
88.221.99.0/24
|
||||
88.221.172.0/24
|
||||
88.221.175.0/24
|
||||
88.221.195.0/24
|
||||
88.221.198.0/23
|
||||
92.122.5.0/24
|
||||
92.122.254.0/24
|
||||
92.123.123.0/24
|
||||
92.123.176.0/24
|
||||
92.123.208.0/24
|
||||
95.100.3.0/24
|
||||
95.100.60.0/24
|
||||
95.100.97.0/24
|
||||
95.100.142.0/24
|
||||
95.101.30.0/24
|
||||
95.101.51.0/24
|
||||
95.101.166.0/24
|
||||
95.101.199.0/24
|
||||
95.101.241.0/24
|
||||
95.101.247.0/24
|
||||
96.6.89.0/24
|
||||
96.6.161.0/24
|
||||
96.7.0.0/16
|
||||
96.16.160.0/24
|
||||
96.16.184.0/24
|
||||
96.16.186.0/24
|
||||
96.16.221.0/24
|
||||
96.17.38.0/24
|
||||
96.17.109.0/24
|
||||
96.17.210.0/24
|
||||
103.28.54.0/24
|
||||
103.74.6.0/24
|
||||
104.65.15.0/24
|
||||
104.66.5.0/24
|
||||
104.66.7.0/24
|
||||
104.66.36.0/24
|
||||
104.66.44.0/24
|
||||
104.66.140.0/24
|
||||
104.67.26.0/24
|
||||
104.67.37.0/24
|
||||
104.67.57.0/24
|
||||
104.67.152.0/24
|
||||
104.68.176.0/24
|
||||
104.68.183.0/24
|
||||
104.68.189.0/24
|
||||
104.69.0.0/16
|
||||
104.70.69.0/24
|
||||
104.70.154.0/24
|
||||
104.70.200.0/24
|
||||
104.70.204.0/24
|
||||
104.70.207.0/24
|
||||
104.71.138.0/24
|
||||
104.71.152.0/24
|
||||
104.71.213.0/24
|
||||
104.72.60.0/24
|
||||
104.72.63.0/24
|
||||
104.72.154.0/24
|
||||
104.72.156.0/24
|
||||
104.73.12.0/24
|
||||
104.74.0.0/16
|
||||
104.75.37.0/24
|
||||
104.75.57.0/24
|
||||
104.75.65.0/24
|
||||
104.75.228.0/24
|
||||
104.76.18.0/24
|
||||
104.76.58.0/24
|
||||
104.76.65.0/24
|
||||
104.76.88.0/24
|
||||
104.76.111.0/24
|
||||
104.76.114.0/24
|
||||
104.76.133.0/24
|
||||
104.77.22.0/24
|
||||
104.78.0.0/16
|
||||
104.79.88.0/24
|
||||
104.79.128.0/24
|
||||
104.79.153.0/24
|
||||
104.80.3.0/24
|
||||
104.80.29.0/24
|
||||
104.80.37.0/24
|
||||
104.80.53.0/24
|
||||
104.80.59.0/24
|
||||
104.80.64.0/24
|
||||
104.80.66.0/24
|
||||
104.80.88.0/24
|
||||
104.81.11.0/24
|
||||
104.81.23.0/24
|
||||
104.81.120.0/24
|
||||
104.81.126.0/24
|
||||
104.81.137.0/24
|
||||
104.81.141.0/24
|
||||
104.81.244.0/23
|
||||
104.82.83.0/24
|
||||
104.82.89.0/24
|
||||
104.82.180.0/23
|
||||
104.82.245.0/24
|
||||
104.82.247.0/24
|
||||
104.83.70.0/24
|
||||
104.83.83.0/24
|
||||
104.83.89.0/24
|
||||
104.83.100.0/24
|
||||
104.83.102.0/24
|
||||
104.84.154.0/24
|
||||
104.84.169.0/24
|
||||
104.84.187.0/24
|
||||
104.85.41.0/24
|
||||
104.85.50.0/24
|
||||
104.85.52.0/23
|
||||
104.85.172.0/24
|
||||
104.85.174.0/24
|
||||
104.86.44.0/23
|
||||
104.86.110.0/24
|
||||
104.86.250.0/24
|
||||
104.87.39.0/24
|
||||
104.87.102.0/24
|
||||
104.87.227.0/24
|
||||
104.87.228.0/24
|
||||
104.88.0.0/16
|
||||
104.89.8.0/24
|
||||
104.89.18.0/24
|
||||
104.89.38.0/23
|
||||
104.89.40.0/24
|
||||
104.89.143.0/24
|
||||
104.90.20.0/24
|
||||
104.90.24.0/24
|
||||
104.90.44.0/24
|
||||
104.90.49.0/24
|
||||
104.90.96.0/24
|
||||
104.90.100.0/24
|
||||
104.90.104.0/24
|
||||
104.90.140.0/24
|
||||
104.90.143.0/24
|
||||
104.90.180.0/24
|
||||
104.91.170.0/24
|
||||
104.91.217.0/24
|
||||
104.91.233.0/24
|
||||
104.92.6.0/24
|
||||
104.92.80.0/24
|
||||
104.92.90.0/24
|
||||
104.92.102.0/24
|
||||
104.92.123.0/24
|
||||
104.92.136.0/24
|
||||
104.92.153.0/24
|
||||
104.93.0.0/16
|
||||
104.94.2.0/24
|
||||
104.94.8.0/24
|
||||
104.94.18.0/24
|
||||
104.94.110.0/24
|
||||
104.94.173.0/24
|
||||
104.94.204.0/24
|
||||
104.95.20.0/24
|
||||
104.95.24.0/24
|
||||
104.95.59.0/24
|
||||
104.95.98.0/24
|
||||
104.95.110.0/24
|
||||
104.95.119.0/24
|
||||
104.95.197.0/24
|
||||
104.95.227.0/24
|
||||
104.96.0.0/16
|
||||
104.97.66.0/24
|
||||
104.97.113.0/24
|
||||
104.97.226.0/24
|
||||
104.97.228.0/24
|
||||
104.98.0.0/15
|
||||
104.100.51.0/24
|
||||
104.100.52.0/24
|
||||
104.100.187.0/24
|
||||
104.101.203.0/24
|
||||
104.102.10.0/24
|
||||
104.102.56.0/24
|
||||
104.103.52.0/24
|
||||
104.103.58.0/24
|
||||
104.103.70.0/24
|
||||
104.103.106.0/24
|
||||
104.103.157.0/24
|
||||
104.104.162.0/24
|
||||
104.104.187.0/24
|
||||
104.105.7.0/24
|
||||
104.105.10.0/24
|
||||
104.105.28.0/24
|
||||
104.105.58.0/24
|
||||
104.105.148.0/24
|
||||
104.105.153.0/24
|
||||
104.106.200.0/24
|
||||
104.106.236.0/24
|
||||
104.107.7.0/24
|
||||
104.107.52.0/23
|
||||
104.107.108.0/24
|
||||
104.107.168.0/23
|
||||
104.107.248.0/24
|
||||
104.108.46.0/24
|
||||
104.108.52.0/24
|
||||
104.108.69.0/24
|
||||
104.109.55.0/24
|
||||
104.109.66.0/24
|
||||
104.109.82.0/24
|
||||
104.109.130.0/24
|
||||
104.109.139.0/24
|
||||
104.109.142.0/24
|
||||
104.109.160.0/24
|
||||
104.109.208.0/24
|
||||
104.109.235.0/24
|
||||
104.110.104.0/24
|
||||
104.111.200.0/24
|
||||
104.111.247.0/24
|
||||
104.112.150.0/24
|
||||
104.112.238.0/24
|
||||
104.113.52.0/24
|
||||
104.113.62.0/24
|
||||
104.113.115.0/24
|
||||
104.115.83.0/24
|
||||
104.115.92.0/24
|
||||
104.115.97.0/24
|
||||
104.115.118.0/24
|
||||
104.115.125.0/24
|
||||
104.115.175.0/24
|
||||
104.115.209.0/24
|
||||
104.115.227.0/24
|
||||
104.115.233.0/24
|
||||
104.115.253.0/24
|
||||
104.116.0.0/24
|
||||
104.116.18.0/24
|
||||
104.116.70.0/24
|
||||
104.116.130.0/24
|
||||
104.116.145.0/24
|
||||
104.116.217.0/24
|
||||
104.116.243.0/24
|
||||
104.116.246.0/24
|
||||
104.116.251.0/24
|
||||
104.117.0.0/24
|
||||
104.117.65.0/24
|
||||
104.117.95.0/24
|
||||
104.117.105.0/24
|
||||
104.117.140.0/24
|
||||
104.118.6.0/24
|
||||
104.118.28.0/24
|
||||
104.118.96.0/24
|
||||
104.118.103.0/24
|
||||
104.118.112.0/24
|
||||
104.119.40.0/24
|
||||
104.119.181.0/24
|
||||
104.120.78.0/24
|
||||
104.120.86.0/24
|
||||
104.120.92.0/24
|
||||
104.120.143.0/24
|
||||
104.120.178.0/24
|
||||
104.120.219.0/24
|
||||
104.121.21.0/24
|
||||
104.121.70.0/24
|
||||
104.121.122.0/24
|
||||
104.121.226.0/24
|
||||
104.121.232.0/24
|
||||
104.121.249.0/24
|
||||
104.122.2.0/24
|
||||
104.122.10.0/24
|
||||
104.122.102.0/24
|
||||
104.122.198.0/24
|
||||
104.122.203.0/24
|
||||
104.122.220.0/24
|
||||
104.122.255.0/24
|
||||
104.123.122.0/24
|
||||
104.124.27.0/24
|
||||
104.124.49.0/24
|
||||
104.124.119.0/24
|
||||
104.124.134.0/24
|
||||
104.124.139.0/24
|
||||
104.124.182.0/24
|
||||
104.124.211.0/24
|
||||
104.124.228.0/24
|
||||
104.125.0.0/16
|
||||
104.126.21.0/24
|
||||
104.126.83.0/24
|
||||
104.127.43.0/24
|
||||
104.127.62.0/24
|
||||
104.127.119.0/24
|
||||
104.127.221.0/24
|
||||
106.15.109.0/24
|
||||
110.45.200.0/24
|
||||
115.223.23.0/24
|
||||
117.103.182.0/24
|
||||
118.155.230.0/24
|
||||
118.214.82.0/24
|
||||
118.214.249.0/24
|
||||
118.215.92.0/24
|
||||
118.215.97.0/24
|
||||
118.215.176.0/24
|
||||
121.156.60.0/24
|
||||
122.252.43.0/24
|
||||
125.56.227.0/24
|
||||
125.252.235.0/24
|
||||
128.241.91.0/24
|
||||
139.175.87.0/24
|
||||
141.0.168.0/24
|
||||
146.66.152.0/24
|
||||
152.199.38.0/24
|
||||
153.254.86.0/24
|
||||
155.133.227.0/24
|
||||
155.133.229.0/24
|
||||
155.133.230.0/24
|
||||
155.133.238.0/24
|
||||
155.133.242.0/24
|
||||
155.133.254.0/24
|
||||
162.254.193.0/24
|
||||
162.254.195.0/24
|
||||
162.254.196.0/23
|
||||
165.254.12.0/24
|
||||
165.254.105.0/24
|
||||
165.254.134.0/24
|
||||
172.16.0.0/16
|
||||
172.19.83.0/24
|
||||
172.224.1.0/24
|
||||
172.224.11.0/24
|
||||
172.226.72.0/24
|
||||
172.226.220.0/24
|
||||
172.227.13.0/24
|
||||
172.227.150.0/24
|
||||
172.227.171.0/24
|
||||
172.228.232.0/24
|
||||
172.229.58.0/24
|
||||
172.230.102.0/24
|
||||
172.230.106.0/24
|
||||
172.230.108.0/24
|
||||
172.230.172.0/24
|
||||
172.231.9.0/24
|
||||
173.197.192.0/24
|
||||
173.205.6.0/24
|
||||
173.222.1.0/24
|
||||
173.222.43.0/24
|
||||
173.222.193.0/24
|
||||
173.222.225.0/24
|
||||
173.222.237.0/24
|
||||
173.223.81.0/24
|
||||
173.223.87.0/24
|
||||
173.223.164.0/24
|
||||
173.252.0.0/16
|
||||
174.36.0.0/15
|
||||
175.99.100.0/24
|
||||
175.99.115.0/24
|
||||
175.139.142.0/24
|
||||
182.162.106.0/24
|
||||
184.24.26.0/24
|
||||
184.24.104.0/24
|
||||
184.24.110.0/24
|
||||
184.24.155.0/24
|
||||
184.24.195.0/24
|
||||
184.24.223.0/24
|
||||
184.25.19.0/24
|
||||
184.25.56.0/24
|
||||
184.25.61.0/24
|
||||
184.25.91.0/24
|
||||
184.25.146.0/24
|
||||
184.25.158.0/24
|
||||
184.25.205.0/24
|
||||
184.25.221.0/24
|
||||
184.25.243.0/24
|
||||
184.25.248.0/24
|
||||
184.25.252.0/23
|
||||
184.26.22.0/24
|
||||
184.26.84.0/24
|
||||
184.26.114.0/24
|
||||
184.26.120.0/24
|
||||
184.26.140.0/23
|
||||
184.26.221.0/24
|
||||
184.27.0.0/16
|
||||
184.28.0.0/16
|
||||
184.29.37.0/24
|
||||
184.29.59.0/24
|
||||
184.29.108.0/24
|
||||
184.29.150.0/24
|
||||
184.30.6.0/24
|
||||
184.30.19.0/24
|
||||
184.30.20.0/24
|
||||
184.30.226.0/24
|
||||
184.31.201.0/24
|
||||
184.50.2.0/24
|
||||
184.50.87.0/24
|
||||
184.50.163.0/24
|
||||
184.51.0.0/24
|
||||
184.51.15.0/24
|
||||
184.51.17.0/24
|
||||
184.51.56.0/24
|
||||
184.51.141.0/24
|
||||
184.84.56.0/24
|
||||
184.84.168.0/24
|
||||
184.85.67.0/24
|
||||
184.85.120.0/24
|
||||
184.85.244.0/24
|
||||
184.86.0.0/16
|
||||
184.87.14.0/24
|
||||
184.87.121.0/24
|
||||
184.87.197.0/24
|
||||
185.25.180.0/24
|
||||
185.27.16.0/24
|
||||
185.88.181.0/24
|
||||
192.81.222.0/24
|
||||
198.172.88.0/24
|
||||
199.16.0.0/16
|
||||
199.59.0.0/16
|
||||
199.239.182.0/24
|
||||
203.69.81.0/24
|
||||
205.186.152.0/24
|
||||
208.43.0.0/16
|
||||
208.64.201.0/24
|
||||
208.78.164.0/24
|
||||
208.101.0.0/16
|
||||
209.170.97.0/24
|
||||
210.61.248.0/24
|
||||
210.201.31.0/24
|
||||
216.3.133.0/24
|
||||
216.156.211.0/24
|
||||
223.119.157.0/24
|
||||
223.119.206.0/24
|
||||
223.119.217.0/24
|
||||
224.0.0.0/4
|
||||
243.185.187.0/24
|
||||
@ -1,140 +0,0 @@
|
||||
300英雄,300hero-cn.rules
|
||||
永恒之塔-台服,Aion-TW.rules
|
||||
美国卡车模拟国际服,American-Truck-Simulator.rules
|
||||
圣歌,Anthem.rules
|
||||
Apex-uu,Apex-uu.rules
|
||||
Apex英雄,Apex.rules
|
||||
方舟:生存进化,ARK--Survival-Evolved.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
|
||||
黑色沙漠-steam,BlackDesert-steam.rules
|
||||
黑色幸存者,BlackSurvivor.rules
|
||||
剑灵台服,Blade%26Soul%20TW.rules
|
||||
剑灵-日服,Blade-%26-Soul-jp.rules
|
||||
剑灵-国服全部区服(UU规则),Blood-%26-Soul-CN-TestServer-NantianGuo-Alpha.rules
|
||||
剑灵-国服-南天国(测试版),Blood-%26-Soul-CN.rules
|
||||
无主之地3,Borderlands3-asia.rules
|
||||
使命召唤4:现代战争重置版,Call-Of-Duty-4-Modern-Warfare.rules
|
||||
使命召唤15亚服,Call-Of-Duty15-Asia.rules
|
||||
英雄连2,Company-Of-Heroes-2.rules
|
||||
反恐精英:全球攻势,CS-GO.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
|
||||
暗黑破坏神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
|
||||
刀塔霸业,Dota-Underlords.rules
|
||||
DOTA2-日服,Dota2-jp.rules
|
||||
逃离塔科夫,Escape-from-Tarkov.rules
|
||||
欧卡2所有分区-UU,Euro-Truck-Simulator-2.rules
|
||||
Eve-online欧服,Eve-online.rules
|
||||
FIFA19,FiFa19-INT.rules
|
||||
FIFA20,FIFA20.rules
|
||||
最终幻想14国服,FINAL-FANTASY-XIV-cn.rules
|
||||
最终幻想14,Final-Fantasy-XIV.rules
|
||||
荣耀战魂,For-Honour.rules
|
||||
堡垒之夜-亚服,Fortnite-AS.rules
|
||||
堡垒之夜-国服,Fortnite-cn.rules
|
||||
极限竞速地平线4,Forza-Horizon-4.rules
|
||||
极限竞速7,Forza-Motorsport-7.rules
|
||||
基佬大乱斗Gang-Beasts,Gang-Beasts.rules
|
||||
GTA5,GTA-5.rules
|
||||
激战2,Guild-Wars-2.rules
|
||||
巫师昆特牌国际服,Gwent_The-Witcher-Card-game.rules
|
||||
杀手2外服,HITMAN2.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
|
||||
怪兽世界猎人steam版,Monster-Hunter-World.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%20Of%20Exile.rules
|
||||
流放之路,PathOfexile.rules
|
||||
梦幻之星2-日服(tx),PHANTASY%20STAR%20ONLINE2-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%26-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台湾,RagnarokOnlineTW.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-社区(Beta),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-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
|
||||
战争前线,War-thunder-steam.rules
|
||||
战争雷霆-steam,Warface.rules
|
||||
看门狗,Watch-Dogs.rules
|
||||
看门狗2,Watch-Dogs2.rules
|
||||
求生意志OL,Will-To-Live-Online.rules
|
||||
坦克世界-亚服,World-of-Tanks-Asia.rules
|
||||
坦克世界-国服,World-of-Tanks-cn.rules
|
||||
魔兽世界台服,World-of-warcraft-tw.rules
|
||||
战舰世界-亚服,World-of-Warships-US.rules
|
||||
战舰世界-美服,World-of-Warships.rules
|
||||
僵尸世界大战,Worldwar-Z.rules
|
||||
魔兽世界-欧服,WoW-EU.rules
|
||||
游戏王决斗链接,YO-GI-HO%20delulinks.rules
|
||||
游侠对战平台,YouXiaDuiZhanPingTai.rules
|
||||
@ -1,81 +0,0 @@
|
||||
time.windows.com
|
||||
time.nist.gov
|
||||
time.apple.com
|
||||
time.asia.apple.com
|
||||
cn.ntp.org.cn
|
||||
edu.ntp.org.cn
|
||||
hk.ntp.org.cn
|
||||
tw.ntp.org.cn
|
||||
us.ntp.org.cn
|
||||
sgp.ntp.org.cn
|
||||
kr.ntp.org.cn
|
||||
jp.ntp.org.cn
|
||||
de.ntp.org.cn
|
||||
ina.ntp.org.cn
|
||||
0.openwrt.pool.ntp.org
|
||||
1.openwrt.pool.ntp.org
|
||||
2.openwrt.pool.ntp.org
|
||||
3.openwrt.pool.ntp.org
|
||||
ntp.aliyun.com
|
||||
ntp1.aliyun.com
|
||||
ntp2.aliyun.com
|
||||
ntp3.aliyun.com
|
||||
ntp4.aliyun.com
|
||||
ntp5.aliyun.com
|
||||
ntp6.aliyun.com
|
||||
ntp7.aliyun.com
|
||||
time1.aliyun.com
|
||||
time2.aliyun.com
|
||||
time3.aliyun.com
|
||||
time4.aliyun.com
|
||||
time5.aliyun.com
|
||||
time6.aliyun.com
|
||||
time7.aliyun.com
|
||||
s1c.time.edu.cn
|
||||
s2m.time.edu.cn
|
||||
s1b.time.edu.cn
|
||||
s1e.time.edu.cn
|
||||
s2a.time.edu.cn
|
||||
s2b.time.edu.cn
|
||||
time1.apple.com
|
||||
time2.apple.com
|
||||
time3.apple.com
|
||||
time4.apple.com
|
||||
time5.apple.com
|
||||
time6.apple.com
|
||||
time7.apple.com
|
||||
time1.google.com
|
||||
time2.google.com
|
||||
time3.google.com
|
||||
time4.google.com
|
||||
.music.163.com
|
||||
.music.126.net
|
||||
p1.music.126.net
|
||||
p2.music.126.net
|
||||
p3.music.126.net
|
||||
p4.music.126.net
|
||||
p5.music.126.net
|
||||
p1c.music.126.net
|
||||
p2c.music.126.net
|
||||
p3c.music.126.net
|
||||
p4c.music.126.net
|
||||
p5c.music.126.net
|
||||
interface.music.163.com
|
||||
interface1.music.163.com
|
||||
interface2.music.163.com
|
||||
interface3.music.163.com
|
||||
interface4.music.163.com
|
||||
interface5.music.163.com
|
||||
apm.music.163.com
|
||||
apm3.music.163.com
|
||||
man.netease.com
|
||||
api.iplay.163.com
|
||||
ac.dun.163yun.com
|
||||
mr.da.netease.com
|
||||
crash.163.com
|
||||
imap.163.com
|
||||
music.126.net
|
||||
music.163.com
|
||||
msftconnecttest.com
|
||||
msftncsi.com
|
||||
qq.com
|
||||
@ -1,142 +0,0 @@
|
||||
#!/bin/bash /etc/rc.common
|
||||
. /lib/functions.sh
|
||||
|
||||
config_name=$(uci get clash.config.config_update_name 2>/dev/null)
|
||||
CONFIG_YAML="/usr/share/clash/config/sub/${config_name}"
|
||||
url=$(grep -F "${config_name}" "/usr/share/clashbackup/confit_list.conf" | awk -F '#' '{print $2}')
|
||||
lang=$(uci get luci.main.lang 2>/dev/null)
|
||||
REAL_LOG="/usr/share/clash/clash_real.txt"
|
||||
c_type=$(uci get clash.config.config_type 2>/dev/null)
|
||||
path=$(uci get clash.config.use_config 2>/dev/null)
|
||||
type=$(grep -F "${config_name}" "/usr/share/clashbackup/confit_list.conf" | awk -F '#' '{print $3}')
|
||||
|
||||
if [ $type == "clash" ] && [ ! -z $url ];then
|
||||
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Updating Configuration..." >$REAL_LOG
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "开始更新配置" >$REAL_LOG
|
||||
fi
|
||||
wget --no-check-certificate --user-agent="Clash/OpenWRT" $url -O 2>&1 >1 $CONFIG_YAML
|
||||
|
||||
if [ "$?" -eq "0" ]; then
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Updating Configuration Completed" >$REAL_LOG
|
||||
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "更新配置完成" >$REAL_LOG
|
||||
|
||||
fi
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
sleep 2
|
||||
use_config=$(uci get clash.config.use_config 2>/dev/null)
|
||||
|
||||
if [ "$c_type" -eq 1 ] && [ "$CONFIG_YAML" = "$use_config" ];then
|
||||
if pidof clash >/dev/null; then
|
||||
/etc/init.d/clash restart 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $type == "ssr2clash" ] && [ ! -z $url ];then
|
||||
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Updating Configuration..." >$REAL_LOG
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "开始更新配置" >$REAL_LOG
|
||||
fi
|
||||
wget --no-check-certificate --user-agent="Clash/OpenWRT" "https://ssrsub2clashr.herokuapp.com/ssrsub2clash?sub=$url" -O 2>&1 >1 $CONFIG_YAML
|
||||
|
||||
if [ "$?" -eq "0" ]; then
|
||||
|
||||
CONFIG_YAMLL="/tmp/conf"
|
||||
da_password=$(uci get clash.config.dash_pass 2>/dev/null)
|
||||
redir_port=$(uci get clash.config.redir_port 2>/dev/null)
|
||||
http_port=$(uci get clash.config.http_port 2>/dev/null)
|
||||
socks_port=$(uci get clash.config.socks_port 2>/dev/null)
|
||||
dash_port=$(uci get clash.config.dash_port 2>/dev/null)
|
||||
bind_addr=$(uci get clash.config.bind_addr 2>/dev/null)
|
||||
allow_lan=$(uci get clash.config.allow_lan 2>/dev/null)
|
||||
log_level=$(uci get clash.config.level 2>/dev/null)
|
||||
p_mode=$(uci get clash.config.p_mode 2>/dev/null)
|
||||
sed -i "/^Proxy:/i\#clash-openwrt" $CONFIG_YAML 2>/dev/null
|
||||
sed -i '1,/#clash-openwrt/d' $CONFIG_YAML 2>/dev/null
|
||||
|
||||
cat /usr/share/clash/dns.yaml $CONFIG_YAML > $CONFIG_YAMLL 2>/dev/null
|
||||
mv $CONFIG_YAMLL $CONFIG_YAML 2>/dev/null
|
||||
|
||||
sed -i "1i\#****CLASH-CONFIG-START****#" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "2i\port: ${http_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/port: ${http_port}/a\socks-port: ${socks_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/socks-port: ${socks_port}/a\redir-port: ${redir_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/redir-port: ${redir_port}/a\allow-lan: ${allow_lan}" $CONFIG_YAML 2>/dev/null
|
||||
if [ $allow_lan == "true" ]; then
|
||||
sed -i "/allow-lan: ${allow_lan}/a\bind-address: \"${bind_addr}\"" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/bind-address: \"${bind_addr}\"/a\mode: ${p_mode}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/mode: ${p_mode}/a\log-level: ${log_level}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/log-level: ${log_level}/a\external-controller: 0.0.0.0:${dash_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/external-controller: 0.0.0.0:${dash_port}/a\secret: \"${da_password}\"" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/secret: \"${da_password}\"/a\external-ui: \"/usr/share/clash/dashboard\"" $CONFIG_YAML 2>/dev/null
|
||||
|
||||
else
|
||||
sed -i "/allow-lan: ${allow_lan}/a\mode: Rule" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/mode: Rule/a\log-level: ${log_level}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/log-level: ${log_level}/a\external-controller: 0.0.0.0:${dash_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/external-controller: 0.0.0.0:${dash_port}/a\secret: \"${da_password}\"" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/secret: \"${da_password}\"/a\external-ui: \"/usr/share/clash/dashboard\"" $CONFIG_YAML 2>/dev/null
|
||||
fi
|
||||
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Updating Configuration Completed" >$REAL_LOG
|
||||
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "更新配置完成" >$REAL_LOG
|
||||
|
||||
fi
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
sleep 2
|
||||
use_config=$(uci get clash.config.use_config 2>/dev/null)
|
||||
|
||||
if [ "$c_type" -eq 1 ] && [ "$CONFIG_YAML" = "$use_config" ];then
|
||||
if pidof clash >/dev/null; then
|
||||
/etc/init.d/clash restart 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
if [ $type == "v2clash" ] && [ ! -z $url ];then
|
||||
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Updating Configuration..." >$REAL_LOG
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "开始更新配置" >$REAL_LOG
|
||||
fi
|
||||
wget --no-check-certificate --user-agent="Clash/OpenWRT" "https://tgbot.lbyczf.com/v2rayn2clash?url=$url" -O 2>&1 >1 $CONFIG_YAML
|
||||
|
||||
if [ "$?" -eq "0" ]; then
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Updating Configuration Completed" >$REAL_LOG
|
||||
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "更新配置完成" >$REAL_LOG
|
||||
|
||||
fi
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
sleep 2
|
||||
use_config=$(uci get clash.config.use_config 2>/dev/null)
|
||||
|
||||
if [ "$c_type" -eq 1 ] && [ "$CONFIG_YAML" = "$use_config" ];then
|
||||
if pidof clash >/dev/null; then
|
||||
/etc/init.d/clash restart 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -1,146 +0,0 @@
|
||||
#!/bin/bash /etc/rc.common
|
||||
. /lib/functions.sh
|
||||
|
||||
c_type=$(uci get clash.config.config_type 2>/dev/null)
|
||||
|
||||
countt=$(grep -c '' /usr/share/clashbackup/confit_list.conf)
|
||||
count_nums=1
|
||||
while [[ $count_nums -le $countt ]]
|
||||
do
|
||||
|
||||
config_name=$(sed -n "$count_nums"p /usr/share/clashbackup/confit_list.conf| awk -F '#' '{print $1}')
|
||||
|
||||
CONFIG_YAML="/usr/share/clash/config/sub/${config_name}"
|
||||
url=$(grep -F "${config_name}" "/usr/share/clashbackup/confit_list.conf" | awk -F '#' '{print $2}')
|
||||
lang=$(uci get luci.main.lang 2>/dev/null)
|
||||
REAL_LOG="/usr/share/clash/update_clash_real.txt"
|
||||
|
||||
type=$(grep -F "${config_name}" "/usr/share/clashbackup/confit_list.conf" | awk -F '#' '{print $3}')
|
||||
|
||||
if [ $type == "clash" ] && [ ! -z $url ];then
|
||||
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Updating Configuration..." >$REAL_LOG
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "开始更新配置" >$REAL_LOG
|
||||
fi
|
||||
wget --no-check-certificate --user-agent="Clash/OpenWRT" $url -O 2>&1 >1 $CONFIG_YAML
|
||||
sleep 3
|
||||
if [ "$?" -eq "0" ]; then
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Updating Configuration Completed" >$REAL_LOG
|
||||
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "更新配置完成" >$REAL_LOG
|
||||
|
||||
fi
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ $type == "ssr2clash" ] && [ ! -z $url ];then
|
||||
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Updating Configuration..." >$REAL_LOG
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "开始更新配置" >$REAL_LOG
|
||||
fi
|
||||
wget --no-check-certificate --user-agent="Clash/OpenWRT" "https://ssrsub2clashr.herokuapp.com/ssrsub2clash?sub=$url" -O 2>&1 >1 $CONFIG_YAML
|
||||
sleep 3
|
||||
if [ "$?" -eq "0" ]; then
|
||||
|
||||
CONFIG_YAMLL="/tmp/conf"
|
||||
da_password=$(uci get clash.config.dash_pass 2>/dev/null)
|
||||
redir_port=$(uci get clash.config.redir_port 2>/dev/null)
|
||||
http_port=$(uci get clash.config.http_port 2>/dev/null)
|
||||
socks_port=$(uci get clash.config.socks_port 2>/dev/null)
|
||||
dash_port=$(uci get clash.config.dash_port 2>/dev/null)
|
||||
bind_addr=$(uci get clash.config.bind_addr 2>/dev/null)
|
||||
allow_lan=$(uci get clash.config.allow_lan 2>/dev/null)
|
||||
log_level=$(uci get clash.config.level 2>/dev/null)
|
||||
p_mode=$(uci get clash.config.p_mode 2>/dev/null)
|
||||
sed -i "/^Proxy:/i\#clash-openwrt" $CONFIG_YAML 2>/dev/null
|
||||
sed -i '1,/#clash-openwrt/d' $CONFIG_YAML 2>/dev/null
|
||||
|
||||
cat /usr/share/clash/dns.yaml $CONFIG_YAML > $CONFIG_YAMLL 2>/dev/null
|
||||
mv $CONFIG_YAMLL $CONFIG_YAML 2>/dev/null
|
||||
|
||||
sed -i "1i\#****CLASH-CONFIG-START****#" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "2i\port: ${http_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/port: ${http_port}/a\socks-port: ${socks_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/socks-port: ${socks_port}/a\redir-port: ${redir_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/redir-port: ${redir_port}/a\allow-lan: ${allow_lan}" $CONFIG_YAML 2>/dev/null
|
||||
if [ $allow_lan == "true" ]; then
|
||||
sed -i "/allow-lan: ${allow_lan}/a\bind-address: \"${bind_addr}\"" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/bind-address: \"${bind_addr}\"/a\mode: ${p_mode}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/mode: ${p_mode}/a\log-level: ${log_level}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/log-level: ${log_level}/a\external-controller: 0.0.0.0:${dash_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/external-controller: 0.0.0.0:${dash_port}/a\secret: \"${da_password}\"" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/secret: \"${da_password}\"/a\external-ui: \"/usr/share/clash/dashboard\"" $CONFIG_YAML 2>/dev/null
|
||||
|
||||
else
|
||||
sed -i "/allow-lan: ${allow_lan}/a\mode: Rule" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/mode: Rule/a\log-level: ${log_level}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/log-level: ${log_level}/a\external-controller: 0.0.0.0:${dash_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/external-controller: 0.0.0.0:${dash_port}/a\secret: \"${da_password}\"" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/secret: \"${da_password}\"/a\external-ui: \"/usr/share/clash/dashboard\"" $CONFIG_YAML 2>/dev/null
|
||||
fi
|
||||
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Updating Configuration Completed" >$REAL_LOG
|
||||
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "更新配置完成" >$REAL_LOG
|
||||
|
||||
fi
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ $type == "v2clash" ] && [ ! -z $url ];then
|
||||
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Updating Configuration..." >$REAL_LOG
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "开始更新配置" >$REAL_LOG
|
||||
fi
|
||||
wget --no-check-certificate --user-agent="Clash/OpenWRT" "https://tgbot.lbyczf.com/v2rayn2clash?url=$url" -O 2>&1 >1 $CONFIG_YAML
|
||||
sleep 3
|
||||
if [ "$?" -eq "0" ]; then
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Updating Configuration Completed" >$REAL_LOG
|
||||
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "更新配置完成" >$REAL_LOG
|
||||
|
||||
fi
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
count_nums=$(( $count_nums + 1))
|
||||
done
|
||||
|
||||
sleep 2
|
||||
|
||||
use=$(uci get clash.config.use_config 2>/dev/null)
|
||||
|
||||
if [ "$c_type" -eq 1 ] && [ "$(ls -l $use|awk '{print int($5)}')" -ne 0 ];then
|
||||
|
||||
if pidof clash >/dev/null; then
|
||||
/etc/init.d/clash restart 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
@ -1,7 +0,0 @@
|
||||
#!/bin/bash /etc/rc.common
|
||||
. /lib/functions.sh
|
||||
|
||||
name=$(uci get clash.config.config_up_remove 2>/dev/null)
|
||||
if [ ! -z $name ];then
|
||||
rm -rf /usr/share/clash/config/upload/${name}
|
||||
fi
|
||||
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
yacd.haishan.me
|
||||
@ -1,12 +0,0 @@
|
||||
# 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
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user