From 5c647ffcc3fb1c69478dae70591c3cfed54fa237 Mon Sep 17 00:00:00 2001 From: 233boy <31657650+233boy@users.noreply.github.com> Date: Sat, 8 Jun 2019 10:39:08 +0800 Subject: [PATCH 01/10] update caddy service --- src/download-caddy.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/download-caddy.sh b/src/download-caddy.sh index e870808..80a8014 100644 --- a/src/download-caddy.sh +++ b/src/download-caddy.sh @@ -27,6 +27,7 @@ _install_caddy_service() { if [[ $systemd ]]; then cp -f ${caddy_tmp}init/linux-systemd/caddy.service /lib/systemd/system/ # sed -i "s/www-data/root/g" /lib/systemd/system/caddy.service + sed -i "/on-abnormal/a RestartSec=3" /lib/systemd/system/caddy.service sed -i "s/on-abnormal/always/" /lib/systemd/system/caddy.service systemctl enable caddy else @@ -44,4 +45,7 @@ _install_caddy_service() { chown -R www-data.www-data /etc/ssl/caddy mkdir -p /etc/caddy/ -} + + ## create sites dir + mkdir -p /etc/caddy/sites +} \ No newline at end of file From 4555f1ad9a0dad01bb7269a77bfabc9105af03a6 Mon Sep 17 00:00:00 2001 From: 233boy <31657650+233boy@users.noreply.github.com> Date: Fri, 14 Jun 2019 09:03:15 +0800 Subject: [PATCH 02/10] fix v2ray command not found --- src/download-v2ray.sh | 1 + src/uninstall.sh | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/download-v2ray.sh b/src/download-v2ray.sh index b291ddb..4cc285e 100644 --- a/src/download-v2ray.sh +++ b/src/download-v2ray.sh @@ -30,6 +30,7 @@ _download_v2ray_file() { mkdir -p /usr/bin/v2ray cp -f "/tmp/v2ray/v2ray" "/usr/bin/v2ray/v2ray" chmod +x "/usr/bin/v2ray/v2ray" + echo "alias v2ray=$_v2ray_sh" >>/root/.bashrc cp -f "/tmp/v2ray/v2ctl" "/usr/bin/v2ray/v2ctl" chmod +x "/usr/bin/v2ray/v2ctl" } diff --git a/src/uninstall.sh b/src/uninstall.sh index cb3989b..a2e881b 100644 --- a/src/uninstall.sh +++ b/src/uninstall.sh @@ -86,6 +86,7 @@ if [[ $is_uninstall_v2ray && $is_uninstall_caddy ]]; then rm -rf /usr/bin/v2ray rm -rf $_v2ray_sh + sed -i '/alias v2ray=/d' /root/.bashrc rm -rf /etc/v2ray rm -rf /var/log/v2ray @@ -148,6 +149,7 @@ elif [[ $is_uninstall_v2ray ]]; then rm -rf /usr/bin/v2ray rm -rf $_v2ray_sh + sed -i '/alias v2ray=/d' /root/.bashrc rm -rf /etc/v2ray rm -rf /var/log/v2ray if [[ $systemd ]]; then From aacf1cf7abb1148507411a26586890242b96e4ed Mon Sep 17 00:00:00 2001 From: 233boy <31657650+233boy@users.noreply.github.com> Date: Fri, 14 Jun 2019 10:22:56 +0800 Subject: [PATCH 03/10] update bbr check --- install.sh | 25 ++++++++++--------------- src/bbr.sh | 20 ++++++++++++++++++++ src/init.sh | 6 ++++++ v2ray.sh | 27 ++++----------------------- 4 files changed, 40 insertions(+), 38 deletions(-) create mode 100644 src/bbr.sh diff --git a/install.sh b/install.sh index 719b170..5151690 100644 --- a/install.sh +++ b/install.sh @@ -6,6 +6,11 @@ yellow='\e[93m' magenta='\e[95m' cyan='\e[96m' none='\e[0m' +_red() { echo -e ${red}$*${none}; } +_green() { echo -e ${green}$*${none}; } +_yellow() { echo -e ${yellow}$*${none}; } +_magenta() { echo -e ${magenta}$*${none}; } +_cyan() { echo -e ${cyan}$*${none}; } # Root [[ $(id -u) != 0 ]] && echo -e "\n 哎呀……请使用 ${red}root ${none}用户运行 ${yellow}~(^_^) ${none}\n" && exit 1 @@ -907,20 +912,6 @@ backup_config() { fi } -try_enable_bbr() { - if [[ $(uname -r | cut -b 1) -eq 4 ]]; then - case $(uname -r | cut -b 3-4) in - 9. | [1-9][0-9]) - sed -i '/net.ipv4.tcp_congestion_control/d' /etc/sysctl.conf - sed -i '/net.core.default_qdisc/d' /etc/sysctl.conf - echo "net.ipv4.tcp_congestion_control = bbr" >>/etc/sysctl.conf - echo "net.core.default_qdisc = fq" >>/etc/sysctl.conf - sysctl -p >/dev/null 2>&1 - ;; - esac - fi -} - get_ip() { ip=$(curl -s https://ipinfo.io/ip) [[ -z $ip ]] && ip=$(curl -s https://api.ip.sb/ip) @@ -980,7 +971,6 @@ install() { blocked_hosts shadowsocks_config install_info - try_enable_bbr # [[ $caddy ]] && domain_check install_v2ray if [[ $caddy || $v2ray_port == "80" ]]; then @@ -993,6 +983,11 @@ install() { fi fi [[ $caddy ]] && install_caddy + + ## bbr + _load bbr.sh + _try_enable_bbr + get_ip config show_config_info diff --git a/src/bbr.sh b/src/bbr.sh new file mode 100644 index 0000000..e51a828 --- /dev/null +++ b/src/bbr.sh @@ -0,0 +1,20 @@ +_open_bbr() { + sed -i '/net.ipv4.tcp_congestion_control/d' /etc/sysctl.conf + sed -i '/net.core.default_qdisc/d' /etc/sysctl.conf + echo "net.ipv4.tcp_congestion_control = bbr" >>/etc/sysctl.conf + echo "net.core.default_qdisc = fq" >>/etc/sysctl.conf + sysctl -p >/dev/null 2>&1 + echo + _green "..由于你的 VPS 内核支持开启 BBR ...已经为你启用 BBR 优化...." + echo +} + +_try_enable_bbr() { + local _test1=$(uname -r | cut -d\. -f1) + local _test2=$(uname -r | cut -d\. -f2) + if [[ $_test1 -eq 4 && $_test2 -ge 9 ]] || [[ $_test1 -ge 5 ]]; then + _open_bbr + enable_bbr=true + fi +} + diff --git a/src/init.sh b/src/init.sh index 079a9c3..a1077b8 100644 --- a/src/init.sh +++ b/src/init.sh @@ -1,3 +1,9 @@ +_red() { echo -e ${red}$*${none}; } +_green() { echo -e ${green}$*${none}; } +_yellow() { echo -e ${yellow}$*${none}; } +_magenta() { echo -e ${magenta}$*${none}; } +_cyan() { echo -e ${cyan}$*${none}; } + _rm() { rm -rf "$@" } diff --git a/v2ray.sh b/v2ray.sh index a9b04b8..4b18a1a 100644 --- a/v2ray.sh +++ b/v2ray.sh @@ -2293,33 +2293,14 @@ other() { install_bbr() { local test1=$(sed -n '/net.ipv4.tcp_congestion_control/p' /etc/sysctl.conf) local test2=$(sed -n '/net.core.default_qdisc/p' /etc/sysctl.conf) - if [[ $(uname -r | cut -b 1) -eq 4 ]]; then - case $(uname -r | cut -b 3-4) in - 9. | [1-9][0-9]) - if [[ $test1 == "net.ipv4.tcp_congestion_control = bbr" && $test2 == "net.core.default_qdisc = fq" ]]; then - local is_bbr=true - else - local try_enable_bbr=true - fi - ;; - esac - fi - if [[ $is_bbr ]]; then + if [[ $test1 == "net.ipv4.tcp_congestion_control = bbr" && $test2 == "net.core.default_qdisc = fq" ]]; then echo echo -e "$green BBR 已经启用啦...无需再安装$none" echo - elif [[ $try_enable_bbr ]]; then - sed -i '/net.ipv4.tcp_congestion_control/d' /etc/sysctl.conf - sed -i '/net.core.default_qdisc/d' /etc/sysctl.conf - echo "net.ipv4.tcp_congestion_control = bbr" >>/etc/sysctl.conf - echo "net.core.default_qdisc = fq" >>/etc/sysctl.conf - sysctl -p >/dev/null 2>&1 - echo - echo -e "$green ..由于你的 VPS 内核支持开启 BBR ...已经为你启用 BBR 优化....$none" - echo else - # https://teddysun.com/489.html - bash <(curl -s -L https://github.com/teddysun/across/raw/master/bbr.sh) + _load bbr.sh + _try_enable_bbr + [[ ! $enable_bbr ]] && bash <(curl -s -L https://github.com/teddysun/across/raw/master/bbr.sh) fi } install_lotserver() { From 03a274c72feb5417922083039f1518d31272dd7b Mon Sep 17 00:00:00 2001 From: 233boy <31657650+233boy@users.noreply.github.com> Date: Thu, 20 Jun 2019 14:38:58 +0800 Subject: [PATCH 04/10] support ARM cpu. close #248 --- install.sh | 40 +++++++++++++++++++++++++++++----------- src/download-caddy.sh | 6 +----- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/install.sh b/install.sh index 5151690..adbd94b 100644 --- a/install.sh +++ b/install.sh @@ -19,22 +19,40 @@ cmd="apt-get" sys_bit=$(uname -m) -if [[ $sys_bit == "i386" || $sys_bit == "i686" ]]; then +case $sys_bit in +i[36]86) v2ray_bit="32" -elif [[ $sys_bit == "x86_64" ]]; then + caddy_arch="386" + ;; +x86_64) v2ray_bit="64" -else + caddy_arch="amd64" + ;; +*armv6*) + v2ray_bit="arm" + caddy_arch="arm6" + ;; +*armv7*) + v2ray_bit="arm" + caddy_arch="arm7" + ;; +*aarch64* | *armv8*) + v2ray_bit="arm64" + caddy_arch="arm64" + ;; +*) echo -e " 哈哈……这个 ${red}辣鸡脚本${none} 不支持你的系统。 ${yellow}(-_-) ${none} 备注: 仅支持 Ubuntu 16+ / Debian 8+ / CentOS 7+ 系统 " && exit 1 -fi + ;; +esac # 笨笨的检测方法 -if [[ -f /usr/bin/apt-get || -f /usr/bin/yum ]] && [[ -f /bin/systemctl ]]; then +if [[ $(command -v apt-get) || $(command -v yum) ]] && [[ $(command -v systemctl) ]]; then - if [[ -f /usr/bin/yum ]]; then + if [[ $(command -v yum) ]]; then cmd="yum" @@ -863,10 +881,10 @@ config() { if [[ $cmd == "apt-get" ]]; then cat >/etc/network/if-pre-up.d/iptables <<-EOF -#!/bin/sh -/sbin/iptables-restore < /etc/iptables.rules.v4 -/sbin/ip6tables-restore < /etc/iptables.rules.v6 - EOF + #!/bin/sh + /sbin/iptables-restore < /etc/iptables.rules.v4 + /sbin/ip6tables-restore < /etc/iptables.rules.v6 + EOF chmod +x /etc/network/if-pre-up.d/iptables # else # [ $(pgrep "firewall") ] && systemctl stop firewalld @@ -987,7 +1005,7 @@ install() { ## bbr _load bbr.sh _try_enable_bbr - + get_ip config show_config_info diff --git a/src/download-caddy.sh b/src/download-caddy.sh index 80a8014..d9ea475 100644 --- a/src/download-caddy.sh +++ b/src/download-caddy.sh @@ -2,11 +2,7 @@ _download_caddy_file() { caddy_tmp="/tmp/install_caddy/" caddy_tmp_file="/tmp/install_caddy/caddy.tar.gz" [[ -d $caddy_tmp ]] && rm -rf $caddy_tmp - if [[ $sys_bit == "i386" || $sys_bit == "i686" ]]; then - local caddy_download_link="https://caddyserver.com/download/linux/386?license=personal" - else - local caddy_download_link="https://caddyserver.com/download/linux/amd64?license=personal" - fi + local caddy_download_link="https://caddyserver.com/download/linux/${caddy_arch}?license=personal" mkdir -p $caddy_tmp From dc21125153ddbf8c823d1c7509fa68ca1765385d Mon Sep 17 00:00:00 2001 From: 233boy <31657650+233boy@users.noreply.github.com> Date: Thu, 20 Jun 2019 14:41:54 +0800 Subject: [PATCH 05/10] close #248 --- v2ray.sh | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/v2ray.sh b/v2ray.sh index 4b18a1a..ba91a3a 100644 --- a/v2ray.sh +++ b/v2ray.sh @@ -16,15 +16,37 @@ cmd="apt-get" sys_bit=$(uname -m) -if [[ $sys_bit == "i386" || $sys_bit == "i686" ]]; then +case $sys_bit in +i[36]86) v2ray_bit="32" -elif [[ $sys_bit == "x86_64" ]]; then + caddy_arch="386" + ;; +x86_64) v2ray_bit="64" -else - echo -e " 哈哈……这个 ${red}辣鸡脚本${none} 不支持你的系统。 ${yellow}(-_-) ${none}" && exit 1 -fi + caddy_arch="amd64" + ;; +*armv6*) + v2ray_bit="arm" + caddy_arch="arm6" + ;; +*armv7*) + v2ray_bit="arm" + caddy_arch="arm7" + ;; +*aarch64* | *armv8*) + v2ray_bit="arm64" + caddy_arch="arm64" + ;; +*) + echo -e " + 哈哈……这个 ${red}辣鸡脚本${none} 不支持你的系统。 ${yellow}(-_-) ${none} + + 备注: 仅支持 Ubuntu 16+ / Debian 8+ / CentOS 7+ 系统 + " && exit 1 + ;; +esac -if [[ -f /usr/bin/yum ]]; then +if [[ $(command -v yum) ]]; then cmd="yum" From f515968ebfdc182b857772e0b599b9f7988aa8bc Mon Sep 17 00:00:00 2001 From: 233boy <31657650+233boy@users.noreply.github.com> Date: Sat, 22 Jun 2019 10:57:43 +0800 Subject: [PATCH 06/10] fix #249 --- install.sh | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index adbd94b..05e1c2c 100644 --- a/install.sh +++ b/install.sh @@ -126,7 +126,32 @@ _load() { local _dir="/etc/v2ray/233boy/v2ray/src/" . "${_dir}$@" } +_sys_timezone() { + IS_OPENVZ= + if hostnamectl status | grep -q openvz; then + IS_OPENVZ=1 + fi + echo + timedatectl set-timezone Asia/Shanghai + timedatectl set-ntp true + echo "已将你的主机设置为Asia/Shanghai时区并通过systemd-timesyncd自动同步时间。" + echo + + if [[ $IS_OPENVZ ]]; then + echo + echo -e "你的主机环境为 ${yellow}Openvz${none} ,建议使用${yellow}v2ray mkcp${none}系列协议。" + echo -e "注意:${yellow}Openvz${none} 系统时间无法由虚拟机内程序控制同步。" + echo -e "如果主机时间跟实际相差${yellow}超过90秒${none},v2ray将无法正常通信,请发ticket联系vps主机商调整。" + fi +} + +_sys_time() { + echo -e "\n主机时间:${yellow}" + timedatectl status | sed -n '1p;4p' + echo -e "${none}" + [[ $IS_OPENV ]] && pause +} v2ray_config() { # clear echo @@ -754,14 +779,16 @@ caddy_config() { install_v2ray() { $cmd update -y if [[ $cmd == "apt-get" ]]; then - $cmd install -y lrzsz git zip unzip curl wget qrencode libcap2-bin + $cmd install -y lrzsz git zip unzip curl wget qrencode libcap2-bin dbus else # $cmd install -y lrzsz git zip unzip curl wget qrencode libcap iptables-services $cmd install -y lrzsz git zip unzip curl wget qrencode libcap fi ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime [ -d /etc/v2ray ] && rm -rf /etc/v2ray - date -s "$(curl -sI g.cn | grep Date | cut -d' ' -f3-6)Z" + # date -s "$(curl -sI g.cn | grep Date | cut -d' ' -f3-6)Z" + _sys_timezone + _sys_time if [[ $local_install ]]; then if [[ ! -d $(pwd)/config ]]; then From db4b81048a516df5c5336e8d78ac473f9c9df726 Mon Sep 17 00:00:00 2001 From: 233boy <31657650+233boy@users.noreply.github.com> Date: Sun, 23 Jun 2019 22:22:33 +0800 Subject: [PATCH 07/10] support padavan v2ray --- config/client/h2.json | 43 +++++++++++++++------------------------ config/client/http.json | 43 +++++++++++++++------------------------ config/client/kcp.json | 43 +++++++++++++++------------------------ config/client/quic.json | 43 +++++++++++++++------------------------ config/client/tcp.json | 43 +++++++++++++++------------------------ config/client/ws.json | 43 +++++++++++++++------------------------ config/client/ws_tls.json | 43 +++++++++++++++------------------------ v2ray.sh | 2 +- 8 files changed, 113 insertions(+), 190 deletions(-) diff --git a/config/client/h2.json b/config/client/h2.json index 73d634d..d0fb204 100644 --- a/config/client/h2.json +++ b/config/client/h2.json @@ -1,8 +1,4 @@ { - "log": { - "error": "error.log", - "loglevel": "warning" - }, "outbounds": [ { "protocol": "vmess", @@ -42,6 +38,15 @@ } ], "inbounds": [ + { + "port": "1099", + "protocol": "dokodemo-door", + "settings": { + "network": "tcp,udp", + "timeout": 0, + "followRedirect": true + } + }, { "port": 2333, "listen": "127.0.0.1", @@ -65,6 +70,8 @@ ], "dns": { "servers": [ + "1.1.1.1", + "1.0.0.1", "8.8.8.8", "8.8.4.4", "localhost" @@ -76,34 +83,16 @@ { "type": "field", "ip": [ - "0.0.0.0/8", - "10.0.0.0/8", - "100.64.0.0/10", - "127.0.0.0/8", - "169.254.0.0/16", - "172.16.0.0/12", - "192.0.0.0/24", - "192.0.2.0/24", - "192.168.0.0/16", - "198.18.0.0/15", - "198.51.100.0/24", - "203.0.113.0/24", - "::1/128", - "fc00::/7", - "fe80::/10", + "geoip:private", "geoip:cn" ], - "domain": [ - "geosite:cn" - ], "outboundTag": "direct" }, { - "type": "chinasites", - "outboundTag": "direct" - }, - { - "type": "chinaip", + "type": "field", + "domain": [ + "geosite:cn" + ], "outboundTag": "direct" } ] diff --git a/config/client/http.json b/config/client/http.json index 563164a..de28a84 100644 --- a/config/client/http.json +++ b/config/client/http.json @@ -1,8 +1,4 @@ { - "log": { - "error": "error.log", - "loglevel": "warning" - }, "outbounds": [ { "protocol": "vmess", @@ -72,6 +68,15 @@ } ], "inbounds": [ + { + "port": "1099", + "protocol": "dokodemo-door", + "settings": { + "network": "tcp,udp", + "timeout": 0, + "followRedirect": true + } + }, { "port": 2333, "listen": "127.0.0.1", @@ -95,6 +100,8 @@ ], "dns": { "servers": [ + "1.1.1.1", + "1.0.0.1", "8.8.8.8", "8.8.4.4", "localhost" @@ -106,34 +113,16 @@ { "type": "field", "ip": [ - "0.0.0.0/8", - "10.0.0.0/8", - "100.64.0.0/10", - "127.0.0.0/8", - "169.254.0.0/16", - "172.16.0.0/12", - "192.0.0.0/24", - "192.0.2.0/24", - "192.168.0.0/16", - "198.18.0.0/15", - "198.51.100.0/24", - "203.0.113.0/24", - "::1/128", - "fc00::/7", - "fe80::/10", + "geoip:private", "geoip:cn" ], - "domain": [ - "geosite:cn" - ], "outboundTag": "direct" }, { - "type": "chinasites", - "outboundTag": "direct" - }, - { - "type": "chinaip", + "type": "field", + "domain": [ + "geosite:cn" + ], "outboundTag": "direct" } ] diff --git a/config/client/kcp.json b/config/client/kcp.json index c386ca0..2d94f97 100644 --- a/config/client/kcp.json +++ b/config/client/kcp.json @@ -1,8 +1,4 @@ { - "log": { - "error": "error.log", - "loglevel": "warning" - }, "outbounds": [ { "protocol": "vmess", @@ -43,6 +39,15 @@ } ], "inbounds": [ + { + "port": "1099", + "protocol": "dokodemo-door", + "settings": { + "network": "tcp,udp", + "timeout": 0, + "followRedirect": true + } + }, { "port": 2333, "listen": "127.0.0.1", @@ -66,6 +71,8 @@ ], "dns": { "servers": [ + "1.1.1.1", + "1.0.0.1", "8.8.8.8", "8.8.4.4", "localhost" @@ -77,34 +84,16 @@ { "type": "field", "ip": [ - "0.0.0.0/8", - "10.0.0.0/8", - "100.64.0.0/10", - "127.0.0.0/8", - "169.254.0.0/16", - "172.16.0.0/12", - "192.0.0.0/24", - "192.0.2.0/24", - "192.168.0.0/16", - "198.18.0.0/15", - "198.51.100.0/24", - "203.0.113.0/24", - "::1/128", - "fc00::/7", - "fe80::/10", + "geoip:private", "geoip:cn" ], - "domain": [ - "geosite:cn" - ], "outboundTag": "direct" }, { - "type": "chinasites", - "outboundTag": "direct" - }, - { - "type": "chinaip", + "type": "field", + "domain": [ + "geosite:cn" + ], "outboundTag": "direct" } ] diff --git a/config/client/quic.json b/config/client/quic.json index 98487f6..5e6ca2d 100644 --- a/config/client/quic.json +++ b/config/client/quic.json @@ -1,8 +1,4 @@ { - "log": { - "error": "error.log", - "loglevel": "warning" - }, "outbounds": [ { "protocol": "vmess", @@ -42,6 +38,15 @@ } ], "inbounds": [ + { + "port": "1099", + "protocol": "dokodemo-door", + "settings": { + "network": "tcp,udp", + "timeout": 0, + "followRedirect": true + } + }, { "port": 2333, "listen": "127.0.0.1", @@ -65,6 +70,8 @@ ], "dns": { "servers": [ + "1.1.1.1", + "1.0.0.1", "8.8.8.8", "8.8.4.4", "localhost" @@ -76,34 +83,16 @@ { "type": "field", "ip": [ - "0.0.0.0/8", - "10.0.0.0/8", - "100.64.0.0/10", - "127.0.0.0/8", - "169.254.0.0/16", - "172.16.0.0/12", - "192.0.0.0/24", - "192.0.2.0/24", - "192.168.0.0/16", - "198.18.0.0/15", - "198.51.100.0/24", - "203.0.113.0/24", - "::1/128", - "fc00::/7", - "fe80::/10", + "geoip:private", "geoip:cn" ], - "domain": [ - "geosite:cn" - ], "outboundTag": "direct" }, { - "type": "chinasites", - "outboundTag": "direct" - }, - { - "type": "chinaip", + "type": "field", + "domain": [ + "geosite:cn" + ], "outboundTag": "direct" } ] diff --git a/config/client/tcp.json b/config/client/tcp.json index 25adf4a..8ff30d0 100644 --- a/config/client/tcp.json +++ b/config/client/tcp.json @@ -1,8 +1,4 @@ { - "log": { - "error": "error.log", - "loglevel": "warning" - }, "outbounds": [ { "protocol": "vmess", @@ -32,6 +28,15 @@ } ], "inbounds": [ + { + "port": "1099", + "protocol": "dokodemo-door", + "settings": { + "network": "tcp,udp", + "timeout": 0, + "followRedirect": true + } + }, { "port": 2333, "listen": "127.0.0.1", @@ -55,6 +60,8 @@ ], "dns": { "servers": [ + "1.1.1.1", + "1.0.0.1", "8.8.8.8", "8.8.4.4", "localhost" @@ -66,34 +73,16 @@ { "type": "field", "ip": [ - "0.0.0.0/8", - "10.0.0.0/8", - "100.64.0.0/10", - "127.0.0.0/8", - "169.254.0.0/16", - "172.16.0.0/12", - "192.0.0.0/24", - "192.0.2.0/24", - "192.168.0.0/16", - "198.18.0.0/15", - "198.51.100.0/24", - "203.0.113.0/24", - "::1/128", - "fc00::/7", - "fe80::/10", + "geoip:private", "geoip:cn" ], - "domain": [ - "geosite:cn" - ], "outboundTag": "direct" }, { - "type": "chinasites", - "outboundTag": "direct" - }, - { - "type": "chinaip", + "type": "field", + "domain": [ + "geosite:cn" + ], "outboundTag": "direct" } ] diff --git a/config/client/ws.json b/config/client/ws.json index c062444..7f600df 100644 --- a/config/client/ws.json +++ b/config/client/ws.json @@ -1,8 +1,4 @@ { - "log": { - "error": "error.log", - "loglevel": "warning" - }, "outbounds": [ { "protocol": "vmess", @@ -35,6 +31,15 @@ } ], "inbounds": [ + { + "port": "1099", + "protocol": "dokodemo-door", + "settings": { + "network": "tcp,udp", + "timeout": 0, + "followRedirect": true + } + }, { "port": 2333, "listen": "127.0.0.1", @@ -58,6 +63,8 @@ ], "dns": { "servers": [ + "1.1.1.1", + "1.0.0.1", "8.8.8.8", "8.8.4.4", "localhost" @@ -69,34 +76,16 @@ { "type": "field", "ip": [ - "0.0.0.0/8", - "10.0.0.0/8", - "100.64.0.0/10", - "127.0.0.0/8", - "169.254.0.0/16", - "172.16.0.0/12", - "192.0.0.0/24", - "192.0.2.0/24", - "192.168.0.0/16", - "198.18.0.0/15", - "198.51.100.0/24", - "203.0.113.0/24", - "::1/128", - "fc00::/7", - "fe80::/10", + "geoip:private", "geoip:cn" ], - "domain": [ - "geosite:cn" - ], "outboundTag": "direct" }, { - "type": "chinasites", - "outboundTag": "direct" - }, - { - "type": "chinaip", + "type": "field", + "domain": [ + "geosite:cn" + ], "outboundTag": "direct" } ] diff --git a/config/client/ws_tls.json b/config/client/ws_tls.json index 048924f..9281cd0 100644 --- a/config/client/ws_tls.json +++ b/config/client/ws_tls.json @@ -1,8 +1,4 @@ { - "log": { - "error": "error.log", - "loglevel": "warning" - }, "outbounds": [ { "protocol": "vmess", @@ -45,6 +41,15 @@ } ], "inbounds": [ + { + "port": "1099", + "protocol": "dokodemo-door", + "settings": { + "network": "tcp,udp", + "timeout": 0, + "followRedirect": true + } + }, { "port": 2333, "listen": "127.0.0.1", @@ -68,6 +73,8 @@ ], "dns": { "servers": [ + "1.1.1.1", + "1.0.0.1", "8.8.8.8", "8.8.4.4", "localhost" @@ -79,34 +86,16 @@ { "type": "field", "ip": [ - "0.0.0.0/8", - "10.0.0.0/8", - "100.64.0.0/10", - "127.0.0.0/8", - "169.254.0.0/16", - "172.16.0.0/12", - "192.0.0.0/24", - "192.0.2.0/24", - "192.168.0.0/16", - "198.18.0.0/15", - "198.51.100.0/24", - "203.0.113.0/24", - "::1/128", - "fc00::/7", - "fe80::/10", + "geoip:private", "geoip:cn" ], - "domain": [ - "geosite:cn" - ], "outboundTag": "direct" }, { - "type": "chinasites", - "outboundTag": "direct" - }, - { - "type": "chinaip", + "type": "field", + "domain": [ + "geosite:cn" + ], "outboundTag": "direct" } ] diff --git a/v2ray.sh b/v2ray.sh index ba91a3a..29878ec 100644 --- a/v2ray.sh +++ b/v2ray.sh @@ -10,7 +10,7 @@ none='\e[0m' # Root [[ $(id -u) != 0 ]] && echo -e " 哎呀……请使用 ${red}root ${none}用户运行 ${yellow}~(^_^) ${none}" && exit 1 -_version="v3.09" +_version="v3.10" cmd="apt-get" From 966bf6f733163b7555c5920147610ccb2d202d23 Mon Sep 17 00:00:00 2001 From: 233boy <31657650+233boy@users.noreply.github.com> Date: Tue, 25 Jun 2019 11:35:11 +0800 Subject: [PATCH 08/10] update dns config --- config/client/h2.json | 37 +++++++++++++++++++++++++++++++------ config/client/http.json | 37 +++++++++++++++++++++++++++++++------ config/client/kcp.json | 37 +++++++++++++++++++++++++++++++------ config/client/quic.json | 37 +++++++++++++++++++++++++++++++------ config/client/tcp.json | 37 +++++++++++++++++++++++++++++++------ config/client/ws.json | 37 +++++++++++++++++++++++++++++++------ config/client/ws_tls.json | 37 +++++++++++++++++++++++++++++++------ src/client_file.sh | 2 ++ v2ray.sh | 2 +- 9 files changed, 220 insertions(+), 43 deletions(-) diff --git a/config/client/h2.json b/config/client/h2.json index d0fb204..debbfac 100644 --- a/config/client/h2.json +++ b/config/client/h2.json @@ -35,6 +35,10 @@ "protocol": "freedom", "settings": {}, "tag": "direct" + }, + { + "protocol": "dns", + "tag": "dns-out" } ], "inbounds": [ @@ -47,24 +51,31 @@ "followRedirect": true } }, + { + "port": 2133, + "tag": "dns-in", + "protocol": "dokodemo-door", + "settings": { + "address": "127.0.0.1", + "port": 80, + "timeout": 0, + "network": "tcp,udp" + } + }, { "port": 2333, - "listen": "127.0.0.1", "protocol": "socks", "settings": { "auth": "noauth", - "udp": true, - "ip": "127.0.0.1" + "udp": true } }, { "port": 6666, - "listen": "127.0.0.1", "protocol": "http", "settings": { "auth": "noauth", - "udp": true, - "ip": "127.0.0.1" + "udp": true } } ], @@ -72,6 +83,13 @@ "servers": [ "1.1.1.1", "1.0.0.1", + { + "address": "119.29.29.29", + "port": 53, + "domains": [ + "geosite:cn" + ] + }, "8.8.8.8", "8.8.4.4", "localhost" @@ -80,6 +98,13 @@ "routing": { "domainStrategy": "IPOnDemand", "rules": [ + { + "type": "field", + "inboundTag": [ + "dns-in" + ], + "outboundTag": "dns-out" + }, { "type": "field", "ip": [ diff --git a/config/client/http.json b/config/client/http.json index de28a84..dc92e1f 100644 --- a/config/client/http.json +++ b/config/client/http.json @@ -65,6 +65,10 @@ "protocol": "freedom", "settings": {}, "tag": "direct" + }, + { + "protocol": "dns", + "tag": "dns-out" } ], "inbounds": [ @@ -77,24 +81,31 @@ "followRedirect": true } }, + { + "port": 2133, + "tag": "dns-in", + "protocol": "dokodemo-door", + "settings": { + "address": "127.0.0.1", + "port": 80, + "timeout": 0, + "network": "tcp,udp" + } + }, { "port": 2333, - "listen": "127.0.0.1", "protocol": "socks", "settings": { "auth": "noauth", - "udp": true, - "ip": "127.0.0.1" + "udp": true } }, { "port": 6666, - "listen": "127.0.0.1", "protocol": "http", "settings": { "auth": "noauth", - "udp": true, - "ip": "127.0.0.1" + "udp": true } } ], @@ -102,6 +113,13 @@ "servers": [ "1.1.1.1", "1.0.0.1", + { + "address": "119.29.29.29", + "port": 53, + "domains": [ + "geosite:cn" + ] + }, "8.8.8.8", "8.8.4.4", "localhost" @@ -110,6 +128,13 @@ "routing": { "domainStrategy": "IPOnDemand", "rules": [ + { + "type": "field", + "inboundTag": [ + "dns-in" + ], + "outboundTag": "dns-out" + }, { "type": "field", "ip": [ diff --git a/config/client/kcp.json b/config/client/kcp.json index 2d94f97..477dac7 100644 --- a/config/client/kcp.json +++ b/config/client/kcp.json @@ -36,6 +36,10 @@ "protocol": "freedom", "settings": {}, "tag": "direct" + }, + { + "protocol": "dns", + "tag": "dns-out" } ], "inbounds": [ @@ -48,24 +52,31 @@ "followRedirect": true } }, + { + "port": 2133, + "tag": "dns-in", + "protocol": "dokodemo-door", + "settings": { + "address": "127.0.0.1", + "port": 80, + "timeout": 0, + "network": "tcp,udp" + } + }, { "port": 2333, - "listen": "127.0.0.1", "protocol": "socks", "settings": { "auth": "noauth", - "udp": true, - "ip": "127.0.0.1" + "udp": true } }, { "port": 6666, - "listen": "127.0.0.1", "protocol": "http", "settings": { "auth": "noauth", - "udp": true, - "ip": "127.0.0.1" + "udp": true } } ], @@ -73,6 +84,13 @@ "servers": [ "1.1.1.1", "1.0.0.1", + { + "address": "119.29.29.29", + "port": 53, + "domains": [ + "geosite:cn" + ] + }, "8.8.8.8", "8.8.4.4", "localhost" @@ -81,6 +99,13 @@ "routing": { "domainStrategy": "IPOnDemand", "rules": [ + { + "type": "field", + "inboundTag": [ + "dns-in" + ], + "outboundTag": "dns-out" + }, { "type": "field", "ip": [ diff --git a/config/client/quic.json b/config/client/quic.json index 5e6ca2d..7bef3fa 100644 --- a/config/client/quic.json +++ b/config/client/quic.json @@ -35,6 +35,10 @@ "protocol": "freedom", "settings": {}, "tag": "direct" + }, + { + "protocol": "dns", + "tag": "dns-out" } ], "inbounds": [ @@ -47,24 +51,31 @@ "followRedirect": true } }, + { + "port": 2133, + "tag": "dns-in", + "protocol": "dokodemo-door", + "settings": { + "address": "127.0.0.1", + "port": 80, + "timeout": 0, + "network": "tcp,udp" + } + }, { "port": 2333, - "listen": "127.0.0.1", "protocol": "socks", "settings": { "auth": "noauth", - "udp": true, - "ip": "127.0.0.1" + "udp": true } }, { "port": 6666, - "listen": "127.0.0.1", "protocol": "http", "settings": { "auth": "noauth", - "udp": true, - "ip": "127.0.0.1" + "udp": true } } ], @@ -72,6 +83,13 @@ "servers": [ "1.1.1.1", "1.0.0.1", + { + "address": "119.29.29.29", + "port": 53, + "domains": [ + "geosite:cn" + ] + }, "8.8.8.8", "8.8.4.4", "localhost" @@ -80,6 +98,13 @@ "routing": { "domainStrategy": "IPOnDemand", "rules": [ + { + "type": "field", + "inboundTag": [ + "dns-in" + ], + "outboundTag": "dns-out" + }, { "type": "field", "ip": [ diff --git a/config/client/tcp.json b/config/client/tcp.json index 8ff30d0..96b377e 100644 --- a/config/client/tcp.json +++ b/config/client/tcp.json @@ -25,6 +25,10 @@ "protocol": "freedom", "settings": {}, "tag": "direct" + }, + { + "protocol": "dns", + "tag": "dns-out" } ], "inbounds": [ @@ -37,24 +41,31 @@ "followRedirect": true } }, + { + "port": 2133, + "tag": "dns-in", + "protocol": "dokodemo-door", + "settings": { + "address": "127.0.0.1", + "port": 80, + "timeout": 0, + "network": "tcp,udp" + } + }, { "port": 2333, - "listen": "127.0.0.1", "protocol": "socks", "settings": { "auth": "noauth", - "udp": true, - "ip": "127.0.0.1" + "udp": true } }, { "port": 6666, - "listen": "127.0.0.1", "protocol": "http", "settings": { "auth": "noauth", - "udp": true, - "ip": "127.0.0.1" + "udp": true } } ], @@ -62,6 +73,13 @@ "servers": [ "1.1.1.1", "1.0.0.1", + { + "address": "119.29.29.29", + "port": 53, + "domains": [ + "geosite:cn" + ] + }, "8.8.8.8", "8.8.4.4", "localhost" @@ -70,6 +88,13 @@ "routing": { "domainStrategy": "IPOnDemand", "rules": [ + { + "type": "field", + "inboundTag": [ + "dns-in" + ], + "outboundTag": "dns-out" + }, { "type": "field", "ip": [ diff --git a/config/client/ws.json b/config/client/ws.json index 7f600df..3189143 100644 --- a/config/client/ws.json +++ b/config/client/ws.json @@ -28,6 +28,10 @@ "protocol": "freedom", "settings": {}, "tag": "direct" + }, + { + "protocol": "dns", + "tag": "dns-out" } ], "inbounds": [ @@ -40,24 +44,31 @@ "followRedirect": true } }, + { + "port": 2133, + "tag": "dns-in", + "protocol": "dokodemo-door", + "settings": { + "address": "127.0.0.1", + "port": 80, + "timeout": 0, + "network": "tcp,udp" + } + }, { "port": 2333, - "listen": "127.0.0.1", "protocol": "socks", "settings": { "auth": "noauth", - "udp": true, - "ip": "127.0.0.1" + "udp": true } }, { "port": 6666, - "listen": "127.0.0.1", "protocol": "http", "settings": { "auth": "noauth", - "udp": true, - "ip": "127.0.0.1" + "udp": true } } ], @@ -65,6 +76,13 @@ "servers": [ "1.1.1.1", "1.0.0.1", + { + "address": "119.29.29.29", + "port": 53, + "domains": [ + "geosite:cn" + ] + }, "8.8.8.8", "8.8.4.4", "localhost" @@ -73,6 +91,13 @@ "routing": { "domainStrategy": "IPOnDemand", "rules": [ + { + "type": "field", + "inboundTag": [ + "dns-in" + ], + "outboundTag": "dns-out" + }, { "type": "field", "ip": [ diff --git a/config/client/ws_tls.json b/config/client/ws_tls.json index 9281cd0..163fc51 100644 --- a/config/client/ws_tls.json +++ b/config/client/ws_tls.json @@ -38,6 +38,10 @@ "protocol": "freedom", "settings": {}, "tag": "direct" + }, + { + "protocol": "dns", + "tag": "dns-out" } ], "inbounds": [ @@ -50,24 +54,31 @@ "followRedirect": true } }, + { + "port": 2133, + "tag": "dns-in", + "protocol": "dokodemo-door", + "settings": { + "address": "127.0.0.1", + "port": 80, + "timeout": 0, + "network": "tcp,udp" + } + }, { "port": 2333, - "listen": "127.0.0.1", "protocol": "socks", "settings": { "auth": "noauth", - "udp": true, - "ip": "127.0.0.1" + "udp": true } }, { "port": 6666, - "listen": "127.0.0.1", "protocol": "http", "settings": { "auth": "noauth", - "udp": true, - "ip": "127.0.0.1" + "udp": true } } ], @@ -75,6 +86,13 @@ "servers": [ "1.1.1.1", "1.0.0.1", + { + "address": "119.29.29.29", + "port": 53, + "domains": [ + "geosite:cn" + ] + }, "8.8.8.8", "8.8.4.4", "localhost" @@ -83,6 +101,13 @@ "routing": { "domainStrategy": "IPOnDemand", "rules": [ + { + "type": "field", + "inboundTag": [ + "dns-in" + ], + "outboundTag": "dns-out" + }, { "type": "field", "ip": [ diff --git a/src/client_file.sh b/src/client_file.sh index 8bd5ddf..b47e3f7 100644 --- a/src/client_file.sh +++ b/src/client_file.sh @@ -1,3 +1,5 @@ +# vmess +_load vmess-config.sh _get_client_file() { local _link="$(cat $v2ray_client_config | tr -d [:space:] | base64 -w0)" local link="https://233boy.github.io/tools/json.html#${_link}" diff --git a/v2ray.sh b/v2ray.sh index 29878ec..2dd49d6 100644 --- a/v2ray.sh +++ b/v2ray.sh @@ -10,7 +10,7 @@ none='\e[0m' # Root [[ $(id -u) != 0 ]] && echo -e " 哎呀……请使用 ${red}root ${none}用户运行 ${yellow}~(^_^) ${none}" && exit 1 -_version="v3.10" +_version="v3.11" cmd="apt-get" From 6058e148f1a8be0a1792afcd8006e8b20c938cc7 Mon Sep 17 00:00:00 2001 From: 233boy <31657650+233boy@users.noreply.github.com> Date: Tue, 25 Jun 2019 11:42:38 +0800 Subject: [PATCH 09/10] fix bug --- src/vmess-config.sh | 8 ++++---- v2ray.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vmess-config.sh b/src/vmess-config.sh index a1e81cd..cb7e1f6 100644 --- a/src/vmess-config.sh +++ b/src/vmess-config.sh @@ -98,14 +98,14 @@ esac ## change client config file [[ -z $ip ]] && get_ip if [[ $v2ray_transport == [45] ]]; then - sed -i "s/233blog.com/$domain/; 13s/2333/443/; 16s/$old_id/$v2ray_id/; 17s/233/$alterId/" $v2ray_client_config + sed -i "s/233blog.com/$domain/; 9s/2333/443/; 12s/$old_id/$v2ray_id/; 13s/233/$alterId/" $v2ray_client_config if [[ $is_path ]]; then - sed -i "31s/233blog/$path/" $v2ray_client_config + sed -i "27s/233blog/$path/" $v2ray_client_config else - sed -i "31s/233blog//" $v2ray_client_config + sed -i "27s/233blog//" $v2ray_client_config fi else - sed -i "s/233blog.com/$ip/; 13s/2333/$v2ray_port/; 16s/$old_id/$v2ray_id/; 17s/233/$alterId/" $v2ray_client_config + sed -i "s/233blog.com/$ip/; 9s/2333/$v2ray_port/; 12s/$old_id/$v2ray_id/; 13s/233/$alterId/" $v2ray_client_config fi # zip -q -r -j --password "233blog.com" /etc/v2ray/233blog_v2ray.zip $v2ray_client_config diff --git a/v2ray.sh b/v2ray.sh index 2dd49d6..e62861c 100644 --- a/v2ray.sh +++ b/v2ray.sh @@ -10,7 +10,7 @@ none='\e[0m' # Root [[ $(id -u) != 0 ]] && echo -e " 哎呀……请使用 ${red}root ${none}用户运行 ${yellow}~(^_^) ${none}" && exit 1 -_version="v3.11" +_version="v3.12" cmd="apt-get" From 87340c995e84e7fb9dc7dc10711bcdf86db77a54 Mon Sep 17 00:00:00 2001 From: 233boy <31657650+233boy@users.noreply.github.com> Date: Tue, 25 Jun 2019 19:11:55 +0800 Subject: [PATCH 10/10] update rules --- config/client/h2.json | 13 ++++++++++++- config/client/http.json | 13 ++++++++++++- config/client/kcp.json | 13 ++++++++++++- config/client/quic.json | 13 ++++++++++++- config/client/tcp.json | 13 ++++++++++++- config/client/ws.json | 13 ++++++++++++- config/client/ws_tls.json | 13 ++++++++++++- v2ray.sh | 2 +- 8 files changed, 85 insertions(+), 8 deletions(-) diff --git a/config/client/h2.json b/config/client/h2.json index debbfac..1133c48 100644 --- a/config/client/h2.json +++ b/config/client/h2.json @@ -36,6 +36,11 @@ "settings": {}, "tag": "direct" }, + { + "protocol": "blackhole", + "settings": {}, + "tag": "blocked" + }, { "protocol": "dns", "tag": "dns-out" @@ -105,10 +110,16 @@ ], "outboundTag": "dns-out" }, + { + "type": "field", + "ip": [ + "geoip:private" + ], + "outboundTag": "blocked" + }, { "type": "field", "ip": [ - "geoip:private", "geoip:cn" ], "outboundTag": "direct" diff --git a/config/client/http.json b/config/client/http.json index dc92e1f..bf33a8d 100644 --- a/config/client/http.json +++ b/config/client/http.json @@ -66,6 +66,11 @@ "settings": {}, "tag": "direct" }, + { + "protocol": "blackhole", + "settings": {}, + "tag": "blocked" + }, { "protocol": "dns", "tag": "dns-out" @@ -135,10 +140,16 @@ ], "outboundTag": "dns-out" }, + { + "type": "field", + "ip": [ + "geoip:private" + ], + "outboundTag": "blocked" + }, { "type": "field", "ip": [ - "geoip:private", "geoip:cn" ], "outboundTag": "direct" diff --git a/config/client/kcp.json b/config/client/kcp.json index 477dac7..0ff2f09 100644 --- a/config/client/kcp.json +++ b/config/client/kcp.json @@ -37,6 +37,11 @@ "settings": {}, "tag": "direct" }, + { + "protocol": "blackhole", + "settings": {}, + "tag": "blocked" + }, { "protocol": "dns", "tag": "dns-out" @@ -106,10 +111,16 @@ ], "outboundTag": "dns-out" }, + { + "type": "field", + "ip": [ + "geoip:private" + ], + "outboundTag": "blocked" + }, { "type": "field", "ip": [ - "geoip:private", "geoip:cn" ], "outboundTag": "direct" diff --git a/config/client/quic.json b/config/client/quic.json index 7bef3fa..8dde17c 100644 --- a/config/client/quic.json +++ b/config/client/quic.json @@ -36,6 +36,11 @@ "settings": {}, "tag": "direct" }, + { + "protocol": "blackhole", + "settings": {}, + "tag": "blocked" + }, { "protocol": "dns", "tag": "dns-out" @@ -105,10 +110,16 @@ ], "outboundTag": "dns-out" }, + { + "type": "field", + "ip": [ + "geoip:private" + ], + "outboundTag": "blocked" + }, { "type": "field", "ip": [ - "geoip:private", "geoip:cn" ], "outboundTag": "direct" diff --git a/config/client/tcp.json b/config/client/tcp.json index 96b377e..06e4774 100644 --- a/config/client/tcp.json +++ b/config/client/tcp.json @@ -26,6 +26,11 @@ "settings": {}, "tag": "direct" }, + { + "protocol": "blackhole", + "settings": {}, + "tag": "blocked" + }, { "protocol": "dns", "tag": "dns-out" @@ -95,10 +100,16 @@ ], "outboundTag": "dns-out" }, + { + "type": "field", + "ip": [ + "geoip:private" + ], + "outboundTag": "blocked" + }, { "type": "field", "ip": [ - "geoip:private", "geoip:cn" ], "outboundTag": "direct" diff --git a/config/client/ws.json b/config/client/ws.json index 3189143..f4d3d0e 100644 --- a/config/client/ws.json +++ b/config/client/ws.json @@ -29,6 +29,11 @@ "settings": {}, "tag": "direct" }, + { + "protocol": "blackhole", + "settings": {}, + "tag": "blocked" + }, { "protocol": "dns", "tag": "dns-out" @@ -98,10 +103,16 @@ ], "outboundTag": "dns-out" }, + { + "type": "field", + "ip": [ + "geoip:private" + ], + "outboundTag": "blocked" + }, { "type": "field", "ip": [ - "geoip:private", "geoip:cn" ], "outboundTag": "direct" diff --git a/config/client/ws_tls.json b/config/client/ws_tls.json index 163fc51..757a882 100644 --- a/config/client/ws_tls.json +++ b/config/client/ws_tls.json @@ -39,6 +39,11 @@ "settings": {}, "tag": "direct" }, + { + "protocol": "blackhole", + "settings": {}, + "tag": "blocked" + }, { "protocol": "dns", "tag": "dns-out" @@ -108,10 +113,16 @@ ], "outboundTag": "dns-out" }, + { + "type": "field", + "ip": [ + "geoip:private" + ], + "outboundTag": "blocked" + }, { "type": "field", "ip": [ - "geoip:private", "geoip:cn" ], "outboundTag": "direct" diff --git a/v2ray.sh b/v2ray.sh index e62861c..a6eea0d 100644 --- a/v2ray.sh +++ b/v2ray.sh @@ -10,7 +10,7 @@ none='\e[0m' # Root [[ $(id -u) != 0 ]] && echo -e " 哎呀……请使用 ${red}root ${none}用户运行 ${yellow}~(^_^) ${none}" && exit 1 -_version="v3.12" +_version="v3.13" cmd="apt-get"