Repository: libp2p/go-libp2p
Pull request #2689 (2024-01-25 03:10:08)

chore: Fixed spelling errors in some files.


Patch:
diff --git a/core/routing/routing.go b/core/routing/routing.go
index e1d47451..b995b052 100644
--- a/core/routing/routing.go
+++ b/core/routing/routing.go
@@ -76,7 +76,7 @@ type Routing interface {
 	ValueStore
 
 	// Bootstrap allows callers to hint to the routing system to get into a
-	// Boostrapped state and remain there. It is not a synchronous call.
+	// Bootstrapped state and remain there. It is not a synchronous call.
 	Bootstrap(context.Context) error
 
 	// TODO expose io.Closer or plain-old Close error
diff --git a/examples/multipro/pb/p2p.pb.go b/examples/multipro/pb/p2p.pb.go
index a33d5497..2399383c 100644
--- a/examples/multipro/pb/p2p.pb.go
+++ b/examples/multipro/pb/p2p.pb.go
@@ -110,7 +110,7 @@ func (m *MessageData) GetSign() []byte {
 	return nil
 }
 
-// a protocol define a set of reuqest and responses
+// A protocol defines a set of requests and responses.
 type PingRequest struct {
 	MessageData *MessageData `protobuf:"bytes,1,opt,name=messageData" json:"messageData,omitempty"`
 	// method specific data
@@ -205,7 +205,7 @@ func (m *PingResponse) GetMessage() string {
 	return ""
 }
 
-// a protocol define a set of reuqest and responses
+// A protocol defines a set of requests and responses
 type EchoRequest struct {
 	MessageData *MessageData `protobuf:"bytes,1,opt,name=messageData" json:"messageData,omitempty"`
 	// method specific data
diff --git a/examples/multipro/pb/p2p.proto b/examples/multipro/pb/p2p.proto
index 5488f2a6..a360b246 100644
--- a/examples/multipro/pb/p2p.proto
+++ b/examples/multipro/pb/p2p.proto
@@ -16,7 +16,7 @@ message MessageData {
 
 //// ping protocol
 
-// a protocol define a set of reuqest and responses
+// A protocol defines a set of requests and responses.
 message PingRequest {
     MessageData messageData = 1;
 
@@ -36,7 +36,7 @@ message PingResponse {
 
 //// echo protocol
 
-// a protocol define a set of reuqest and responses
+// A protocol defines a set of requests and responses.
 message EchoRequest {
     MessageData messageData = 1;
 
diff --git a/p2p/host/autorelay/metrics.go b/p2p/host/autorelay/metrics.go
index 8028655b..af4b53ed 100644
--- a/p2p/host/autorelay/metrics.go
+++ b/p2p/host/autorelay/metrics.go
@@ -59,7 +59,7 @@ var (
 		prometheus.CounterOpts{
 			Namespace: metricNamespace,
 			Name:      "candidates_circuit_v2_support_total",
-			Help:      "Candidiates supporting circuit v2",
+			Help:      "Candidates supporting circuit v2",
 		},
 		[]string{"support"},
 	)
@@ -167,7 +167,7 @@ func NewMetricsTracer(opts ...MetricsTracerOption) MetricsTracer {
 	metricshelper.RegisterCollectors(setting.reg, collectors...)
 
 	// Initialise these counters to 0 otherwise the first reservation requests aren't handled
-	// correctly when using promql increse function
+	// correctly when using promql increase function
 	reservationRequestsOutcomeTotal.WithLabelValues("refresh", "success")
 	reservationRequestsOutcomeTotal.WithLabelValues("new", "success")
 	candidatesCircuitV2SupportTotal.WithLabelValues("yes")
diff --git a/p2p/host/autorelay/relay_finder.go b/p2p/host/autorelay/relay_finder.go
index ef79950b..13f8c63e 100644
--- a/p2p/host/autorelay/relay_finder.go
+++ b/p2p/host/autorelay/relay_finder.go
@@ -63,7 +63,7 @@ type relayFinder struct {
 	candidates                 map[peer.ID]*candidate
 	backoff                    map[peer.ID]time.Time
 	maybeConnectToRelayTrigger chan struct{} // cap: 1
-	// Any time _something_ hapens that might cause us to need new candidates.
+	// Any time _something_ happens that might cause us to need new candidates.
 	// This could be
 	// * the disconnection of a relay
 	// * the failed attempt to obtain a reservation with a current candidate
diff --git a/p2p/host/basic/natmgr.go b/p2p/host/basic/natmgr.go
index 8e8fbea3..bc55e4d7 100644
--- a/p2p/host/basic/natmgr.go
+++ b/p2p/host/basic/natmgr.go
@@ -127,7 +127,7 @@ func (nmgr *natManager) background(ctx context.Context) {
 	for {
 		select {
 		case <-nmgr.syncFlag:
-			nmgr.doSync() // sync when our listen addresses chnage.
+			nmgr.doSync() // sync when our listen addresses change.
 		case <-ctx.Done():
 			return
 		}
diff --git a/p2p/security/tls/transport.go b/p2p/security/tls/transport.go
index 7c28efe3..0c494a7f 100644
--- a/p2p/security/tls/transport.go
+++ b/p2p/security/tls/transport.go
@@ -113,7 +113,7 @@ func (t *Transport) SecureOutbound(ctx context.Context, insecure net.Conn, p pee
 	for _, muxer := range t.muxers {
 		muxers = append(muxers, (string)(muxer))
 	}
-	// Prepend the prefered muxers list to TLS config.
+	// Prepend the preferred muxers list to TLS config.
 	config.NextProtos = append(muxers, config.NextProtos...)
 	cs, err := t.handshake(ctx, tls.Client(insecure, config), keyCh)
 	if err != nil {


Test patch:
diff --git a/core/crypto/ecdsa_test.go b/core/crypto/ecdsa_test.go
index cc75d574..6e4720d7 100644
--- a/core/crypto/ecdsa_test.go
+++ b/core/crypto/ecdsa_test.go
@@ -25,7 +25,7 @@ func TestECDSABasicSignAndVerify(t *testing.T) {
 	}
 
 	if !ok {
-		t.Fatal("signature didnt match")
+		t.Fatal("signature didn't match")
 	}
 
 	// change data
diff --git a/core/crypto/rsa_test.go b/core/crypto/rsa_test.go
index f4a7971a..dbc88dda 100644
--- a/core/crypto/rsa_test.go
+++ b/core/crypto/rsa_test.go
@@ -24,7 +24,7 @@ func TestRSABasicSignAndVerify(t *testing.T) {
 	}
 
 	if !ok {
-		t.Fatal("signature didnt match")
+		t.Fatal("signature didn't match")
 	}
 
 	// change data
diff --git a/core/crypto/secp256k1_test.go b/core/crypto/secp256k1_test.go
index 81f2f578..67bbe470 100644
--- a/core/crypto/secp256k1_test.go
+++ b/core/crypto/secp256k1_test.go
@@ -24,7 +24,7 @@ func TestSecp256k1BasicSignAndVerify(t *testing.T) {
 	}
 
 	if !ok {
-		t.Fatal("signature didnt match")
+		t.Fatal("signature didn't match")
 	}
 
 	// change data
diff --git a/p2p/host/autonat/svc_test.go b/p2p/host/autonat/svc_test.go
index 96836d1d..d58a9b75 100644
--- a/p2p/host/autonat/svc_test.go
+++ b/p2p/host/autonat/svc_test.go
@@ -189,7 +189,7 @@ func TestAutoNATServiceRateLimitJitter(t *testing.T) {
 		svc.mx.Lock()
 		defer svc.mx.Unlock()
 		return svc.globalReqs == 0
-	}, dur*5/2, 10*time.Millisecond, "reset of rate limitter occurred slower than expected")
+	}, dur*5/2, 10*time.Millisecond, "reset of rate limiter occurred slower than expected")
 }
 
 func TestAutoNATServiceStartup(t *testing.T) {
diff --git a/p2p/test/security/bench_test.go b/p2p/test/security/bench_test.go
index e3b0b937..fb50e3fa 100644
--- a/p2p/test/security/bench_test.go
+++ b/p2p/test/security/bench_test.go
@@ -79,7 +79,7 @@ func benchmarkHandshakes(b *testing.B, factory Factory) {
 
 	pipes := make(chan net.Conn, 1)
 
-	var finished sync.Mutex // wait until all data has been transfered
+	var finished sync.Mutex // wait until all data has been transferred
 	finished.Lock()
 	go func() {
 		defer finished.Unlock()