Browse Source

chore: fix typos in comment (#2674)

pull/2678/head
alex 10 months ago
committed by GitHub
parent
commit
317c9fff7d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      internal/sha256/post_go1_21.go
  2. 4
      internal/sha256/pre_go1_21.go
  3. 2
      p2p/http/libp2phttp.go
  4. 6
      p2p/protocol/holepunch/svc.go

4
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

4
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

2
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)
}

6
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)

Loading…
Cancel
Save