coreapi: implement swarm api
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com> This commit was moved from ipfs/interface-go-ipfs-core@3ab7f14240700d0e64e011e5fca7c847afc9ce9e This commit was moved from ipfs/boxo@81615a9f48e0bba90d04b4ac389948124aeff053
Łukasz Magiera committed
Mar 10, 2018 at 19:02 UTC
fc8386301bc0534bac90eeb0b1c3b7b4a908a0b0
2 files changed
+6
-3
core/coreiface/coreapi.go
+3
@@ -34,6 +34,9 @@ type CoreAPI interface {
34
// Dht returns an implementation of Dht API
35
Dht() DhtAPI
36
37
+ // Swarm returns an implementation of Swarm API
38
+ Swarm() SwarmAPI
39
+
40
// ResolvePath resolves the path using Unixfs resolver
41
ResolvePath(context.Context, Path) (ResolvedPath, error)
42
core/coreiface/swarm.go
+3
-3
@@ -1,9 +1,9 @@
1
package iface
2
3
import (
4
+ "context"
5
"time"
6
6
- "context"
7
ma "gx/ipfs/QmWWQ2Txc2c6tqjsBpzg5Ar652cHPGNsQQp2SejkNmkUMb/go-multiaddr"
8
peer "gx/ipfs/QmZoWKhxUmZ2seW4BzX6fJkNR8hh9PsGModr7q171yq2SS/go-libp2p-peer"
9
)
@@ -17,11 +17,11 @@ type PeerInfo interface {
17
Address() ma.Multiaddr
18
19
// Latency returns last known round trip time to the peer
20
- Latency() time.Duration
20
+ Latency(context.Context) (time.Duration, error)
21
22
// Streams returns list of streams established with the peer
23
// TODO: should this return multicodecs?
24
- Streams() []string
24
+ Streams(context.Context) ([]string, error)
25
}
26
27
// SwarmAPI specifies the interface to libp2p swarm