v1.0.0beta15.1

~新增自定义http/sock5代理认证功能
~新增支持安装内置yacd面板
~增加自定义DNS配置功能
~优化安装脚本
~修复部分设备无法正常显示局域网连接ip/mac的bug
~修复iptables报错的bug
~同步最新版本Geoip数据库文件
This commit is contained in:
juewuy 2020-10-22 20:53:22 +08:00
parent e51069fc79
commit 9e7799981b
5 changed files with 43 additions and 21 deletions

Binary file not shown.

View File

@ -1,4 +1,4 @@
clash_v=1.2.0
clashpre_v=2020.10.09
GeoIP_v=20201021
versionsh=1.0.0beta15.1
versionsh=1.0.0beta15.2

View File

@ -11,13 +11,19 @@ echo "** by Juewuy **"
echo "***********************************************"
#检查root权限
[ "$USER" != "root" ] && [ "$USER" != "admin" ] && echo 请使用root用户执行安装&& exit 1
if [ "$USER" != "root" ];then
echo 当前用户:$USER
$echo "\033[31m请尽量使用root用户执行安装!\033[0m"
echo -----------------------------------------------
read -p "仍要安装?可能会产生未知错误!(1/0) > " res
[ "$res" != "1" ] && exit
fi
#检查更新
url="https://cdn.jsdelivr.net/gh/juewuy/ShellClash"
if [ "$test" -gt 0 ];then
url="--resolve raw.githubusercontent.com:443:199.232.68.133 https://raw.githubusercontent.com/juewuy/ShellClash/master"
[ "$test" -eq 2 ] && url="http://192.168.31.30:8080/clash-for-Miwifi" && echo $url
[ "$test" -eq 2 ] && url="http://192.168.31.30:8080/clash-for-Miwifi"
[ "$test" -eq 3 ] && url="http://192.168.123.90:8080/clash-for-Miwifi"
else
release_new=$(curl -kfsSL --resolve api.github.com:443:140.82.113.5 "https://api.github.com/repos/juewuy/ShellClash/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g') #检查版本
@ -43,14 +49,13 @@ gettar(){
mv $clashdir/clashservice /etc/init.d/clash
chmod 777 /etc/init.d/clash
else
[ -d /etc/systemd/system/ ] && sysdir=/etc/systemd/system/
[ -d /usr/lib/systemd/system/ ] && sysdir=/usr/lib/systemd/system/
[ -w /etc/systemd/system ] && sysdir=/etc/systemd/system
[ -w /usr/lib/systemd/system ] && sysdir=/usr/lib/systemd/system
if [ -n "$sysdir" ];then
#设为systemd方式启动
mv $clashdir/clash.service $sysdir/clash.service
sed -i "s%/etc/clash%$clashdir%g" $sysdir/clash.service
systemctl daemon-reload
rm -rf /etc/init.d/clash
else
#设为保守模式启动
sed -i '/start_old=*/'d $clashdir/mark
@ -64,10 +69,12 @@ gettar(){
sed -i '/versionsh_l=*/'d $clashdir/mark
sed -i "1i\versionsh_l=$release_new" $clashdir/mark
#设置环境变量
sed -i '/alias clash=*/'d /etc/profile
echo "alias clash=\"$shtype $clashdir/clash.sh\"" >> /etc/profile #设置快捷命令环境变量
sed -i '/export clashdir=*/'d /etc/profile
echo "export clashdir=\"$clashdir\"" >> /etc/profile #设置clash路径环境变量
[ -w $HOME/.bashrc ] && profile=$HOME/.bashrc
[ -w /etc/profile ] && profile=/etc/profile
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路径环境变量
#删除临时文件
rm -rf /tmp/clashfm.tar.gz
rm -rf $clashdir/clashservice
@ -86,10 +93,13 @@ $echo "\033[33m输入\033[30;47m clash \033[0;33m命令即可管理\033
echo -----------------------------------------------
}
setdir(){
echo -----------------------------------------------
$echo "\033[32m 1 在默认目录(/etc)安装"
$echo "\033[33m 2 手动设置安装目录"
$echo "\033[0m 0 退出安装"
echo -----------------------------------------------
$echo "\033[33m安装ShellClash至少需要预留约10MB的磁盘空间\033[0m"
$echo " 1 在\033[32m/etc目录\033[0m下安装(适合路由设备)"
$echo " 2 在\033[32m/usr/share目录\033[0m下安装(适合大多数设备)"
$echo " 3 在\033[32m当前用户目录\033[0m下安装(适合非root用户)"
$echo " 4 手动设置安装目录"
$echo " 0 退出安装"
echo -----------------------------------------------
read -p "请输入相应数字 > " num
#设置目录
@ -99,19 +109,27 @@ if [ -z $num ];then
elif [ "$num" = "1" ];then
dir=/etc
elif [ "$num" = "2" ];then
dir=/usr/share
elif [ "$num" = "3" ];then
dir=$HOME/.local/share
mkdir -p $HOME/.config/systemd/user
elif [ "$num" = "4" ];then
echo -----------------------------------------------
echo '可用路径 剩余空间:'
df -h | awk '{print $6,$2}'| sed 1d
df -h | awk '{print $6,$4}'| sed 1d
echo '路径是必须带 / 的格式,写入虚拟内存(/tmp,/sys,..)的文件会在重启后消失!!!'
read -p "请输入自定义路径 > " dir
if [ -z "$dir" ];then
$echo "\033[31m路径错误已取消安装\033[0m"
exit;
$echo "\033[31m路径错误请重新设置\033[0m"
setdir
fi
else
echo 安装已取消!!!
exit;
fi
echo 目标目录磁盘剩余:$(df -h $dir | awk '{print $4}' | sed 1d )
read -p "确认安装?(1/0) > " res
[ "$res" != "1" ] && setdir
clashdir=$dir/clash
install
}
@ -135,6 +153,9 @@ if [ -n "$clashdir" ];then
echo -----------------------------------------------
$echo "\033[31m 旧版本文件已卸载!\033[0m"
setdir
elif [ "$res" = "9" ];then
echo 测试模式,变更安装位置
setdir
else
$echo "\033[31m输入错误已取消安装\033[0m"
exit;

View File

@ -573,9 +573,11 @@ echo -----------------------------------------------
echo -e " 0 返回上级菜单"
read -p "请输入对应数字 > " num
if [ "$num" = '1' ]; then
echo 'function FindProxyForURL(url, host) {' > $dir/pac
echo " return \"SOCKS $authentication@$host:$mix_port; PROXY $authentication@$host:$mix_port; DIRECT;\"" >> $dir/pac
echo '}' >> $dir/pac
cat > $dir/pac <<EOF
function FindProxyForURL(url, host) {
return "PROXY $authentication@$host:$mix_port; DIRECT;"
}
EOF
echo -e "\033[33mPAC文件已生成\033[0m"
echo -e "PAC地址\033[32m$pac\033[0m"
echo "使用教程https://baike.baidu.com/item/PAC/16292100"

View File

@ -266,7 +266,6 @@ start_dns(){
iptables -t nat -A clash_dns -p udp --dport 53 -j REDIRECT --to $dns_port
iptables -t nat -A clash_dns -p tcp --dport 53 -j REDIRECT --to $dns_port
iptables -t nat -A PREROUTING -p udp -j clash_dns
iptables -t nat -A OUTPUT -p udp -j clash_dns
#Google home DNS特殊处理
iptables -t nat -I PREROUTING -p tcp -d 8.8.8.8 -j clash_dns
iptables -t nat -I PREROUTING -p tcp -d 8.8.4.4 -j clash_dns