mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-24 03:47:45 +08:00
Merge pull request ipfs/boxoipfs/interface-go-ipfs-core#35 from raulk/migrate-libp2p
migrate to go-libp2p-core. This commit was moved from ipfs/interface-go-ipfs-core@f77aa7ee2c This commit was moved from ipfs/boxo@60f7faebc3
This commit is contained in:
commit
dc6ca5a77d
@ -6,8 +6,7 @@ import (
|
||||
|
||||
"github.com/ipfs/interface-go-ipfs-core/options"
|
||||
|
||||
"github.com/libp2p/go-libp2p-peer"
|
||||
pstore "github.com/libp2p/go-libp2p-peerstore"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
)
|
||||
|
||||
// DhtAPI specifies the interface to the DHT
|
||||
@ -16,11 +15,11 @@ import (
|
||||
type DhtAPI interface {
|
||||
// FindPeer queries the DHT for all of the multiaddresses associated with a
|
||||
// Peer ID
|
||||
FindPeer(context.Context, peer.ID) (pstore.PeerInfo, error)
|
||||
FindPeer(context.Context, peer.ID) (peer.AddrInfo, error)
|
||||
|
||||
// FindProviders finds peers in the DHT who can provide a specific value
|
||||
// given a key.
|
||||
FindProviders(context.Context, path.Path, ...options.DhtFindProvidersOption) (<-chan pstore.PeerInfo, error)
|
||||
FindProviders(context.Context, path.Path, ...options.DhtFindProvidersOption) (<-chan peer.AddrInfo, error)
|
||||
|
||||
// Provide announces to the network that you are providing given values
|
||||
Provide(context.Context, path.Path, ...options.DhtProvideOption) error
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/ipfs/interface-go-ipfs-core/options"
|
||||
|
||||
"github.com/libp2p/go-libp2p-peer"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
)
|
||||
|
||||
// Key specifies the interface to Keys in KeyAPI Keystore
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
|
||||
options "github.com/ipfs/interface-go-ipfs-core/options"
|
||||
|
||||
peer "github.com/libp2p/go-libp2p-peer"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
)
|
||||
|
||||
// PubSubSubscription is an active PubSub subscription
|
||||
|
||||
@ -5,10 +5,10 @@ import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
net "github.com/libp2p/go-libp2p-net"
|
||||
"github.com/libp2p/go-libp2p-peer"
|
||||
pstore "github.com/libp2p/go-libp2p-peerstore"
|
||||
"github.com/libp2p/go-libp2p-protocol"
|
||||
"github.com/libp2p/go-libp2p-core/network"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
"github.com/libp2p/go-libp2p-core/protocol"
|
||||
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
)
|
||||
|
||||
@ -26,7 +26,7 @@ type ConnectionInfo interface {
|
||||
Address() ma.Multiaddr
|
||||
|
||||
// Direction returns which way the connection was established
|
||||
Direction() net.Direction
|
||||
Direction() network.Direction
|
||||
|
||||
// Latency returns last known round trip time to the peer
|
||||
Latency() (time.Duration, error)
|
||||
@ -38,7 +38,7 @@ type ConnectionInfo interface {
|
||||
// SwarmAPI specifies the interface to libp2p swarm
|
||||
type SwarmAPI interface {
|
||||
// Connect to a given peer
|
||||
Connect(context.Context, pstore.PeerInfo) error
|
||||
Connect(context.Context, peer.AddrInfo) error
|
||||
|
||||
// Disconnect from a given address
|
||||
Disconnect(context.Context, ma.Multiaddr) error
|
||||
|
||||
Loading…
Reference in New Issue
Block a user