From 945be73bca889d494081fa82db006f5c71e578f4 Mon Sep 17 00:00:00 2001 From: MeshCollider Date: Tue, 23 Jan 2018 18:38:58 +1300 Subject: [PATCH] brontide: Make dialer parameter in brontide.Dial non-optional --- brontide/conn.go | 10 ++-------- brontide/noise_test.go | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/brontide/conn.go b/brontide/conn.go index 0edc2ee2..79091f1d 100644 --- a/brontide/conn.go +++ b/brontide/conn.go @@ -33,17 +33,11 @@ var _ net.Conn = (*Conn)(nil) // public key. In the case of a handshake failure, the connection is closed and // a non-nil error is returned. func Dial(localPriv *btcec.PrivateKey, netAddr *lnwire.NetAddress, - dialer ...func(string, string) (net.Conn, error)) (*Conn, error) { + dialer func(string, string) (net.Conn, error)) (*Conn, error) { ipAddr := netAddr.Address.String() var conn net.Conn var err error - if dialer == nil { - // A dial function WAS NOT passed in. - conn, err = net.Dial("tcp", ipAddr) - } else { - // A dial function WAS passed in so we use it instead. - conn, err = dialer[0]("tcp", ipAddr) - } + conn, err = dialer("tcp", ipAddr) if err != nil { return nil, err } diff --git a/brontide/noise_test.go b/brontide/noise_test.go index ac76a0d0..b40d3e83 100644 --- a/brontide/noise_test.go +++ b/brontide/noise_test.go @@ -47,7 +47,7 @@ func establishTestConnection() (net.Conn, net.Conn, func(), error) { conErrChan := make(chan error, 1) connChan := make(chan net.Conn, 1) go func() { - conn, err := Dial(remotePriv, netAddr) + conn, err := Dial(remotePriv, netAddr, net.Dial) conErrChan <- err connChan <- conn