1
1
mirror of https://git.sr.ht/~emersion/tlstunnel synced 2024-11-19 15:53:50 +01:00

Ignore EOF on tls.Conn.Handshake

This happens when using the tls-alpn-01 challange.
This commit is contained in:
Simon Ser 2022-02-03 10:22:53 +01:00
parent 47f87cf2fc
commit 4bf50457dc

@ -288,7 +288,9 @@ func (ln *Listener) handle(conn net.Conn) error {
if err := tlsConn.SetDeadline(time.Now().Add(tlsHandshakeTimeout)); err != nil { if err := tlsConn.SetDeadline(time.Now().Add(tlsHandshakeTimeout)); err != nil {
return fmt.Errorf("failed to set TLS handshake timeout: %v", err) return fmt.Errorf("failed to set TLS handshake timeout: %v", err)
} }
if err := tlsConn.Handshake(); err != nil { if err := tlsConn.Handshake(); err == io.EOF {
return nil
} else if err != nil {
return fmt.Errorf("TLS handshake failed: %v", err) return fmt.Errorf("TLS handshake failed: %v", err)
} }
if err := tlsConn.SetDeadline(time.Time{}); err != nil { if err := tlsConn.SetDeadline(time.Time{}); err != nil {