Commit 8c35696f authored by Łukasz Magiera's avatar Łukasz Magiera

coreapi swarm: rewire address listing cmds

License: MIT
Signed-off-by: default avatarŁukasz Magiera <magik6k@gmail.com>
parent a48b2a80
...@@ -33,6 +33,9 @@ type KeyAPI interface { ...@@ -33,6 +33,9 @@ type KeyAPI interface {
// List lists keys stored in keystore // List lists keys stored in keystore
List(ctx context.Context) ([]Key, error) 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 removes keys from keystore. Returns ipns path of the removed key
Remove(ctx context.Context, name string) (Key, error) Remove(ctx context.Context, name string) (Key, error)
} }
...@@ -9,12 +9,13 @@ import ( ...@@ -9,12 +9,13 @@ import (
"gx/ipfs/QmZNkThpqfVXs9GNbexPrfBbXSLNYeKrE7jwFM2oqHbyqN/go-libp2p-protocol" "gx/ipfs/QmZNkThpqfVXs9GNbexPrfBbXSLNYeKrE7jwFM2oqHbyqN/go-libp2p-protocol"
"gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer" "gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer"
pstore "gx/ipfs/QmfAQMFpgDU2U4BXG64qVr8HSiictfWvkSBz7Y2oDj65st/go-libp2p-peerstore" pstore "gx/ipfs/QmfAQMFpgDU2U4BXG64qVr8HSiictfWvkSBz7Y2oDj65st/go-libp2p-peerstore"
net "gx/ipfs/QmfDPh144WGBqRxZb1TGDHerbMnZATrHZggAPw7putNnBq/go-libp2p-net"
) )
var ( var (
ErrNotConnected = errors.New("not connected") ErrNotConnected = errors.New("not connected")
ErrConnNotFound = errors.New("conn not found") ErrConnNotFound = errors.New("conn not found")
) )
// ConnectionInfo contains information about a peer // ConnectionInfo contains information about a peer
type ConnectionInfo interface { type ConnectionInfo interface {
...@@ -24,6 +25,9 @@ type ConnectionInfo interface { ...@@ -24,6 +25,9 @@ type ConnectionInfo interface {
// Address returns the multiaddress via which we are connected with the peer // Address returns the multiaddress via which we are connected with the peer
Address() ma.Multiaddr 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 returns last known round trip time to the peer
Latency(context.Context) (time.Duration, error) Latency(context.Context) (time.Duration, error)
...@@ -41,4 +45,8 @@ type SwarmAPI interface { ...@@ -41,4 +45,8 @@ type SwarmAPI interface {
// Peers returns the list of peers we are connected to // Peers returns the list of peers we are connected to
Peers(context.Context) ([]ConnectionInfo, error) 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)
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment