mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-23 19:37:46 +08:00
Merge pull request ipfs/go-ipfs-http-client#97 from ipfs/fix/decode
IDB58Decode -> Decode This commit was moved from ipfs/go-ipfs-http-client@e7332a87e8
This commit is contained in:
commit
861ff4a722
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/ipfs/interface-go-ipfs-core"
|
||||
iface "github.com/ipfs/interface-go-ipfs-core"
|
||||
caopts "github.com/ipfs/interface-go-ipfs-core/options"
|
||||
"github.com/ipfs/interface-go-ipfs-core/path"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
@ -45,7 +45,7 @@ func (api *KeyAPI) Generate(ctx context.Context, name string, opts ...caopts.Key
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out.pid, err = peer.IDB58Decode(out.Id)
|
||||
out.pid, err = peer.Decode(out.Id)
|
||||
return &out, err
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ func (api *KeyAPI) Rename(ctx context.Context, oldName string, newName string, o
|
||||
}
|
||||
|
||||
id := &keyOutput{JName: out.Now, Id: out.Id}
|
||||
id.pid, err = peer.IDB58Decode(id.Id)
|
||||
id.pid, err = peer.Decode(id.Id)
|
||||
return id, out.Overwrite, err
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ func (api *KeyAPI) List(ctx context.Context) ([]iface.Key, error) {
|
||||
res := make([]iface.Key, len(out.Keys))
|
||||
for i, k := range out.Keys {
|
||||
var err error
|
||||
k.pid, err = peer.IDB58Decode(k.Id)
|
||||
k.pid, err = peer.Decode(k.Id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -100,7 +100,7 @@ func (api *KeyAPI) Self(ctx context.Context) (iface.Key, error) {
|
||||
|
||||
var err error
|
||||
out := keyOutput{JName: "self", Id: id.ID}
|
||||
out.pid, err = peer.IDB58Decode(out.Id)
|
||||
out.pid, err = peer.Decode(out.Id)
|
||||
return &out, err
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ func (api *KeyAPI) Remove(ctx context.Context, name string) (iface.Key, error) {
|
||||
}
|
||||
|
||||
var err error
|
||||
out.Keys[0].pid, err = peer.IDB58Decode(out.Keys[0].Id)
|
||||
out.Keys[0].pid, err = peer.Decode(out.Keys[0].Id)
|
||||
return &out.Keys[0], err
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
|
||||
"github.com/ipfs/interface-go-ipfs-core"
|
||||
iface "github.com/ipfs/interface-go-ipfs-core"
|
||||
caopts "github.com/ipfs/interface-go-ipfs-core/options"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
)
|
||||
@ -41,7 +41,7 @@ func (api *PubsubAPI) Peers(ctx context.Context, opts ...caopts.PubSubPeersOptio
|
||||
|
||||
res := make([]peer.ID, len(out.Strings))
|
||||
for i, sid := range out.Strings {
|
||||
id, err := peer.IDB58Decode(sid)
|
||||
id, err := peer.Decode(sid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/ipfs/interface-go-ipfs-core"
|
||||
iface "github.com/ipfs/interface-go-ipfs-core"
|
||||
"github.com/libp2p/go-libp2p-core/network"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
"github.com/libp2p/go-libp2p-core/protocol"
|
||||
@ -91,7 +91,7 @@ func (api *SwarmAPI) Peers(ctx context.Context) ([]iface.ConnectionInfo, error)
|
||||
direction: conn.Direction,
|
||||
}
|
||||
|
||||
out.peer, err = peer.IDB58Decode(conn.Peer)
|
||||
out.peer, err = peer.Decode(conn.Peer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -131,7 +131,7 @@ func (api *SwarmAPI) KnownAddrs(ctx context.Context) (map[peer.ID][]multiaddr.Mu
|
||||
addrs[i] = a
|
||||
}
|
||||
|
||||
pid, err := peer.IDB58Decode(spid)
|
||||
pid, err := peer.Decode(spid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user