1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-10 09:52:20 +08:00

Dialer for dht

dht doesn't need the whole network interface, only needs a Dialer.
(much reduced surface of possible errors)
This commit is contained in:
Juan Batiz-Benet
2014-10-21 03:13:10 -07:00
parent cc9f276f0f
commit cc5c181ae0
4 changed files with 22 additions and 17 deletions

View File

@ -3,6 +3,7 @@ package dht
import (
"sync"
inet "github.com/jbenet/go-ipfs/net"
peer "github.com/jbenet/go-ipfs/peer"
queue "github.com/jbenet/go-ipfs/peer/queue"
kb "github.com/jbenet/go-ipfs/routing/kbucket"
@ -14,17 +15,12 @@ import (
var maxQueryConcurrency = AlphaValue
type dhtDialer interface {
// DialPeer attempts to establish a connection to a given peer
DialPeer(peer.Peer) error
}
type dhtQuery struct {
// the key we're querying for
key u.Key
// dialer used to ensure we're connected to peers
dialer dhtDialer
dialer inet.Dialer
// the function to execute per peer
qfunc queryFunc
@ -42,7 +38,7 @@ type dhtQueryResult struct {
}
// constructs query
func newQuery(k u.Key, d dhtDialer, f queryFunc) *dhtQuery {
func newQuery(k u.Key, d inet.Dialer, f queryFunc) *dhtQuery {
return &dhtQuery{
key: k,
dialer: d,