Fix server create

This commit is contained in:
世界 2022-08-27 17:35:25 +08:00
parent d6dce7e634
commit 4360e71743
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4

View File

@ -38,8 +38,10 @@ func NewServer(ctx context.Context, options option.V2RayGRPCOptions, tlsConfig *
errorHandler: errorHandler, errorHandler: errorHandler,
path: fmt.Sprintf("/%s/Tun", url.QueryEscape(options.ServiceName)), path: fmt.Sprintf("/%s/Tun", url.QueryEscape(options.ServiceName)),
} }
if !common.Contains(tlsConfig.NextProtos, "h2") { if tlsConfig != nil {
tlsConfig.NextProtos = append(tlsConfig.NextProtos, "h2") if !common.Contains(tlsConfig.NextProtos, "h2") {
tlsConfig.NextProtos = append(tlsConfig.NextProtos, "h2")
}
} }
server.httpServer = &http.Server{ server.httpServer = &http.Server{
Handler: server, Handler: server,