coreapi swarm: rewire address listing cmds
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com> This commit was moved from ipfs/interface-go-ipfs-core@8c35696f74f086858b6acaf8ee6a0ffe570e46cb This commit was moved from ipfs/boxo@4020059a81eb3f31fec83c825d6ce4d9dd8c65c4
Łukasz Magiera committed
Sep 17, 2018 at 19:53 UTC
cb1f0c550ff5acbde160286b46a5a18d9a4393df
2 files changed
+12
-1
core/coreiface/key.go
+3
@@ -33,6 +33,9 @@ type KeyAPI interface {
33
// List lists keys stored in keystore
34
List(ctx context.Context) ([]Key, error)
35
36
+ // Self returns the 'main' node key
37
+ Self(ctx context.Context) (Key, error)
38
+
39
// Remove removes keys from keystore. Returns ipns path of the removed key
40
Remove(ctx context.Context, name string) (Key, error)
41
}
core/coreiface/swarm.go
+9
-1
@@ -9,12 +9,13 @@ import (
9
"gx/ipfs/QmZNkThpqfVXs9GNbexPrfBbXSLNYeKrE7jwFM2oqHbyqN/go-libp2p-protocol"
10
"gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer"
11
pstore "gx/ipfs/QmfAQMFpgDU2U4BXG64qVr8HSiictfWvkSBz7Y2oDj65st/go-libp2p-peerstore"
12
+ net "gx/ipfs/QmfDPh144WGBqRxZb1TGDHerbMnZATrHZggAPw7putNnBq/go-libp2p-net"
13
)
14
15
var (
16
ErrNotConnected = errors.New("not connected")
17
ErrConnNotFound = errors.New("conn not found")
17
- )
18
+)
19
20
// ConnectionInfo contains information about a peer
21
type ConnectionInfo interface {
@@ -24,6 +25,9 @@ type ConnectionInfo interface {
25
// Address returns the multiaddress via which we are connected with the peer
26
Address() ma.Multiaddr
27
28
+ // Direction returns which way the connection was established
29
+ Direction() net.Direction
30
+
31
// Latency returns last known round trip time to the peer
32
Latency(context.Context) (time.Duration, error)
33
@@ -41,4 +45,8 @@ type SwarmAPI interface {
45
46
// Peers returns the list of peers we are connected to
47
Peers(context.Context) ([]ConnectionInfo, error)
48
+
49
+ KnownAddrs(context.Context) (map[peer.ID][]ma.Multiaddr, error)
50
+ LocalAddrs(context.Context) ([]ma.Multiaddr, error)
51
+ ListenAddrs(context.Context) ([]ma.Multiaddr, error)
52
}