Skip to content

Commit 5065a50

Browse files
comments formatting and typos (#1019)
1 parent 4a7d31d commit 5065a50

File tree

5 files changed

+17
-16
lines changed

5 files changed

+17
-16
lines changed

amino/defaults.go

+5-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
)
1515

1616
const (
17-
// ProtocolPrefix is the base prefix for Amono DHT protocols.
17+
// ProtocolPrefix is the base prefix for Amino DHT protocols.
1818
ProtocolPrefix protocol.ID = "/ipfs"
1919

2020
// ProtocolID is the latest protocol identifier for the Amino DHT.
@@ -49,9 +49,7 @@ const (
4949
DefaultProviderAddrTTL = 24 * time.Hour
5050
)
5151

52-
var (
53-
// Protocols is a slice containing all supported protocol IDs for Amino DHT.
54-
// Currently, it only includes the main ProtocolID, but it's defined as a slice
55-
// to allow for potential future protocol versions or variants.
56-
Protocols = []protocol.ID{ProtocolID}
57-
)
52+
// Protocols is a slice containing all supported protocol IDs for Amino DHT.
53+
// Currently, it only includes the main ProtocolID, but it's defined as a slice
54+
// to allow for potential future protocol versions or variants.
55+
var Protocols = []protocol.ID{ProtocolID}

dht.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ func makeDHT(h host.Host, cfg dhtcfg.Config) (*IpfsDHT, error) {
336336
}
337337

338338
// construct routing table
339-
// use twice the theoritical usefulness threhold to keep older peers around longer
339+
// use twice the theoretical usefulness threshold to keep older peers around longer
340340
rt, err := makeRoutingTable(dht, cfg, 2*maxLastSuccessfulOutboundThreshold)
341341
if err != nil {
342342
return nil, fmt.Errorf("failed to construct routing table,err=%s", err)
@@ -720,7 +720,7 @@ func (dht *IpfsDHT) validPeerFound(p peer.ID) {
720720
}
721721
}
722722

723-
// peerStoppedDHT signals the routing table that a peer is unable to responsd to DHT queries anymore.
723+
// peerStoppedDHT signals the routing table that a peer is unable to respond to DHT queries anymore.
724724
func (dht *IpfsDHT) peerStoppedDHT(p peer.ID) {
725725
logger.Debugw("peer stopped dht", "peer", p)
726726
// A peer that does not support the DHT protocol is dead for us.

dual/dual.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ import (
2626
"github.com/hashicorp/go-multierror"
2727
)
2828

29-
const tracer = tracing.Tracer("go-libp2p-kad-dht/dual")
30-
const dualName = "Dual"
29+
const (
30+
tracer = tracing.Tracer("go-libp2p-kad-dht/dual")
31+
dualName = "Dual"
32+
)
3133

32-
// DHT implements the routing interface to provide two concrete DHT implementationts for use
34+
// DHT implements the routing interface to provide two concrete DHT implementations for use
3335
// in IPFS that are used to support both global network users and disjoint LAN usecases.
3436
type DHT struct {
3537
WAN *dht.IpfsDHT
@@ -99,7 +101,7 @@ func DHTOption(opts ...dht.Option) Option {
99101
// IpfsDHT internal constructions, modulo additional options used by the Dual DHT to enforce
100102
// the LAN-vs-WAN distinction.
101103
// Note: query or routing table functional options provided as arguments to this function
102-
// will be overriden by this constructor.
104+
// will be overridden by this constructor.
103105
func New(ctx context.Context, h host.Host, options ...Option) (*DHT, error) {
104106
var cfg config
105107
err := cfg.apply(

handlers.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,9 @@ func (dht *IpfsDHT) handleAddProvider(ctx context.Context, p peer.ID, pmes *pb.M
363363
continue
364364
}
365365

366-
// We run the addrs filter after checking for the length,
367-
// this allows transient nodes with varying /p2p-circuit addresses to still have their anouncement go through.
366+
// We run the addrs filter after checking for the length, this allows
367+
// transient nodes with varying /p2p-circuit addresses to still have their
368+
// announcement go through.
368369
addrs := dht.filterAddrs(pi.Addrs)
369370
dht.providerStore.AddProvider(ctx, key, peer.AddrInfo{ID: pi.ID, Addrs: addrs})
370371
}

rt_diversity_filter_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func TestRTPeerDiversityFilter(t *testing.T) {
5050
require.True(t, r.Allow(g2))
5151
r.Increment(g2)
5252

53-
// and then it dosen't work again
53+
// and then it doesn't work again
5454
require.False(t, r.Allow(g2))
5555
}
5656

0 commit comments

Comments
 (0)