Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade ipfs deps #95

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion account_export.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"io"
"strings"

ipfs_interface "github.com/ipfs/boxo/coreiface"
"github.com/ipfs/go-cid"
cbornode "github.com/ipfs/go-ipld-cbor"
ipfs_interface "github.com/ipfs/interface-go-ipfs-core"
mh "github.com/multiformats/go-multihash"
"go.uber.org/multierr"
"go.uber.org/zap"
Expand Down
2 changes: 1 addition & 1 deletion api_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (s *service) ServiceGetConfiguration(ctx context.Context, req *protocoltype
AccountPK: member,
DevicePK: device,
AccountGroupPK: accountGroup.Group().PublicKey,
PeerID: key.ID().Pretty(),
PeerID: key.ID().String(),
Listeners: listeners,
}, nil
}
2 changes: 1 addition & 1 deletion api_contact.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (s *service) RefreshContactRequest(ctx context.Context, req *protocoltypes.
}

res.PeersFound = append(res.PeersFound, &protocoltypes.RefreshContactRequest_Peer{
ID: p.ID.Pretty(),
ID: p.ID.String(),
Addrs: addrs,
})
}
Expand Down
6 changes: 3 additions & 3 deletions api_debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func (s *service) PeerList(ctx context.Context, request *protocoltypes.PeerList_
if api == nil {
return nil, errcode.TODO.Wrap(fmt.Errorf("IPFS Core API is not available"))
}
swarmPeers, err := api.Swarm().Peers(ctx) // https://pkg.go.dev/github.com/ipfs/interface-go-ipfs-core#ConnectionInfo
swarmPeers, err := api.Swarm().Peers(ctx) // https://pkg.go.dev/github.com/ipfs/boxo/coreiface#ConnectionInfo
if err != nil {
return nil, errcode.TODO.Wrap(err)
}
Expand All @@ -248,7 +248,7 @@ func (s *service) PeerList(ctx context.Context, request *protocoltypes.PeerList_
// each peer in the swarm should be visible
for _, swarmPeer := range swarmPeers {
peers[swarmPeer.ID()] = &protocoltypes.PeerList_Peer{
ID: swarmPeer.ID().Pretty(),
ID: swarmPeer.ID().String(),
Errors: []string{},
Routes: []*protocoltypes.PeerList_Route{},
}
Expand All @@ -270,7 +270,7 @@ func (s *service) PeerList(ctx context.Context, request *protocoltypes.PeerList_
peer, ok := peers[swarmPeer.ID()]
if !ok {
peer = &protocoltypes.PeerList_Peer{
ID: swarmPeer.ID().Pretty(),
ID: swarmPeer.ID().String(),
Errors: []string{},
Routes: []*protocoltypes.PeerList_Route{},
}
Expand Down
6 changes: 3 additions & 3 deletions api_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (s *service) craftPeerConnectedMessage(peer peer.ID) (*protocoltypes.GroupD
}

connected := protocoltypes.GroupDeviceStatus_Reply_PeerConnected{
PeerID: peer.Pretty(),
PeerID: peer.String(),
DevicePK: devicePKRaw,
}

Expand Down Expand Up @@ -207,12 +207,12 @@ CONN_LOOP:

func (s *service) craftDeviceDisconnectedMessage(peer peer.ID) *protocoltypes.GroupDeviceStatus_Reply_PeerDisconnected {
return &protocoltypes.GroupDeviceStatus_Reply_PeerDisconnected{
PeerID: peer.Pretty(),
PeerID: peer.String(),
}
}

func (s *service) craftDeviceReconnectedMessage(peer peer.ID) *protocoltypes.GroupDeviceStatus_Reply_PeerReconnecting {
return &protocoltypes.GroupDeviceStatus_Reply_PeerReconnecting{
PeerID: peer.Pretty(),
PeerID: peer.String(),
}
}
237 changes: 124 additions & 113 deletions go.mod

Large diffs are not rendered by default.

1,130 changes: 312 additions & 818 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion orbitdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"sync"
"time"

coreapi "github.com/ipfs/boxo/coreiface"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore"
ds_sync "github.com/ipfs/go-datastore/sync"
coreapi "github.com/ipfs/interface-go-ipfs-core"
"github.com/libp2p/go-libp2p/core/crypto"
peer "github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/p2p/host/eventbus"
Expand Down
8 changes: 4 additions & 4 deletions pkg/ipfsutil/conn_logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (cl *connLogger) Connected(net network.Network, c network.Conn) {
<-time.After(10 * time.Millisecond)
if tags := cl.getPeerTags(c.RemotePeer()); tags != nil {
cl.logger.Info("Connected",
logutil.PrivateString("peer", c.RemotePeer().Pretty()),
logutil.PrivateString("peer", c.RemotePeer().String()),
logutil.PrivateString("to", c.LocalMultiaddr().String()),
logutil.PrivateString("from", c.RemoteMultiaddr().String()),
logutil.PrivateStrings("tags", tags),
Expand All @@ -81,7 +81,7 @@ func (cl *connLogger) Connected(net network.Network, c network.Conn) {
func (cl *connLogger) Disconnected(n network.Network, c network.Conn) {
if tags := cl.getPeerTags(c.RemotePeer()); tags != nil {
cl.logger.Info("Disconnected",
logutil.PrivateString("peer", c.RemotePeer().Pretty()),
logutil.PrivateString("peer", c.RemotePeer().String()),
logutil.PrivateString("to", c.LocalMultiaddr().String()),
logutil.PrivateString("from", c.RemoteMultiaddr().String()),
logutil.PrivateStrings("tags", tags),
Expand All @@ -92,7 +92,7 @@ func (cl *connLogger) Disconnected(n network.Network, c network.Conn) {
func (cl *connLogger) OpenedStream(n network.Network, s network.Stream) {
if tags := cl.getPeerTags(s.Conn().RemotePeer()); tags != nil {
cl.logger.Debug("Stream opened",
logutil.PrivateString("peer", s.Conn().RemotePeer().Pretty()),
logutil.PrivateString("peer", s.Conn().RemotePeer().String()),
logutil.PrivateString("to", s.Conn().LocalMultiaddr().String()),
logutil.PrivateString("from", s.Conn().RemoteMultiaddr().String()),
logutil.PrivateString("protocol", string(s.Protocol())),
Expand All @@ -104,7 +104,7 @@ func (cl *connLogger) OpenedStream(n network.Network, s network.Stream) {
func (cl *connLogger) ClosedStream(n network.Network, s network.Stream) {
if tags := cl.getPeerTags(s.Conn().RemotePeer()); tags != nil {
cl.logger.Debug("Stream closed",
logutil.PrivateString("peer", s.Conn().RemotePeer().Pretty()),
logutil.PrivateString("peer", s.Conn().RemotePeer().String()),
logutil.PrivateString("to", s.Conn().LocalMultiaddr().String()),
logutil.PrivateString("from", s.Conn().RemoteMultiaddr().String()),
logutil.PrivateString("protocol", string(s.Protocol())),
Expand Down
2 changes: 1 addition & 1 deletion pkg/ipfsutil/extended_core_api.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ipfsutil

import (
ipfs_interface "github.com/ipfs/interface-go-ipfs-core"
ipfs_interface "github.com/ipfs/boxo/coreiface"
ipfs_core "github.com/ipfs/kubo/core"
ipfs_coreapi "github.com/ipfs/kubo/core/coreapi"
"github.com/libp2p/go-libp2p/core/connmgr"
Expand Down
2 changes: 1 addition & 1 deletion pkg/ipfsutil/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func ParseAndResolveMaddrs(ctx context.Context, logger *zap.Logger, addrs []stri
}
logger.Debug("rdvp peer resolved addrs",
logutil.PrivateString("input", addr),
// logutil.PrivateString("ID", rdvpeer.ID.Pretty()),
// logutil.PrivateString("ID", rdvpeer.ID.String()),
logutil.PrivateStrings("addrs", addrStrings),
)
outPeersUnmatched[j] = rdvpeer
Expand Down
2 changes: 1 addition & 1 deletion pkg/ipfsutil/localrecord.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"os"

ipfs_interface "github.com/ipfs/interface-go-ipfs-core"
ipfs_interface "github.com/ipfs/boxo/coreiface"
ipfs_core "github.com/ipfs/kubo/core"
"github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/core/network"
Expand Down
24 changes: 6 additions & 18 deletions pkg/ipfsutil/mobile.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@ import (
"context"
"fmt"

ds "github.com/ipfs/go-datastore"
ipfs_config "github.com/ipfs/kubo/config"
ipfs_p2p "github.com/ipfs/kubo/core/node/libp2p"
p2p "github.com/libp2p/go-libp2p"
dht "github.com/libp2p/go-libp2p-kad-dht"
p2p_dht "github.com/libp2p/go-libp2p-kad-dht"
"github.com/libp2p/go-libp2p-kad-dht/dual"
p2p_record "github.com/libp2p/go-libp2p-record"
host "github.com/libp2p/go-libp2p/core/host"
p2p_host "github.com/libp2p/go-libp2p/core/host"
p2p_peer "github.com/libp2p/go-libp2p/core/peer"
p2p_routing "github.com/libp2p/go-libp2p/core/routing"

ipfs_mobile "berty.tech/weshnet/pkg/ipfsutil/mobile"
Expand Down Expand Up @@ -117,27 +113,19 @@ func NewIPFSMobile(ctx context.Context, repo *ipfs_mobile.RepoMobile, opts *Mobi
}

func CustomRoutingOption(mode p2p_dht.ModeOpt, net DHTNetworkMode, opts ...p2p_dht.Option) func(
ctx context.Context,
host p2p_host.Host,
dstore ds.Batching,
validator p2p_record.Validator,
bootstrapPeers ...p2p_peer.AddrInfo,
args ipfs_p2p.RoutingOptionArgs,
) (p2p_routing.Routing, error) {
return func(
ctx context.Context,
host p2p_host.Host,
dstore ds.Batching,
validator p2p_record.Validator,
bootstrapPeers ...p2p_peer.AddrInfo,
args ipfs_p2p.RoutingOptionArgs,
) (p2p_routing.Routing, error) {
opts = append(opts,
p2p_dht.Mode(mode),
p2p_dht.Datastore(dstore),
p2p_dht.Validator(validator),
p2p_dht.BootstrapPeers(bootstrapPeers...),
p2p_dht.Datastore(args.Datastore),
p2p_dht.Validator(args.Validator),
p2p_dht.BootstrapPeers(args.BootstrapPeers...),
)

return newDualDHT(ctx, host, net, opts...)
return newDualDHT(args.Ctx, args.Host, net, opts...)
}
}

Expand Down
6 changes: 4 additions & 2 deletions pkg/ipfsutil/mobile/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (im *IpfsMobile) Close() error {
}

func (im *IpfsMobile) ServeCoreHTTP(l net.Listener, opts ...ipfs_corehttp.ServeOption) error {
gatewayOpt := ipfs_corehttp.GatewayOption(false, ipfs_corehttp.WebUIPaths...)
gatewayOpt := ipfs_corehttp.GatewayOption(ipfs_corehttp.WebUIPaths...)
opts = append(opts,
ipfs_corehttp.WebUIOption,
gatewayOpt,
Expand All @@ -79,9 +79,11 @@ func (im *IpfsMobile) ServeCoreHTTP(l net.Listener, opts ...ipfs_corehttp.ServeO
}

func (im *IpfsMobile) ServeGateway(l net.Listener, writable bool, opts ...ipfs_corehttp.ServeOption) error {
// TODO: do we need to pass writable another way?

opts = append(opts,
ipfs_corehttp.HostnameOption(),
ipfs_corehttp.GatewayOption(writable, "/ipfs", "/ipns"),
ipfs_corehttp.GatewayOption("/ipfs", "/ipns"),
ipfs_corehttp.VersionOption(),
ipfs_corehttp.CheckVersionOption(),
ipfs_corehttp.CommandsROOption(im.commandCtx),
Expand Down
16 changes: 3 additions & 13 deletions pkg/ipfsutil/mobile/routing.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
package node

import (
"context"
"fmt"

ds "github.com/ipfs/go-datastore"
ipfs_p2p "github.com/ipfs/kubo/core/node/libp2p"
p2p_record "github.com/libp2p/go-libp2p-record"
p2p_host "github.com/libp2p/go-libp2p/core/host"
p2p_peer "github.com/libp2p/go-libp2p/core/peer"
p2p_routing "github.com/libp2p/go-libp2p/core/routing"
)

Expand All @@ -19,20 +15,14 @@ type RoutingConfig struct {
}

func NewRoutingConfigOption(ro ipfs_p2p.RoutingOption, rc *RoutingConfig) ipfs_p2p.RoutingOption {
return func(
ctx context.Context,
host p2p_host.Host,
dstore ds.Batching,
validator p2p_record.Validator,
bootstrapPeers ...p2p_peer.AddrInfo,
) (p2p_routing.Routing, error) {
routing, err := ro(ctx, host, dstore, validator, bootstrapPeers...)
return func(args ipfs_p2p.RoutingOptionArgs) (p2p_routing.Routing, error) {
routing, err := ro(args)
if err != nil {
return nil, err
}

if rc.ConfigFunc != nil {
if err := rc.ConfigFunc(host, routing); err != nil {
if err := rc.ConfigFunc(args.Host, routing); err != nil {
return nil, fmt.Errorf("failed to config routing: %w", err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/ipfsutil/pubsub_adaptater.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ipfsutil

import (
ipfs_interface "github.com/ipfs/interface-go-ipfs-core"
ipfs_interface "github.com/ipfs/boxo/coreiface"
)

type pubsubCoreAPIAdapter struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/ipfsutil/pubsub_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"sync"

ipfs_interface "github.com/ipfs/interface-go-ipfs-core"
ipfs_iopts "github.com/ipfs/interface-go-ipfs-core/options"
ipfs_interface "github.com/ipfs/boxo/coreiface"
ipfs_iopts "github.com/ipfs/boxo/coreiface/options"
p2p_pubsub "github.com/libp2p/go-libp2p-pubsub"
p2p_peer "github.com/libp2p/go-libp2p/core/peer"
"go.uber.org/zap"
Expand Down
2 changes: 1 addition & 1 deletion pkg/ipfsutil/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func ResetRepoIdentity(c *ipfs_cfg.Config) error {
}

// Identity
c.Identity.PeerID = pid.Pretty()
c.Identity.PeerID = pid.String()
c.Identity.PrivKey = base64.StdEncoding.EncodeToString(privkeyb)

return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/ipfsutil/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func TestingRepo(t testing.TB, ctx context.Context, datastore ds.Datastore) ipfs

c.Bootstrap = []string{}
c.Addresses.Swarm = []string{"/ip6/::/tcp/0"}
c.Identity.PeerID = pid.Pretty()
c.Identity.PeerID = pid.String()
c.Identity.PrivKey = base64.StdEncoding.EncodeToString(privkeyb)
c.Swarm.ResourceMgr.Enabled = ipfs_cfg.False

Expand Down
2 changes: 1 addition & 1 deletion pkg/proximitytransport/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func newListener(ctx context.Context, localMa ma.Multiaddr, t *proximityTranspor
// Starts the native driver.
// If it failed, don't return a error because no other transport
// on the libp2p node will be created.
t.driver.Start(t.host.ID().Pretty())
t.driver.Start(t.host.ID().String())

return listener
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/proximitytransport/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (t *proximityTransport) Dial(ctx context.Context, remoteMa ma.Multiaddr, re
// remoteAddr is supposed to be equal to remotePID since with proximity transports:
// multiaddr = /<protocol>/<peerID>
remoteAddr, err := remoteMa.ValueForProtocol(t.driver.ProtocolCode())
if err != nil || remoteAddr != remotePID.Pretty() {
if err != nil || remoteAddr != remotePID.String() {
return nil, errors.Wrap(err, "error: proximityTransport.Dial: wrong multiaddr")
}

Expand Down Expand Up @@ -141,7 +141,7 @@ func (t *proximityTransport) CanDial(remoteMa ma.Multiaddr) bool {
func (t *proximityTransport) Listen(localMa ma.Multiaddr) (tpt.Listener, error) {
// localAddr is supposed to be equal to the localPID
// or to DefaultAddr since multiaddr == /<protocol>/<peerID>
localPID := t.host.ID().Pretty()
localPID := t.host.ID().String()
localAddr, err := localMa.ValueForProtocol(t.driver.ProtocolCode())
if err != nil || (localMa.String() != t.driver.DefaultAddr() && localAddr != localPID) {
return nil, errors.Wrap(err, "error: proximityTransport.Listen: wrong multiaddr")
Expand Down
2 changes: 1 addition & 1 deletion service.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (

pubsub_fix "github.com/berty/go-libp2p-pubsub"
"github.com/dgraph-io/badger/v2/options"
ipfs_interface "github.com/ipfs/boxo/coreiface"
ds "github.com/ipfs/go-datastore"
ds_sync "github.com/ipfs/go-datastore/sync"
badger "github.com/ipfs/go-ds-badger2"
ipfs_interface "github.com/ipfs/interface-go-ipfs-core"
pubsub "github.com/libp2p/go-libp2p-pubsub"
"github.com/libp2p/go-libp2p/core/crypto"
"github.com/libp2p/go-libp2p/core/event"
Expand Down
2 changes: 1 addition & 1 deletion service_outofstoremessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"io"
"time"

ipfs_interface "github.com/ipfs/boxo/coreiface"
ds "github.com/ipfs/go-datastore"
ds_sync "github.com/ipfs/go-datastore/sync"
ipfs_interface "github.com/ipfs/interface-go-ipfs-core"
"go.uber.org/zap"
"google.golang.org/grpc"

Expand Down
2 changes: 1 addition & 1 deletion store_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"fmt"
"sync"

coreapi "github.com/ipfs/boxo/coreiface"
"github.com/ipfs/go-cid"
coreapi "github.com/ipfs/interface-go-ipfs-core"
"github.com/libp2p/go-libp2p/core/crypto"
"github.com/libp2p/go-libp2p/core/event"
"github.com/libp2p/go-libp2p/p2p/host/eventbus"
Expand Down
2 changes: 1 addition & 1 deletion store_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"

"github.com/gogo/protobuf/proto"
coreapi "github.com/ipfs/interface-go-ipfs-core"
coreapi "github.com/ipfs/boxo/coreiface"
"github.com/libp2p/go-libp2p/core/crypto"
"github.com/libp2p/go-libp2p/core/event"
"github.com/libp2p/go-libp2p/p2p/host/eventbus"
Expand Down
2 changes: 1 addition & 1 deletion tool/bench-cellular/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func runClient(ctx context.Context, gOpts *globalOpts, cOpts *clientOpts) error
return fmt.Errorf("client host creation failed: %v", err)
}

log.Println("Local peerID:", h.ID().Pretty())
log.Println("Local peerID:", h.ID())

peerid, err := addDestToPeerstore(h, cOpts.dest)
if err != nil {
Expand Down
Loading
Loading