Skip to content

Commit

Permalink
fix for #3
Browse files Browse the repository at this point in the history
Deadline was not set for TLS1.3
  • Loading branch information
g0rbe committed May 31, 2022
1 parent 4a3082d commit 76f090d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/protocols/tls/tls13/tls13.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ func handshake(network, ip, port string, timeout time.Duration, ciphers []cipher
uTlsConn := tls.UClient(dialConn, &conf, tls.HelloCustom)
defer uTlsConn.Close()

if err := uTlsConn.SetDeadline(time.Now().Add(timeout)); err != nil {
return result, err
}

spec := tls.ClientHelloSpec{
TLSVersMax: tls.VersionTLS13,
TLSVersMin: tls.VersionTLS10,
Expand Down Expand Up @@ -97,6 +101,9 @@ func handshake(network, ip, port string, timeout time.Duration, ciphers []cipher
case strings.Contains(err.Error(), "EOF"):
// Based on the tests, EOF means that no reaction to handshake, a "close notify" or TCP RST.
return result, nil
case strings.Contains(err.Error(), "i/o timeout"):
// Unresponsive server
return result, nil
default:
return result, fmt.Errorf("failed to handshake: %s", err)
}
Expand Down

0 comments on commit 76f090d

Please sign in to comment.