From 317c9fff7d6bd5154213059669808ef833d88ce7 Mon Sep 17 00:00:00 2001 From: alex <152680487+bodhi-crypo@users.noreply.github.com> Date: Fri, 29 Dec 2023 12:02:17 +0800 Subject: [PATCH] chore: fix typos in comment (#2674) --- internal/sha256/post_go1_21.go | 4 ++-- internal/sha256/pre_go1_21.go | 4 ++-- p2p/http/libp2phttp.go | 2 +- p2p/protocol/holepunch/svc.go | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/sha256/post_go1_21.go b/internal/sha256/post_go1_21.go index 98c14b609..96d61ccc0 100644 --- a/internal/sha256/post_go1_21.go +++ b/internal/sha256/post_go1_21.go @@ -1,8 +1,8 @@ //go:build go1.21 // This package use build tags to select between github.com/minio/sha256-simd -// for go1.20 and bellow and crypto/sha256 for go1.21 and above. -// This is used because a fast SHANI implementation of sha256 is only avaiable +// for go1.20 and below and crypto/sha256 for go1.21 and above. +// This is used because a fast SHANI implementation of sha256 is only available // in the std for go1.21 and above. See https://go.dev/issue/50543. // TODO: Once go1.22 releases remove this package and replace all uses // with crypto/sha256 because the two supported version of go will have the fast diff --git a/internal/sha256/pre_go1_21.go b/internal/sha256/pre_go1_21.go index db0573333..91046b9ec 100644 --- a/internal/sha256/pre_go1_21.go +++ b/internal/sha256/pre_go1_21.go @@ -1,8 +1,8 @@ //go:build !go1.21 // This package use build tags to select between github.com/minio/sha256-simd -// for go1.20 and bellow and crypto/sha256 for go1.21 and above. -// This is used because a fast SHANI implementation of sha256 is only avaiable +// for go1.20 and below and crypto/sha256 for go1.21 and above. +// This is used because a fast SHANI implementation of sha256 is only available // in the std for go1.21 and above. See https://go.dev/issue/50543. // TODO: Once go1.22 releases remove this package and replace all uses // with crypto/sha256 because the two supported version of go will have the fast diff --git a/p2p/http/libp2phttp.go b/p2p/http/libp2phttp.go index 87f8f9a38..fbd8a64f4 100644 --- a/p2p/http/libp2phttp.go +++ b/p2p/http/libp2phttp.go @@ -48,7 +48,7 @@ type WellKnownHandler struct { wellKnownCache []byte } -// streamHostListen retuns a net.Listener that listens on libp2p streams for HTTP/1.1 messages. +// streamHostListen returns a net.Listener that listens on libp2p streams for HTTP/1.1 messages. func streamHostListen(streamHost host.Host) (net.Listener, error) { return gostream.Listen(streamHost, ProtocolIDForMultistreamSelect) } diff --git a/p2p/protocol/holepunch/svc.go b/p2p/protocol/holepunch/svc.go index 47bf434fb..70fd0ef55 100644 --- a/p2p/protocol/holepunch/svc.go +++ b/p2p/protocol/holepunch/svc.go @@ -196,7 +196,7 @@ func (s *Service) incomingHolePunch(str network.Stream) (rtt time.Duration, remo str.SetDeadline(time.Now().Add(StreamTimeout)) if err := rd.ReadMsg(msg); err != nil { - return 0, nil, nil, fmt.Errorf("failed to read message from initator: %w", err) + return 0, nil, nil, fmt.Errorf("failed to read message from initiator: %w", err) } if t := msg.GetType(); t != pb.HolePunch_CONNECT { return 0, nil, nil, fmt.Errorf("expected CONNECT message from initiator but got %d", t) @@ -218,13 +218,13 @@ func (s *Service) incomingHolePunch(str network.Stream) (rtt time.Duration, remo msg.ObsAddrs = addrsToBytes(ownAddrs) tstart := time.Now() if err := wr.WriteMsg(msg); err != nil { - return 0, nil, nil, fmt.Errorf("failed to write CONNECT message to initator: %w", err) + return 0, nil, nil, fmt.Errorf("failed to write CONNECT message to initiator: %w", err) } // Read SYNC message msg.Reset() if err := rd.ReadMsg(msg); err != nil { - return 0, nil, nil, fmt.Errorf("failed to read message from initator: %w", err) + return 0, nil, nil, fmt.Errorf("failed to read message from initiator: %w", err) } if t := msg.GetType(); t != pb.HolePunch_SYNC { return 0, nil, nil, fmt.Errorf("expected SYNC message from initiator but got %d", t)