Maybe fix merge conflict?

The solution I chose was to avoid setting up a TLS connection if one was already provided to the `serve()` functions.
This commit is contained in:
s0ph0s 2024-12-13 22:55:59 -05:00
parent cd223d9e57
commit c883e617da
2 changed files with 6 additions and 2 deletions

View file

@ -52,6 +52,7 @@ import (
"path"
"path/filepath"
"regexp"
"reflect"
"runtime/debug"
"slices"
"sort"
@ -727,7 +728,8 @@ func serve(listenerName string, cid int64, tlsConfig *tls.Config, nc net.Conn, x
}
}()
if xtls {
isAlreadyTLS := reflect.TypeOf(nc) == reflect.TypeFor[*tls.Conn]()
if xtls && !isAlreadyTLS {
// Start TLS on connection. We perform the handshake explicitly, so we can set a
// timeout, do client certificate authentication, log TLS details afterwards.
c.xtlsHandshakeAndAuthenticate(c.conn)

View file

@ -23,6 +23,7 @@ import (
"net"
"net/textproto"
"os"
"reflect"
"runtime/debug"
"slices"
"sort"
@ -893,7 +894,8 @@ func serve(listenerName string, cid int64, hostname dns.Domain, tlsConfig *tls.C
}
}()
if xtls {
isAlreadyTLS := reflect.TypeOf(nc) == reflect.TypeFor[*tls.Conn]()
if xtls && !isAlreadyTLS {
// Start TLS on connection. We perform the handshake explicitly, so we can set a
// timeout, do client certificate authentication, log TLS details afterwards.
c.xtlsHandshakeAndAuthenticate(c.conn)