Add PeerStorer interface

This commit is contained in:
Matt Joiner 2021-02-21 17:17:57 +11:00
parent cff461c898
commit 051093ca31
1 changed files with 6 additions and 0 deletions

6
dht.go
View File

@ -6,6 +6,7 @@ import (
"github.com/anacrolix/dht/v2"
"github.com/anacrolix/dht/v2/krpc"
peer_store "github.com/anacrolix/dht/v2/peer-store"
)
type DhtServer interface {
@ -18,6 +19,11 @@ type DhtServer interface {
WriteStatus(io.Writer)
}
// Optional interface for DhtServer's that can expose their peer store (if any).
type PeerStorer interface {
PeerStore() peer_store.Interface
}
type DhtAnnounce interface {
Close()
Peers() <-chan dht.PeersValues