Skip to content

Commit 7fe7c25

Browse files
committed
add xhttp
1 parent 5993b5f commit 7fe7c25

File tree

5 files changed

+33
-22
lines changed

5 files changed

+33
-22
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
- 支持所有常用协议
1818
- 一键添加 VLESS-REALITY (默认)
1919
- 一键添加 Shadowsocks 2022
20-
- 一键添加 VMess-(TCP/mKCP/QUIC)
20+
- 一键添加 VMess-(TCP/mKCP)
2121
- 一键添加 VMess-(WS/H2/gRPC)-TLS
22-
- 一键添加 VLESS-(WS/H2/gRPC)-TLS
22+
- 一键添加 VLESS-(WS/H2/gRPC/XHTTP)-TLS
2323
- 一键添加 Trojan-(WS/H2/gRPC)-TLS
24-
- 一键添加 VMess-(TCP/mKCP/QUIC) 动态端口
24+
- 一键添加 VMess-(TCP/mKCP) 动态端口
2525
- 一键启用 BBR
2626
- 一键更改伪装网站
2727
- 一键更改 (端口/UUID/密码/域名/路径/加密方式/SNI/动态端口/等...)

install.sh

+1
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ check_status() {
198198
# dependent pkg install fail
199199
[[ ! -f $is_pkg_ok ]] && {
200200
msg err "安装依赖包失败"
201+
msg err "请尝试手动安装依赖包: $cmd update -y; $cmd install -y $pkg"
201202
is_fail=1
202203
}
203204

src/caddy.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ ${host}:${is_https_port} {
3939
import ${is_caddy_site_file}.add
4040
}"
4141
;;
42-
splithttp)
42+
xhttp)
4343
cat >${is_caddy_site_file} <<<"
4444
${host}:${is_https_port} {
4545
reverse_proxy ${path}/* 127.0.0.1:${port}

src/core.sh

+27-17
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
protocol_list=(
44
VMess-TCP
55
VMess-mKCP
6-
VMess-QUIC
6+
# VMess-QUIC
77
VMess-H2-TLS
88
VMess-WS-TLS
99
VMess-gRPC-TLS
1010
VLESS-H2-TLS
1111
VLESS-WS-TLS
1212
VLESS-gRPC-TLS
13-
VLESS-SplitHTTP-TLS
13+
VLESS-XHTTP-TLS
1414
VLESS-REALITY
1515
Trojan-H2-TLS
1616
Trojan-WS-TLS
@@ -19,7 +19,7 @@ protocol_list=(
1919
# Dokodemo-Door
2020
VMess-TCP-dynamic-port
2121
VMess-mKCP-dynamic-port
22-
VMess-QUIC-dynamic-port
22+
# VMess-QUIC-dynamic-port
2323
Socks
2424
)
2525
ss_method_list=(
@@ -125,7 +125,7 @@ get_uuid() {
125125
}
126126

127127
get_ip() {
128-
[[ $ip || $is_no_auto_tls || $is_gen ]] && return
128+
[[ $ip || $is_no_auto_tls || $is_gen || $is_dont_get_ip ]] && return
129129
export "$(_wget -4 -qO- https://one.one.one.one/cdn-cgi/trace | grep ip=)" &>/dev/null
130130
[[ ! $ip ]] && export "$(_wget -6 -qO- https://one.one.one.one/cdn-cgi/trace | grep ip=)" &>/dev/null
131131
[[ ! $ip ]] && {
@@ -727,6 +727,8 @@ change() {
727727

728728
# delete config.
729729
del() {
730+
# dont get ip
731+
is_dont_get_ip=1
730732
[[ $is_conf_dir_empty ]] && return # not found any json file.
731733
# get a config file
732734
[[ ! $is_config_file ]] && get info $1
@@ -756,6 +758,7 @@ del() {
756758
warn "当前配置目录为空! 因为你刚刚删除了最后一个配置文件."
757759
is_conf_dir_empty=1
758760
fi
761+
unset is_dont_get_ip
759762
[[ $is_dont_auto_exit ]] && unset is_config_file
760763
}
761764

@@ -875,14 +878,15 @@ add() {
875878
is_lower=${1,,}
876879
if [[ $is_lower ]]; then
877880
case $is_lower in
878-
tcp | kcp | quic | tcpd | kcpd | quicd)
881+
# tcp | kcp | quic | tcpd | kcpd | quicd)
882+
tcp | kcp | tcpd | kcpd)
879883
is_new_protocol=VMess-$(sed 's/^K/mK/;s/D$/-dynamic-port/' <<<${is_lower^^})
880884
;;
881885
ws | h2 | grpc | vws | vh2 | vgrpc | tws | th2 | tgrpc)
882886
is_new_protocol=$(sed -E "s/^V/VLESS-/;s/^T/Trojan-/;/^(W|H|G)/{s/^/VMess-/};s/G/g/" <<<${is_lower^^})-TLS
883887
;;
884-
vsh | split | splithttp)
885-
is_new_protocol=VLESS-SplitHTTP-TLS
888+
xhttp)
889+
is_new_protocol=VLESS-XHTTP-TLS
886890
;;
887891
r | reality)
888892
is_new_protocol=VLESS-REALITY
@@ -981,7 +985,7 @@ add() {
981985
kcp_seed=
982986
[[ $(grep -i tcp <<<$is_new_protocol) ]] && header_type=
983987
;;
984-
h2 | ws | grpc | splithttp)
988+
h2 | ws | grpc | xhttp)
985989
old_host=$host
986990
if [[ ! $is_use_tls ]]; then
987991
host=
@@ -1201,10 +1205,10 @@ get() {
12011205
is_json_str=$(cat $is_conf_dir/"$is_config_file")
12021206
is_json_data_base=$(jq '.inbounds[0]|.protocol,.port,(.settings|(.clients[0]|.id,.password),.method,.password,.address,.port,.detour.to,(.accounts[0]|.user,.pass))' <<<$is_json_str)
12031207
[[ $? != 0 ]] && err "无法读取此文件: $is_config_file"
1204-
is_json_data_more=$(jq '.inbounds[0]|.streamSettings|.network,.tcpSettings.header.type,(.kcpSettings|.seed,.header.type),.quicSettings.header.type,.wsSettings.path,.httpSettings.path,.grpcSettings.serviceName,.splithttpSettings.path' <<<$is_json_str)
1205-
is_json_data_host=$(jq '.inbounds[0]|.streamSettings|.grpc_host,.wsSettings.headers.Host,.httpSettings.host[0],.splithttpSettings.host' <<<$is_json_str)
1208+
is_json_data_more=$(jq '.inbounds[0]|.streamSettings|.network,.tcpSettings.header.type,(.kcpSettings|.seed,.header.type),.quicSettings.header.type,.wsSettings.path,.httpSettings.path,.grpcSettings.serviceName,.xhttpSettings.path' <<<$is_json_str)
1209+
is_json_data_host=$(jq '.inbounds[0]|.streamSettings|.grpc_host,.wsSettings.headers.Host,.httpSettings.host[0],.xhttpSettings.host' <<<$is_json_str)
12061210
is_json_data_reality=$(jq '.inbounds[0]|.streamSettings|.security,(.realitySettings|.serverNames[0],.publicKey,.privateKey)' <<<$is_json_str)
1207-
is_up_var_set=(null is_protocol port uuid trojan_password ss_method ss_password door_addr door_port is_dynamic_port is_socks_user is_socks_pass net tcp_type kcp_seed kcp_type quic_type ws_path h2_path grpc_path split_path grpc_host ws_host h2_host split_host is_reality is_servername is_public_key is_private_key)
1211+
is_up_var_set=(null is_protocol port uuid trojan_password ss_method ss_password door_addr door_port is_dynamic_port is_socks_user is_socks_pass net tcp_type kcp_seed kcp_type quic_type ws_path h2_path grpc_path xhttp_path grpc_host ws_host h2_host xhttp_host is_reality is_servername is_public_key is_private_key)
12081212
[[ $is_debug ]] && msg "\n------------- debug: $is_config_file -------------"
12091213
i=0
12101214
for v in $(sed 's/""/null/g;s/"//g' <<<"$is_json_data_base $is_json_data_more $is_json_data_host $is_json_data_reality"); do
@@ -1216,8 +1220,14 @@ get() {
12161220
[[ ${!v} == 'null' ]] && unset $v
12171221
done
12181222

1219-
path="${ws_path}${h2_path}${grpc_path}${split_path}"
1220-
host="${ws_host}${h2_host}${grpc_host}${split_host}"
1223+
# splithttp
1224+
if [[ $net == 'splithttp' ]]; then
1225+
net=xhttp
1226+
xhttp_path=$(jq -r '.inbounds[0]|.streamSettings|.splithttpSettings.path' <<<$is_json_str)
1227+
xhttp_host=$(jq -r '.inbounds[0]|.streamSettings|.splithttpSettings.host' <<<$is_json_str)
1228+
fi
1229+
path="${ws_path}${h2_path}${grpc_path}${xhttp_path}"
1230+
host="${ws_host}${h2_host}${grpc_host}${xhttp_host}"
12211231
header_type="${tcp_type}${kcp_type}${quic_type}"
12221232
if [[ $is_reality == 'reality' ]]; then
12231233
net=reality
@@ -1343,10 +1353,10 @@ get() {
13431353
[[ ! $path ]] && path="/$uuid"
13441354
is_stream='httpSettings:{path:"'$path'",host:["'$host'"]}'
13451355
;;
1346-
*split*)
1347-
net=splithttp
1356+
*xhttp*)
1357+
net=xhttp
13481358
[[ ! $path ]] && path="/$uuid"
1349-
is_stream='splithttpSettings:{host:"'$host'",path:"'$path'"}'
1359+
is_stream='xhttpSettings:{host:"'$host'",path:"'$path'"}'
13501360
;;
13511361
*)
13521362
err "无法识别传输协议: $is_config_file"
@@ -1503,7 +1513,7 @@ info() {
15031513
is_url="ss://$(echo -n ${ss_method}:${ss_password} | base64 -w 0)@${is_addr}:${port}#233boy-$net-${is_addr}"
15041514
is_info_str=($is_protocol $is_addr $port $ss_password $ss_method)
15051515
;;
1506-
ws | h2 | grpc | splithttp)
1516+
ws | h2 | grpc | xhttp)
15071517
is_color=45
15081518
is_can_change=(0 1 2 3 5)
15091519
is_info_show=(0 1 2 3 4 6 7 8)

xray.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

33
args=$@
4-
is_sh_ver=v1.23
4+
is_sh_ver=v1.24
55

66
. /etc/xray/sh/src/init.sh

0 commit comments

Comments
 (0)