Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4ce1e48f8 | ||
|
|
5153ca84e1 | ||
|
|
7acac3c6e9 | ||
|
|
f6eb1577af | ||
|
|
30b98f7f64 | ||
|
|
925c4644bb | ||
|
|
4d7bd92381 | ||
|
|
6129b69588 | ||
|
|
47c938568e | ||
|
|
2328ed9616 | ||
|
|
0b6e84d767 | ||
|
|
b4fdcf8a27 | ||
|
|
36fcc884d6 | ||
|
|
1d1098b166 | ||
|
|
03dd3654b7 | ||
|
|
e668551fd0 |
BIN
bin/Country.mmdb
BIN
bin/Country.mmdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
bin/cn_mini.mmdb
BIN
bin/cn_mini.mmdb
Binary file not shown.
|
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 112 KiB |
@@ -1,3 +1,4 @@
|
||||
1.2.0
|
||||
1.1.0
|
||||
1.0.0beta18.2
|
||||
1.0.0beta17
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
clash_v=1.3.5
|
||||
clashpre_v=2020.12.27
|
||||
versionsh=1.1.0
|
||||
GeoIP_v=20210210
|
||||
clash_v=1.4.2
|
||||
clashpre_v=2021.03.10
|
||||
GeoIP_v=20210322
|
||||
versionsh=1.2.0
|
||||
|
||||
BIN
bin/yacd.tar.gz
BIN
bin/yacd.tar.gz
Binary file not shown.
@@ -86,7 +86,7 @@ gettar(){
|
||||
fi
|
||||
#修饰文件及版本号
|
||||
shtype=sh && [ -n "$(ls -l /bin/sh|grep -o dash)" ] && shtype=bash
|
||||
sed -i "s%#!/bin/sh%#!/bin/$shtype%g" $clashdir/start.sh
|
||||
sed -i "s|/bin/sh|/bin/$shtype|" $clashdir/start.sh
|
||||
chmod 777 $clashdir/start.sh
|
||||
sed -i '/versionsh_l=*/'d $clashdir/mark
|
||||
echo versionsh_l=$release_new >> $clashdir/mark
|
||||
|
||||
@@ -27,8 +27,8 @@ getconfig(){
|
||||
#检查mac地址记录
|
||||
[ ! -f $clashdir/mac ] && touch $clashdir/mac
|
||||
#获取本机host地址
|
||||
host=$(ubus call network.interface.lan status 2>&1 | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}';)
|
||||
[ -z "$host" ] && host=$(ip a 2>&1 | grep -w 'inet' | grep 'global' | grep -E '192.|10.' | sed 's/.*inet.//g' | sed 's/\/[0-9][0-9].*$//g' | head -n 1)
|
||||
[ -z "$host" ] && host=$(ubus call network.interface.lan status 2>&1 | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}';)
|
||||
[ -z "$host" ] && host=$(ip a 2>&1 | grep -w 'inet' | grep 'global' | grep -E '\ 1(92|0|72)\.' | sed 's/.*inet.//g' | sed 's/\/[0-9][0-9].*$//g' | head -n 1)
|
||||
[ -z "$host" ] && host=127.0.0.1
|
||||
#dashboard目录位置
|
||||
[ -d $clashdir/ui ] && dbdir=$clashdir/ui && hostdir=":$db_port/ui"
|
||||
@@ -93,7 +93,7 @@ getconfig(){
|
||||
setconfig(){
|
||||
#参数1代表变量名,参数2代表变量值,参数3即文件路径
|
||||
[ -z "$3" ] && configpath=$clashdir/mark || configpath=$3
|
||||
[ -n "$(grep ${1} $configpath)" ] && sed -i "s#${1}=.*#${1}=${2}#g" $configpath || echo "${1}=${2}" >> $configpath
|
||||
[ -n "$(grep ${1} $configpath)" ] && sed -i "s#${1}=\(.*\)#${1}=${2}#g" $configpath || echo "${1}=${2}" >> $configpath
|
||||
}
|
||||
#启动相关
|
||||
errornum(){
|
||||
@@ -166,6 +166,7 @@ setport(){
|
||||
echo -e " 5 修改面板访问端口: \033[36m$db_port\033[0m"
|
||||
echo -e " 6 设置面板访问密码: \033[36m$secret\033[0m"
|
||||
echo -e " 7 修改默认端口过滤: \033[36m$multiport\033[0m"
|
||||
echo -e " 8 指定本机host地址: \033[36m$host\033[0m"
|
||||
echo -e " 0 返回上级菜单"
|
||||
read -p "请输入对应数字 > " num
|
||||
if [ -z "$num" ]; then
|
||||
@@ -233,6 +234,26 @@ setport(){
|
||||
echo -e "\033[32m设置成功!!!\033[0m"
|
||||
fi
|
||||
setport
|
||||
elif [ "$num" = 8 ]; then
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[33m此处可以更改脚本内置的host地址\033[0m"
|
||||
echo -e "\033[31m设置后如本机host地址有变动,请务必手动修改!\033[0m"
|
||||
echo -----------------------------------------------
|
||||
read -p "请输入自定义host地址(输入0移除自定义host) > " host
|
||||
if [ "$host" = "0" ];then
|
||||
host=""
|
||||
setconfig host $host
|
||||
echo -e "\033[32m已经移除自定义host地址,请重新运行脚本以自动获取host!!!\033[0m"
|
||||
exit 0
|
||||
elif [ -n "$(echo $host | grep -Po '(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|[1-9])(\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)){3}')" ]; then
|
||||
setconfig host $host
|
||||
echo -e "\033[32m设置成功!!!\033[0m"
|
||||
else
|
||||
host=""
|
||||
echo -e "\033[31m输入错误,请仔细核对!!!\033[0m"
|
||||
fi
|
||||
sleep 1
|
||||
setport
|
||||
fi
|
||||
}
|
||||
setdns(){
|
||||
@@ -521,7 +542,7 @@ clashcfg(){
|
||||
echo -e " 1 Redir模式:CPU以及内存\033[33m占用较低\033[0m"
|
||||
echo -e " 但\033[31m不支持UDP\033[0m流量转发"
|
||||
echo -e " 适合\033[32m非游戏用户\033[0m使用"
|
||||
echo -e " 2 混合模式: 使用redir转发TCP,Tun转发UPD"
|
||||
echo -e " 2 混合模式: 使用redir转发TCP,Tun转发UDP流量"
|
||||
echo -e " \033[33m速度较快\033[0m,\033[31m内存占用略高\033[0m"
|
||||
echo -e " 适合\033[32m游戏用户、综合用户\033[0m"
|
||||
echo -e " 3 Tun模式: \033[33m支持UDP转发\033[0m且延迟最低"
|
||||
@@ -719,7 +740,7 @@ clashadv(){
|
||||
echo -e " 3 Redir模式udp转发: \033[36m$tproxy_mod\033[0m ————依赖iptables-mod-tproxy"
|
||||
echo -e " 4 启用小闪存模式: \033[36m$mini_clash\033[0m ————启动时方下载核心及数据库文件"
|
||||
echo -e " 5 配置内置DNS服务 \033[36m$dns_no\033[0m"
|
||||
echo -e " 6 手动指定相关服务端口及秘钥"
|
||||
echo -e " 6 手动指定相关端口、秘钥及本机host"
|
||||
echo -e " 7 使用自定义配置"
|
||||
echo -----------------------------------------------
|
||||
echo -e " 8 \033[31m重置\033[0m配置文件"
|
||||
|
||||
@@ -217,6 +217,7 @@ getlink2(){
|
||||
read -p "请输入完整链接 > " link
|
||||
test=$(echo $link | grep -iE "tp.*://" )
|
||||
link=`echo ${link/\ \(*\)/''}` #删除恶心的超链接内容
|
||||
link=`echo ${link//\&/\\\&}` #为分隔符 & 添加转义
|
||||
if [ -n "$link" -a -n "$test" ];then
|
||||
echo -----------------------------------------------
|
||||
echo -e 请检查输入的链接是否正确:
|
||||
@@ -363,17 +364,22 @@ gettar(){
|
||||
fi
|
||||
#修饰文件及版本号
|
||||
shtype=sh && [ -n "$(ls -l /bin/sh|grep -o dash)" ] && shtype=bash
|
||||
sed -i "s%#!/bin/sh%#!/bin/$shtype%g" $clashdir/start.sh
|
||||
sed -i "s|/bin/sh|/bin/$shtype|" $clashdir/start.sh
|
||||
chmod 777 $clashdir/start.sh
|
||||
sed -i '/versionsh_l=*/'d $clashdir/mark
|
||||
echo versionsh_l=$release_new >> $clashdir/mark
|
||||
#设置环境变量
|
||||
[ -w ~/.bashrc ] && profile=~/.bashrc
|
||||
[ -w /etc/profile ] && profile=/etc/profile
|
||||
if [ -n "$profile" ];then
|
||||
sed -i '/alias clash=*/'d $profile
|
||||
echo "alias clash=\"$shtype $clashdir/clash.sh\"" >> $profile #设置快捷命令环境变量
|
||||
sed -i '/export clashdir=*/'d $profile
|
||||
echo "export clashdir=\"$clashdir\"" >> $profile #设置clash路径环境变量
|
||||
else
|
||||
echo 无法写入环境变量!请检查安装权限!
|
||||
exit 1
|
||||
fi
|
||||
#删除临时文件
|
||||
rm -rf /tmp/clashfm.tar.gz
|
||||
rm -rf $clashdir/clashservice
|
||||
@@ -560,7 +566,7 @@ getdb(){
|
||||
sed -i "s/127.0.0.1/${host}/g" $dbdir/assets/*.js
|
||||
sed -i "s/9090/${db_port}/g" $dbdir/assets/*.js
|
||||
else
|
||||
sed -i "s/127.0.0.1:9090/${host}:${db_port}/g" $dbdir/app*.js
|
||||
sed -i "s/127.0.0.1:9090/${host}:${db_port}/g" $dbdir/*.html
|
||||
#sed -i "s/7892/${db_port}/g" $dbdir/app*.js
|
||||
fi
|
||||
#如果clash在运行则重启clash服务
|
||||
@@ -932,6 +938,15 @@ userguide(){
|
||||
read -p "是否下载并安装根证书?(1/0) > " res
|
||||
[ "$res" = 1 ] && checkupdate && getcrt
|
||||
fi
|
||||
#设置加密DNS
|
||||
webget /tmp/ssl_test https://baidu.com echooff rediron skipceroff
|
||||
if [ "$result" = "200" ];then
|
||||
dns_nameserver='https://223.5.5.5/dns-query, https://doh.pub/dns-query, tls://dns.rubyfish.cn:853'
|
||||
dns_fallback='https://1.0.0.1/dns-query, https://8.8.4.4/dns-query, https://doh.opendns.com/dns-query'
|
||||
setconfig dns_nameserver \'"$dns_nameserver"\'
|
||||
setconfig dns_fallback \'"$dns_fallback"\'
|
||||
fi
|
||||
rm -rf /tmp/ssl_test
|
||||
#提示导入订阅或者配置文件
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[32m是否导入配置文件?\033[0m(这是运行前的最后一步)"
|
||||
|
||||
@@ -90,9 +90,9 @@ mark_time(){
|
||||
echo start_time=$start_time >> $clashdir/mark
|
||||
}
|
||||
gethost(){
|
||||
host=$(ubus call network.interface.lan status 2>&1 | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}';)
|
||||
[ -z "$host" ] && host=$(ip a 2>&1 | grep -w 'inet' | grep 'global' | grep -E '192.|10.' | sed 's/.*inet.//g' | sed 's/\/[0-9][0-9].*$//g' | head -n 1)
|
||||
[ -n "$host" ] && lanhost="-s $(echo $host | grep -oE '192.|10.')0.0.0/8"
|
||||
[ -z "$host" ] && host=$(ubus call network.interface.lan status 2>&1 | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}';)
|
||||
[ -z "$host" ] && host=$(ip a 2>&1 | grep -w 'inet' | grep 'global' | grep -E '\ 1(92|0|72)\.' | sed 's/.*inet.//g' | sed 's/\/[0-9][0-9].*$//g' | head -n 1)
|
||||
[ -n "$host" ] && lanhost="-s $(echo $host | grep -oE '^1(92|0|72)\.')0.0.0/8"
|
||||
}
|
||||
#配置文件相关
|
||||
getyaml(){
|
||||
@@ -166,7 +166,7 @@ EOF`
|
||||
else
|
||||
Https=""
|
||||
#检测节点或providers
|
||||
if [ -z "$(cat $yamlnew | grep -E 'server:|proxy-providers:' | grep -v 'nameserver')" ];then
|
||||
if [ -z "$(cat $yamlnew | grep -E 'server:|proxy-providers:' | grep -v 'nameserver' | head -n 1)" ];then
|
||||
echo -----------------------------------------------
|
||||
logger "获取到了配置文件,但似乎并不包含正确的节点信息!" 31
|
||||
echo -----------------------------------------------
|
||||
@@ -264,18 +264,20 @@ secret: $secret
|
||||
$tun
|
||||
$exper
|
||||
$dns
|
||||
store-selected: false
|
||||
EOF
|
||||
###################################
|
||||
[ -f $clashdir/user.yaml ] && yaml_user=$clashdir/user.yaml
|
||||
#合并文件
|
||||
cut -c 1- $tmpdir/set.yaml $yaml_user $tmpdir/proxy.yaml > $tmpdir/config.yaml
|
||||
#插入自定义规则
|
||||
sed -i "/#自定义规则/d" $tmpdir/config.yaml
|
||||
if [ -f $clashdir/rules.yaml ];then
|
||||
while read line;do
|
||||
[ -z "$(echo "$line " | grep '#')" ] && \
|
||||
[ -n "$(echo "$line" | grep '\-\ ')" ] && \
|
||||
sed -i "/$line/d" $tmpdir/config.yaml && \
|
||||
sed -i "/^rules:/a\ $line" $tmpdir/config.yaml
|
||||
line=$(echo "$line" | sed 's#/#\\/#') && \
|
||||
sed -i "/^rules:/a\ $line #自定义规则" $tmpdir/config.yaml
|
||||
done < $clashdir/rules.yaml
|
||||
fi
|
||||
#如果没有使用小闪存模式
|
||||
@@ -452,7 +454,7 @@ web_save(){
|
||||
#使用get_save获取面板节点设置
|
||||
get_save http://localhost:${db_port}/proxies | awk -F "{" '{for(i=1;i<=NF;i++) print $i}' | grep -E '^"all".*"Selector"' > /tmp/clash_web_check_$USER
|
||||
while read line ;do
|
||||
def=$(echo $line | awk -F "[\[,]" '{print $2}')
|
||||
def=$(echo $line | awk -F "[[,]" '{print $2}')
|
||||
now=$(echo $line | grep -oE '"now".*",' | sed 's/"now"://g'| sed 's/,//g')
|
||||
[ "$def" != "$now" ] && echo $line | grep -oE '"name".*"now".*",' | sed 's/"name"://g' | sed 's/"now"://g'| sed 's/"//g' >> /tmp/clash_web_save_$USER
|
||||
done < /tmp/clash_web_check_$USER
|
||||
|
||||
Reference in New Issue
Block a user