summaryrefslogtreecommitdiff
path: root/dialer.go
diff options
context:
space:
mode:
Diffstat (limited to 'dialer.go')
-rw-r--r--dialer.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/dialer.go b/dialer.go
index f38586d..402ac7e 100644
--- a/dialer.go
+++ b/dialer.go
@@ -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
})
}