mirror of
https://github.com/ipfs/kubo.git
synced 2025-09-10 14:34:24 +08:00
dht: linting
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
// package dht implements a distributed hash table that satisfies the ipfs routing
|
||||
// Package dht implements a distributed hash table that satisfies the ipfs routing
|
||||
// interface. This DHT is modeled after kademlia with Coral and S/Kademlia modifications.
|
||||
package dht
|
||||
|
||||
@ -583,7 +583,7 @@ func (dht *IpfsDHT) Bootstrap(ctx context.Context) {
|
||||
rand.Read(id)
|
||||
p, err := dht.FindPeer(ctx, peer.ID(id))
|
||||
if err != nil {
|
||||
log.Error("Bootstrap peer error: %s", err)
|
||||
log.Errorf("Bootstrap peer error: %s", err)
|
||||
}
|
||||
err = dht.dialer.DialPeer(ctx, p)
|
||||
if err != nil {
|
||||
|
@ -31,6 +31,8 @@ func peerToPBPeer(p peer.Peer) *Message_Peer {
|
||||
return pbp
|
||||
}
|
||||
|
||||
// PeersToPBPeers converts a slice of Peers into a slice of *Message_Peers,
|
||||
// ready to go out on the wire.
|
||||
func PeersToPBPeers(peers []peer.Peer) []*Message_Peer {
|
||||
pbpeers := make([]*Message_Peer, len(peers))
|
||||
for i, p := range peers {
|
||||
|
@ -125,6 +125,9 @@ func (dht *IpfsDHT) Provide(ctx context.Context, key u.Key) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// FindProvidersAsync is the same thing as FindProviders, but returns a channel.
|
||||
// Peers will be returned on the channel as soon as they are found, even before
|
||||
// the search query completes.
|
||||
func (dht *IpfsDHT) FindProvidersAsync(ctx context.Context, key u.Key, count int) <-chan peer.Peer {
|
||||
log.Event(ctx, "findProviders", &key)
|
||||
peerOut := make(chan peer.Peer, count)
|
||||
@ -199,7 +202,6 @@ func (dht *IpfsDHT) addPeerListAsync(ctx context.Context, k u.Key, peers []*pb.M
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
// Find specific Peer
|
||||
// FindPeer searches for a peer with given ID.
|
||||
func (dht *IpfsDHT) FindPeer(ctx context.Context, id peer.ID) (peer.Peer, error) {
|
||||
|
||||
|
Reference in New Issue
Block a user