server+brontide: use ECDH interface for brontide handshake
This commit is contained in:
7 files changed
+94
-66
No files matched your search
+4
-2
@@ -8,6 +8,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
)
|
||||
|
||||
@@ -32,8 +33,9 @@ var _ net.Conn = (*Conn)(nil)
|
||||
// remote peer located at address which has remotePub as its long-term static
|
||||
// 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,
|
||||
func Dial(local keychain.SingleKeyECDH, netAddr *lnwire.NetAddress,
|
||||
dialer func(string, string) (net.Conn, error)) (*Conn, error) {
|
||||
|
||||
ipAddr := netAddr.Address.String()
|
||||
var conn net.Conn
|
||||
var err error
|
||||
@@ -44,7 +46,7 @@ func Dial(localPriv *btcec.PrivateKey, netAddr *lnwire.NetAddress,
|
||||
|
||||
b := &Conn{
|
||||
conn: conn,
|
||||
noise: NewBrontideMachine(true, localPriv, netAddr.IdentityKey),
|
||||
noise: NewBrontideMachine(true, local, netAddr.IdentityKey),
|
||||
}
|
||||
|
||||
// Initiate the handshake by sending the first act to the receiver.
|
||||
|
||||
Reference in new issue
Block a user