Set 10s TCP dial timeout on GorillaDialer via NetDialContext

This commit is contained in:
Jay
2026-06-04 20:36:52 -04:00
parent ef2304f327
commit 3ea4393876
2 changed files with 6 additions and 6 deletions
+5 -3
View File
@@ -3,6 +3,7 @@ package transport
import (
"context"
"log/slog"
"net"
"net/http"
"time"
@@ -18,12 +19,13 @@ type GorillaDialer struct {
*websocket.Dialer
}
const dialTimeout = 10 * time.Second
func NewGorillaDialer() *GorillaDialer {
netDialer := &net.Dialer{Timeout: dialTimeout}
return &GorillaDialer{
Dialer: &websocket.Dialer{
HandshakeTimeout: 45 * time.Second,
ReadBufferSize: 1024,
WriteBufferSize: 1024,
NetDialContext: netDialer.DialContext,
},
}
}