fix staticcheck
This commit is contained in:
parent
1ec50360f3
commit
f046ec6d71
|
@ -2,7 +2,6 @@ package noise
|
|||
|
||||
import (
|
||||
"context"
|
||||
"golang.org/x/crypto/poly1305"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
|
@ -10,6 +9,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"golang.org/x/crypto/poly1305"
|
||||
|
||||
"github.com/libp2p/go-libp2p-core/crypto"
|
||||
"github.com/libp2p/go-libp2p-core/sec"
|
||||
)
|
||||
|
@ -201,11 +202,6 @@ func benchDataTransfer(b *benchenv, dataSize int64, m testMode) {
|
|||
b.ReportMetric(bytesPerSec, "bytes/sec")
|
||||
}
|
||||
|
||||
type bc struct {
|
||||
plainTextChunkLen int64
|
||||
readBufferLen int64
|
||||
}
|
||||
|
||||
func BenchmarkTransfer1MB(b *testing.B) {
|
||||
for n, bc := range bcs {
|
||||
b.Run(n, func(b *testing.B) {
|
||||
|
|
|
@ -5,13 +5,14 @@ import (
|
|||
"crypto/rand"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
pool "github.com/libp2p/go-buffer-pool"
|
||||
"golang.org/x/crypto/poly1305"
|
||||
"time"
|
||||
|
||||
"golang.org/x/crypto/poly1305"
|
||||
|
||||
"github.com/flynn/noise"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
|
||||
pool "github.com/libp2p/go-buffer-pool"
|
||||
"github.com/libp2p/go-libp2p-core/crypto"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
|
||||
|
@ -94,8 +95,7 @@ func (s *secureSession) runHandshake(ctx context.Context) error {
|
|||
}
|
||||
} else {
|
||||
// stage 0 //
|
||||
plaintext, err := s.readHandshakeMessage(hs)
|
||||
if err != nil {
|
||||
if _, err := s.readHandshakeMessage(hs); err != nil {
|
||||
return fmt.Errorf("error reading handshake message: %w", err)
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ func (s *secureSession) runHandshake(ctx context.Context) error {
|
|||
}
|
||||
|
||||
// stage 2 //
|
||||
plaintext, err = s.readHandshakeMessage(hs)
|
||||
plaintext, err := s.readHandshakeMessage(hs)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading handshake message: %w", err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue