Commit 8b7bf266 authored by Łukasz Magiera's avatar Łukasz Magiera

p2p: add peer address to peerstore if specified

License: MIT
Signed-off-by: default avatarŁukasz Magiera <magik6k@gmail.com>
parent 633b04e5
......@@ -11,8 +11,9 @@ import (
cmds "github.com/ipfs/go-ipfs/commands"
core "github.com/ipfs/go-ipfs/core"
"gx/ipfs/QmSP88ryZkHSRn1fnngAaV2Vcn63WUJzAavnRM9CVdU1Ky/go-ipfs-cmdkit"
pstore "gx/ipfs/QmXauCuJzmzapetmC6W4TuDJLL1yFFrVzSHoWv8YdbmnxH/go-libp2p-peerstore"
ma "gx/ipfs/QmYmsdtJ3HsodkePE3eU3TsCaP2YvPZJ4LoXnNkDE5Tpt7/go-multiaddr"
"gx/ipfs/QmdE4gMduCKCGAcczM2F5ioYDfdeKuPix138wrES1YSr7f/go-ipfs-cmdkit"
)
// P2PListenerInfoOutput is output type of ls command
......@@ -267,12 +268,16 @@ can transparently connect to a p2p service.
return
}
_, peer, err := ParsePeerParam(req.Arguments()[0])
addr, peer, err := ParsePeerParam(req.Arguments()[0])
if err != nil {
res.SetError(err, cmdkit.ErrNormal)
return
}
if addr != nil {
n.Peerstore.AddAddr(peer, addr, pstore.TempAddrTTL)
}
proto := "/p2p/" + req.Arguments()[1]
bindAddr, _ := ma.NewMultiaddr("/ip4/127.0.0.1/tcp/0")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment