mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-23 06:35:07 +01:00
rpcserver: add support to connect to onion addresses
In this commit, we now allow connections to onion addresses due to recently adding support to properly parse them. Co-Authored-By: Eugene <crypt-iq@users.noreply.github.com>
This commit is contained in:
parent
3669a40c52
commit
d6d0c26252
1 changed files with 2 additions and 15 deletions
17
rpcserver.go
17
rpcserver.go
|
@ -9,8 +9,6 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -635,25 +633,14 @@ func (r *rpcServer) ConnectPeer(ctx context.Context,
|
|||
return nil, fmt.Errorf("cannot make connection to self")
|
||||
}
|
||||
|
||||
// If the address doesn't already have a port, we'll assume the current
|
||||
// default port.
|
||||
var addr string
|
||||
_, _, err = net.SplitHostPort(in.Addr.Host)
|
||||
if err != nil {
|
||||
addr = net.JoinHostPort(in.Addr.Host, strconv.Itoa(defaultPeerPort))
|
||||
} else {
|
||||
addr = in.Addr.Host
|
||||
}
|
||||
|
||||
// We use ResolveTCPAddr here in case we wish to resolve hosts over Tor.
|
||||
host, err := cfg.net.ResolveTCPAddr("tcp", addr)
|
||||
addr, err := parseAddr(in.Addr.Host)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
peerAddr := &lnwire.NetAddress{
|
||||
IdentityKey: pubKey,
|
||||
Address: host,
|
||||
Address: addr,
|
||||
ChainNet: activeNetParams.Net,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue