diff --git a/amino/defaults.go b/amino/defaults.go index 2d702450b..c28f672ee 100644 --- a/amino/defaults.go +++ b/amino/defaults.go @@ -14,7 +14,7 @@ import ( ) const ( - // ProtocolPrefix is the base prefix for Amono DHT protocols. + // ProtocolPrefix is the base prefix for Amino DHT protocols. ProtocolPrefix protocol.ID = "/ipfs" // ProtocolID is the latest protocol identifier for the Amino DHT. @@ -49,9 +49,7 @@ const ( DefaultProviderAddrTTL = 24 * time.Hour ) -var ( - // Protocols is a slice containing all supported protocol IDs for Amino DHT. - // Currently, it only includes the main ProtocolID, but it's defined as a slice - // to allow for potential future protocol versions or variants. - Protocols = []protocol.ID{ProtocolID} -) +// Protocols is a slice containing all supported protocol IDs for Amino DHT. +// Currently, it only includes the main ProtocolID, but it's defined as a slice +// to allow for potential future protocol versions or variants. +var Protocols = []protocol.ID{ProtocolID} diff --git a/dht.go b/dht.go index e241c9a81..3760738a4 100644 --- a/dht.go +++ b/dht.go @@ -336,7 +336,7 @@ func makeDHT(h host.Host, cfg dhtcfg.Config) (*IpfsDHT, error) { } // construct routing table - // use twice the theoritical usefulness threhold to keep older peers around longer + // use twice the theoretical usefulness threshold to keep older peers around longer rt, err := makeRoutingTable(dht, cfg, 2*maxLastSuccessfulOutboundThreshold) if err != nil { return nil, fmt.Errorf("failed to construct routing table,err=%s", err) @@ -720,7 +720,7 @@ func (dht *IpfsDHT) validPeerFound(p peer.ID) { } } -// peerStoppedDHT signals the routing table that a peer is unable to responsd to DHT queries anymore. +// peerStoppedDHT signals the routing table that a peer is unable to respond to DHT queries anymore. func (dht *IpfsDHT) peerStoppedDHT(p peer.ID) { logger.Debugw("peer stopped dht", "peer", p) // A peer that does not support the DHT protocol is dead for us. diff --git a/dual/dual.go b/dual/dual.go index 0f94cf728..f3a76de1b 100644 --- a/dual/dual.go +++ b/dual/dual.go @@ -26,10 +26,12 @@ import ( "github.com/hashicorp/go-multierror" ) -const tracer = tracing.Tracer("go-libp2p-kad-dht/dual") -const dualName = "Dual" +const ( + tracer = tracing.Tracer("go-libp2p-kad-dht/dual") + dualName = "Dual" +) -// DHT implements the routing interface to provide two concrete DHT implementationts for use +// DHT implements the routing interface to provide two concrete DHT implementations for use // in IPFS that are used to support both global network users and disjoint LAN usecases. type DHT struct { WAN *dht.IpfsDHT @@ -99,7 +101,7 @@ func DHTOption(opts ...dht.Option) Option { // IpfsDHT internal constructions, modulo additional options used by the Dual DHT to enforce // the LAN-vs-WAN distinction. // Note: query or routing table functional options provided as arguments to this function -// will be overriden by this constructor. +// will be overridden by this constructor. func New(ctx context.Context, h host.Host, options ...Option) (*DHT, error) { var cfg config err := cfg.apply( diff --git a/handlers.go b/handlers.go index 3428c0cd1..37d8d973c 100644 --- a/handlers.go +++ b/handlers.go @@ -363,8 +363,9 @@ func (dht *IpfsDHT) handleAddProvider(ctx context.Context, p peer.ID, pmes *pb.M continue } - // We run the addrs filter after checking for the length, - // this allows transient nodes with varying /p2p-circuit addresses to still have their anouncement go through. + // We run the addrs filter after checking for the length, this allows + // transient nodes with varying /p2p-circuit addresses to still have their + // announcement go through. addrs := dht.filterAddrs(pi.Addrs) dht.providerStore.AddProvider(ctx, key, peer.AddrInfo{ID: pi.ID, Addrs: addrs}) } diff --git a/rt_diversity_filter_test.go b/rt_diversity_filter_test.go index 9faad6363..8bec676fe 100644 --- a/rt_diversity_filter_test.go +++ b/rt_diversity_filter_test.go @@ -50,7 +50,7 @@ func TestRTPeerDiversityFilter(t *testing.T) { require.True(t, r.Allow(g2)) r.Increment(g2) - // and then it dosen't work again + // and then it doesn't work again require.False(t, r.Allow(g2)) }