mirror of https://github.com/v2ray/v2ray-core
parent
1955d72e3e
commit
f59c0542c9
|
@ -108,12 +108,12 @@ func Listen(ctx context.Context, address net.Address, port net.Port, streamSetti
|
|||
config := tls.ConfigFromStreamSettings(streamSettings)
|
||||
if config == nil {
|
||||
// return nil, newError("TLS must be enabled for http transport.").AtWarning()
|
||||
h2s := &http2.Server{}
|
||||
h2s:=&http2.Server{}
|
||||
|
||||
server := &http.Server{
|
||||
Addr: serial.Concat(address, ":", port),
|
||||
// TLSConfig: config.GetTLSConfig(tls.WithNextProto("h2")),
|
||||
Handler: h2c.NewHandler(listener, h2s),
|
||||
Handler: h2c.NewHandler(listener,h2s),
|
||||
ReadHeaderTimeout: time.Second * 4,
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ func Listen(ctx context.Context, address net.Address, port net.Port, streamSetti
|
|||
}()
|
||||
|
||||
return listener, nil
|
||||
}
|
||||
} else {
|
||||
server := &http.Server{
|
||||
Addr: serial.Concat(address, ":", port),
|
||||
TLSConfig: config.GetTLSConfig(tls.WithNextProto("h2")),
|
||||
|
@ -159,7 +159,9 @@ func Listen(ctx context.Context, address net.Address, port net.Port, streamSetti
|
|||
newError("stoping serving TLS").Base(err).WriteToLog(session.ExportIDToError(ctx))
|
||||
}
|
||||
}()
|
||||
|
||||
return listener, nil
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
|
Loading…
Reference in New Issue