Skip to content

Commit

Permalink
优化挖矿代码,减少 CPU 占用
Browse files Browse the repository at this point in the history
  • Loading branch information
233boy committed Mar 5, 2018
1 parent a72086a commit f2b1562
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 9 deletions.
4 changes: 2 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ ws_config() {
if [[ "$record" == [Yy] ]]; then
echo
echo
echo -e "$yellow 域名解析 = ${cyan}已解析$none"
echo -e "$yellow 域名解析 = ${cyan}我确定已经有解析了$none"
echo "----------------------------------------------------------------"
echo
break
Expand Down Expand Up @@ -610,7 +610,7 @@ install_info() {
echo
echo -e "$yellow 你的域名 = $cyan$domain$none"
echo
echo -e "$yellow 域名解析 = ${cyan}已解析$none"
echo -e "$yellow 域名解析 = ${cyan}我确定已经有解析了$none"
echo
echo -e "$yellow 自动配置 TLS = $cyan$install_caddy_info$none"

Expand Down
75 changes: 68 additions & 7 deletions v2ray.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ none='\e[0m'
# Root
[[ $(id -u) != 0 ]] && echo -e " 哎呀……请使用 ${red}root ${none}用户运行 ${yellow}~(^_^) ${none}" && exit 1

_version="v1.51"
_version="v1.52"

cmd="apt-get"

Expand Down Expand Up @@ -772,9 +772,11 @@ change_v2ray_config() {
echo
echo -e "$yellow 7. $none修改 伪装的网址 (如果可以)"
echo
echo -e "$yellow 8. $none开启 / 关闭 广告拦截"
echo -e "$yellow 8. $none关闭 网站伪装 和 路径分流 (如果可以)"
echo
read -p "$(echo -e "请选择 [${magenta}1-8$none]:")" _opt
echo -e "$yellow 9. $none开启 / 关闭 广告拦截"
echo
read -p "$(echo -e "请选择 [${magenta}1-9$none]:")" _opt
if [[ -z $_opt ]]; then
error
else
Expand Down Expand Up @@ -807,8 +809,11 @@ change_v2ray_config() {
change_proxy_site_config
break
;;

8)
disable_ws_path
break
;;
9)
blocked_hosts
break
;;
Expand Down Expand Up @@ -1090,7 +1095,7 @@ ws_config() {
if [[ "$record" == [Yy] ]]; then
echo
echo
echo -e "$yellow 域名解析 = ${cyan}已解析$none"
echo -e "$yellow 域名解析 = ${cyan}我确定已经有解析了$none"
echo "----------------------------------------------------------------"
echo
break
Expand Down Expand Up @@ -1331,8 +1336,8 @@ install_caddy() {
}
caddy_config() {
local email=$(shuf -i1-10000000000 -n1)
[[ -z $proxy_site ]] && proxy_site=$(sed '$!d' $backup)
if [[ $is_ws_path ]]; then
[[ -z $proxy_site ]] && proxy_site=$(sed '$!d' $backup)
cat >/etc/caddy/Caddyfile <<-EOF
$domain {
tls ${email}@gmail.com
Expand Down Expand Up @@ -1649,7 +1654,7 @@ change_domain() {
if [[ "$record" == [Yy] ]]; then
echo
echo
echo -e "$yellow 域名解析 = ${cyan}已解析$none"
echo -e "$yellow 域名解析 = ${cyan}我确定已经有解析了$none"
echo "----------------------------------------------------------------"
echo
pause
Expand Down Expand Up @@ -1845,6 +1850,62 @@ domain_check() {
exit 1
fi
}
disable_ws_path() {
if [[ $v2ray_transport == 4 && $caddy_installed ]] && [[ $is_ws_path ]]; then
echo

while :; do
echo -e "是否关闭 ${yellow}网站伪装 和 路径分流${none} [${magenta}Y/N$none]"
read -p "$(echo -e "(默认 [${cyan}N$none]):") " y_n
[[ -z "$y_n" ]] && y_n="n"
if [[ "$y_n" == [Yy] ]]; then
echo
echo
echo -e "$yellow 关闭 网站伪装 和 路径分流 = $cyan$none"
echo "----------------------------------------------------------------"
echo
pause
sed -i "41s/true/false/" $backup
is_ws_path=''
caddy_config
config
clear
view_v2ray_config_info
download_v2ray_config_ask
break
elif [[ "$y_n" == [Nn] ]]; then
echo
echo -e " $green已取消关闭 网站伪装 和 路径分流 ....$none"
echo
break
else
error
fi

done
else
echo
echo -e "$red 抱歉...不支持修改...$none"
echo
echo -e " 当前传输协议为: ${cyan}${transport[$v2ray_transport - 1]}${none}"
echo
if [[ $caddy_installed ]]; then
echo -e " 自动配置 TLS = ${cyan}打开$none"
else
echo -e " 自动配置 TLS = $red关闭$none"
fi
echo
if [[ $is_ws_path ]]; then
echo -e " 路径分流 = ${cyan}打开$none"
else
echo -e " 路径分流 = $red关闭$none"
fi
echo
echo -e " 必须为 WebSocket + TLS 传输协议, 自动配置 TLS = ${cyan}打开$none, 路径分流 = ${cyan}打开$none, 才能修改"
echo

fi
}
blocked_hosts() {
if [[ $is_blocked_ad ]]; then
local _info="$green已开启$none"
Expand Down

0 comments on commit f2b1562

Please sign in to comment.