Skip to content

Commit

Permalink
coreapi swarm: rewire address listing cmds
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>


This commit was moved from ipfs/interface-go-ipfs-core@8c35696
  • Loading branch information
magik6k committed Sep 26, 2018
1 parent 0f6f6ec commit 4020059
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions coreiface/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ type KeyAPI interface {
// List lists keys stored in keystore
List(ctx context.Context) ([]Key, error)

// Self returns the 'main' node key
Self(ctx context.Context) (Key, error)

// Remove removes keys from keystore. Returns ipns path of the removed key
Remove(ctx context.Context, name string) (Key, error)
}
10 changes: 9 additions & 1 deletion coreiface/swarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ import (
"gx/ipfs/QmZNkThpqfVXs9GNbexPrfBbXSLNYeKrE7jwFM2oqHbyqN/go-libp2p-protocol"
"gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer"
pstore "gx/ipfs/QmfAQMFpgDU2U4BXG64qVr8HSiictfWvkSBz7Y2oDj65st/go-libp2p-peerstore"
net "gx/ipfs/QmfDPh144WGBqRxZb1TGDHerbMnZATrHZggAPw7putNnBq/go-libp2p-net"
)

var (
ErrNotConnected = errors.New("not connected")
ErrConnNotFound = errors.New("conn not found")
)
)

// ConnectionInfo contains information about a peer
type ConnectionInfo interface {
Expand All @@ -24,6 +25,9 @@ type ConnectionInfo interface {
// Address returns the multiaddress via which we are connected with the peer
Address() ma.Multiaddr

// Direction returns which way the connection was established
Direction() net.Direction

// Latency returns last known round trip time to the peer
Latency(context.Context) (time.Duration, error)

Expand All @@ -41,4 +45,8 @@ type SwarmAPI interface {

// Peers returns the list of peers we are connected to
Peers(context.Context) ([]ConnectionInfo, error)

KnownAddrs(context.Context) (map[peer.ID][]ma.Multiaddr, error)
LocalAddrs(context.Context) ([]ma.Multiaddr, error)
ListenAddrs(context.Context) ([]ma.Multiaddr, error)
}

0 comments on commit 4020059

Please sign in to comment.