diff --git a/config/client/quic.json b/config/client/quic.json new file mode 100644 index 0000000..98487f6 --- /dev/null +++ b/config/client/quic.json @@ -0,0 +1,111 @@ +{ + "log": { + "error": "error.log", + "loglevel": "warning" + }, + "outbounds": [ + { + "protocol": "vmess", + "settings": { + "vnext": [ + { + "address": "233blog.com", + "port": 2333, + "users": [ + { + "id": "e55c8d17-2cf3-b21a-bcf1-eeacb011ed79", + "alterId": 233, + "security": "auto" + } + ] + } + ] + }, + "streamSettings": { + "network": "quic", + "quicSettings": { + "security": "aes-128-gcm", + "key": "", + "header": { + "type": "none" + } + } + }, + "mux": { + "enabled": true + } + }, + { + "protocol": "freedom", + "settings": {}, + "tag": "direct" + } + ], + "inbounds": [ + { + "port": 2333, + "listen": "127.0.0.1", + "protocol": "socks", + "settings": { + "auth": "noauth", + "udp": true, + "ip": "127.0.0.1" + } + }, + { + "port": 6666, + "listen": "127.0.0.1", + "protocol": "http", + "settings": { + "auth": "noauth", + "udp": true, + "ip": "127.0.0.1" + } + } + ], + "dns": { + "servers": [ + "8.8.8.8", + "8.8.4.4", + "localhost" + ] + }, + "routing": { + "domainStrategy": "IPOnDemand", + "rules": [ + { + "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:cn" + ], + "domain": [ + "geosite:cn" + ], + "outboundTag": "direct" + }, + { + "type": "chinasites", + "outboundTag": "direct" + }, + { + "type": "chinaip", + "outboundTag": "direct" + } + ] + } +} \ No newline at end of file diff --git a/config/server/dynamic/quic.json b/config/server/dynamic/quic.json new file mode 100644 index 0000000..06b21f1 --- /dev/null +++ b/config/server/dynamic/quic.json @@ -0,0 +1,171 @@ +{ + "log": { + "access": "/var/log/v2ray/access.log", + "error": "/var/log/v2ray/error.log", + "loglevel": "warning" + }, + "inbounds": [ + { + "port": 2333, + "protocol": "vmess", + "settings": { + "clients": [ + { + "id": "e55c8d17-2cf3-b21a-bcf1-eeacb011ed79", + "level": 1, + "alterId": 233 + } + ], + "detour": { + "to": "dynamic" + } + }, + "streamSettings": { + "network": "quic" + }, + "sniffing": { + "enabled": true, + "destOverride": [ + "http", + "tls" + ] + } + }, + { + "protocol": "vmess", + "port": "10000-20000", + "tag": "dynamic", + "settings": { + "default": { + "level": 1, + "alterId": 32 + } + }, + "allocate": { + "strategy": "random", + "concurrency": 2, + "refresh": 5 + }, + "streamSettings": { + "network": "quic", + "quicSettings": { + "security": "aes-128-gcm", + "key": "", + "header": { + "type": "none" + } + } + } + } + //include_ss + //include_socks + //include_mtproto + //include_config + // + ], + "outbounds": [ + { + "protocol": "freedom", + "settings": {} + }, + { + "protocol": "blackhole", + "settings": {}, + "tag": "blocked" + }, + { + "protocol": "freedom", + "settings": {}, + "tag": "direct" + }, + { + "protocol": "mtproto", + "settings": {}, + "tag": "tg-out" + } + ], + "dns": { + "server": [ + "8.8.8.8", + "8.8.4.4", + "1.1.1.1", + "1.0.0.1", + "localhost" + ] + }, + "routing": { + "domainStrategy": "IPOnDemand", + "rules": [ + { + "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" + ], + "outboundTag": "blocked" + }, + { + "type": "field", + "domain": [ + "domain:epochtimes.com", + "domain:epochtimes.com.tw", + "domain:epochtimes.fr", + "domain:epochtimes.de", + "domain:epochtimes.jp", + "domain:epochtimes.ru", + "domain:epochtimes.co.il", + "domain:epochtimes.co.kr", + "domain:epochtimes-romania.com", + "domain:erabaru.net", + "domain:lagranepoca.com", + "domain:theepochtimes.com", + "domain:ntdtv.com", + "domain:ntd.tv", + "domain:ntdtv-dc.com", + "domain:ntdtv.com.tw", + "domain:minghui.org", + "domain:renminbao.com", + "domain:dafahao.com", + "domain:dongtaiwang.com", + "domain:falundafa.org", + "domain:wujieliulan.com", + "domain:ninecommentaries.com", + "domain:shenyun.com" + ], + "outboundTag": "blocked" + }, + { + "type": "field", + "inboundTag": ["tg-in"], + "outboundTag": "tg-out" + } + //include_ban_bt + //include_ban_ad + //include_rules + // + ] + }, + "transport": { + "kcpSettings": { + "uplinkCapacity": 100, + "downlinkCapacity": 100, + "congestion": true + }, + "sockopt": { + "tcpFastOpen": true + } + } +} \ No newline at end of file diff --git a/config/server/quic.json b/config/server/quic.json new file mode 100644 index 0000000..fcc66ba --- /dev/null +++ b/config/server/quic.json @@ -0,0 +1,149 @@ +{ + "log": { + "access": "/var/log/v2ray/access.log", + "error": "/var/log/v2ray/error.log", + "loglevel": "warning" + }, + "inbounds": [ + { + "port": 2333, + "protocol": "vmess", + "settings": { + "clients": [ + { + "id": "e55c8d17-2cf3-b21a-bcf1-eeacb011ed79", + "level": 1, + "alterId": 233 + } + ] + }, + "streamSettings": { + "network": "quic", + "quicSettings": { + "security": "aes-128-gcm", + "key": "", + "header": { + "type": "none" + } + } + }, + "sniffing": { + "enabled": true, + "destOverride": [ + "http", + "tls" + ] + } + } + //include_ss + //include_socks + //include_mtproto + //include_config + // + ], + "outbounds": [ + { + "protocol": "freedom", + "settings": {} + }, + { + "protocol": "blackhole", + "settings": {}, + "tag": "blocked" + }, + { + "protocol": "freedom", + "settings": {}, + "tag": "direct" + }, + { + "protocol": "mtproto", + "settings": {}, + "tag": "tg-out" + } + ], + "dns": { + "server": [ + "8.8.8.8", + "8.8.4.4", + "1.1.1.1", + "1.0.0.1", + "localhost" + ] + }, + "routing": { + "domainStrategy": "IPOnDemand", + "rules": [ + { + "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" + ], + "outboundTag": "blocked" + }, + { + "type": "field", + "domain": [ + "domain:epochtimes.com", + "domain:epochtimes.com.tw", + "domain:epochtimes.fr", + "domain:epochtimes.de", + "domain:epochtimes.jp", + "domain:epochtimes.ru", + "domain:epochtimes.co.il", + "domain:epochtimes.co.kr", + "domain:epochtimes-romania.com", + "domain:erabaru.net", + "domain:lagranepoca.com", + "domain:theepochtimes.com", + "domain:ntdtv.com", + "domain:ntd.tv", + "domain:ntdtv-dc.com", + "domain:ntdtv.com.tw", + "domain:minghui.org", + "domain:renminbao.com", + "domain:dafahao.com", + "domain:dongtaiwang.com", + "domain:falundafa.org", + "domain:wujieliulan.com", + "domain:ninecommentaries.com", + "domain:shenyun.com" + ], + "outboundTag": "blocked" + }, + { + "type": "field", + "inboundTag": ["tg-in"], + "outboundTag": "tg-out" + } + //include_ban_bt + //include_ban_ad + //include_rules + // + ] + }, + "transport": { + "kcpSettings": { + "uplinkCapacity": 100, + "downlinkCapacity": 100, + "congestion": true + }, + "sockopt": { + "tcpFastOpen": true + } + } +} \ No newline at end of file diff --git a/install.sh b/install.sh index 6f8a654..8ddedc2 100644 --- a/install.sh +++ b/install.sh @@ -58,6 +58,12 @@ transport=( mKCP_wechat-video mKCP_dtls mKCP_wireguard + QUIC + QUIC_utp + QUIC_srtp + QUIC_wechat-video + QUIC_dtls + QUIC_wireguard TCP_dynamicPort TCP_HTTP_dynamicPort WebSocket_dynamicPort @@ -67,6 +73,12 @@ transport=( mKCP_wechat-video_dynamicPort mKCP_dtls_dynamicPort mKCP_wireguard_dynamicPort + QUIC_dynamicPort + QUIC_utp_dynamicPort + QUIC_srtp_dynamicPort + QUIC_wechat-video_dynamicPort + QUIC_dtls_dynamicPort + QUIC_wireguard_dynamicPort ) ciphers=( @@ -147,7 +159,7 @@ v2ray_port_config() { ;; esac done - if [[ $v2ray_transport -ge 12 ]]; then + if [[ $v2ray_transport -ge 18 ]]; then v2ray_dynamic_port_start fi ;; @@ -633,7 +645,7 @@ install_info() { echo echo -e "$yellow 路径分流 = ${cyan}/${path}$none" fi - elif [[ $v2ray_transport -ge 12 ]]; then + elif [[ $v2ray_transport -ge 18 ]]; then echo echo -e "$yellow V2Ray 端口 = $cyan$v2ray_port$none" echo @@ -832,7 +844,7 @@ config() { v2ray_id=$uuid alterId=233 ban_bt=true - if [[ $v2ray_transport -ge 12 ]]; then + if [[ $v2ray_transport -ge 18 ]]; then v2ray_dynamicPort_start=${v2ray_dynamic_port_start_input} v2ray_dynamicPort_end=${v2ray_dynamic_port_end_input} fi @@ -860,7 +872,7 @@ config() { open_port "80" open_port "443" open_port $v2ray_port - elif [[ $v2ray_transport -ge 12 ]]; then + elif [[ $v2ray_transport -ge 18 ]]; then open_port $v2ray_port open_port "multiport" else @@ -874,7 +886,7 @@ config() { backup_config() { sed -i "18s/=1/=$v2ray_transport/; 21s/=2333/=$v2ray_port/; 24s/=$old_id/=$uuid/" $backup - if [[ $v2ray_transport -ge 12 ]]; then + if [[ $v2ray_transport -ge 18 ]]; then sed -i "30s/=10000/=$v2ray_dynamic_port_start_input/; 33s/=20000/=$v2ray_dynamic_port_end_input/" $backup fi if [[ $shadowsocks ]]; then diff --git a/src/transport.sh b/src/transport.sh new file mode 100644 index 0000000..20d4614 --- /dev/null +++ b/src/transport.sh @@ -0,0 +1,34 @@ +transport=( + TCP + TCP_HTTP + WebSocket + "WebSocket + TLS" + HTTP/2 + mKCP + mKCP_utp + mKCP_srtp + mKCP_wechat-video + mKCP_dtls + mKCP_wireguard + QUIC + QUIC_utp + QUIC_srtp + QUIC_wechat-video + QUIC_dtls + QUIC_wireguard + TCP_dynamicPort + TCP_HTTP_dynamicPort + WebSocket_dynamicPort + mKCP_dynamicPort + mKCP_utp_dynamicPort + mKCP_srtp_dynamicPort + mKCP_wechat-video_dynamicPort + mKCP_dtls_dynamicPort + mKCP_wireguard_dynamicPort + QUIC_dynamicPort + QUIC_utp_dynamicPort + QUIC_srtp_dynamicPort + QUIC_wechat-video_dynamicPort + QUIC_dtls_dynamicPort + QUIC_wireguard_dynamicPort +) diff --git a/src/uninstall.sh b/src/uninstall.sh index 0423126..cb3989b 100644 --- a/src/uninstall.sh +++ b/src/uninstall.sh @@ -72,7 +72,7 @@ if [[ $is_uninstall_v2ray && $is_uninstall_caddy ]]; then del_port "80" del_port "443" del_port $v2ray_port - elif [[ $v2ray_transport -ge 12 ]]; then + elif [[ $v2ray_transport -ge 18 ]]; then del_port $v2ray_port del_port "multiport" else @@ -134,7 +134,7 @@ elif [[ $is_uninstall_v2ray ]]; then del_port "80" del_port "443" del_port $v2ray_port - elif [[ $v2ray_transport -ge 12 ]]; then + elif [[ $v2ray_transport -ge 18 ]]; then del_port $v2ray_port del_port "multiport" else diff --git a/src/v2ray-info.sh b/src/v2ray-info.sh index 2a910ab..f362c22 100644 --- a/src/v2ray-info.sh +++ b/src/v2ray-info.sh @@ -7,43 +7,66 @@ _v2_args() { _path="/" fi case $v2ray_transport in - 1 | 12) + 1 | 18) net="tcp" ;; - 2 | 13) + 2 | 19) net="tcp" header="http" host="www.baidu.com" ;; - 3 | 4 | 14) + 3 | 4 | 20) net="ws" ;; 5) net="h2" ;; - 6 | 15) + 6 | 21) net="kcp" ;; - 7 | 16) + 7 | 22) net="kcp" header="utp" ;; - 8 | 17) + 8 | 23) net="kcp" header="srtp" ;; - 9 | 18) + 9 | 24) net="kcp" header="wechat-video" ;; - 10 | 19) + 10 | 25) net="kcp" header="dtls" ;; - 11 | 20) + 11 | 26) net="kcp" header="wireguard" ;; + 12 | 27) + net="quic" + ;; + 13 | 28) + net="quic" + header="utp" + ;; + 14 | 29) + net="quic" + header="srtp" + ;; + 15 | 30) + net="quic" + header="wechat-video" + ;; + 16 | 31) + net="quic" + header="dtls" + ;; + 17 | 32) + net="quic" + header="wireguard" + ;; esac } @@ -94,10 +117,10 @@ _v2_info() { echo -e "$yellow 伪装类型 (header type) = ${cyan}${header}$none" echo fi - if [[ $v2ray_transport -ge 12 ]] && [[ $ban_ad ]]; then + if [[ $v2ray_transport -ge 18 ]] && [[ $ban_ad ]]; then echo " 备注: 动态端口已启用...广告拦截已开启..." echo - elif [[ $v2ray_transport -ge 12 ]]; then + elif [[ $v2ray_transport -ge 18 ]]; then echo " 备注: 动态端口已启用..." echo elif [[ $ban_ad ]]; then diff --git a/src/v2ray-transport-args.sh b/src/v2ray-transport-args.sh deleted file mode 100644 index 8b13789..0000000 --- a/src/v2ray-transport-args.sh +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/vmess-config.sh b/src/vmess-config.sh index bb69696..a1e81cd 100644 --- a/src/vmess-config.sh +++ b/src/vmess-config.sh @@ -24,22 +24,30 @@ case $v2ray_transport in v2ray_server_config_file="/etc/v2ray/233boy/v2ray/config/server/kcp.json" v2ray_client_config_file="/etc/v2ray/233boy/v2ray/config/client/kcp.json" ;; -12) +1[2-7]) + v2ray_server_config_file="/etc/v2ray/233boy/v2ray/config/server/quic.json" + v2ray_client_config_file="/etc/v2ray/233boy/v2ray/config/client/quic.json" + ;; +18) v2ray_server_config_file="/etc/v2ray/233boy/v2ray/config/server/dynamic/tcp.json" v2ray_client_config_file="/etc/v2ray/233boy/v2ray/config/client/tcp.json" ;; -13) +19) v2ray_server_config_file="/etc/v2ray/233boy/v2ray/config/server/dynamic/http.json" v2ray_client_config_file="/etc/v2ray/233boy/v2ray/config/client/http.json" ;; -14) +20) v2ray_server_config_file="/etc/v2ray/233boy/v2ray/config/server/dynamic/ws.json" v2ray_client_config_file="/etc/v2ray/233boy/v2ray/config/client/ws.json" ;; -*) +2[1-6]) v2ray_server_config_file="/etc/v2ray/233boy/v2ray/config/server/dynamic/kcp.json" v2ray_client_config_file="/etc/v2ray/233boy/v2ray/config/client/kcp.json" ;; +*) + v2ray_server_config_file="/etc/v2ray/233boy/v2ray/config/server/dynamic/quic.json" + v2ray_client_config_file="/etc/v2ray/233boy/v2ray/config/client/quic.json" + ;; esac # copy config file @@ -50,12 +58,12 @@ cp -f $v2ray_client_config_file $v2ray_client_config sed -i "9s/2333/$v2ray_port/; 14s/$old_id/$v2ray_id/; 16s/233/$alterId/" $v2ray_server_config # change dynamic port -if [[ $v2ray_transport -ge 12 ]]; then +if [[ $v2ray_transport -ge 18 ]]; then local multi_port="${v2ray_dynamicPort_start}-${v2ray_dynamicPort_end}" sed -i "s/10000-20000/$multi_port/" $v2ray_server_config fi -# change domain and path, or mkcp headers +# change domain and path, or header type case $v2ray_transport in 5) sed -i "24s/233blog.com/$domain/" $v2ray_server_config @@ -65,23 +73,23 @@ case $v2ray_transport in sed -i "26s/233blog//" $v2ray_server_config fi ;; -7 | 16) +7 | 13 | 22 | 28) sed -i "s/none/utp/" $v2ray_server_config sed -i "s/none/utp/" $v2ray_client_config ;; -8 | 17) +8 | 14 | 23 | 29) sed -i "s/none/srtp/" $v2ray_server_config sed -i "s/none/srtp/" $v2ray_client_config ;; -9 | 18) +9 | 15 | 24 | 30) sed -i "s/none/wechat-video/" $v2ray_server_config sed -i "s/none/wechat-video/" $v2ray_client_config ;; -10 | 19) +10 | 16 | 25 | 31) sed -i "s/none/dtls/" $v2ray_server_config sed -i "s/none/dtls/" $v2ray_client_config ;; -11 | 20) +11 | 17 | 26 | 32) sed -i "s/none/wireguard/" $v2ray_server_config sed -i "s/none/wireguard/" $v2ray_client_config ;; diff --git a/templates/quic.json b/templates/quic.json new file mode 100644 index 0000000..5e19884 --- /dev/null +++ b/templates/quic.json @@ -0,0 +1,30 @@ +{ + "port": 2333, // v2ray port + "protocol": "vmess", + "settings": { + "clients": [ + { + "id": "e55c8d17-2cf3-b21a-bcf1-eeacb011ed79", // uuid + "level": 1, + "alterId": 233 // alaterid + } + ] + }, + "streamSettings": { + "network": "quic", + "security": "aes-128-gcm", + "key": "", + "quicSettings": { + "header": { + "type": "none" // options > [none, srtp, utp, wechat-video, dtls, wireguard] + } + } + }, + "sniffing": { + "enabled": true, + "destOverride": [ + "http", + "tls" + ] + } +} \ No newline at end of file diff --git a/tools/quic.sh b/tools/quic.sh new file mode 100644 index 0000000..83bdab4 --- /dev/null +++ b/tools/quic.sh @@ -0,0 +1,8 @@ +#!/bin/bash +backup="/etc/v2ray/233blog_v2ray_backup.conf" +. $backup +if [[ $v2ray_transport -ge 13 ]]; then + tmp_transport=$(($v2ray_transport +6)) + sed -i "18s/=$v2ray_transport/=$tmp_transport/" $backup +fi +v2ray update.sh diff --git a/v2ray.sh b/v2ray.sh index d75dea8..1ba2596 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.07-test" +_version="v3.08-test" cmd="apt-get" @@ -59,7 +59,7 @@ fi if [[ $mark != "v3" ]]; then . /etc/v2ray/233boy/v2ray/tools/v3.sh fi -if [[ $v2ray_transport -ge 12 ]]; then +if [[ $v2ray_transport -ge 18 ]]; then dynamicPort=true port_range="${v2ray_dynamicPort_start}-${v2ray_dynamicPort_end}" fi @@ -98,29 +98,7 @@ else caddy_run_status="$red未在运行$none" fi -transport=( - TCP - TCP_HTTP - WebSocket - "WebSocket + TLS" - HTTP/2 - mKCP - mKCP_utp - mKCP_srtp - mKCP_wechat-video - mKCP_dtls - mKCP_wireguard - TCP_dynamicPort - TCP_HTTP_dynamicPort - WebSocket_dynamicPort - mKCP_dynamicPort - mKCP_utp_dynamicPort - mKCP_srtp_dynamicPort - mKCP_wechat-video_dynamicPort - mKCP_dtls_dynamicPort - mKCP_wireguard_dynamicPort -) - +_load transport.sh ciphers=( aes-128-cfb aes-256-cfb @@ -928,7 +906,7 @@ change_v2ray_transport() { if [[ $v2ray_transport_opt == [45] ]]; then tls_config - elif [[ $v2ray_transport_opt -ge 12 ]]; then + elif [[ $v2ray_transport_opt -ge 18 ]]; then v2ray_dynamic_port_start v2ray_dynamic_port_end pause @@ -973,7 +951,7 @@ old_transport() { if [[ $is_path ]]; then backup_config -path fi - elif [[ $v2ray_transport -ge 12 ]]; then + elif [[ $v2ray_transport -ge 18 ]]; then del_port "multiport" fi } @@ -1036,7 +1014,7 @@ tls_config() { is_path=true fi - if [[ $v2ray_transport -ge 12 ]]; then + if [[ $v2ray_transport -ge 18 ]]; then del_port "multiport" fi domain=$new_domain @@ -1066,7 +1044,7 @@ tls_config() { proxy_site=$new_proxy_site is_path=true fi - if [[ $v2ray_transport -ge 12 ]]; then + if [[ $v2ray_transport -ge 18 ]]; then del_port "multiport" fi domain=$new_domain @@ -1122,7 +1100,7 @@ auto_tls_config() { proxy_site=$new_proxy_site is_path=true fi - if [[ $v2ray_transport -ge 12 ]]; then + if [[ $v2ray_transport -ge 18 ]]; then del_port "multiport" fi domain=$new_domain @@ -1146,7 +1124,7 @@ auto_tls_config() { pause domain_check backup_config v2ray_transport domain - if [[ $v2ray_transport -ge 12 ]]; then + if [[ $v2ray_transport -ge 18 ]]; then del_port "multiport" fi domain=$new_domain @@ -1377,7 +1355,7 @@ v2ray_dynamic_port_end() { } change_v2ray_dynamicport() { - if [[ $v2ray_transport -ge 12 ]]; then + if [[ $v2ray_transport -ge 18 ]]; then change_v2ray_dynamic_port_start change_v2ray_dynamic_port_end pause @@ -2282,10 +2260,10 @@ create_v2ray_config_text() { echo "伪装类型 (header type) = ${header}" echo fi - if [[ $v2ray_transport -ge 12 ]] && [[ $ban_ad ]]; then + if [[ $v2ray_transport -ge 18 ]] && [[ $ban_ad ]]; then echo "备注: 动态端口已启用...广告拦截已开启..." echo - elif [[ $v2ray_transport -ge 12 ]]; then + elif [[ $v2ray_transport -ge 18 ]]; then echo "备注: 动态端口已启用..." echo elif [[ $ban_ad ]]; then