Fix: vmess h2 use server as host if host option is empty

This commit is contained in:
gVisor bot 2021-04-09 18:15:46 +08:00
parent 887752e8f1
commit d4fbad4ed7

View file

@ -270,7 +270,12 @@ func NewVmess(option VmessOption) (*Vmess, error) {
option: &option, 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) { dialFn := func(network, addr string) (net.Conn, error) {
c, err := dialer.DialContext(context.Background(), "tcp", v.addr) c, err := dialer.DialContext(context.Background(), "tcp", v.addr)
if err != nil { if err != nil {