Merge Mainline
This commit is contained in:
commit
4c82568b19
@ -318,27 +318,45 @@ menu "Global build settings"
|
||||
endchoice
|
||||
|
||||
config TARGET_ROOTFS_SECURITY_LABELS
|
||||
bool "Enable rootfs security labels"
|
||||
bool
|
||||
select KERNEL_SQUASHFS_XATTR
|
||||
select KERNEL_EXT4_FS_SECURITY
|
||||
select KERNEL_F2FS_FS_SECURITY
|
||||
select KERNEL_UBIFS_FS_SECURITY
|
||||
select KERNEL_JFFS2_FS_SECURITY
|
||||
|
||||
config SELINUX
|
||||
bool "Enable SELinux"
|
||||
select KERNEL_SECURITY_SELINUX
|
||||
select TARGET_ROOTFS_SECURITY_LABELS
|
||||
select PACKAGE_procd-selinux
|
||||
select PACKAGE_busybox-selinux
|
||||
help
|
||||
This option enables the usage of SELinux labels
|
||||
This option enables SELinux kernel features, applies security labels
|
||||
in squashfs rootfs and selects the selinux-variants of busybox and procd.
|
||||
|
||||
Selecting this option results in about 0.5MiB of additional flash space
|
||||
usage accounting for increased kernel and rootfs size.
|
||||
|
||||
choice
|
||||
prompt "default SELinux type"
|
||||
depends on TARGET_ROOTFS_SECURITY_LABELS
|
||||
default SELINUXTYPE_dssp
|
||||
help
|
||||
Choose SELinux policy to be used for build.
|
||||
Select SELinux policy to be installed and used for applying rootfs labels.
|
||||
|
||||
config SELINUXTYPE_targeted
|
||||
bool "targeted"
|
||||
select PACKAGE_refpolicy
|
||||
help
|
||||
SELinux Reference Policy (refpolicy)
|
||||
|
||||
config SELINUXTYPE_dssp
|
||||
bool "dssp"
|
||||
select PACKAGE_selinux-policy
|
||||
help
|
||||
Defensec SELinux Security Policy -- OpenWrt edition
|
||||
|
||||
endchoice
|
||||
|
||||
endmenu
|
||||
|
||||
@ -937,6 +937,7 @@ config KERNEL_SECURITY_SELINUX
|
||||
config KERNEL_SECURITY_SELINUX_BOOTPARAM
|
||||
bool "NSA SELinux boot parameter"
|
||||
depends on KERNEL_SECURITY_SELINUX
|
||||
default y
|
||||
|
||||
config KERNEL_SECURITY_SELINUX_DISABLE
|
||||
bool "NSA SELinux runtime disable"
|
||||
@ -945,6 +946,7 @@ config KERNEL_SECURITY_SELINUX_DISABLE
|
||||
config KERNEL_SECURITY_SELINUX_DEVELOP
|
||||
bool "NSA SELinux Development Support"
|
||||
depends on KERNEL_SECURITY_SELINUX
|
||||
default y
|
||||
|
||||
config KERNEL_LSM
|
||||
string
|
||||
|
||||
@ -12,9 +12,11 @@ OPENWRT_GIT = $(PROJECT_GIT)
|
||||
LEDE_GIT = $(PROJECT_GIT)
|
||||
|
||||
ifdef PKG_SOURCE_VERSION
|
||||
PKG_VERSION ?= $(if $(PKG_SOURCE_DATE),$(PKG_SOURCE_DATE)-)$(call version_abbrev,$(PKG_SOURCE_VERSION))
|
||||
PKG_SOURCE_SUBDIR ?= $(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE ?= $(PKG_SOURCE_SUBDIR).tar.xz
|
||||
ifndef PKG_VERSION
|
||||
PKG_VERSION := $(if $(PKG_SOURCE_DATE),$(PKG_SOURCE_DATE)-)$(call version_abbrev,$(PKG_SOURCE_VERSION))
|
||||
endif
|
||||
PKG_SOURCE_SUBDIR ?= $(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE ?= $(PKG_SOURCE_SUBDIR).tar.xz
|
||||
endif
|
||||
|
||||
DOWNLOAD_RDEP=$(STAMP_PREPARED) $(HOST_STAMP_PREPARED)
|
||||
|
||||
@ -6,12 +6,12 @@ ifdef CONFIG_TESTING_KERNEL
|
||||
KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER)
|
||||
endif
|
||||
|
||||
LINUX_VERSION-4.14 = .200
|
||||
LINUX_VERSION-4.19 = .149
|
||||
LINUX_VERSION-4.14 = .202
|
||||
LINUX_VERSION-4.19 = .152
|
||||
LINUX_VERSION-5.4 = .71
|
||||
|
||||
LINUX_KERNEL_HASH-4.14.200 = 5d404a0224a34b5379f1871cc46825487d557c2660459d2b5c3cd4871d699a38
|
||||
LINUX_KERNEL_HASH-4.19.149 = d9cdcb9a66942a56b91c8d4b273d15a3c5b8e59fad44b79e03362cfffaa62a00
|
||||
LINUX_KERNEL_HASH-4.14.202 = 95c717ab5b0bdd2333e829f0507385fbe3424ceee810727f3a8551a0c74be328
|
||||
LINUX_KERNEL_HASH-4.19.152 = a5a6aa9c2c2810efa72b5d9723de86ccea3f965b2dd748d15e82d5fac23a055d
|
||||
LINUX_KERNEL_HASH-5.4.71 = 737049ef3cf38d46ee3b377354336cdbc1c4dd95b4e54975a70716f96c8d6cc7
|
||||
|
||||
remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-openclash
|
||||
PKG_VERSION:=0.40.7
|
||||
PKG_VERSION:=0.40.10
|
||||
PKG_RELEASE:=beta
|
||||
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>
|
||||
|
||||
@ -9,12 +9,16 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
select PACKAGE_libcap-bin
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
CATEGORY:=LuCI
|
||||
SUBMENU:=3. Applications
|
||||
TITLE:=LuCI support for clash
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+iptables +dnsmasq-full +coreutils +coreutils-nohup +bash +curl +jsonfilter +ca-certificates +ipset +ip-full +iptables-mod-tproxy
|
||||
DEPENDS:=+iptables +dnsmasq-full +coreutils +coreutils-nohup +bash +curl +jsonfilter +ca-certificates +ipset +ip-full +iptables-mod-tproxy +iptables-mod-extra +libcap
|
||||
MAINTAINER:=vernesong
|
||||
endef
|
||||
|
||||
@ -95,4 +99,4 @@ define Package/$(PKG_NAME)/install
|
||||
$(CP) $(PKG_BUILD_DIR)/luasrc/* $(1)/usr/lib/lua/luci/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
@ -261,7 +261,7 @@ o:depends("type", "http")
|
||||
o:depends("type", "trojan")
|
||||
|
||||
-- [[ TLS ]]--
|
||||
o = s:option(ListValue, "tls", translate("TLS"))
|
||||
o = s:option(ListValue, "tls", translate("tls"))
|
||||
o.rmempty = true
|
||||
o.default = "false"
|
||||
o:value("true")
|
||||
@ -273,8 +273,9 @@ o:depends("obfs_vmess", "http")
|
||||
o:depends("type", "socks5")
|
||||
o:depends("type", "http")
|
||||
|
||||
o = s:option(Value, "servername", translate("TLS Custom Host"))
|
||||
o = s:option(Value, "servername", translate("sni"))
|
||||
o.rmempty = true
|
||||
o.datatype = "host"
|
||||
o.placeholder = translate("example.com")
|
||||
o:depends("obfs_vmess", "websocket")
|
||||
|
||||
@ -285,18 +286,6 @@ o:value("true")
|
||||
o:value("false")
|
||||
o:depends("obfs_vmess", "http")
|
||||
|
||||
-- 验证用户名
|
||||
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
|
||||
|
||||
-- [[ MUX ]]--
|
||||
o = s:option(ListValue, "mux", translate("mux"))
|
||||
o.rmempty = true
|
||||
@ -311,6 +300,19 @@ o.datatype = "host"
|
||||
o.placeholder = translate("example.com")
|
||||
o.rmempty = true
|
||||
o:depends("type", "trojan")
|
||||
o:depends("type", "http")
|
||||
|
||||
-- 验证用户名
|
||||
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
|
||||
|
||||
-- [[ alpn ]]--
|
||||
o = s:option(DynamicList, "alpn", translate("alpn"))
|
||||
|
||||
@ -132,7 +132,7 @@ msgid "fake-ip-mix(tun mix mode)"
|
||||
msgstr "Fake-IP(TUN-混合)模式【依赖kmod-tun】【UDP-TUN,TCP-转发】"
|
||||
|
||||
msgid "Select Mode For OpenClash Work, Try Flush DNS Cache If Network Error"
|
||||
msgstr "选择运行模式,Redir-Host模式下无法代理路由器自身流量,如客户端的网络异常请尝试清除DNS缓存"
|
||||
msgstr "选择运行模式,如客户端的网络异常请尝试清除DNS缓存"
|
||||
|
||||
msgid "Proxy Mode"
|
||||
msgstr "*代理模式"
|
||||
|
||||
@ -94,13 +94,15 @@ revert_dns() {
|
||||
uci delete dhcp.@dnsmasq[0].cachesize >/dev/null 2>&1
|
||||
}
|
||||
|
||||
if [ -s "/tmp/resolv.conf.d/resolv.conf.auto" ]; then
|
||||
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.d/resolv.conf.auto >/dev/null 2>&1
|
||||
elif [ -s "/tmp/resolv.conf.auto" ]; then
|
||||
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto >/dev/null 2>&1
|
||||
fi
|
||||
uci set dhcp.@dnsmasq[0].noresolv=0 >/dev/null 2>&1
|
||||
|
||||
[ "$1" -eq 1 ] && {
|
||||
if [ -s "/tmp/resolv.conf.d/resolv.conf.auto" ]; then
|
||||
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.d/resolv.conf.auto >/dev/null 2>&1
|
||||
elif [ -s "/tmp/resolv.conf.auto" ]; then
|
||||
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto >/dev/null 2>&1
|
||||
fi
|
||||
uci set dhcp.@dnsmasq[0].noresolv=0 >/dev/null 2>&1
|
||||
}
|
||||
|
||||
uci commit dhcp
|
||||
uci commit openclash
|
||||
rm -rf /tmp/dnsmasq.d/dnsmasq_openclash.conf >/dev/null 2>&1
|
||||
@ -137,16 +139,7 @@ cat "$CHANGE_FILE" "$DNS_FILE" "$PROXY_PROVIDER_FILE" "$PROXY_FILE" "$GROUP_FILE
|
||||
|
||||
yml_check()
|
||||
{
|
||||
#格式替换
|
||||
sed -i 's/\t/ /g' "$3" 2>/dev/null
|
||||
sed -i "s/- \{2,\}/- /g" "$3" 2>/dev/null
|
||||
sed -i "s/^\.\.\.$//g" "$3" 2>/dev/null
|
||||
sed -i "s/^---$//g" "$3" 2>/dev/null
|
||||
sed -i "s/^ \{1,\}dns:/dns:/g" "$3" 2>/dev/null
|
||||
|
||||
#检查关键字避免后续操作出错
|
||||
/usr/share/openclash/yml_field_name_ch.sh "$3" 2>/dev/null
|
||||
|
||||
|
||||
#创建启动备份
|
||||
cp "$3" "$5"
|
||||
|
||||
@ -154,6 +147,17 @@ yml_check()
|
||||
if [ ! -f "$4" ]; then
|
||||
cp "$3" "$4"
|
||||
fi
|
||||
|
||||
#格式替换
|
||||
sed -i 's/\t/ /g' "$3" 2>/dev/null
|
||||
sed -i "s/- \{2,\}/- /g" "$3" 2>/dev/null
|
||||
sed -i "s/^\.\.\.$//g" "$3" 2>/dev/null
|
||||
sed -i "s/^---$//g" "$3" 2>/dev/null
|
||||
sed -i "s/^ \{1,\}dns:/dns:/g" "$3" 2>/dev/null
|
||||
sed -i '/OpenClash-General/d' "$3" 2>/dev/null
|
||||
|
||||
#检查关键字避免后续操作出错
|
||||
/usr/share/openclash/yml_field_name_ch.sh "$3" 2>/dev/null
|
||||
|
||||
#取出general部分
|
||||
/usr/share/openclash/yml_field_cut.sh "general" "$CHANGE_FILE" "$3"
|
||||
@ -162,6 +166,11 @@ yml_check()
|
||||
nameserver_len=$(sed -n '/^ \{0,\}nameserver:/=' "$3" 2>/dev/null)
|
||||
if [ -n "$nameserver_len" ]; then
|
||||
/usr/share/openclash/yml_field_cut.sh "$nameserver_len" "$DNS_FILE" "$3"
|
||||
else
|
||||
fallback_len=$(sed -n '/^ \{0,\}fallback:/=' "$3" 2>/dev/null)
|
||||
if [ -n "$fallback_len" ]; then
|
||||
/usr/share/openclash/yml_field_cut.sh "$fallback_len" "$DNS_FILE" "$3"
|
||||
fi
|
||||
fi 2>/dev/null
|
||||
|
||||
#取出proxy部分
|
||||
@ -243,65 +252,10 @@ yml_check()
|
||||
/usr/share/openclash/yml_field_cut.sh "$rule_bak_len" "$RULE_BAK_FILE" "$4"
|
||||
fi 2>/dev/null
|
||||
|
||||
#自定义DNS还原
|
||||
if [ "$(grep -c '##Custom DNS##' "$CHANGE_FILE")" -gt 0 ] || [ "$(grep -c '##Custom DNS##' "$DNS_FILE")" -gt 0 ]; then
|
||||
if [ "$2" = 0 ] && [ -f "$4" ]; then
|
||||
#取出dns备份
|
||||
nameserver_len=$(sed -n '/^ \{0,\}nameserver:/=' "$4" 2>/dev/null)
|
||||
if [ -n "$nameserver_len" ]; then
|
||||
/usr/share/openclash/yml_field_cut.sh "$nameserver_len" "/tmp/backdns.config" "$4" "dns"
|
||||
fi 2>/dev/null
|
||||
sed -i '/^ \{0,\}nameserver:/,$d' "$DNS_FILE" 2>/dev/null
|
||||
sed -i '/##Custom DNS##/d' "$CHANGE_FILE" 2>/dev/null
|
||||
cat "/tmp/backdns.config" >> "$DNS_FILE"
|
||||
rm -rf /tmp/backdns.config 2>/dev/null
|
||||
fi
|
||||
fi 2>/dev/null
|
||||
|
||||
}
|
||||
|
||||
#检查DNS设置
|
||||
yml_dns_check()
|
||||
{
|
||||
|
||||
#检查DNS字段
|
||||
if [ -z "$(grep '^dns:' "$CHANGE_FILE")" ]; then
|
||||
echo "dns:" >> "$CHANGE_FILE" 2>/dev/null
|
||||
fi
|
||||
|
||||
if [ -z "$(grep '^ \{0,\}nameserver:' "$DNS_FILE")" ]; then
|
||||
echo " nameserver:" > "$DNS_FILE" 2>/dev/null
|
||||
cat >> "$DNS_FILE" <<-EOF
|
||||
- 114.114.114.114
|
||||
- 119.29.29.29
|
||||
fallback:
|
||||
- https://cloudflare-dns.com/dns-query
|
||||
- https://dns.google/dns-query
|
||||
- https://1.1.1.1/dns-query
|
||||
- tls://8.8.8.8:853
|
||||
EOF
|
||||
fi
|
||||
|
||||
dns_port=$(grep "^ \{0,\}listen:" "$CHANGE_FILE" |awk -F ':' '{print $3}' |awk -F '#' '{print $1}' |tr -cd "[0-9]" 2>/dev/null)
|
||||
if [ -z "$dns_port" ] || [ "$dns_port" -eq 53 ]; then
|
||||
dns_port=7874
|
||||
fi
|
||||
|
||||
if [ -n "$(grep "^ \{0,\}listen:" "$CHANGE_FILE")" ]; then
|
||||
if [ "$ipv6_enable" != "1" ]; then
|
||||
sed -i "/^ \{0,\}listen:/c\ listen: 127.0.0.1:${dns_port}" "$CHANGE_FILE" 2>/dev/null
|
||||
else
|
||||
sed -i "/^ \{0,\}listen:/c\ listen: 0.0.0.0:${dns_port}" "$CHANGE_FILE" 2>/dev/null
|
||||
fi
|
||||
else
|
||||
if [ "$ipv6_enable" != "1" ]; then
|
||||
sed -i "/^dns:/a\ listen: 127.0.0.1:${dns_port}" "$CHANGE_FILE" 2>/dev/null
|
||||
else
|
||||
sed -i "/^dns:/a\ listen: 0.0.0.0:${dns_port}" "$CHANGE_FILE" 2>/dev/null
|
||||
fi
|
||||
fi 2>/dev/null
|
||||
|
||||
#保存DNS端口方便后续调用
|
||||
uci set openclash.config.dns_port="$dns_port" && uci commit openclash
|
||||
|
||||
#检查general部分的缩进
|
||||
if [ -n "$(grep "^ \{1,\}port:" "$CHANGE_FILE")" ] || [ -n "$(grep "^ \{1,\}mode:" "$CHANGE_FILE")" ] || [ -n "$(grep "^ \{1,\}log-level:" "$CHANGE_FILE")" ]; then
|
||||
@ -311,10 +265,53 @@ EOF
|
||||
sed -n '/^dns:/,$p' "$CHANGE_FILE" >> /tmp/config.check 2>/dev/null
|
||||
mv /tmp/config.check "$CHANGE_FILE" 2>/dev/null
|
||||
fi
|
||||
|
||||
#自定义DNS还原
|
||||
if [ "$(grep -c '##Custom DNS##' "$CHANGE_FILE")" -gt 0 ] || [ "$(grep -c '##Custom DNS##' "$DNS_FILE")" -gt 0 ]; then
|
||||
if [ "$2" = 0 ] && [ -f "$4" ]; then
|
||||
#取出dns备份
|
||||
nameserver_len=$(sed -n '/^ \{0,\}nameserver:/=' "$4" 2>/dev/null)
|
||||
if [ -n "$nameserver_len" ]; then
|
||||
/usr/share/openclash/yml_field_cut.sh "$nameserver_len" "/tmp/backdns.config" "$4"
|
||||
else
|
||||
fallback_len=$(sed -n '/^ \{0,\}fallback:/=' "$3" 2>/dev/null)
|
||||
if [ -n "$fallback_len" ]; then
|
||||
/usr/share/openclash/yml_field_cut.sh "$fallback_len" "/tmp/backdns.config" "$4"
|
||||
fi
|
||||
fi 2>/dev/null
|
||||
rm -rf "$DNS_FILE" 2>/dev/null
|
||||
rm -rf "$FALLBACK_FILTER_FILE" 2>/dev/null
|
||||
sed -i '/##Custom DNS##/d' "$CHANGE_FILE" 2>/dev/null
|
||||
cat "/tmp/backdns.config" >> "$DNS_FILE" 2>/dev/null
|
||||
rm -rf /tmp/backdns.config 2>/dev/null
|
||||
fi
|
||||
fi 2>/dev/null
|
||||
#检查DNS服务
|
||||
if [ -z "$(grep '^ \{0,\}nameserver:' "$DNS_FILE")" ] || [ -z "$(sed '/^ \{0,\}fallback/,$d' "$DNS_FILE" 2>/dev/null |grep '^ \{0,\}- ')" ]; then
|
||||
echo "检测到DNS选项下的Nameserver未设置服务器,开始补全..." >$START_LOG
|
||||
echo "${LOGTIME} Nameserver Option Must Be Setted, Auto Completed" >>$LOG_FILE
|
||||
echo " nameserver:" > "$DNS_FILE" 2>/dev/null
|
||||
cat >> "$DNS_FILE" <<-EOF
|
||||
- 114.114.114.114
|
||||
- 119.29.29.29
|
||||
fallback:
|
||||
- https://cloudflare-dns.com/dns-query
|
||||
- https://dns.google/dns-query
|
||||
- https://1.1.1.1/dns-query
|
||||
- tls://8.8.8.8:853
|
||||
EOF
|
||||
sleep 2
|
||||
fi
|
||||
|
||||
dns_port=$(grep "^ \{0,\}listen:" "$CHANGE_FILE" |awk -F ':' '{print $3}' |awk -F '#' '{print $1}' |tr -cd "[0-9]" 2>/dev/null)
|
||||
if [ -z "$dns_port" ] || [ "$dns_port" -eq 53 ]; then
|
||||
dns_port=7874
|
||||
fi
|
||||
|
||||
#保存DNS端口方便后续调用
|
||||
uci set openclash.config.dns_port="$dns_port" && uci commit openclash
|
||||
|
||||
#添加标识
|
||||
sed -i '/OpenClash-General/d' "$DNS_FILE" 2>/dev/null
|
||||
sed -i '/OpenClash-General/d' "$FALLBACK_FILTER_FILE" 2>/dev/null
|
||||
echo '#===================== OpenClash-General-Settings =====================#' >> "$FALLBACK_FILTER_FILE" 2>/dev/null
|
||||
}
|
||||
|
||||
@ -398,10 +395,10 @@ fi
|
||||
if [ -z "$(pidof clash)" ] && [ "$provider_path_exist" = 0 ]; then
|
||||
if [ "$2" = "proxy_provider" ]; then
|
||||
echo "错误: 代理集文件下载失败,请到日志页面查看详细错误信息!" >$START_LOG
|
||||
echo "${LOGTIME} Faild to Download Proxy-Provider File, Please Check The Error Info And Try Again" >> $LOG_FILE
|
||||
echo "${LOGTIME} Error: Faild to Download Proxy-Provider File, Please Check The Error Info And Try Again" >> $LOG_FILE
|
||||
else
|
||||
echo "错误: 规则集文件下载失败,请到日志页面查看详细错误信息!" >$START_LOG
|
||||
echo "${LOGTIME} Faild to Download Rule-Provider File, Please Check The Error Info And Try Again" >> $LOG_FILE
|
||||
echo "${LOGTIME} Error: Faild to Download Rule-Provider File, Please Check The Error Info And Try Again" >> $LOG_FILE
|
||||
fi
|
||||
sleep 10
|
||||
start_fail
|
||||
@ -452,12 +449,15 @@ yml_dns_get()
|
||||
|
||||
if [ -n "$group" ]; then
|
||||
if [ "$group" = "nameserver" ]; then
|
||||
echo " $dns_type$dns_address" >>/tmp/config.namedns
|
||||
if [ -z "$(grep "nameserver:$" /tmp/config.namedns 2>/dev/null)" ]; then
|
||||
echo " nameserver:" >/tmp/config.namedns
|
||||
fi
|
||||
echo " $dns_type$dns_address" >>/tmp/config.namedns
|
||||
else
|
||||
if [ -z "$(grep "fallback:$" /tmp/config.falldns 2>/dev/null)" ]; then
|
||||
echo " fallback:" >/tmp/config.falldns
|
||||
fi
|
||||
echo " $dns_type$dns_address" >>/tmp/config.falldns
|
||||
echo " $dns_type$dns_address" >>/tmp/config.falldns
|
||||
fi
|
||||
else
|
||||
return
|
||||
@ -468,18 +468,26 @@ yml_dns_get()
|
||||
yml_dns_custom()
|
||||
{
|
||||
if [ "$1" = 1 ]; then
|
||||
echo " nameserver:" >/tmp/config.namedns
|
||||
echo "##Custom DNS##" >> /tmp/config.namedns 2>/dev/null
|
||||
config_load "openclash"
|
||||
config_foreach yml_dns_get "dns_servers"
|
||||
sed -i '/^ \{0,\}nameserver:/,$d' "$2" 2>/dev/null
|
||||
cat "/tmp/config.namedns" >> "$2" 2>/dev/null
|
||||
cat "/tmp/config.falldns" >> "$2" 2>/dev/null
|
||||
if [ -f "/tmp/config.namedns" ]; then
|
||||
sed -i '/^ \{0,\}nameserver:/,$d' "$2" 2>/dev/null
|
||||
sed -i "/^ \{0,\}nameserver:/a\##Custom DNS##" "/tmp/config.namedns"
|
||||
cat "/tmp/config.namedns" >> "$2" 2>/dev/null
|
||||
cat "/tmp/config.falldns" >> "$2" 2>/dev/null
|
||||
else
|
||||
echo "错误: 配置文件DNS选项下的Nameserver必须设置服务器,已停止设置自定义DNS服务器!" >$START_LOG
|
||||
echo "${LOGTIME} Error: Nameserver Option Must Be Setted, Stop Customing DNS Servers" >>$LOG_FILE
|
||||
sleep 3
|
||||
fi
|
||||
rm -rf /tmp/config.namedns 2>/dev/null
|
||||
rm -rf /tmp/config.falldns 2>/dev/null
|
||||
elif [ -z "$(grep "##Custom DNS##" "$2" 2>/dev/null)" ]; then
|
||||
fi
|
||||
|
||||
if [ -z "$(grep "##Custom DNS##" "$2" 2>/dev/null)" ]; then
|
||||
sed -i "/^ \{0,\}nameserver:/c\ nameserver:" "$2" 2>/dev/null
|
||||
sed -i "/^ \{0,\}fallback:/c\ fallback:" "$2" 2>/dev/null
|
||||
sed -i "s/^ \{0,\}- / - /g" "$2" 2>/dev/null
|
||||
fi
|
||||
|
||||
#fallback-filter
|
||||
@ -518,7 +526,7 @@ EOF
|
||||
sed -i "/ipcidr:/c\ ipcidr:" "$3" 2>/dev/null
|
||||
fi
|
||||
if [ -z "$(grep "^ - " "$3")" ]; then
|
||||
sed -i '/^ \{0,\}ipcidr:/,/OpenClash-General-Settings/ {s/^ \{0,\}- / - /}' "$3" 2>/dev/null #修改参数空格
|
||||
sed -i '/^ \{0,\}ipcidr:/,/,$/ {s/^ \{0,\}- / - /g}' "$3" 2>/dev/null #修改参数空格
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -555,9 +563,7 @@ yml_auth_custom()
|
||||
if [ -f /tmp/config.auth ]; then
|
||||
sed -i '/^dns:/i\authentication:' "$1" 2>/dev/null
|
||||
sed -i '/^authentication:/r/tmp/config.auth' "$1" 2>/dev/null
|
||||
mv /tmp/config.auth /tmp/openclash.auth 2>/dev/null
|
||||
else
|
||||
rm -rf /tmp/openclash.auth 2>/dev/null
|
||||
rm -rf /tmp/config.auth 2>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
@ -940,7 +946,7 @@ if [ ! -f "$CONFIG_FILE" ]; then
|
||||
exit 0
|
||||
elif [ ! -f "$CONFIG_FILE" ]; then
|
||||
echo "错误: 缺少配置文件,请上传或更新配置文件!" >$START_LOG
|
||||
echo "${LOGTIME} Config Not Found" >> $LOG_FILE
|
||||
echo "${LOGTIME} Error: Config Not Found" >> $LOG_FILE
|
||||
sleep 5
|
||||
exit 0
|
||||
fi
|
||||
@ -988,14 +994,14 @@ do_run_file()
|
||||
|
||||
if [ "$small_flash_memory" != "1" ]; then
|
||||
dev_core_path="/etc/openclash/core/clash"
|
||||
tun_core_path="/etc/openclash/core/clash_tun"
|
||||
game_core_path="/etc/openclash/core/clash_game"
|
||||
geoip_path="/etc/openclash/Country.mmdb"
|
||||
tun_core_path="/etc/openclash/core/clash_tun"
|
||||
game_core_path="/etc/openclash/core/clash_game"
|
||||
geoip_path="/etc/openclash/Country.mmdb"
|
||||
else
|
||||
dev_core_path="/tmp/etc/openclash/core/clash"
|
||||
tun_core_path="/tmp/etc/openclash/core/clash_tun"
|
||||
game_core_path="/tmp/etc/openclash/core/clash_game"
|
||||
geoip_path="/tmp/etc/openclash/Country.mmdb"
|
||||
tun_core_path="/tmp/etc/openclash/core/clash_tun"
|
||||
game_core_path="/tmp/etc/openclash/core/clash_game"
|
||||
geoip_path="/tmp/etc/openclash/Country.mmdb"
|
||||
fi
|
||||
|
||||
rm -rf "/etc/openclash/clash" 2>/dev/null
|
||||
@ -1045,7 +1051,7 @@ do_run_file()
|
||||
[ ! -x "$dev_core_path" ] && chmod 4755 "$dev_core_path" 2>/dev/null
|
||||
|
||||
[ -f "$geoip_path" ] && [ "$small_flash_memory" = "1" ] && {
|
||||
rm -rf "/etc/openclash/Country.mmdb" 2>/dev/null
|
||||
rm -rf "/etc/openclash/Country.mmdb" 2>/dev/null
|
||||
ln -s "$geoip_path" /etc/openclash/Country.mmdb 2>/dev/null
|
||||
}
|
||||
|
||||
@ -1065,6 +1071,17 @@ do_run_file()
|
||||
nohup /usr/share/openclash/openclash_core.sh "$core_type" &
|
||||
exit 0
|
||||
}
|
||||
|
||||
if ! capsh --is-uid=0 >/dev/null; then
|
||||
echo "错误:Capsh异常,请尝试重新安装依赖【libcap】和相应的Capsh库,终止启动..." >$START_LOG
|
||||
echo "${LOGTIME} Error: Could Not Load The Capsh Library, Please Verify The Capsh Shell Library Work Well" >> $LOG_FILE
|
||||
echo "${LOGTIME} Tip: You Could Download And Re-Install The libcap & libcap-bin Library From The Address Below:" >> $LOG_FILE
|
||||
echo "" >> $LOG_FILE
|
||||
echo "---------- https://mirrors.cloud.tencent.com/lede/snapshots/packages/ ----------" >> $LOG_FILE
|
||||
echo "" >> $LOG_FILE
|
||||
sleep 5
|
||||
start_fail
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
@ -1078,7 +1095,9 @@ start_run_core()
|
||||
curl -s --connect-timeout 5 -m 5 -H 'Content-Type: application/json' -H "Authorization: Bearer ${da_password}" -XPUT http://"$lan_ip":"$cn_port"/configs -d "{\"path\": \"$CONFIG_FILE\"}" 2>/dev/null
|
||||
else
|
||||
kill_clash
|
||||
nohup "$CLASH" -d "$CLASH_CONFIG" -f "$CONFIG_FILE" >> $LOG_FILE 2>&1 &
|
||||
#使用nobody启动内核方便代理路由自身流量
|
||||
capabilties="cap_sys_resource,cap_dac_override,cap_net_raw,cap_net_bind_service,cap_net_admin"
|
||||
capsh --caps="${capabilties}+eip" -- -c "capsh --user=nobody --addamb='${capabilties}' -- -c 'nohup $CLASH -d $CLASH_CONFIG -f \"$CONFIG_FILE\" >> $LOG_FILE 2>&1 &'" >> $LOG_FILE 2>&1
|
||||
fi
|
||||
uci set openclash.config.config_reload=1 2>/dev/null
|
||||
uci commit openclash
|
||||
@ -1087,9 +1106,9 @@ start_run_core()
|
||||
check_core_status()
|
||||
{
|
||||
check_time=1
|
||||
while ( [ "$check_time" -le 3 ] && [ -z "$(pidof clash)" ] )
|
||||
while ( [ "$check_time" -le 3 ] && [ -n "$(pidof clash)" ] )
|
||||
do
|
||||
sleep 2
|
||||
sleep 1
|
||||
check_time=$(expr "$check_time" + 1)
|
||||
done
|
||||
}
|
||||
@ -1105,17 +1124,17 @@ raw_config_start()
|
||||
if [ -z "$dns_port" ] || [ -z "$en_mode" ] || [ -z "$proxy_port" ]; then
|
||||
if [ -z "$dns_port" ]; then
|
||||
echo "错误: 无法获取DNS部分的监听端口设置, OpenClash 使用原始配置文件启动失败" >$START_LOG
|
||||
echo "${LOGTIME} Get DNS 'listen' Option Error, OpenClash Can Not Start With Raw Config File" >> $LOG_FILE
|
||||
echo "${LOGTIME} Error: Get DNS 'listen' Option Error, OpenClash Can Not Start With Raw Config File" >> $LOG_FILE
|
||||
sleep 3
|
||||
fi
|
||||
if [ -z "$en_mode" ]; then
|
||||
echo "错误: 无法获取DNS部分的运行模式设置, OpenClash 使用原始配置文件启动失败" >$START_LOG
|
||||
echo "${LOGTIME} Get DNS 'enhanced-mode' Option Error, OpenClash Can Not Start With Raw Config File" >> $LOG_FILE
|
||||
echo "${LOGTIME} Error: Get DNS 'enhanced-mode' Option Error, OpenClash Can Not Start With Raw Config File" >> $LOG_FILE
|
||||
sleep 3
|
||||
fi
|
||||
if [ -z "$proxy_port" ]; then
|
||||
echo "错误: 无法获取General部分的转发端口设置, OpenClash 使用原始配置文件启动失败" >$START_LOG
|
||||
echo "${LOGTIME} Get General 'redir-port' Option Error, OpenClash Can Not Start With Raw Config File" >> $LOG_FILE
|
||||
echo "${LOGTIME} Error: Get General 'redir-port' Option Error, OpenClash Can Not Start With Raw Config File" >> $LOG_FILE
|
||||
sleep 3
|
||||
fi
|
||||
start_fail
|
||||
@ -1126,7 +1145,7 @@ raw_config_start()
|
||||
|
||||
if ! pidof clash >/dev/null; then
|
||||
echo "错误: OpenClash 启动失败,请到日志页面查看详细错误信息!" >$START_LOG
|
||||
echo "${LOGTIME} OpenClash Can Not Start, Please Check The Error Info And Try Again" >> $LOG_FILE
|
||||
echo "${LOGTIME} Error: OpenClash Can Not Start, Please Check The Error Info And Try Again" >> $LOG_FILE
|
||||
sleep 5
|
||||
start_fail
|
||||
fi
|
||||
@ -1162,10 +1181,10 @@ raw_config_start()
|
||||
fi
|
||||
|
||||
dase=$(grep "^ \{0,\}Secret:" "$CONFIG_FILE" |awk -F ': ' '{print $2}' |awk -F '#' '{print $1}' |sed 's/^ \{0,\}//g' 2>/dev/null |sed 's/ \{0,\}$//g' 2>/dev/null |sed "s/\'//g" 2>/dev/null |sed "s/\'//g" 2>/dev/null)
|
||||
uci set openclash.config.dashboard_password=dase 2>/dev/null
|
||||
uci set openclash.config.dashboard_password="$dase" 2>/dev/null
|
||||
|
||||
cn_port=$(grep "^ \{0,\}external-controller:" "$CONFIG_FILE" |awk -F ':' '{print $3}' |awk -F '#' '{print $1}' |tr -cd "[0-9]" 2>/dev/null)
|
||||
uci set openclash.config.dashboard_password=cn_port 2>/dev/null
|
||||
uci set openclash.config.dashboard_password="$cn_port" 2>/dev/null
|
||||
|
||||
uci set openclash.config.restricted_mode=1
|
||||
|
||||
@ -1177,12 +1196,12 @@ try_restore_start()
|
||||
if [ -z "$(pidof clash)" ]; then
|
||||
if [ "$rule_source" = 0 ] && [ "$enable_custom_clash_rules" = 0 ]; then
|
||||
echo "错误: OpenClash 启动失败,尝试使用原始配置文件启动..." >$START_LOG
|
||||
echo "${LOGTIME} OpenClash Can Not Start, Try Use Raw Config Restart Again" >> $LOG_FILE
|
||||
echo "${LOGTIME} Error: OpenClash Can Not Start, Try Use Raw Config Restart Again" >> $LOG_FILE
|
||||
sleep 3
|
||||
raw_config_start
|
||||
else
|
||||
echo "错误: OpenClash 启动失败,尝试还原第三方规则并重新启动 Clash 主程序..." >$START_LOG
|
||||
echo "${LOGTIME} OpenClash Can Not Start, Try Use Backup Rules Start Again" >> $LOG_FILE
|
||||
echo "${LOGTIME} Error: OpenClash Can Not Start, Try Use Backup Rules Start Again" >> $LOG_FILE
|
||||
rm -rf /tmp/yaml_general 2>/dev/null
|
||||
#获取备份rule_provider
|
||||
rule_provider_bak_len=$(sed -n '/^rule-providers:/=' "$START_BACKUP" 2>/dev/null)
|
||||
@ -1200,11 +1219,11 @@ try_restore_start()
|
||||
/usr/share/openclash/yml_field_cut.sh "$rule_bak_len" "$RULE_BAK_FILE" "$START_BACKUP"
|
||||
fi 2>/dev/null
|
||||
yml_rule_bak_merge
|
||||
nohup "$CLASH" -d "$CLASH_CONFIG" -f "$CONFIG_FILE" >> $LOG_FILE 2>&1 &
|
||||
start_run_core
|
||||
check_core_status
|
||||
if ! pidof clash >/dev/null; then
|
||||
echo "错误: OpenClash 启动失败,尝试使用原始配置文件启动..." >$START_LOG
|
||||
echo "${LOGTIME} OpenClash Can Not Start, Try Use Raw Config Restart Again" >> $LOG_FILE
|
||||
echo "${LOGTIME} Error: OpenClash Can Not Start, Try Use Raw Config Restart Again" >> $LOG_FILE
|
||||
sleep 3
|
||||
raw_config_start
|
||||
fi
|
||||
@ -1231,15 +1250,18 @@ firewall_redirect_exclude()
|
||||
if [ -z "$src_dport" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -z "$en_mode_tun" ]; then
|
||||
iptables -t mangle -A openclash -p udp --dport "$src_dport" -j RETURN >/dev/null 2>&1
|
||||
|
||||
if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 3 ]; then
|
||||
iptables -t nat -I openclash_output -p tcp --sport "$src_dport" -j RETURN >/dev/null 2>&1
|
||||
iptables -t mangle -I openclash_output -p udp --sport "$src_dport" -j RETURN >/dev/null 2>&1
|
||||
iptables -t mangle -I openclash -p udp --dport "$src_dport" -j RETURN >/dev/null 2>&1
|
||||
elif [ "$en_mode_tun" -ne 3 ]; then
|
||||
iptables -t mangle -A openclash -p tcp --dport "$src_dport" -j RETURN >/dev/null 2>&1
|
||||
iptables -t mangle -A openclash -p udp --dport "$src_dport" -j RETURN >/dev/null 2>&1
|
||||
else
|
||||
iptables -t mangle -A openclash -p udp --dport "$src_dport" -j RETURN >/dev/null 2>&1
|
||||
iptables -t mangle -I openclash_output -p tcp --sport "$src_dport" -j RETURN >/dev/null 2>&1
|
||||
iptables -t mangle -I openclash_output -p udp --sport "$src_dport" -j RETURN >/dev/null 2>&1
|
||||
iptables -t mangle -I openclash -p tcp --dport "$src_dport" -j RETURN >/dev/null 2>&1
|
||||
iptables -t mangle -I openclash -p udp --dport "$src_dport" -j RETURN >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
set_firewall()
|
||||
@ -1369,6 +1391,7 @@ if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 3 ]; then
|
||||
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 openclash
|
||||
iptables -t mangle -F openclash
|
||||
iptables -t mangle -A openclash -m set --match-set localnetwork dst -j RETURN
|
||||
iptables -t mangle -A openclash -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1
|
||||
iptables -t mangle -A openclash -m set --match-set lan_ac_black_macs src -j RETURN >/dev/null 2>&1
|
||||
@ -1379,21 +1402,19 @@ if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 3 ]; then
|
||||
iptables -t mangle -A openclash -m set --match-set china_ip_route dst -j RETURN >/dev/null 2>&1
|
||||
fi
|
||||
iptables -t mangle -A openclash -p udp --dport 53 -j RETURN >/dev/null 2>&1
|
||||
#端口转发
|
||||
config_load "firewall"
|
||||
config_foreach firewall_redirect_exclude "redirect"
|
||||
iptables -t mangle -A openclash -p udp -j TPROXY --on-port "$proxy_port" --on-ip 0.0.0.0 --tproxy-mark "$PROXY_FWMARK"
|
||||
iptables -t mangle -A PREROUTING -p udp -j openclash
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$en_mode" = "fake-ip" ]; then
|
||||
#if [ "$en_mode" = "fake-ip" ]; then
|
||||
iptables -t nat -N openclash_output
|
||||
iptables -t nat -F openclash_output
|
||||
iptables -t nat -A openclash_output -m set --match-set localnetwork dst -j RETURN
|
||||
iptables -t nat -A openclash_output -p tcp -d 198.18.0.0/16 -j REDIRECT --to-ports "$proxy_port"
|
||||
iptables -t nat -A OUTPUT -p tcp -j openclash_output
|
||||
fi
|
||||
#iptables -t nat -A openclash_output -p tcp -d 198.18.0.0/16 -j REDIRECT --to-ports "$proxy_port"
|
||||
iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -p tcp -j REDIRECT --to-ports "$proxy_port"
|
||||
iptables -t nat -I OUTPUT -j openclash_output
|
||||
#fi
|
||||
|
||||
#if [ "$ipv6_enable" -eq 1 ]; then
|
||||
# #tcp
|
||||
@ -1439,24 +1460,21 @@ if [ -n "$en_mode_tun" ]; then
|
||||
fi
|
||||
ip rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE"
|
||||
|
||||
#设置防火墙
|
||||
iptables -t mangle -N openclash_output
|
||||
iptables -t mangle -F openclash_output
|
||||
iptables -t mangle -A openclash_output -m set --match-set localnetwork dst -j RETURN
|
||||
if [ "$en_mode_tun" -ne 3 ]; then
|
||||
#设置防火墙
|
||||
iptables -t mangle -N openclash_output
|
||||
iptables -t mangle -F openclash_output
|
||||
iptables -t mangle -A openclash_output -m set --match-set localnetwork dst -j RETURN
|
||||
if [ "$en_mode" = "fake-ip" ]; then
|
||||
iptables -t mangle -A openclash_output -d 198.18.0.0/16 -j MARK --set-mark "$PROXY_FWMARK"
|
||||
fi
|
||||
iptables -t mangle -I OUTPUT -j openclash_output
|
||||
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -j MARK --set-mark "$PROXY_FWMARK"
|
||||
else
|
||||
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -p udp -j MARK --set-mark "$PROXY_FWMARK"
|
||||
fi
|
||||
iptables -t mangle -I OUTPUT -j openclash_output
|
||||
|
||||
iptables -t mangle -N openclash
|
||||
iptables -t mangle -F openclash
|
||||
iptables -t mangle -N openclash_dns_hijack
|
||||
iptables -t mangle -F openclash_dns_hijack
|
||||
#端口转发
|
||||
config_load "firewall"
|
||||
config_foreach firewall_redirect_exclude "redirect"
|
||||
#其他流量
|
||||
iptables -t mangle -A openclash -m set --match-set localnetwork dst -j RETURN >/dev/null 2>&1
|
||||
iptables -t mangle -A openclash -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1
|
||||
@ -1486,6 +1504,10 @@ if [ -n "$en_mode_tun" ]; then
|
||||
# ip6tables -t mangle -I PREROUTING -j MARK --set-mark "$PROXY_FWMARK"
|
||||
# fi
|
||||
fi
|
||||
|
||||
#端口转发
|
||||
config_load "firewall"
|
||||
config_foreach firewall_redirect_exclude "redirect"
|
||||
}
|
||||
|
||||
revert_firewall()
|
||||
@ -1503,7 +1525,13 @@ revert_firewall()
|
||||
for out_line in $out_lines; do
|
||||
iptables -t nat -D OUTPUT "$out_line" >/dev/null 2>&1
|
||||
done >/dev/null 2>&1
|
||||
iptables -t nat -D OUTPUT -p tcp -j openclash_output >/dev/null 2>&1
|
||||
iptables -t nat -D OUTPUT -j openclash_output >/dev/null 2>&1
|
||||
|
||||
out_lines=$(iptables -nvL OUTPUT -t mangle |sed 1,2d |sed -n '/openclash/=' 2>/dev/null |sort -rn)
|
||||
for out_line in $out_lines; do
|
||||
iptables -t mangle -D OUTPUT "$out_line" >/dev/null 2>&1
|
||||
done >/dev/null 2>&1
|
||||
iptables -t mangle -D OUTPUT -j openclash_output >/dev/null 2>&1
|
||||
|
||||
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
|
||||
@ -1598,10 +1626,10 @@ start()
|
||||
{
|
||||
#禁止多个实例
|
||||
status=$(unify_ps_status "/etc/init.d/openclash")
|
||||
[ "$status" -gt "3" ] && echo "Multiple Start Scripts Running, Exit..." >> $LOG_FILE && exit 0
|
||||
[ "$status" -gt "3" ] && echo "${LOGTIME} Warning: Multiple Start Scripts Running, Exit..." >> $LOG_FILE && exit 0
|
||||
|
||||
enable=$(uci get openclash.config.enable 2>/dev/null)
|
||||
[ "$enable" != "1" ] && echo "OpenClash Now Disabled, Need Start From Luci Page, Exit..." >> $LOG_FILE && exit 0
|
||||
[ "$enable" != "1" ] && echo "${LOGTIME} Warning: OpenClash Now Disabled, Need Start From Luci Page, Exit..." >> $LOG_FILE && exit 0
|
||||
|
||||
config_choose
|
||||
|
||||
@ -1616,30 +1644,22 @@ start()
|
||||
|
||||
echo "第二步: 配置文件检查..." >$START_LOG
|
||||
yml_check "$en_mode" "$enable_custom_dns" "$CONFIG_FILE" "$BACKUP_FILE" "$START_BACKUP"
|
||||
yml_dns_check
|
||||
|
||||
|
||||
echo "第三步: 修改配置文件..." >$START_LOG
|
||||
config_load "openclash"
|
||||
config_foreach yml_auth_get "authentication"
|
||||
yml_auth_custom "$CHANGE_FILE"
|
||||
yml_dns_custom "$enable_custom_dns" "$DNS_FILE" "$FALLBACK_FILTER_FILE"
|
||||
/usr/share/openclash/yml_change.sh >/dev/null 2>&1 "$LOGTIME" "$en_mode" "$enable_custom_dns" "$da_password" "$cn_port" "$proxy_port" "$CHANGE_FILE" "$ipv6_enable" "$http_port" "$socks_port" "$lan_ip" "$log_level" "$proxy_mode" "$intranet_allowed" "$en_mode_tun" "$stack_type" &
|
||||
/usr/share/openclash/yml_change.sh >/dev/null 2>&1 "$LOGTIME" "$en_mode" "$enable_custom_dns" "$da_password" "$cn_port" "$proxy_port" "$CHANGE_FILE" "$ipv6_enable" "$http_port" "$socks_port" "$lan_ip" "$log_level" "$proxy_mode" "$intranet_allowed" "$en_mode_tun" "$stack_type" "$dns_port" &
|
||||
/usr/share/openclash/yml_rules_change.sh >/dev/null 2>&1 "$LOGTIME" "$rule_source" "$enable_custom_clash_rules" "$RULE_FILE" "$set_rule_file" "$en_mode" "$enable_rule_proxy" "$BACKUP_FILE" "$RULE_PROVIDER_FILE" &
|
||||
wait
|
||||
yml_provider_path "$PROXY_PROVIDER_FILE" "proxy_provider"
|
||||
yml_provider_path "$RULE_PROVIDER_FILE" "rule_provider"
|
||||
yml_custom_rule_provider
|
||||
yml_game_custom
|
||||
yml_merge
|
||||
|
||||
echo "第四步: DNS设置检查..." >$START_LOG
|
||||
if [ -n "$(sed -n '/^ \{0,\}nameserver:/{n;p}' "$CONFIG_FILE" |grep '^ \{0,\}fallback:')" ] || [ -n "$(sed -n '/^ \{0,\}nameserver:/{n;p}' "$CONFIG_FILE" |grep 'OpenClash-General')" ]; then
|
||||
echo "错误: 配置文件DNS选项下的Nameserver必须设置服务器,已自动还原配置文件,请重新设置!" >$START_LOG
|
||||
echo "${LOGTIME} Nameserver Must Be Set, Please Change Your Configrations In Config.yaml" >>$LOG_FILE
|
||||
mv "$START_BACKUP" "$CONFIG_FILE"
|
||||
sleep 5
|
||||
start_fail
|
||||
fi
|
||||
echo "第四步: 合并配置文件修改..." >$START_LOG
|
||||
yml_merge
|
||||
|
||||
echo "第五步: 启动主程序..." >$START_LOG
|
||||
sleep 1
|
||||
@ -1675,12 +1695,12 @@ start()
|
||||
sleep 5
|
||||
elif [ -n "$(uci get dhcp.lan.dhcpv6 2>/dev/null)" ]; then
|
||||
echo "OpenClash 启动成功,检测到您启用了IPV6的DHCP服务,可能会造成连接异常!" >$START_LOG
|
||||
echo "${LOGTIME} OpenClash Start Successful, Please Note That Network May Abnormal With IPV6's DHCP Server" >> $LOG_FILE
|
||||
echo "${LOGTIME} Warning: OpenClash Start Successful, Please Note That Network May Abnormal With IPV6's DHCP Server" >> $LOG_FILE
|
||||
sleep 5
|
||||
fi
|
||||
if [ "$(uci get openclash.config.restricted_mode 2>/dev/null)" = "1" ]; then
|
||||
echo "OpenClash 使用原始配置文件启动成功,部分设置可能未生效!" >$START_LOG
|
||||
echo "${LOGTIME} OpenClash Start Successful With Raw Config File, Please Note That It's Restricted Mode Now" >> $LOG_FILE
|
||||
echo "${LOGTIME} Warning: OpenClash Start Successful With Raw Config File, Please Note That It's Restricted Mode Now" >> $LOG_FILE
|
||||
sleep 5
|
||||
fi
|
||||
echo "OpenClash Already Start"
|
||||
|
||||
Binary file not shown.
@ -73,10 +73,10 @@ music.migu.cn
|
||||
#QQ快捷登录
|
||||
localhost.ptlogin2.qq.com
|
||||
#Nintendo Switch
|
||||
*.*.*.srv.nintendo.net
|
||||
*.*.*.*.srv.nintendo.net
|
||||
#Sony PlayStation
|
||||
*.*.stun.playstation.net
|
||||
*.*.*.stun.playstation.net
|
||||
#Microsoft Xbox
|
||||
xbox.*.*.microsoft.com
|
||||
*.*.xboxlive.com
|
||||
xbox.*.microsoft.com
|
||||
*.*.*.xboxlive.com
|
||||
proxy.golang.org
|
||||
@ -25,6 +25,8 @@
|
||||
##- SRC-IP-CIDR,192.168.1.208/28,DIRECT
|
||||
##- SRC-IP-CIDR,192.168.1.224/27,DIRECT
|
||||
|
||||
##- SRC-IP-CIDR,198.18.0.1/32,DIRECT
|
||||
|
||||
##此时IP为192.168.1.1和192.168.1.201的客户端流量走代理(策略),其余客户端不走代理
|
||||
##因为Fake-IP模式下,IP地址为192.168.1.1的路由器自身流量可走代理(策略),所以需要排除
|
||||
##因为Fake-IP模式下,IP地址为192.168.1.1、198.18.0.1的路由器自身流量可走代理(策略),所以需要排除
|
||||
##在线IP段转CIDR地址:http://ip2cidr.com
|
||||
@ -7,17 +7,10 @@ status=$(unify_ps_status "clash_version.sh")
|
||||
|
||||
CKTIME=$(date "+%Y-%m-%d-%H")
|
||||
LAST_OPVER="/tmp/clash_last_version"
|
||||
HTTP_PORT=$(uci get openclash.config.http_port 2>/dev/null)
|
||||
PROXY_ADDR=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null)
|
||||
|
||||
if [ -s "/tmp/openclash.auth" ]; then
|
||||
PROXY_AUTH=$(cat /tmp/openclash.auth |awk -F '- ' '{print $2}' |sed -n '1p' 2>/dev/null)
|
||||
fi
|
||||
|
||||
VERSION_URL="https://raw.githubusercontent.com/vernesong/OpenClash/master/core_version"
|
||||
if [ "$CKTIME" != "$(grep "CheckTime" $LAST_OPVER 2>/dev/null |awk -F ':' '{print $2}')" ]; then
|
||||
if pidof clash >/dev/null; then
|
||||
curl -sL --connect-timeout 10 --retry 2 -x http://$PROXY_ADDR:$HTTP_PORT -U "$PROXY_AUTH" "$VERSION_URL" -o $LAST_OPVER >/dev/null 2>&1
|
||||
curl -sL --connect-timeout 10 --retry 2 https://raw.githubusercontent.com/vernesong/OpenClash/master/core_version -o $LAST_OPVER >/dev/null 2>&1
|
||||
else
|
||||
curl -sL --connect-timeout 10 --retry 2 https://cdn.jsdelivr.net/gh/vernesong/OpenClash@master/core_version -o $LAST_OPVER >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
@ -153,6 +153,8 @@ change_dns()
|
||||
uci commit dhcp
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||
fi
|
||||
iptables -t nat -I OUTPUT -j openclash_output >/dev/null 2>&1
|
||||
iptables -t mangle -I OUTPUT -j openclash_output >/dev/null 2>&1
|
||||
nohup /usr/share/openclash/openclash_watchdog.sh &
|
||||
fi
|
||||
}
|
||||
@ -170,6 +172,9 @@ config_download_direct()
|
||||
uci delete dhcp.@dnsmasq[0].cachesize >/dev/null 2>&1
|
||||
uci commit dhcp
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||
|
||||
iptables -t nat -D OUTPUT -j openclash_output >/dev/null 2>&1
|
||||
iptables -t mangle -D OUTPUT -j openclash_output >/dev/null 2>&1
|
||||
sleep 3
|
||||
|
||||
config_download
|
||||
|
||||
@ -7,16 +7,11 @@
|
||||
START_LOG="/tmp/openclash_start.log"
|
||||
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
LOG_FILE="/tmp/openclash.log"
|
||||
HTTP_PORT=$(uci get openclash.config.http_port 2>/dev/null)
|
||||
PROXY_ADDR=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null)
|
||||
china_ip_route=$(uci get openclash.config.china_ip_route 2>/dev/null)
|
||||
|
||||
if [ -s "/tmp/openclash.auth" ]; then
|
||||
PROXY_AUTH=$(cat /tmp/openclash.auth |awk -F '- ' '{print $2}' |sed -n '1p' 2>/dev/null)
|
||||
fi
|
||||
|
||||
echo "开始下载大陆IP白名单..." >$START_LOG
|
||||
if pidof clash >/dev/null; then
|
||||
curl -sL --connect-timeout 10 --retry 2 -x http://$PROXY_ADDR:$HTTP_PORT -U "$PROXY_AUTH" https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/RuleSet/Extra/ChinaIP.yaml -o /tmp/ChinaIP.yaml >/dev/null 2>&1
|
||||
curl -sL --connect-timeout 10 --retry 2 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/RuleSet/Extra/ChinaIP.yaml -o /tmp/ChinaIP.yaml >/dev/null 2>&1
|
||||
else
|
||||
curl -sL --connect-timeout 10 --retry 2 https://cdn.jsdelivr.net/gh/DivineEngine/Profiles@master/Clash/RuleSet/Extra/ChinaIP.yaml -o /tmp/ChinaIP.yaml >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#!/bin/sh
|
||||
. /lib/functions.sh
|
||||
. /usr/share/openclash/openclash_ps.sh
|
||||
|
||||
START_LOG="/tmp/openclash_start.log"
|
||||
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
@ -9,8 +10,7 @@ CORE_TYPE="$1"
|
||||
en_mode=$(uci get openclash.config.en_mode 2>/dev/null)
|
||||
small_flash_memory=$(uci get openclash.config.small_flash_memory 2>/dev/null)
|
||||
CPU_MODEL=$(uci get openclash.config.core_version 2>/dev/null)
|
||||
HTTP_PORT=$(uci get openclash.config.http_port 2>/dev/null)
|
||||
PROXY_ADDR=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null)
|
||||
|
||||
[ ! -f "/tmp/clash_last_version" ] && /usr/share/openclash/clash_version.sh 2>/dev/null
|
||||
if [ "$small_flash_memory" != "1" ]; then
|
||||
dev_core_path="/etc/openclash/core/clash"
|
||||
@ -24,19 +24,13 @@ else
|
||||
mkdir -p /tmp/etc/openclash/core
|
||||
fi
|
||||
|
||||
|
||||
[ -s "/tmp/openclash.auth" ] && {
|
||||
PROXY_AUTH=$(cat /tmp/openclash.auth |awk -F '- ' '{print $2}' |sed -n '1p' 2>/dev/null)
|
||||
}
|
||||
|
||||
case $CORE_TYPE in
|
||||
"Tun")
|
||||
CORE_CV=$($tun_core_path -v 2>/dev/null |awk -F ' ' '{print $2}')
|
||||
CORE_LV=$(sed -n 2p /tmp/clash_last_version 2>/dev/null)
|
||||
echo $CORE_CV >>/tmp/1
|
||||
if [ -z "$CORE_LV" ]; then
|
||||
echo "获取【Tun】内核最新版本信息失败,请稍后再试..." >$START_LOG
|
||||
echo "${LOGTIME} 【Tun】Core Version Check Error, Please Try Again After A few seconds" >>$LOG_FILE
|
||||
echo "${LOGTIME} Error: 【Tun】Core Version Check Error, Please Try Again After A few Seconds" >>$LOG_FILE
|
||||
sleep 5
|
||||
echo "" >$START_LOG
|
||||
exit 0
|
||||
@ -68,15 +62,15 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
|
||||
case $CORE_TYPE in
|
||||
"Tun")
|
||||
echo "正在下载【Tun】版本内核,如下载失败请尝试手动下载并上传..." >$START_LOG
|
||||
curl -sL -m 30 --retry 2 -x http://$PROXY_ADDR:$HTTP_PORT -U "$PROXY_AUTH" https://github.com/vernesong/OpenClash/releases/download/TUN-Premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz >/dev/null 2>&1
|
||||
curl -sL -m 30 --retry 2 https://github.com/vernesong/OpenClash/releases/download/TUN-Premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz >/dev/null 2>&1
|
||||
;;
|
||||
"Game")
|
||||
echo "正在下载【Game】版本内核,如下载失败请尝试手动下载并上传..." >$START_LOG
|
||||
curl -sL -m 30 --retry 2 -x http://$PROXY_ADDR:$HTTP_PORT -U "$PROXY_AUTH" https://github.com/vernesong/OpenClash/releases/download/TUN/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_game.tar.gz >/dev/null 2>&1
|
||||
curl -sL -m 30 --retry 2 https://github.com/vernesong/OpenClash/releases/download/TUN/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_game.tar.gz >/dev/null 2>&1
|
||||
;;
|
||||
*)
|
||||
echo "正在下载【Dev】版本内核,如下载失败请尝试手动下载并上传..." >$START_LOG
|
||||
curl -sL -m 30 --retry 2 -x http://$PROXY_ADDR:$HTTP_PORT -U "$PROXY_AUTH" https://github.com/vernesong/OpenClash/releases/download/Clash/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz >/dev/null 2>&1
|
||||
curl -sL -m 30 --retry 2 https://github.com/vernesong/OpenClash/releases/download/Clash/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz >/dev/null 2>&1
|
||||
esac
|
||||
else
|
||||
case $CORE_TYPE in
|
||||
@ -131,7 +125,7 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
|
||||
|
||||
if [ "$?" -ne "0" ]; then
|
||||
echo "【"$CORE_TYPE"】版本内核更新失败,请检查网络或稍后再试!" >$START_LOG
|
||||
echo "${LOGTIME} OpenClash 【"$CORE_TYPE"】 Core Update Error" >>$LOG_FILE
|
||||
echo "${LOGTIME} Error: OpenClash 【"$CORE_TYPE"】 Core Update Error" >>$LOG_FILE
|
||||
case $CORE_TYPE in
|
||||
"Tun")
|
||||
rm -rf /tmp/clash_tun >/dev/null 2>&1
|
||||
@ -170,11 +164,11 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
|
||||
uci set openclash.config.config_reload=0
|
||||
uci commit openclash
|
||||
fi
|
||||
[ "$if_restart" -eq 1 ] && /etc/init.d/openclash restart
|
||||
[ "$if_restart" -eq 1 ] && [ "$(unify_ps_prevent)" -eq 0 ] && /etc/init.d/openclash restart
|
||||
echo "" >$START_LOG
|
||||
else
|
||||
echo "【"$CORE_TYPE"】版本内核更新失败,请确认设备闪存空间足够后再试!" >$START_LOG
|
||||
echo "${LOGTIME} OpenClash 【"$CORE_TYPE"】 Core Update Error" >>$LOG_FILE
|
||||
echo "${LOGTIME} Error: OpenClash 【"$CORE_TYPE"】 Core Update Error" >>$LOG_FILE
|
||||
case $CORE_TYPE in
|
||||
"Tun")
|
||||
rm -rf /tmp/clash_tun >/dev/null 2>&1
|
||||
@ -189,7 +183,7 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
|
||||
fi
|
||||
else
|
||||
echo "【"$CORE_TYPE"】版本内核下载失败,请检查网络或稍后再试!" >$START_LOG
|
||||
echo "${LOGTIME} OpenClash 【"$CORE_TYPE"】 Core Update Error" >>$LOG_FILE
|
||||
echo "${LOGTIME} Error: OpenClash 【"$CORE_TYPE"】 Core Update Error" >>$LOG_FILE
|
||||
case $CORE_TYPE in
|
||||
"Tun")
|
||||
rm -rf /tmp/clash_tun >/dev/null 2>&1
|
||||
|
||||
@ -98,6 +98,9 @@ ca-certificates: $(ts_re "$(opkg status ca-certificates 2>/dev/null |grep 'Statu
|
||||
ipset: $(ts_re "$(opkg status ipset 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
ip-full: $(ts_re "$(opkg status ip-full 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
iptables-mod-tproxy: $(ts_re "$(opkg status iptables-mod-tproxy 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
iptables-mod-extra: $(ts_re "$(opkg status iptables-mod-extra 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
libcap: $(ts_re "$(opkg status libcap 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
libcap-bin: $(ts_re "$(opkg status libcap-bin 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
kmod-tun(TUN模式): $(ts_re "$(opkg status kmod-tun 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
luci-compat(Luci-19.07): $(ts_re "$(opkg status luci-compat 2>/dev/null |grep 'Status' |awk -F ': ' '{print $2}' 2>/dev/null)")
|
||||
EOF
|
||||
|
||||
@ -19,20 +19,16 @@
|
||||
TMP_RULE_DIR="/tmp/$RULE_FILE_NAME"
|
||||
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
LOG_FILE="/tmp/openclash.log"
|
||||
HTTP_PORT=$(uci get openclash.config.http_port 2>/dev/null)
|
||||
PROXY_ADDR=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null)
|
||||
if [ -s "/tmp/openclash.auth" ]; then
|
||||
PROXY_AUTH=$(cat /tmp/openclash.auth |awk -F '- ' '{print $2}' |sed -n '1p' 2>/dev/null)
|
||||
fi
|
||||
|
||||
if [ "$RULE_TYPE" = "game" ]; then
|
||||
if pidof clash >/dev/null; then
|
||||
curl -sL --connect-timeout 5 --retry 2 -x http://$PROXY_ADDR:$HTTP_PORT -U "$PROXY_AUTH" https://raw.githubusercontent.com/FQrabbit/SSTap-Rule/master/rules/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1
|
||||
curl -sL --connect-timeout 5 --retry 2 https://raw.githubusercontent.com/FQrabbit/SSTap-Rule/master/rules/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1
|
||||
else
|
||||
curl -sL --connect-timeout 5 --retry 2 https://cdn.jsdelivr.net/gh/FQrabbit/SSTap-Rule@master/rules/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1
|
||||
fi
|
||||
elif [ "$RULE_TYPE" = "provider" ]; then
|
||||
if pidof clash >/dev/null; then
|
||||
curl -sL --connect-timeout 5 --retry 2 -x http://$PROXY_ADDR:$HTTP_PORT -U "$PROXY_AUTH" https://raw.githubusercontent.com/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1
|
||||
curl -sL --connect-timeout 5 --retry 2 https://raw.githubusercontent.com/"$DOWNLOAD_PATH" -o "$TMP_RULE_DIR" >/dev/null 2>&1
|
||||
else
|
||||
curl -sL --connect-timeout 5 --retry 2 https://cdn.jsdelivr.net/gh/"$(echo "$DOWNLOAD_PATH" |awk -F '/master' '{print $1}' 2>/dev/null)"@master"$(echo "$DOWNLOAD_PATH" |awk -F 'master' '{print $2}')" -o "$TMP_RULE_DIR" >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
@ -13,7 +13,7 @@ if [ -s "$CUSTOM_FILE" ]; then
|
||||
cat "$CUSTOM_FILE" |while read -r line || [[ -n ${line} ]];
|
||||
do
|
||||
if [ -z "$(echo $line |grep '^ \{0,\}#' 2>/dev/null)" ]; then
|
||||
echo " - '$line'" >> "$FAKE_FILTER_FILE"
|
||||
echo " - '$line'" >> "$FAKE_FILTER_FILE"
|
||||
else
|
||||
continue
|
||||
fi
|
||||
|
||||
@ -27,7 +27,7 @@ restore_history() {
|
||||
NOW_NAME=$(echo $line |awk -F '#*#' '{print $3}')
|
||||
GROUP_STATE=$(GROUP_STATE "$GROUP_NAME")
|
||||
GROUP_STATE_NUM=0
|
||||
while ( [ ! -z "$(pidof clash)" ] && [ "$GROUP_STATE" != "200" ] && [ "$GROUP_STATE_NUM" -le 1 ] )
|
||||
while ( [ ! -z "$(pidof clash)" ] && [ "$GROUP_STATE" != "200" ] && [ "$GROUP_STATE_NUM" -le 3 ] )
|
||||
do
|
||||
sleep 3
|
||||
GROUP_STATE_NUM=$(expr "$GROUP_STATE_NUM" + 1)
|
||||
@ -41,7 +41,7 @@ close_all_conection() {
|
||||
}
|
||||
|
||||
if [ -s "$HISTORY_PATH" ]; then
|
||||
cat "$HISTORY_PATH" |while read line
|
||||
cat "$HISTORY_PATH" |while read -r line
|
||||
do
|
||||
GROUP_NAME=$(echo $line |awk -F '#*#' '{print $1}')
|
||||
if [ "$GROUP_NAME" != "GLOBAL" ]; then
|
||||
|
||||
@ -8,11 +8,7 @@
|
||||
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
LOG_FILE="/tmp/openclash.log"
|
||||
small_flash_memory=$(uci get openclash.config.small_flash_memory 2>/dev/null)
|
||||
HTTP_PORT=$(uci get openclash.config.http_port 2>/dev/null)
|
||||
PROXY_ADDR=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null)
|
||||
if [ -s "/tmp/openclash.auth" ]; then
|
||||
PROXY_AUTH=$(cat /tmp/openclash.auth |awk -F '- ' '{print $2}' |sed -n '1p' 2>/dev/null)
|
||||
fi
|
||||
|
||||
if [ "$small_flash_memory" != "1" ]; then
|
||||
geoip_path="/etc/openclash/Country.mmdb"
|
||||
mkdir -p /etc/openclash
|
||||
@ -22,7 +18,7 @@
|
||||
fi
|
||||
echo "开始下载 GEOIP 数据库..." >$START_LOG
|
||||
if pidof clash >/dev/null; then
|
||||
curl -sL --connect-timeout 10 --retry 2 -x http://$PROXY_ADDR:$HTTP_PORT -U "$PROXY_AUTH" https://raw.githubusercontent.com/alecthw/mmdb_china_ip_list/release/Country.mmdb -o /tmp/Country.mmdb >/dev/null 2>&1
|
||||
curl -sL --connect-timeout 10 --retry 2 https://raw.githubusercontent.com/alecthw/mmdb_china_ip_list/release/Country.mmdb -o /tmp/Country.mmdb >/dev/null 2>&1
|
||||
else
|
||||
curl -sL --connect-timeout 10 --retry 2 http://www.ideame.top/mmdb/Country.mmdb -o /tmp/Country.mmdb >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
@ -10,26 +10,21 @@
|
||||
LOG_FILE="/tmp/openclash.log"
|
||||
echo "开始获取使用中的第三方规则名称..." >$START_LOG
|
||||
RUlE_SOURCE=$(uci get openclash.config.rule_source 2>/dev/null)
|
||||
HTTP_PORT=$(uci get openclash.config.http_port 2>/dev/null)
|
||||
PROXY_ADDR=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null)
|
||||
OTHER_RULE_PROVIDER_FILE="/tmp/other_rule_provider.yaml"
|
||||
OTHER_SCRIPT_FILE="/tmp/other_rule_script.yaml"
|
||||
OTHER_RULE_FILE="/tmp/other_rule.yaml"
|
||||
|
||||
if [ -s "/tmp/openclash.auth" ]; then
|
||||
PROXY_AUTH=$(cat /tmp/openclash.auth |awk -F '- ' '{print $2}' |sed -n '1p' 2>/dev/null)
|
||||
fi
|
||||
echo "开始下载使用中的第三方规则..." >$START_LOG
|
||||
if [ "$RUlE_SOURCE" = "lhie1" ]; then
|
||||
if pidof clash >/dev/null; then
|
||||
curl -sL --connect-timeout 10 --retry 2 -x http://$PROXY_ADDR:$HTTP_PORT -U "$PROXY_AUTH" https://raw.githubusercontent.com/lhie1/Rules/master/Clash/Rule.yaml -o /tmp/rules.yaml >/dev/null 2>&1
|
||||
curl -sL --connect-timeout 10 --retry 2 https://raw.githubusercontent.com/lhie1/Rules/master/Clash/Rule.yaml -o /tmp/rules.yaml >/dev/null 2>&1
|
||||
else
|
||||
curl -sL --connect-timeout 10 --retry 2 https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Rule.yaml -o /tmp/rules.yaml >/dev/null 2>&1
|
||||
fi
|
||||
sed -i '1i rules:' /tmp/rules.yaml
|
||||
elif [ "$RUlE_SOURCE" = "ConnersHua" ]; then
|
||||
if pidof clash >/dev/null; then
|
||||
curl -sL --connect-timeout 10 --retry 2 -x http://$PROXY_ADDR:$HTTP_PORT -U "$PROXY_AUTH" https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/Global.yaml -o /tmp/rules.yaml >/dev/null 2>&1
|
||||
curl -sL --connect-timeout 10 --retry 2 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/Global.yaml -o /tmp/rules.yaml >/dev/null 2>&1
|
||||
else
|
||||
curl -sL --connect-timeout 10 --retry 2 https://cdn.jsdelivr.net/gh/DivineEngine/Profiles@master/Clash/Global.yaml -o /tmp/rules.yaml >/dev/null 2>&1
|
||||
fi
|
||||
@ -38,7 +33,7 @@
|
||||
sed -i "s/- GEOIP,/#- GEOIP,/g" /tmp/rules.yaml 2>/dev/null
|
||||
elif [ "$RUlE_SOURCE" = "ConnersHua_return" ]; then
|
||||
if pidof clash >/dev/null; then
|
||||
curl -sL --connect-timeout 10 --retry 2 -x http://$PROXY_ADDR:$HTTP_PORT -U "$PROXY_AUTH" https://raw.githubusercontent.com/ConnersHua/Profiles/master/Clash/China.yaml -o /tmp/rules.yaml >/dev/null 2>&1
|
||||
curl -sL --connect-timeout 10 --retry 2 https://raw.githubusercontent.com/ConnersHua/Profiles/master/Clash/China.yaml -o /tmp/rules.yaml >/dev/null 2>&1
|
||||
else
|
||||
curl -sL --connect-timeout 10 --retry 2 https://cdn.jsdelivr.net/gh/DivineEngine/Profiles@master/Clash/China.yaml -o /tmp/rules.yaml >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
@ -22,16 +22,11 @@ LAST_OPVER="/tmp/openclash_last_version"
|
||||
LAST_VER=$(sed -n 1p "$LAST_OPVER" 2>/dev/null |sed "s/^v//g")
|
||||
OP_CV=$(sed -n 1p /usr/share/openclash/res/openclash_version 2>/dev/null |awk -F '-' '{print $1}' |awk -F 'v' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
|
||||
OP_LV=$(sed -n 1p $LAST_OPVER 2>/dev/null |awk -F '-' '{print $1}' |awk -F 'v' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
|
||||
HTTP_PORT=$(uci get openclash.config.http_port 2>/dev/null)
|
||||
PROXY_ADDR=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null)
|
||||
if [ -s "/tmp/openclash.auth" ]; then
|
||||
PROXY_AUTH=$(cat /tmp/openclash.auth |awk -F '- ' '{print $2}' |sed -n '1p' 2>/dev/null)
|
||||
fi
|
||||
|
||||
if [ "$(expr "$OP_LV" \> "$OP_CV")" -eq 1 ] && [ -f "$LAST_OPVER" ]; then
|
||||
echo "开始下载 OpenClash-$LAST_VER ..." >$START_LOG
|
||||
if pidof clash >/dev/null; then
|
||||
curl -sL -m 30 --retry 5 -x http://$PROXY_ADDR:$HTTP_PORT -U "$PROXY_AUTH" https://github.com/vernesong/OpenClash/releases/download/v"$LAST_VER"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk >/dev/null 2>&1
|
||||
curl -sL -m 30 --retry 5 https://github.com/vernesong/OpenClash/releases/download/v"$LAST_VER"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk >/dev/null 2>&1
|
||||
else
|
||||
curl -sL -m 30 --retry 5 https://cdn.jsdelivr.net/gh/vernesong/OpenClash@master/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
@ -3,17 +3,10 @@ CKTIME=$(date "+%Y-%m-%d-%H")
|
||||
LAST_OPVER="/tmp/openclash_last_version"
|
||||
OP_CV=$(sed -n 1p /usr/share/openclash/res/openclash_version 2>/dev/null |awk -F '-' '{print $1}' |awk -F 'v' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
|
||||
OP_LV=$(sed -n 1p $LAST_OPVER 2>/dev/null |awk -F '-' '{print $1}' |awk -F 'v' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
|
||||
HTTP_PORT=$(uci get openclash.config.http_port 2>/dev/null)
|
||||
PROXY_ADDR=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null)
|
||||
|
||||
if [ -s "/tmp/openclash.auth" ]; then
|
||||
PROXY_AUTH=$(cat /tmp/openclash.auth |awk -F '- ' '{print $2}' |sed -n '1p' 2>/dev/null)
|
||||
fi
|
||||
|
||||
VERSION_URL="https://raw.githubusercontent.com/vernesong/OpenClash/master/version"
|
||||
if [ "$CKTIME" != "$(grep "CheckTime" $LAST_OPVER 2>/dev/null |awk -F ':' '{print $2}')" ]; then
|
||||
if pidof clash >/dev/null; then
|
||||
curl -sL --connect-timeout 10 --retry 2 -x http://$PROXY_ADDR:$HTTP_PORT -U "$PROXY_AUTH" "$VERSION_URL" -o $LAST_OPVER >/dev/null 2>&1
|
||||
curl -sL --connect-timeout 10 --retry 2 https://raw.githubusercontent.com/vernesong/OpenClash/master/version -o $LAST_OPVER >/dev/null 2>&1
|
||||
else
|
||||
curl -sL --connect-timeout 10 --retry 2 https://cdn.jsdelivr.net/gh/vernesong/OpenClash@master/version -o $LAST_OPVER >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
@ -43,7 +43,8 @@ if [ "$enable" -eq 1 ]; then
|
||||
if [ "$CRASH_NUM" -le 3 ]; then
|
||||
CONFIG_FILE=$(uci get openclash.config.config_path 2>/dev/null)
|
||||
echo "${LOGTIME} Watchdog: Clash Core Problem, Restart." >> $LOG_FILE
|
||||
nohup "$CLASH" -d "$CLASH_CONFIG" -f "$CONFIG_FILE" >> $LOG_FILE 2>&1 &
|
||||
capabilties="cap_sys_resource,cap_dac_override,cap_net_raw,cap_net_bind_service,cap_net_admin"
|
||||
capsh --caps="${capabilties}+eip" -- -c "capsh --user=nobody --addamb='${capabilties}' -- -c 'nohup $CLASH -d $CLASH_CONFIG -f \"$CONFIG_FILE\" >> $LOG_FILE 2>&1 &'" >> $LOG_FILE 2>&1
|
||||
sleep 3
|
||||
if [ "$core_type" = "Tun" ]; then
|
||||
ip route replace default dev utun table "$PROXY_ROUTE_TABLE" 2>/dev/null
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -136,6 +136,20 @@
|
||||
sed -i '/bind-address:/d' "$7" 2>/dev/null
|
||||
sed -i "/^allow-lan:/a\bind-address: \"${bind_address}\"" "$7"
|
||||
|
||||
if [ -n "$(grep "^ \{0,\}listen:" "$7")" ]; then
|
||||
if [ "$8" != "1" ]; then
|
||||
sed -i "/^ \{0,\}listen:/c\ listen: 127.0.0.1:${17}" "$7" 2>/dev/null
|
||||
else
|
||||
sed -i "/^ \{0,\}listen:/c\ listen: 0.0.0.0:${17}" "$7" 2>/dev/null
|
||||
fi
|
||||
else
|
||||
if [ "$8" != "1" ]; then
|
||||
sed -i "/^dns:/a\ listen: 127.0.0.1:${17}" "$7" 2>/dev/null
|
||||
else
|
||||
sed -i "/^dns:/a\ listen: 0.0.0.0:${17}" "$7" 2>/dev/null
|
||||
fi
|
||||
fi 2>/dev/null
|
||||
|
||||
if [ -z "$(grep '^external-ui: "/usr/share/openclash/dashboard"' "$7")" ]; then
|
||||
if [ ! -z "$(grep "^ \{0,\}external-ui:" "$7")" ]; then
|
||||
sed -i '/^ \{0,\}external-ui:/c\external-ui: "/usr/share/openclash/dashboard"' "$7"
|
||||
@ -165,9 +179,9 @@
|
||||
fi
|
||||
sed -i "/^dns:/i\ dns-hijack:" "$7"
|
||||
# sed -i "/^dns:/i\ - 8.8.8.8:53" "$7"
|
||||
sed -i "/^dns:/i\ - tcp://8.8.8.8:53" "$7"
|
||||
sed -i "/^dns:/i\ - tcp://8.8.8.8:53" "$7"
|
||||
# sed -i "/^dns:/i\ - 8.8.4.4:53" "$7"
|
||||
sed -i "/^dns:/i\ - tcp://8.8.4.4:53" "$7"
|
||||
sed -i "/^dns:/i\ - tcp://8.8.4.4:53" "$7"
|
||||
elif [ "$15" -eq 2 ]; then
|
||||
sed -i "/^dns:/i\tun:" "$7"
|
||||
sed -i "/^dns:/i\ enable: true" "$7"
|
||||
@ -198,9 +212,9 @@
|
||||
sed -i "/^hosts:/,/^dns:/ {s/^ \{0,\}'/ '/}" "$7" 2>/dev/null #修改参数空格
|
||||
fi
|
||||
|
||||
sed -i "s/^ \{0,\}- / - /" "$7" 2>/dev/null
|
||||
if [ ! -z "$(grep "^ \{0,\}default-nameserver:" "$7")" ]; then
|
||||
sed -i "/^ \{0,\}default-nameserver:/c\ default-nameserver:" "$7"
|
||||
sed -i "/^ \{0,\}default-nameserver:/,/,$/ {s/^ \{0,\}- / - /g}" "$7" 2>/dev/null #修改参数空格
|
||||
fi
|
||||
|
||||
#fake-ip-filter
|
||||
@ -217,6 +231,7 @@
|
||||
if [ ! -z "$(grep "^ \{0,\}fake-ip-filter:" "$7")" ]; then
|
||||
sed -i "/^ \{0,\}fake-ip-filter:/c\ fake-ip-filter:" "$7"
|
||||
sed -i '/^ \{0,\}fake-ip-filter:/r/etc/openclash/fake_filter.list' "$7" 2>/dev/null
|
||||
sed -i "/^ \{0,\}fake-ip-filter:/,/,$/ {s/^ \{0,\}- / - /g}" "$7" 2>/dev/null #修改参数空格
|
||||
else
|
||||
echo " fake-ip-filter:" >> "$7"
|
||||
sed -i '/^ \{0,\}fake-ip-filter:/r/etc/openclash/fake_filter.list' "$7" 2>/dev/null
|
||||
|
||||
@ -12,13 +12,24 @@ field_cut()
|
||||
rule_provider_len=$(sed -n '/^rule-providers:/=' "$3" 2>/dev/null)
|
||||
script_len=$(sed -n '/^script:/=' "$3" 2>/dev/null)
|
||||
nameserver_len=$(sed -n '/^ \{0,\}nameserver:/=' "$3" 2>/dev/null)
|
||||
lines="$general_len $nameserver_len $proxy_len $provider_len $group_len $rule_len $rule_provider_len $script_len"
|
||||
if [ -z "$nameserver_len" ]; then
|
||||
fallback_len=$(sed -n '/^ \{0,\}fallback:/=' "$3" 2>/dev/null)
|
||||
lines="$general_len $fallback_len $proxy_len $provider_len $group_len $rule_len $rule_provider_len $script_len"
|
||||
else
|
||||
lines="$general_len $nameserver_len $proxy_len $provider_len $group_len $rule_len $rule_provider_len $script_len"
|
||||
fi
|
||||
else
|
||||
fallback_filter_len=$(sed -n '/^ \{0,\}fallback-filter:/=' "$3" 2>/dev/null)
|
||||
cfw_bypass_len=$(sed -n '/^ \{0,\}cfw-bypass:/=' "$3" 2>/dev/null)
|
||||
cfw_latency_timeout_len=$(sed -n '/^ \{0,\}cfw-latency-timeout:/=' "$3" 2>/dev/null)
|
||||
nameserver_len=$(sed -n '/^ \{0,\}nameserver:/=' "$3" 2>/dev/null)
|
||||
lines="$nameserver_len $fallback_filter_len $cfw_bypass_len $cfw_latency_timeout_len"
|
||||
if [ -z "$nameserver_len" ]; then
|
||||
fallback_len=$(sed -n '/^ \{0,\}fallback:/=' "$3" 2>/dev/null)
|
||||
lines="$fallback_len $fallback_filter_len $cfw_bypass_len $cfw_latency_timeout_len"
|
||||
else
|
||||
lines="$nameserver_len $fallback_filter_len $cfw_bypass_len $cfw_latency_timeout_len"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
for i in $lines; do
|
||||
@ -103,6 +114,8 @@ fi
|
||||
fi
|
||||
sed -i '/^ \{0,\}tun:/,/^ \{0,\}enable:/d' "$2" 2>/dev/null
|
||||
sed -i '/^ \{0,\}dns-hijack:/d' "$2" 2>/dev/null
|
||||
sed -i '/^ \{0,\}macOS-auto-route:/d' "$2" 2>/dev/null
|
||||
sed -i '/^ \{0,\}macOS-auto-detect-interface:/d' "$2" 2>/dev/null
|
||||
sed -i '/^ \{0,\}stack:/d' "$2" 2>/dev/null
|
||||
sed -i '/^ \{0,\}device-url:/d' "$2" 2>/dev/null
|
||||
sed -i '/^ \{0,\}dns-listen:/d' "$2" 2>/dev/null
|
||||
@ -38,7 +38,7 @@ set_groups()
|
||||
|
||||
if [ "$1" = "$3" ]; then
|
||||
set_group=1
|
||||
echo " - \"${2}\"" >>$GROUP_FILE
|
||||
echo " - \"${2}\"" >>$GROUP_FILE
|
||||
fi
|
||||
|
||||
}
|
||||
@ -56,7 +56,7 @@ set_relay_groups()
|
||||
|
||||
if [ ! -z "$server_relay_num" ] && [ "$server_group_name" = "$3" ]; then
|
||||
set_group=1
|
||||
echo "$server_relay_num # - \"${2}\"" >>/tmp/relay_server
|
||||
echo "$server_relay_num # - \"${2}\"" >>/tmp/relay_server
|
||||
fi
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ set_other_groups()
|
||||
return
|
||||
fi
|
||||
set_group=1
|
||||
echo " - ${1}" >>$GROUP_FILE
|
||||
echo " - ${1}" >>$GROUP_FILE
|
||||
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ set_provider_groups()
|
||||
|
||||
if [ "$1" = "$3" ]; then
|
||||
set_proxy_provider=1
|
||||
echo " - ${2}" >>$GROUP_FILE
|
||||
echo " - ${2}" >>$GROUP_FILE
|
||||
fi
|
||||
|
||||
}
|
||||
@ -181,10 +181,10 @@ yml_groups_set()
|
||||
|
||||
echo "正在写入【$type】-【$name】策略组到配置文件【$CONFIG_NAME】..." >$START_LOG
|
||||
|
||||
echo "- name: $name" >>$GROUP_FILE
|
||||
echo " type: $type" >>$GROUP_FILE
|
||||
echo " - name: $name" >>$GROUP_FILE
|
||||
echo " type: $type" >>$GROUP_FILE
|
||||
group_name="$name"
|
||||
echo " proxies: $group_name" >>$GROUP_FILE
|
||||
echo " proxies: $group_name" >>$GROUP_FILE
|
||||
|
||||
#名字变化时处理规则部分
|
||||
if [ "$name" != "$old_name" ] && [ ! -z "$old_name" ]; then
|
||||
@ -211,30 +211,30 @@ yml_groups_set()
|
||||
rm -rf /tmp/relay_server 2>/dev/null
|
||||
fi
|
||||
|
||||
echo " use: $group_name" >>$GROUP_FILE
|
||||
echo " use: $group_name" >>$GROUP_FILE
|
||||
|
||||
config_foreach set_proxy_provider "proxy-provider" "$group_name" #加入代理集
|
||||
|
||||
if [ "$set_group" -eq 1 ]; then
|
||||
sed -i "/^ \{0,\}proxies: ${group_name}/c\ proxies:" $GROUP_FILE
|
||||
sed -i "/^ \{0,\}proxies: ${group_name}/c\ proxies:" $GROUP_FILE
|
||||
else
|
||||
sed -i "/proxies: ${group_name}/d" $GROUP_FILE 2>/dev/null
|
||||
fi
|
||||
|
||||
if [ "$set_proxy_provider" -eq 1 ]; then
|
||||
sed -i "/^ \{0,\}use: ${group_name}/c\ use:" $GROUP_FILE
|
||||
sed -i "/^ \{0,\}use: ${group_name}/c\ use:" $GROUP_FILE
|
||||
else
|
||||
sed -i "/use: ${group_name}/d" $GROUP_FILE 2>/dev/null
|
||||
fi
|
||||
|
||||
[ ! -z "$test_url" ] && {
|
||||
echo " url: $test_url" >>$GROUP_FILE
|
||||
echo " url: $test_url" >>$GROUP_FILE
|
||||
}
|
||||
[ ! -z "$test_interval" ] && {
|
||||
echo " interval: \"$test_interval\"" >>$GROUP_FILE
|
||||
echo " interval: \"$test_interval\"" >>$GROUP_FILE
|
||||
}
|
||||
[ ! -z "$tolerance" ] && {
|
||||
echo " tolerance: \"$tolerance\"" >>$GROUP_FILE
|
||||
echo " tolerance: \"$tolerance\"" >>$GROUP_FILE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -559,6 +559,11 @@ do
|
||||
password="$(cfg_get "password:" "$single_server")"
|
||||
fi
|
||||
|
||||
if [ "$server_type" = "http" ]; then
|
||||
#sni:
|
||||
sni="$(cfg_get "sni:" "$single_server")"
|
||||
fi
|
||||
|
||||
if [ "$server_type" = "snell" ]; then
|
||||
#psk:
|
||||
psk="$(cfg_get "psk:" "$single_server")"
|
||||
@ -660,13 +665,17 @@ do
|
||||
else
|
||||
${uci_set}password="$password"
|
||||
fi
|
||||
|
||||
if [ "$server_type" = "http" ]; then
|
||||
${uci_set}sni="$sni"
|
||||
fi
|
||||
|
||||
if [ "$server_type" = "trojan" ]; then
|
||||
${uci_set}sni="$sni"
|
||||
${uci_del}alpn >/dev/null 2>&1
|
||||
for alpn in $alpns; do
|
||||
${uci_add}alpn="$alpn" >/dev/null 2>&1
|
||||
done
|
||||
${uci_set}sni="$sni"
|
||||
${uci_del}alpn >/dev/null 2>&1
|
||||
for alpn in $alpns; do
|
||||
${uci_add}alpn="$alpn" >/dev/null 2>&1
|
||||
done
|
||||
fi
|
||||
else
|
||||
#添加新节点
|
||||
@ -755,6 +764,10 @@ do
|
||||
else
|
||||
${uci_set}password="$password"
|
||||
fi
|
||||
|
||||
if [ "$server_type" = "http" ]; then
|
||||
${uci_set}sni="$sni"
|
||||
fi
|
||||
|
||||
if [ "$server_type" = "trojan" ]; then
|
||||
${uci_set}sni="$sni"
|
||||
|
||||
@ -120,7 +120,7 @@ set_alpn()
|
||||
return
|
||||
fi
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- $1
|
||||
- $1
|
||||
EOF
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ set_http_path()
|
||||
return
|
||||
fi
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- '$1'
|
||||
- '$1'
|
||||
EOF
|
||||
}
|
||||
|
||||
@ -259,54 +259,54 @@ yml_servers_set()
|
||||
#ss
|
||||
if [ "$type" = "ss" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: "$name"
|
||||
type: $type
|
||||
server: $server
|
||||
port: $port
|
||||
cipher: $cipher
|
||||
password: "$password"
|
||||
- name: "$name"
|
||||
type: $type
|
||||
server: $server
|
||||
port: $port
|
||||
cipher: $cipher
|
||||
password: "$password"
|
||||
EOF
|
||||
if [ ! -z "$udp" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
udp: $udp
|
||||
udp: $udp
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$obfss" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
$obfss
|
||||
plugin-opts:
|
||||
mode: $obfs
|
||||
$obfss
|
||||
plugin-opts:
|
||||
mode: $obfs
|
||||
EOF
|
||||
if [ ! -z "$host" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
host: $host
|
||||
host: $host
|
||||
EOF
|
||||
fi
|
||||
if [ "$obfss" = "plugin: v2ray-plugin" ]; then
|
||||
if [ ! -z "$tls" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
tls: $tls
|
||||
tls: $tls
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$skip_cert_verify" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
skip-cert-verify: $skip_cert_verify
|
||||
skip-cert-verify: $skip_cert_verify
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$path" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
$path
|
||||
$path
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$mux" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
mux: $mux
|
||||
mux: $mux
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$custom" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
headers:
|
||||
custom: $custom
|
||||
headers:
|
||||
custom: $custom
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
@ -316,28 +316,28 @@ EOF
|
||||
#ssr
|
||||
if [ "$type" = "ssr" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: "$name"
|
||||
type: $type
|
||||
server: $server
|
||||
port: $port
|
||||
cipher: $cipher_ssr
|
||||
password: "$password"
|
||||
obfs: "$obfs_ssr"
|
||||
protocol: "$protocol"
|
||||
- name: "$name"
|
||||
type: $type
|
||||
server: $server
|
||||
port: $port
|
||||
cipher: $cipher_ssr
|
||||
password: "$password"
|
||||
obfs: "$obfs_ssr"
|
||||
protocol: "$protocol"
|
||||
EOF
|
||||
if [ ! -z "$obfs_param" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
obfs-param: $obfs_param
|
||||
obfs-param: $obfs_param
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$protocol_param" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
protocol-param: $protocol_param
|
||||
protocol-param: $protocol_param
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$udp" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
udp: $udp
|
||||
udp: $udp
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
@ -345,62 +345,62 @@ fi
|
||||
#vmess
|
||||
if [ "$type" = "vmess" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: "$name"
|
||||
type: $type
|
||||
server: $server
|
||||
port: $port
|
||||
uuid: $uuid
|
||||
alterId: $alterId
|
||||
cipher: $securitys
|
||||
- name: "$name"
|
||||
type: $type
|
||||
server: $server
|
||||
port: $port
|
||||
uuid: $uuid
|
||||
alterId: $alterId
|
||||
cipher: $securitys
|
||||
EOF
|
||||
if [ ! -z "$udp" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
udp: $udp
|
||||
udp: $udp
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$skip_cert_verify" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
skip-cert-verify: $skip_cert_verify
|
||||
skip-cert-verify: $skip_cert_verify
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$tls" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
tls: $tls
|
||||
tls: $tls
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$servername" ] && [ "$tls" = "true" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
servername: $servername
|
||||
servername: $servername
|
||||
EOF
|
||||
fi
|
||||
if [ "$obfs_vmess" != "none" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
$obfs_vmess
|
||||
$obfs_vmess
|
||||
EOF
|
||||
if [ ! -z "$path" ] && [ "$obfs_vmess" = "network: ws" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
$path
|
||||
$path
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$custom" ] && [ "$obfs_vmess" = "network: ws" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
ws-headers:
|
||||
$custom
|
||||
ws-headers:
|
||||
$custom
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$http_path" ] && [ "$obfs_vmess" = "network: http" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
http-opts:
|
||||
method: "GET"
|
||||
path:
|
||||
http-opts:
|
||||
method: "GET"
|
||||
path:
|
||||
EOF
|
||||
config_list_foreach "$section" "http_path" set_http_path
|
||||
fi
|
||||
if [ "$keep_alive" = "true" ] && [ "$obfs_vmess" = "network: http" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
headers:
|
||||
Connection:
|
||||
- keep-alive
|
||||
headers:
|
||||
Connection:
|
||||
- keep-alive
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
@ -409,34 +409,34 @@ EOF
|
||||
#socks5
|
||||
if [ "$type" = "socks5" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: "$name"
|
||||
type: $type
|
||||
server: $server
|
||||
port: $port
|
||||
- name: "$name"
|
||||
type: $type
|
||||
server: $server
|
||||
port: $port
|
||||
EOF
|
||||
if [ ! -z "$auth_name" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
username: $auth_name
|
||||
username: $auth_name
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$auth_pass" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
password: $auth_pass
|
||||
password: $auth_pass
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$udp" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
udp: $udp
|
||||
udp: $udp
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$skip_cert_verify" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
skip-cert-verify: $skip_cert_verify
|
||||
skip-cert-verify: $skip_cert_verify
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$tls" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
tls: $tls
|
||||
tls: $tls
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
@ -444,29 +444,34 @@ EOF
|
||||
#http
|
||||
if [ "$type" = "http" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: "$name"
|
||||
type: $type
|
||||
server: $server
|
||||
port: $port
|
||||
- name: "$name"
|
||||
type: $type
|
||||
server: $server
|
||||
port: $port
|
||||
EOF
|
||||
if [ ! -z "$auth_name" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
username: $auth_name
|
||||
username: $auth_name
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$auth_pass" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
password: $auth_pass
|
||||
password: $auth_pass
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$skip_cert_verify" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
skip-cert-verify: $skip_cert_verify
|
||||
skip-cert-verify: $skip_cert_verify
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$tls" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
tls: $tls
|
||||
tls: $tls
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$sni" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
sni: $sni
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
@ -474,31 +479,31 @@ EOF
|
||||
#trojan
|
||||
if [ "$type" = "trojan" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: "$name"
|
||||
type: $type
|
||||
server: $server
|
||||
port: $port
|
||||
password: "$password"
|
||||
- name: "$name"
|
||||
type: $type
|
||||
server: $server
|
||||
port: $port
|
||||
password: "$password"
|
||||
EOF
|
||||
if [ ! -z "$udp" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
udp: $udp
|
||||
udp: $udp
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$sni" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
sni: $sni
|
||||
sni: $sni
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$alpn" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
alpn:
|
||||
alpn:
|
||||
EOF
|
||||
config_list_foreach "$section" "alpn" set_alpn
|
||||
fi
|
||||
if [ ! -z "$skip_cert_verify" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
skip-cert-verify: $skip_cert_verify
|
||||
skip-cert-verify: $skip_cert_verify
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
@ -506,17 +511,17 @@ EOF
|
||||
#snell
|
||||
if [ "$type" = "snell" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: "$name"
|
||||
type: $type
|
||||
server: $server
|
||||
port: $port
|
||||
psk: $psk
|
||||
- name: "$name"
|
||||
type: $type
|
||||
server: $server
|
||||
port: $port
|
||||
psk: $psk
|
||||
EOF
|
||||
if [ "$obfs_snell" != "none" ] && [ ! -z "$host" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
obfs-opts:
|
||||
mode: $obfs_snell
|
||||
host: $host
|
||||
obfs-opts:
|
||||
mode: $obfs_snell
|
||||
host: $host
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
@ -573,7 +578,7 @@ echo "开始写入配置文件【$CONFIG_NAME】的代理集信息..." >$START_L
|
||||
echo "proxy-providers:" >$PROXY_PROVIDER_FILE
|
||||
rm -rf /tmp/Proxy_Provider
|
||||
config_foreach yml_proxy_provider_set "proxy-provider"
|
||||
sed -i "s/^ \{0,\}/ - /" /tmp/Proxy_Provider 2>/dev/null #添加参数
|
||||
sed -i "s/^ \{0,\}/ - /" /tmp/Proxy_Provider 2>/dev/null #添加参数
|
||||
if [ "$(grep "-" /tmp/Proxy_Provider 2>/dev/null |wc -l)" -eq 0 ]; then
|
||||
rm -rf $PROXY_PROVIDER_FILE
|
||||
rm -rf /tmp/Proxy_Provider
|
||||
@ -588,7 +593,7 @@ echo "Proxy:" >$SERVER_FILE
|
||||
config_foreach yml_servers_set "servers"
|
||||
egrep '^ {0,}-' $SERVER_FILE |grep name: |awk -F 'name: ' '{print $2}' |sed 's/,.*//' 2>/dev/null >/tmp/Proxy_Server 2>&1
|
||||
if [ -s "/tmp/Proxy_Server" ]; then
|
||||
sed -i "s/^ \{0,\}/ - /" /tmp/Proxy_Server 2>/dev/null #添加参数
|
||||
sed -i "s/^ \{0,\}/ - /" /tmp/Proxy_Server 2>/dev/null #添加参数
|
||||
else
|
||||
rm -rf $SERVER_FILE
|
||||
rm -rf /tmp/Proxy_Server
|
||||
@ -600,74 +605,74 @@ if [ "$rule_sources" = "ConnersHua" ] && [ "$servers_if_update" != "1" ] && [ -z
|
||||
echo "使用ConnersHua(规则集)规则创建中..." >$START_LOG
|
||||
echo "proxy-groups:" >>$SERVER_FILE
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: Auto - UrlTest
|
||||
type: url-test
|
||||
- name: Auto - UrlTest
|
||||
type: url-test
|
||||
EOF
|
||||
if [ -f "/tmp/Proxy_Server" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
proxies:
|
||||
proxies:
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
if [ -f "/tmp/Proxy_Provider" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
use:
|
||||
use:
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
url: https://cp.cloudflare.com/generate_204
|
||||
interval: "600"
|
||||
tolerance: "150"
|
||||
- name: Proxy
|
||||
type: select
|
||||
proxies:
|
||||
- Auto - UrlTest
|
||||
- DIRECT
|
||||
url: https://cp.cloudflare.com/generate_204
|
||||
interval: "600"
|
||||
tolerance: "150"
|
||||
- name: Proxy
|
||||
type: select
|
||||
proxies:
|
||||
- Auto - UrlTest
|
||||
- DIRECT
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
if [ -f "/tmp/Proxy_Provider" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
use:
|
||||
use:
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: Domestic
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
- name: Others
|
||||
type: select
|
||||
proxies:
|
||||
- Proxy
|
||||
- DIRECT
|
||||
- Domestic
|
||||
- name: AsianTV
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
- name: Domestic
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
- name: Others
|
||||
type: select
|
||||
proxies:
|
||||
- Proxy
|
||||
- DIRECT
|
||||
- Domestic
|
||||
- name: AsianTV
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
if [ -f "/tmp/Proxy_Provider" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
use:
|
||||
use:
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: GlobalTV
|
||||
type: select
|
||||
proxies:
|
||||
- Proxy
|
||||
- DIRECT
|
||||
- name: GlobalTV
|
||||
type: select
|
||||
proxies:
|
||||
- Proxy
|
||||
- DIRECT
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
if [ -f "/tmp/Proxy_Provider" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
use:
|
||||
use:
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
@ -689,188 +694,188 @@ elif [ "$rule_sources" = "lhie1" ] && [ "$servers_if_update" != "1" ] && [ -z "$
|
||||
echo "使用lhie1规则创建中..." >$START_LOG
|
||||
echo "proxy-groups:" >>$SERVER_FILE
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: Auto - UrlTest
|
||||
type: url-test
|
||||
- name: Auto - UrlTest
|
||||
type: url-test
|
||||
EOF
|
||||
if [ -f "/tmp/Proxy_Server" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
proxies:
|
||||
proxies:
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
if [ -f "/tmp/Proxy_Provider" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
use:
|
||||
use:
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
url: https://cp.cloudflare.com/generate_204
|
||||
interval: "600"
|
||||
tolerance: "150"
|
||||
- name: Proxy
|
||||
type: select
|
||||
proxies:
|
||||
- Auto - UrlTest
|
||||
- DIRECT
|
||||
url: https://cp.cloudflare.com/generate_204
|
||||
interval: "600"
|
||||
tolerance: "150"
|
||||
- name: Proxy
|
||||
type: select
|
||||
proxies:
|
||||
- Auto - UrlTest
|
||||
- DIRECT
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
if [ -f "/tmp/Proxy_Provider" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
use:
|
||||
use:
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: Domestic
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
- name: Others
|
||||
type: select
|
||||
proxies:
|
||||
- Proxy
|
||||
- DIRECT
|
||||
- Domestic
|
||||
- name: Apple
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
- name: Microsoft
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
- name: Netflix
|
||||
type: select
|
||||
proxies:
|
||||
- GlobalTV
|
||||
- DIRECT
|
||||
- name: Domestic
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
- name: Others
|
||||
type: select
|
||||
proxies:
|
||||
- Proxy
|
||||
- DIRECT
|
||||
- Domestic
|
||||
- name: Apple
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
- name: Microsoft
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
- name: Netflix
|
||||
type: select
|
||||
proxies:
|
||||
- GlobalTV
|
||||
- DIRECT
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
if [ -f "/tmp/Proxy_Provider" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
use:
|
||||
use:
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: Youtube
|
||||
type: select
|
||||
proxies:
|
||||
- GlobalTV
|
||||
- DIRECT
|
||||
- name: Youtube
|
||||
type: select
|
||||
proxies:
|
||||
- GlobalTV
|
||||
- DIRECT
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
if [ -f "/tmp/Proxy_Provider" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
use:
|
||||
use:
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: Spotify
|
||||
type: select
|
||||
proxies:
|
||||
- GlobalTV
|
||||
- DIRECT
|
||||
- name: Spotify
|
||||
type: select
|
||||
proxies:
|
||||
- GlobalTV
|
||||
- DIRECT
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
if [ -f "/tmp/Proxy_Provider" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
use:
|
||||
use:
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: Steam
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
- name: Steam
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
if [ -f "/tmp/Proxy_Provider" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
use:
|
||||
use:
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: AdBlock
|
||||
type: select
|
||||
proxies:
|
||||
- REJECT
|
||||
- DIRECT
|
||||
- Proxy
|
||||
- name: AsianTV
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
- name: AdBlock
|
||||
type: select
|
||||
proxies:
|
||||
- REJECT
|
||||
- DIRECT
|
||||
- Proxy
|
||||
- name: AsianTV
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
if [ -f "/tmp/Proxy_Provider" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
use:
|
||||
use:
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: GlobalTV
|
||||
type: select
|
||||
proxies:
|
||||
- Proxy
|
||||
- DIRECT
|
||||
- name: GlobalTV
|
||||
type: select
|
||||
proxies:
|
||||
- Proxy
|
||||
- DIRECT
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
if [ -f "/tmp/Proxy_Provider" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
use:
|
||||
use:
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: Speedtest
|
||||
type: select
|
||||
proxies:
|
||||
- Proxy
|
||||
- DIRECT
|
||||
- name: Speedtest
|
||||
type: select
|
||||
proxies:
|
||||
- Proxy
|
||||
- DIRECT
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
if [ -f "/tmp/Proxy_Provider" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
use:
|
||||
use:
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: Telegram
|
||||
type: select
|
||||
proxies:
|
||||
- Proxy
|
||||
- DIRECT
|
||||
- name: Telegram
|
||||
type: select
|
||||
proxies:
|
||||
- Proxy
|
||||
- DIRECT
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
if [ -f "/tmp/Proxy_Provider" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
use:
|
||||
use:
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: PayPal
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
- name: PayPal
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
if [ -f "/tmp/Proxy_Provider" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
use:
|
||||
use:
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
@ -908,44 +913,44 @@ elif [ "$rule_sources" = "ConnersHua_return" ] && [ "$servers_if_update" != "1"
|
||||
echo "使用ConnersHua回国规则创建中..." >$START_LOG
|
||||
echo "proxy-groups:" >>$SERVER_FILE
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: Auto - UrlTest
|
||||
type: url-test
|
||||
- name: Auto - UrlTest
|
||||
type: url-test
|
||||
EOF
|
||||
if [ -f "/tmp/Proxy_Server" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
proxies:
|
||||
proxies:
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
if [ -f "/tmp/Proxy_Provider" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
use:
|
||||
use:
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
url: https://cp.cloudflare.com/generate_204
|
||||
interval: "600"
|
||||
tolerance: "150"
|
||||
- name: Proxy
|
||||
type: select
|
||||
proxies:
|
||||
- Auto - UrlTest
|
||||
- DIRECT
|
||||
url: https://cp.cloudflare.com/generate_204
|
||||
interval: "600"
|
||||
tolerance: "150"
|
||||
- name: Proxy
|
||||
type: select
|
||||
proxies:
|
||||
- Auto - UrlTest
|
||||
- DIRECT
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
if [ -f "/tmp/Proxy_Provider" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
use:
|
||||
use:
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: Others
|
||||
type: select
|
||||
proxies:
|
||||
- Proxy
|
||||
- DIRECT
|
||||
- name: Others
|
||||
type: select
|
||||
proxies:
|
||||
- Proxy
|
||||
- DIRECT
|
||||
EOF
|
||||
${UCI_SET}rule_source="ConnersHua_return"
|
||||
${UCI_SET}Proxy="Proxy"
|
||||
|
||||
@ -29,17 +29,6 @@ yml_other_set()
|
||||
sed -i '/- DOMAIN-KEYWORD,find_node,DIRECT/d' "$4" 2>/dev/null
|
||||
sed -i '/- DOMAIN-KEYWORD,BitTorrent,DIRECT/d' "$4" 2>/dev/null
|
||||
sed -i '/- DOMAIN-KEYWORD,announce_peer,DIRECT/d' "$4" 2>/dev/null
|
||||
|
||||
if [ -z "$(grep '^ \{0,\}- IP-CIDR,198.18.0.1/16,REJECT,no-resolve' "$4")" ] && [ "$6" = "fake-ip" ]; then
|
||||
if [ ! -z "$(grep "^ \{0,\}- IP-CIDR,198.18.0.1/16" "$4")" ]; then
|
||||
sed -i "/^ \{0,\}- IP-CIDR,198.18.0.1\/16/c\- IP-CIDR,198.18.0.1\/16,REJECT,no-resolve" "$4" 2>/dev/null
|
||||
else
|
||||
sed -i '1,/^ \{0,\}- GEOIP/{/^ \{0,\}- GEOIP/s/^ \{0,\}- GEOIP/- IP-CIDR,198.18.0.1\/16,REJECT,no-resolve\n&/}' "$4" 2>/dev/null
|
||||
if [ -z "$(grep '^- IP-CIDR,198.18.0.1/16,REJECT,no-resolve' "$4")" ]; then
|
||||
sed -i '1,/^ \{0,\}- MATCH/{/^ \{0,\}- MATCH/s/^ \{0,\}- MATCH/- IP-CIDR,198.18.0.1\/16,REJECT,no-resolve\n&/}' "$4" 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$7" = 1 ]; then
|
||||
sed -i '1,/^ \{0,\}- GEOIP/{/^ \{0,\}- GEOIP/s/^ \{0,\}- GEOIP/- DOMAIN-KEYWORD,tracker,DIRECT\n&/}' "$4" 2>/dev/null
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
-- https://github.com/project-openwrt
|
||||
|
||||
mp = Map("unblockneteasemusic-mini", translate("解除网易云音乐播放限制 (Mini)"))
|
||||
mp.description = translate("原理:采用 [QQ/酷狗/酷我/咕咪] 等音源,替换网易云音乐 无版权/收费 歌曲链接<br/>由 [CTCGFW]Project-OpenWrt & hyird & Sunsky 提供服务器支持<br/>详细说明参见:https://github.com/project-openwrt/luci-app-unblockneteasemusic-mini")
|
||||
mp.description = translate("原理:采用 [QQ/酷狗/酷我/咪咕] 等音源,替换网易云音乐 无版权/收费 歌曲链接<br/>由 [CTCGFW]Project-OpenWrt & hyird & Sunsky 提供服务器支持<br/>详细说明参见:https://github.com/project-openwrt/luci-app-unblockneteasemusic-mini")
|
||||
|
||||
mp:section(SimpleSection).template = "unblockneteasemusic-mini/unblockneteasemusic_mini_status"
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
mp = Map("unblockneteasemusic", translate("解除网易云音乐播放限制"))
|
||||
mp.description = translate("原理:采用 [QQ/虾米/百度/酷狗/酷我/咕咪/JOOX] 等音源,替换网易云音乐 无版权/收费 歌曲链接<br/>具体使用方法参见:https://github.com/project-openwrt/luci-app-unblockneteasemusic")
|
||||
mp.description = translate("原理:采用 [QQ/虾米/百度/酷狗/酷我/咪咕/JOOX] 等音源,替换网易云音乐 无版权/收费 歌曲链接<br/>具体使用方法参见:https://github.com/project-openwrt/luci-app-unblockneteasemusic")
|
||||
|
||||
mp:section(SimpleSection).template = "unblockneteasemusic/unblockneteasemusic_status"
|
||||
|
||||
@ -17,7 +17,7 @@ music_source:value("default", translate("默认"))
|
||||
music_source:value("netease", translate("网易云音乐"))
|
||||
music_source:value("qq", translate("QQ音乐"))
|
||||
music_source:value("kuwo", translate("酷我音乐"))
|
||||
music_source:value("migu", translate("咕咪音乐"))
|
||||
music_source:value("migu", translate("咪咕音乐"))
|
||||
music_source:value("kugou", translate("酷狗音乐"))
|
||||
music_source:value("xiami", translate("虾米音乐"))
|
||||
music_source:value("baidu", translate("百度音乐"))
|
||||
|
||||
@ -7,12 +7,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=naiveproxy
|
||||
PKG_VERSION:=85.0.4183.83-4
|
||||
PKG_VERSION:=86.0.4240.75-1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/klzgrad/naiveproxy/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=68b3ec22aba04a671ddb14a1f55dc7425c73adf781cbe87a95097c782f269a07
|
||||
PKG_HASH:=91f946e137565115649bc5787788a6889d84e0a20e9878553a832b89c0cb161f
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=BSD 3-Clause
|
||||
|
||||
@ -8,8 +8,6 @@ Subject: [PATCH] Remove concurrency limit
|
||||
src/net/tools/naive/naive_proxy_bin.cc | 2 +-
|
||||
2 files changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/net/tools/naive/naive_proxy.cc b/src/net/tools/naive/naive_proxy.cc
|
||||
index b4d5feee6..a38f79124 100644
|
||||
--- a/src/net/tools/naive/naive_proxy.cc
|
||||
+++ b/src/net/tools/naive/naive_proxy.cc
|
||||
@@ -5,7 +5,6 @@
|
||||
@ -20,7 +18,7 @@ index b4d5feee6..a38f79124 100644
|
||||
#include <utility>
|
||||
|
||||
#include "base/bind.h"
|
||||
@@ -35,7 +34,7 @@ NaiveProxy::NaiveProxy(std::unique_ptr<ServerSocket> listen_socket,
|
||||
@@ -35,7 +34,7 @@ NaiveProxy::NaiveProxy(std::unique_ptr<S
|
||||
const NetworkTrafficAnnotationTag& traffic_annotation)
|
||||
: listen_socket_(std::move(listen_socket)),
|
||||
protocol_(protocol),
|
||||
@ -29,11 +27,9 @@ index b4d5feee6..a38f79124 100644
|
||||
resolver_(resolver),
|
||||
session_(session),
|
||||
net_log_(
|
||||
diff --git a/src/net/tools/naive/naive_proxy_bin.cc b/src/net/tools/naive/naive_proxy_bin.cc
|
||||
index 4ba08712d..00acd7756 100644
|
||||
--- a/src/net/tools/naive/naive_proxy_bin.cc
|
||||
+++ b/src/net/tools/naive/naive_proxy_bin.cc
|
||||
@@ -289,7 +289,7 @@ bool ParseCommandLine(const CommandLine& cmdline, Params* params) {
|
||||
@@ -289,7 +289,7 @@ bool ParseCommandLine(const CommandLine&
|
||||
|
||||
if (!cmdline.concurrency.empty()) {
|
||||
if (!base::StringToInt(cmdline.concurrency, ¶ms->concurrency) ||
|
||||
|
||||
@ -7,8 +7,6 @@ Subject: [PATCH] build: add OpenWrt staging libraries
|
||||
src/build/config/posix/BUILD.gn | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/build/config/posix/BUILD.gn b/src/build/config/posix/BUILD.gn
|
||||
index 9ccb89f27..de9e5501d 100644
|
||||
--- a/src/build/config/posix/BUILD.gn
|
||||
+++ b/src/build/config/posix/BUILD.gn
|
||||
@@ -28,6 +28,9 @@ config("runtime_library") {
|
||||
@ -18,7 +16,7 @@ index 9ccb89f27..de9e5501d 100644
|
||||
+ sysroot_flags += [ "-I" + getenv("OP_STAGING_DIR") + "/usr/include" ]
|
||||
+ sysroot_flags += [ "-I" + getenv("OP_STAGING_DIR") + "/usr/include/nss" ]
|
||||
+ sysroot_flags += [ "-I" + getenv("OP_STAGING_DIR") + "/usr/include/nspr" ]
|
||||
if (is_linux) {
|
||||
if (is_linux || is_chromeos) {
|
||||
# This is here so that all files get recompiled after a sysroot roll and
|
||||
# when turning the sysroot on or off. (defines are passed via the command
|
||||
@@ -57,6 +60,7 @@ config("runtime_library") {
|
||||
@ -29,5 +27,3 @@ index 9ccb89f27..de9e5501d 100644
|
||||
ld_paths = exec_script("sysroot_ld_path.py",
|
||||
[
|
||||
rebase_path("//build/linux/sysroot_ld_path.sh",
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@ -15,18 +15,13 @@ So, let's drop it in global build file.
|
||||
src/BUILD.gn | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/src/BUILD.gn b/src/BUILD.gn
|
||||
index 97494c0a0..daddf5213 100644
|
||||
--- a/src/BUILD.gn
|
||||
+++ b/src/BUILD.gn
|
||||
@@ -746,7 +746,6 @@ group("gn_all") {
|
||||
@@ -751,7 +751,6 @@ group("gn_all") {
|
||||
if (enable_nacl) {
|
||||
deps += [ "//native_client/src/trusted/platform_qualify:vcpuid" ]
|
||||
}
|
||||
- deps += [ "//third_party/libjpeg_turbo:simd_asm" ]
|
||||
}
|
||||
if (is_linux && current_toolchain == host_toolchain) {
|
||||
if ((is_linux || is_chromeos) && current_toolchain == host_toolchain) {
|
||||
deps += [ "//v8:v8_shell" ]
|
||||
--
|
||||
2.17.1
|
||||
|
||||
|
||||
@ -43,6 +43,8 @@ else ifeq ($(CONFIG_64BIT),y)
|
||||
DIR_ARCH:=linux64
|
||||
endif
|
||||
|
||||
TARGET_CFLAGS := $(filter-out -O%,$(TARGET_CFLAGS)) -O3 -flto
|
||||
|
||||
define Build/Compile
|
||||
$(SED) 's|EXE = .exe|EXE =|' $(PKG_BUILD_DIR)/$(DIR_ARCH)/core_portme.mak
|
||||
mkdir $(PKG_BUILD_DIR)/$(ARCH)
|
||||
|
||||
@ -10,7 +10,7 @@ LUCI_TITLE:=n2n_v2 VPN Configuration module
|
||||
LUCI_DEPENDS:=+n2n-edge +n2n-supernode
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=2.8.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
|
||||
@ -43,6 +43,7 @@ m = Map("n2n_v2", translate("N2N v2 VPN"), translatef(
|
||||
"n2n is a layer-two peer-to-peer virtual private network (VPN) which allows users to exploit features typical of P2P applications at network instead of application level."))
|
||||
|
||||
-- Basic config
|
||||
-- edge
|
||||
m:section(SimpleSection).template = "n2n_v2/status"
|
||||
|
||||
s = m:section(TypedSection, "edge", translate("N2N Edge Settings"))
|
||||
@ -89,14 +90,15 @@ s:option(Value, "key", translate("Encryption key"))
|
||||
route = s:option(Flag, "route", translate("Enable packet forwarding"))
|
||||
route.rmempty = false
|
||||
|
||||
s2 = m:section(TypedSection, "supernode", translate("N2N Supernode Settings"))
|
||||
s2.anonymous = true
|
||||
s2.addremove = true
|
||||
-- supernode
|
||||
s = m:section(TypedSection, "supernode", translate("N2N Supernode Settings"))
|
||||
s.anonymous = true
|
||||
s.addremove = true
|
||||
|
||||
switch = s2:option(Flag, "enabled", translate("Enable"))
|
||||
switch = s:option(Flag, "enabled", translate("Enable"))
|
||||
switch.rmempty = false
|
||||
|
||||
port = s2:option(Value, "port", translate("Port"))
|
||||
port = s:option(Value, "port", translate("Port"))
|
||||
port.datatype = "port"
|
||||
port.optional = false
|
||||
|
||||
@ -107,6 +109,10 @@ s.anonymous = true
|
||||
s.addremove = true
|
||||
s.template = "cbi/tblsection"
|
||||
|
||||
---- enable
|
||||
switch = s:option(Flag, "enabled", translate("Enable"))
|
||||
switch.rmempty = false
|
||||
|
||||
---- IP address
|
||||
o = s:option(Value, "ip", translate("IP"))
|
||||
o.optional = false
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
local fs = require "nixio.fs"
|
||||
|
||||
mp = Map("unblockmusic", translate("解锁网易云灰色歌曲"))
|
||||
mp.description = translate("采用 [QQ/虾米/百度/酷狗/酷我/咕咪/JOOX]等音源,替换网易云变灰歌曲链接")
|
||||
mp.description = translate("采用 [QQ/虾米/百度/酷狗/酷我/咪咕/JOOX]等音源,替换网易云变灰歌曲链接")
|
||||
|
||||
mp:section(SimpleSection).template = "unblockmusic/unblockmusic_status"
|
||||
|
||||
@ -31,7 +31,7 @@ speedtype:value("xiami", translate("虾米音乐"))
|
||||
speedtype:value("baidu", translate("百度音乐"))
|
||||
speedtype:value("kugou", translate("酷狗音乐"))
|
||||
speedtype:value("kuwo", translate("酷我音乐"))
|
||||
speedtype:value("migu", translate("咕咪音乐"))
|
||||
speedtype:value("migu", translate("咪咕音乐"))
|
||||
speedtype:value("joox", translate("JOOX音乐"))
|
||||
speedtype.default = "kuwo"
|
||||
speedtype:depends("apptype", "nodejs")
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
local http = luci.http
|
||||
|
||||
mp = Map("unblockneteasemusic", translate("解除网易云音乐播放限制 (Golang)"))
|
||||
mp.description = translate("原理:采用 [酷我/酷狗/咕咪] 音源(后续有空补充),替换网易云音乐 灰色 歌曲链接<br/>具体使用方法参见:https://github.com/cnsilvan/luci-app-unblockneteasemusic<br/>提示:客户端网易云音乐能用就别升级app,最新版本不一定能用")
|
||||
mp.description = translate("原理:采用 [酷我/酷狗/咪咕] 音源(后续有空补充),替换网易云音乐 灰色 歌曲链接<br/>具体使用方法参见:https://github.com/cnsilvan/luci-app-unblockneteasemusic<br/>提示:客户端网易云音乐能用就别升级app,最新版本不一定能用")
|
||||
mp:section(SimpleSection).template = "unblockneteasemusic/unblockneteasemusic_status"
|
||||
|
||||
s = mp:section(TypedSection, "unblockneteasemusic")
|
||||
|
||||
@ -8,7 +8,7 @@ local ipkg = require "luci.model.ipkg"
|
||||
|
||||
local appname = "v2ray_server"
|
||||
local v2ray_api =
|
||||
"https://api.github.com/repos/v2ray/v2ray-core/releases/latest"
|
||||
"https://api.github.com/repos/v2fly/v2ray-core/releases/latest"
|
||||
local wget = "/usr/bin/wget"
|
||||
local wget_args = {
|
||||
"--no-check-certificate", "--quiet", "--timeout=100", "--tries=3"
|
||||
|
||||
@ -8,7 +8,7 @@ PKG_NAME:=n2n
|
||||
PKG_SOURCE_URL:=https://github.com/ntop/n2n.git
|
||||
PKG_SOURCE_VERSION:=99e56e9f3c34c49eeb297971d41150b433489120
|
||||
PKG_VERSION:=2.8.0_git-$(PKG_SOURCE_VERSION)
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
@ -9,8 +9,14 @@ config edge
|
||||
option port '1234'
|
||||
option community 'example'
|
||||
option key 'password'
|
||||
option route '0'
|
||||
option route '1'
|
||||
|
||||
config supernode
|
||||
option enabled '0'
|
||||
option port '1235'
|
||||
|
||||
config route
|
||||
option enabled '0'
|
||||
option ip '192.168.2.0'
|
||||
option mask '24'
|
||||
option gw '10.0.0.200'
|
||||
|
||||
@ -22,11 +22,13 @@ start_instance() {
|
||||
config_get community "$cfg" 'community'
|
||||
config_get key "$cfg" 'key'
|
||||
config_get_bool route "$cfg" 'route' '0'
|
||||
address="$ipaddr/$prefix"
|
||||
address="$ipaddr"
|
||||
[ "$route" = "1" ] && args='-r'
|
||||
[ "$mode" = 'dhcp' ] && address='0.0.0.0'
|
||||
[ "-$mtu" != "-" ] && mtu="-M $mtu"
|
||||
/usr/bin/edge -u 0 -g 0 -d $tunname -a ${mode}:${address} -c $community $([ -n "$key" ] && echo -k $key) -l ${supernode}:${port} $args $mtu
|
||||
eval "$(ipcalc.sh "$ipaddr/$prefix")"
|
||||
netmask="$NETMASK"
|
||||
/usr/bin/edge -u 0 -g 0 -d $tunname -a ${mode}:${address} -s $netmask -c $community $([ -n "$key" ] && echo -k $key) -l ${supernode}:${port} $args $mtu
|
||||
;;
|
||||
supernode)
|
||||
config_get_bool enabled "$cfg" 'enabled' '0'
|
||||
@ -35,6 +37,8 @@ start_instance() {
|
||||
/usr/bin/supernode -l $port &
|
||||
;;
|
||||
route)
|
||||
config_get_bool enabled "$cfg" 'enabled' '0'
|
||||
[ "$enabled" = "0" ] && return 1
|
||||
config_get ip "$cfg" 'ip'
|
||||
config_get mask "$cfg" 'mask'
|
||||
config_get gw "$cfg" 'gw'
|
||||
@ -62,6 +66,7 @@ start() {
|
||||
config_load 'n2n_v2'
|
||||
config_foreach start_instance 'edge'
|
||||
config_foreach start_instance 'supernode'
|
||||
sleep 2
|
||||
config_foreach start_instance 'route'
|
||||
}
|
||||
|
||||
|
||||
@ -9,13 +9,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=v2ray
|
||||
PKG_VERSION:=4.31.0
|
||||
PKG_VERSION:=4.31.1
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/v2ray-core-$(PKG_VERSION)
|
||||
|
||||
PKG_SOURCE:=v2ray-core-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/v2fly/v2ray-core/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=4e475c700863320b92689cb36ef993133e9c799375bbfc4a2811da2283c3673f
|
||||
PKG_HASH:=5a406d482ce63bfcaa5e388c9e52497fd1b1b7100f26b632f3478a4af84e496d
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=selinux-policy
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://git.defensec.nl/selinux-policy.git
|
||||
PKG_SOURCE_DATE:=2020-10-08
|
||||
PKG_SOURCE_VERSION:=cdedea73ecbb8968f9736c35c143b586c8371467
|
||||
PKG_MIRROR_HASH:=3d5a6d60b496b51ae272f7cb495a409c724ee193792f78652a2040b57fab56fe
|
||||
PKG_VERSION:=0.3
|
||||
PKG_MIRROR_HASH:=8f224e4e0ecb459648563862e26fcd5d4d113de5daa277363fc4316da5a05360
|
||||
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
|
||||
PKG_BUILD_DEPENDS:=secilc/host policycoreutils/host
|
||||
|
||||
PKG_MAINTAINER:=Dominick Grift <dominick.grift@defensec.nl>
|
||||
|
||||
@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=policycoreutils
|
||||
PKG_VERSION:=3.1
|
||||
PKG_RELEASE:=4
|
||||
PKG_RELEASE:=5
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/20200710
|
||||
@ -25,10 +25,6 @@ include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/nls.mk
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
DIR_SBIN:= \
|
||||
restorecon \
|
||||
setfiles
|
||||
|
||||
DIR_USR_BIN:= \
|
||||
newrole \
|
||||
secon
|
||||
@ -43,7 +39,6 @@ LIBEXEC_UTILS := \
|
||||
|
||||
SBIN_UTILS:= \
|
||||
restorecon_xattr \
|
||||
restorecon \
|
||||
setfiles
|
||||
|
||||
USR_BIN_UTILS:= \
|
||||
@ -76,6 +71,7 @@ HOST_LDFLAGS += -Wl,-rpath=$(STAGING_DIR_HOSTPKG)/lib
|
||||
$(eval $(foreach a,$(DIR_SBIN),ALTS_$(a):=300:/sbin/$(a):/sbin/policycoreutils-$(a)$(newline)))
|
||||
$(eval $(foreach a,$(DIR_USR_BIN),ALTS_$(a):=300:/usr/bin/$(a):/usr/bin/policycoreutils-$(a)$(newline)))
|
||||
$(eval $(foreach a,$(DIR_USR_SBIN),ALTS_$(a):=300:/usr/sbin/$(a):/usr/sbin/policycoreutils-$(a)$(newline)))
|
||||
ALTS_setfiles:=300:/sbin/restorecon:/sbin/policycoreutils-setfiles 300:/sbin/setfiles:/sbin/policycoreutils-setfiles
|
||||
|
||||
DEPENDS_genhomedircon:=+libsemanage $(INTL_DEPENDS)
|
||||
DEPENDS_load_policy:=+libselinux $(INTL_DEPENDS)
|
||||
@ -83,7 +79,6 @@ DEPENDS_newrole:=+libselinux +libaudit +BUSYBOX_CONFIG_PAM:libpam $(INTL_DEPENDS
|
||||
DEPENDS_open_init_pty:=$(INTL_DEPENDS)
|
||||
DEPENDS_pp:=+libsepol $(INTL_DEPENDS)
|
||||
DEPENDS_restorecon_xattr:=+libselinux +libsepol +libaudit $(INTL_DEPENDS)
|
||||
DEPENDS_restorecon:=+libselinux +libsepol +libaudit $(INTL_DEPENDS)
|
||||
DEPENDS_run_init:=+libselinux +libaudit +BUSYBOX_CONFIG_PAM:libpam $(INTL_DEPENDS)
|
||||
DEPENDS_secon:=+libselinux $(INTL_DEPENDS)
|
||||
DEPENDS_semanage:=+libsemanage
|
||||
|
||||
@ -14,7 +14,7 @@ Signed-off-by: Eric Anholt <eric@anholt.net>
|
||||
|
||||
--- a/mm/page_alloc.c
|
||||
+++ b/mm/page_alloc.c
|
||||
@@ -8008,8 +8008,6 @@ int alloc_contig_range(unsigned long sta
|
||||
@@ -8012,8 +8012,6 @@ int alloc_contig_range(unsigned long sta
|
||||
|
||||
/* Make sure the range is really isolated. */
|
||||
if (test_pages_isolated(outer_start, end, false)) {
|
||||
|
||||
@ -21,8 +21,8 @@ Cc: stable@vger.kernel.org
|
||||
|
||||
--- a/net/bluetooth/hci_conn.c
|
||||
+++ b/net/bluetooth/hci_conn.c
|
||||
@@ -1282,8 +1282,13 @@ int hci_conn_check_link_mode(struct hci_
|
||||
return 0;
|
||||
@@ -1299,8 +1299,13 @@ int hci_conn_check_link_mode(struct hci_
|
||||
return 0;
|
||||
}
|
||||
|
||||
- if (hci_conn_ssp_enabled(conn) &&
|
||||
|
||||
@ -30,7 +30,7 @@ Signed-off-by: Johan Hovold <johan@kernel.org>
|
||||
|
||||
--- a/drivers/usb/serial/option.c
|
||||
+++ b/drivers/usb/serial/option.c
|
||||
@@ -1996,7 +1996,8 @@ static const struct usb_device_id option
|
||||
@@ -2001,7 +2001,8 @@ static const struct usb_device_id option
|
||||
{ USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d01, 0xff) }, /* D-Link DWM-156 (variant) */
|
||||
{ USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d02, 0xff) },
|
||||
{ USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d03, 0xff) },
|
||||
|
||||
@ -90,7 +90,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
expired_count++;
|
||||
--- a/net/netfilter/nf_conntrack_netlink.c
|
||||
+++ b/net/netfilter/nf_conntrack_netlink.c
|
||||
@@ -1123,6 +1123,14 @@ static const struct nla_policy ct_nla_po
|
||||
@@ -1125,6 +1125,14 @@ static const struct nla_policy ct_nla_po
|
||||
.len = NF_CT_LABELS_MAX_SIZE },
|
||||
};
|
||||
|
||||
@ -105,7 +105,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
static int ctnetlink_flush_conntrack(struct net *net,
|
||||
const struct nlattr * const cda[],
|
||||
u32 portid, int report)
|
||||
@@ -1135,7 +1143,7 @@ static int ctnetlink_flush_conntrack(str
|
||||
@@ -1137,7 +1145,7 @@ static int ctnetlink_flush_conntrack(str
|
||||
return PTR_ERR(filter);
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
portid, report);
|
||||
kfree(filter);
|
||||
|
||||
@@ -1181,6 +1189,11 @@ static int ctnetlink_del_conntrack(struc
|
||||
@@ -1183,6 +1191,11 @@ static int ctnetlink_del_conntrack(struc
|
||||
|
||||
ct = nf_ct_tuplehash_to_ctrack(h);
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -198,6 +198,89 @@ config LED_TRIGGER_PHY
|
||||
@@ -199,6 +199,89 @@ config LED_TRIGGER_PHY
|
||||
<Speed in megabits>Mbps or <Speed in gigabits>Gbps
|
||||
|
||||
|
||||
|
||||
@ -295,7 +295,7 @@
|
||||
struct nf_conn *ct = item->ct;
|
||||
struct sk_buff *skb;
|
||||
unsigned int type;
|
||||
@@ -3335,9 +3348,15 @@ static int ctnetlink_stat_exp_cpu(struct
|
||||
@@ -3337,9 +3350,15 @@ static int ctnetlink_stat_exp_cpu(struct
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NF_CONNTRACK_EVENTS
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
/* 4G Systems products */
|
||||
/* This is the 4G XS Stick W14 a.k.a. Mobilcom Debitel Surf-Stick *
|
||||
@@ -575,6 +576,16 @@ static void option_instat_callback(struc
|
||||
@@ -576,6 +577,16 @@ static void option_instat_callback(struc
|
||||
/* Device needs ZLP */
|
||||
#define ZLP BIT(17)
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
|
||||
static const struct usb_device_id option_ids[] = {
|
||||
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
|
||||
@@ -609,6 +620,8 @@ static const struct usb_device_id option
|
||||
@@ -610,6 +621,8 @@ static const struct usb_device_id option
|
||||
{ USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) },
|
||||
{ USB_DEVICE(QUANTA_VENDOR_ID, 0xea42),
|
||||
.driver_info = RSVD(4) },
|
||||
|
||||
@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -209,6 +209,89 @@ config LED_TRIGGER_PHY
|
||||
@@ -210,6 +210,89 @@ config LED_TRIGGER_PHY
|
||||
for any speed known to the PHY.
|
||||
|
||||
|
||||
|
||||
@ -295,7 +295,7 @@
|
||||
struct nf_conn *ct = item->ct;
|
||||
struct sk_buff *skb;
|
||||
unsigned int type;
|
||||
@@ -3479,9 +3492,15 @@ static int ctnetlink_stat_exp_cpu(struct
|
||||
@@ -3481,9 +3494,15 @@ static int ctnetlink_stat_exp_cpu(struct
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NF_CONNTRACK_EVENTS
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
/* 4G Systems products */
|
||||
/* This is the 4G XS Stick W14 a.k.a. Mobilcom Debitel Surf-Stick *
|
||||
@@ -572,6 +573,16 @@ static void option_instat_callback(struc
|
||||
@@ -573,6 +574,16 @@ static void option_instat_callback(struc
|
||||
/* Device needs ZLP */
|
||||
#define ZLP BIT(17)
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
|
||||
static const struct usb_device_id option_ids[] = {
|
||||
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
|
||||
@@ -606,6 +617,8 @@ static const struct usb_device_id option
|
||||
@@ -607,6 +618,8 @@ static const struct usb_device_id option
|
||||
{ USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) },
|
||||
{ USB_DEVICE(QUANTA_VENDOR_ID, 0xea42),
|
||||
.driver_info = RSVD(4) },
|
||||
|
||||
@ -71,7 +71,7 @@ Signed-off-by: Tobias Wolf <dev-NTEO@vplace.de>
|
||||
|
||||
--- a/mm/page_alloc.c
|
||||
+++ b/mm/page_alloc.c
|
||||
@@ -6151,7 +6151,7 @@ static void __ref alloc_node_mem_map(str
|
||||
@@ -6152,7 +6152,7 @@ static void __ref alloc_node_mem_map(str
|
||||
mem_map = NODE_DATA(0)->node_mem_map;
|
||||
#if defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) || defined(CONFIG_FLATMEM)
|
||||
if (page_to_pfn(mem_map) != pgdat->node_start_pfn)
|
||||
|
||||
@ -71,7 +71,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
if (!net_eq(dev_net(dev), sock_net(sk)))
|
||||
goto drop;
|
||||
|
||||
@@ -2216,12 +2218,12 @@ static int tpacket_rcv(struct sk_buff *s
|
||||
@@ -2217,12 +2219,12 @@ static int tpacket_rcv(struct sk_buff *s
|
||||
BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h2)) != 32);
|
||||
BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h3)) != 48);
|
||||
|
||||
@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
if (!net_eq(dev_net(dev), sock_net(sk)))
|
||||
goto drop;
|
||||
|
||||
@@ -3318,6 +3320,7 @@ static int packet_create(struct net *net
|
||||
@@ -3325,6 +3327,7 @@ static int packet_create(struct net *net
|
||||
mutex_init(&po->pg_vec_lock);
|
||||
po->rollover = NULL;
|
||||
po->prot_hook.func = packet_rcv;
|
||||
@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
if (sock->type == SOCK_PACKET)
|
||||
po->prot_hook.func = packet_rcv_spkt;
|
||||
@@ -3940,6 +3943,16 @@ packet_setsockopt(struct socket *sock, i
|
||||
@@ -3947,6 +3950,16 @@ packet_setsockopt(struct socket *sock, i
|
||||
po->xmit = val ? packet_direct_xmit : dev_queue_xmit;
|
||||
return 0;
|
||||
}
|
||||
@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
default:
|
||||
return -ENOPROTOOPT;
|
||||
}
|
||||
@@ -3992,6 +4005,13 @@ static int packet_getsockopt(struct sock
|
||||
@@ -3999,6 +4012,13 @@ static int packet_getsockopt(struct sock
|
||||
case PACKET_VNET_HDR:
|
||||
val = po->has_vnet_hdr;
|
||||
break;
|
||||
|
||||
@ -71,7 +71,7 @@ Signed-off-by: Tobias Wolf <dev-NTEO@vplace.de>
|
||||
|
||||
--- a/mm/page_alloc.c
|
||||
+++ b/mm/page_alloc.c
|
||||
@@ -6401,7 +6401,7 @@ static void __ref alloc_node_mem_map(str
|
||||
@@ -6403,7 +6403,7 @@ static void __ref alloc_node_mem_map(str
|
||||
mem_map = NODE_DATA(0)->node_mem_map;
|
||||
#if defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) || defined(CONFIG_FLATMEM)
|
||||
if (page_to_pfn(mem_map) != pgdat->node_start_pfn)
|
||||
|
||||
@ -71,7 +71,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
if (!net_eq(dev_net(dev), sock_net(sk)))
|
||||
goto drop;
|
||||
|
||||
@@ -2177,12 +2179,12 @@ static int tpacket_rcv(struct sk_buff *s
|
||||
@@ -2178,12 +2180,12 @@ static int tpacket_rcv(struct sk_buff *s
|
||||
BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h2)) != 32);
|
||||
BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h3)) != 48);
|
||||
|
||||
@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
if (!net_eq(dev_net(dev), sock_net(sk)))
|
||||
goto drop;
|
||||
|
||||
@@ -3282,6 +3284,7 @@ static int packet_create(struct net *net
|
||||
@@ -3289,6 +3291,7 @@ static int packet_create(struct net *net
|
||||
mutex_init(&po->pg_vec_lock);
|
||||
po->rollover = NULL;
|
||||
po->prot_hook.func = packet_rcv;
|
||||
@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
if (sock->type == SOCK_PACKET)
|
||||
po->prot_hook.func = packet_rcv_spkt;
|
||||
@@ -3902,6 +3905,16 @@ packet_setsockopt(struct socket *sock, i
|
||||
@@ -3909,6 +3912,16 @@ packet_setsockopt(struct socket *sock, i
|
||||
po->xmit = val ? packet_direct_xmit : dev_queue_xmit;
|
||||
return 0;
|
||||
}
|
||||
@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
default:
|
||||
return -ENOPROTOOPT;
|
||||
}
|
||||
@@ -3954,6 +3967,13 @@ static int packet_getsockopt(struct sock
|
||||
@@ -3961,6 +3974,13 @@ static int packet_getsockopt(struct sock
|
||||
case PACKET_VNET_HDR:
|
||||
val = po->has_vnet_hdr;
|
||||
break;
|
||||
|
||||
@ -16,7 +16,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
|
||||
|
||||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -280,6 +280,11 @@ config BROADCOM_PHY
|
||||
@@ -281,6 +281,11 @@ config BROADCOM_PHY
|
||||
Currently supports the BCM5411, BCM5421, BCM5461, BCM54616S, BCM5464,
|
||||
BCM5481, BCM54810 and BCM5482 PHYs.
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -524,6 +524,13 @@ config XILINX_GMII2RGMII
|
||||
@@ -525,6 +525,13 @@ config XILINX_GMII2RGMII
|
||||
the Reduced Gigabit Media Independent Interface(RGMII) between
|
||||
Ethernet physical media devices and the Gigabit Ethernet controller.
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -531,6 +531,13 @@ config MDIO_IPQ40XX
|
||||
@@ -532,6 +532,13 @@ config MDIO_IPQ40XX
|
||||
This driver supports the MDIO interface found in Qualcomm
|
||||
Atheros ipq40xx Soc chip.
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -292,6 +292,8 @@ config RTL8367B_PHY
|
||||
@@ -293,6 +293,8 @@ config RTL8367B_PHY
|
||||
|
||||
endif # RTL8366_SMI
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user