From d4fbad4ed7ec78edcbdb69859d103a794fe53f5e Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Fri, 9 Apr 2021 18:15:46 +0800 Subject: [PATCH] Fix: vmess h2 use server as host if host option is empty --- adapters/outbound/vmess.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/adapters/outbound/vmess.go b/adapters/outbound/vmess.go index c759f6e1..0d05f8d6 100644 --- a/adapters/outbound/vmess.go +++ b/adapters/outbound/vmess.go @@ -270,7 +270,12 @@ func NewVmess(option VmessOption) (*Vmess, error) { option: &option, } - if option.Network == "grpc" { + switch option.Network { + case "h2": + if len(option.HTTP2Opts.Host) == 0 { + option.HTTP2Opts.Host = append(option.HTTP2Opts.Host, option.Server) + } + case "grpc": dialFn := func(network, addr string) (net.Conn, error) { c, err := dialer.DialContext(context.Background(), "tcp", v.addr) if err != nil {