File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525
2626 // ErrNotReady is returned when a Read/Write attempt is made before the tunnel is ready.
2727 ErrNotReady = errors .New ("tunnel not ready" )
28+
29+ // ErrBadProxy is returned when attempting to use an unregistered proxy.
30+ ErrBadProxy = errors .New ("unknown proxy" )
31+ )
32+
33+ const (
34+ // dialTimeoutInSeconds tells how long to wait on Dial
35+ dialTimeoutInSeconds = 10
2836)
2937
3038// tunnelInfo holds state about the VPN tunnelInfo that has longer duration than a
@@ -119,7 +127,12 @@ func (c *Client) Start(ctx context.Context) error {
119127func (c * Client ) start (ctx context.Context ) error {
120128 c .emit (EventReady )
121129
122- conn , err := c .dial (ctx )
130+ // we hardcode a lesser-lived context for dial step for now.
131+ dialCtx , cancel := context .WithDeadline (
132+ context .Background (),
133+ time .Now ().Add (dialTimeoutInSeconds * time .Second ))
134+ defer cancel ()
135+ conn , err := c .dial (dialCtx )
123136 if err != nil {
124137 return err
125138 }
You can’t perform that action at this time.
0 commit comments