]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Add PeerStorer interface
authorMatt Joiner <anacrolix@gmail.com>
Sun, 21 Feb 2021 06:17:57 +0000 (17:17 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Sun, 21 Feb 2021 06:17:57 +0000 (17:17 +1100)
dht.go

diff --git a/dht.go b/dht.go
index da79aee472b853e153175ef2b752a68a867fc8f2..b69c28845196458ec22d2aadc372f4ee5e7467da 100644 (file)
--- a/dht.go
+++ b/dht.go
@@ -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