mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-13 04:08:08 +08:00
Merge pull request #396 from jbenet/idcmd-fix
Fix ID command lookups of unconnected nodes
This commit is contained in:
commit
2ec2c85cbb
@ -93,15 +93,13 @@ func printPeer(p peer.Peer) (interface{}, error) {
|
||||
info := new(IdOutput)
|
||||
|
||||
info.ID = p.ID().String()
|
||||
if p.PubKey() == nil {
|
||||
return nil, errors.New(`peer publickey not populated on offline runs,
|
||||
please run the daemon to use ipfs id!`)
|
||||
if p.PubKey() != nil {
|
||||
pkb, err := p.PubKey().Bytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
info.PublicKey = base64.StdEncoding.EncodeToString(pkb)
|
||||
}
|
||||
pkb, err := p.PubKey().Bytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
info.PublicKey = base64.StdEncoding.EncodeToString(pkb)
|
||||
for _, a := range p.Addresses() {
|
||||
info.Addresses = append(info.Addresses, a.String())
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user