TLS handshake timeout

This commit is contained in:
Fangliding
2026-11-16 08:43:03 +08:00
parent 676eaf66f8
commit 87bd03816a
+7
View File
@@ -103,6 +103,13 @@ func (c *UConn) Close() error {
return c.Conn.Close()
}
func (c *UConn) HandshakeContext(ctx context.Context) error {
// Chrome の default handshake timeout
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()
return c.UConn.HandshakeContext(ctx)
}
func (c *UConn) HandshakeContextServerName(ctx context.Context) string {
if err := c.HandshakeContext(ctx); err != nil {
return ""