diff options
Diffstat (limited to 'dialer.go')
-rw-r--r-- | dialer.go | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -3,6 +3,7 @@ package obfsvpn import ( "context" "encoding/base64" + "errors" "fmt" "net" "strconv" @@ -24,6 +25,10 @@ const ( certLength = ntor.NodeIDLength + ntor.PublicKeyLength ) +var ( + ErrCannotDial = errors.New("cannot dial") +) + // IATMode determines the amount of time sent between packets. type IATMode int @@ -137,6 +142,9 @@ func (d *Dialer) Dial(network, address string) (net.Conn, error) { ctx := context.Background() return d.dial(ctx, network, address, func(network, address string) (net.Conn, error) { conn, err := d.Dialer.DialContext(ctx, network, address) + if err != nil { + return nil, fmt.Errorf("%w: %s", ErrCannotDial, err) + } return conn.(*net.TCPConn), err }) } |