mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-30 01:52:26 +08:00
p2p/net/conn/dialer: added Dialer field
This commit is contained in:
@ -41,11 +41,10 @@ func (d *Dialer) Dial(ctx context.Context, raddr ma.Multiaddr, remote peer.ID) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: try to get reusing addr/ports to work.
|
// TODO: try to get reusing addr/ports to work.
|
||||||
// madialer := manet.Dialer{LocalAddr: laddr}
|
// d.Dialer.LocalAddr = laddr
|
||||||
madialer := manet.Dialer{}
|
|
||||||
|
|
||||||
log.Debugf("%s dialing %s %s", d.LocalPeer, remote, raddr)
|
log.Debugf("%s dialing %s %s", d.LocalPeer, remote, raddr)
|
||||||
maconn, err := madialer.Dial(raddr)
|
maconn, err := d.Dialer.Dial(raddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
|
|
||||||
msgio "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-msgio"
|
msgio "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-msgio"
|
||||||
ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
|
ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
|
||||||
|
manet "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr-net"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Map maps Keys (Peer.IDs) to Connections.
|
// Map maps Keys (Peer.IDs) to Connections.
|
||||||
@ -52,6 +53,9 @@ type Conn interface {
|
|||||||
// no longer simple (need a peerstore, a local peer, a context, a network, etc)
|
// no longer simple (need a peerstore, a local peer, a context, a network, etc)
|
||||||
type Dialer struct {
|
type Dialer struct {
|
||||||
|
|
||||||
|
// Dialer is an optional manet.Dialer to use.
|
||||||
|
Dialer manet.Dialer
|
||||||
|
|
||||||
// LocalPeer is the identity of the local Peer.
|
// LocalPeer is the identity of the local Peer.
|
||||||
LocalPeer peer.ID
|
LocalPeer peer.ID
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user