Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
interface-go-dms3-core
Commits
713de024
Commit
713de024
authored
Oct 02, 2018
by
Steven Allen
Committed by
GitHub
Oct 02, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4803 from ipfs/feat/coreapi/swarm
coreapi: Swarm API
parents
47db102c
162cac01
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
0 deletions
+63
-0
coreapi.go
coreapi.go
+3
-0
key.go
key.go
+3
-0
swarm.go
swarm.go
+57
-0
No files found.
coreapi.go
View file @
713de024
...
...
@@ -34,6 +34,9 @@ type CoreAPI interface {
// Dht returns an implementation of Dht API
Dht
()
DhtAPI
// Swarm returns an implementation of Swarm API
Swarm
()
SwarmAPI
// ResolvePath resolves the path using Unixfs resolver
ResolvePath
(
context
.
Context
,
Path
)
(
ResolvedPath
,
error
)
...
...
key.go
View file @
713de024
...
...
@@ -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
)
}
swarm.go
0 → 100644
View file @
713de024
package
iface
import
(
"context"
"errors"
"time"
ma
"gx/ipfs/QmYmsdtJ3HsodkePE3eU3TsCaP2YvPZJ4LoXnNkDE5Tpt7/go-multiaddr"
"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
{
// ID returns PeerID
ID
()
peer
.
ID
// 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
()
(
time
.
Duration
,
error
)
// Streams returns list of streams established with the peer
Streams
()
([]
protocol
.
ID
,
error
)
}
// SwarmAPI specifies the interface to libp2p swarm
type
SwarmAPI
interface
{
// Connect to a given peer
Connect
(
context
.
Context
,
pstore
.
PeerInfo
)
error
// Disconnect from a given address
Disconnect
(
context
.
Context
,
ma
.
Multiaddr
)
error
// Peers returns the list of peers we are connected to
Peers
(
context
.
Context
)
([]
ConnectionInfo
,
error
)
// KnownAddrs returns the list of all addresses this node is aware of
KnownAddrs
(
context
.
Context
)
(
map
[
peer
.
ID
][]
ma
.
Multiaddr
,
error
)
// LocalAddrs returns the list of announced listening addresses
LocalAddrs
(
context
.
Context
)
([]
ma
.
Multiaddr
,
error
)
// ListenAddrs returns the list of all listening addresses
ListenAddrs
(
context
.
Context
)
([]
ma
.
Multiaddr
,
error
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment