Improve tls writer

This commit is contained in:
世界
2022-09-30 11:27:18 +08:00
parent 968430c338
commit 1173fdea64
16 changed files with 358 additions and 39 deletions

View File

@@ -72,8 +72,12 @@ func (h *HTTP) Close() error {
}
func (h *HTTP) NewConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext) error {
var err error
if h.tlsConfig != nil {
conn = h.tlsConfig.Server(conn)
conn, err = tls.ServerHandshake(ctx, conn, h.tlsConfig)
if err != nil {
return err
}
}
return http.HandleConnection(ctx, conn, std_bufio.NewReader(conn), h.authenticator, h.upstreamUserHandler(metadata), adapter.UpstreamMetadata(metadata))
}