mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-03 20:27:35 +03:00
Merge pull request #2839 from lucas-clemente/gofumpt
run gofumpt, enable the gofumpt linter
This commit is contained in:
commit
b7652887d2
50 changed files with 132 additions and 109 deletions
|
@ -24,7 +24,8 @@ linters:
|
|||
- exportloopref
|
||||
- goconst
|
||||
- goimports
|
||||
- gofmt
|
||||
- gofmt # redundant, since gofmt *should* be a no-op after gofumpt
|
||||
- gofumpt
|
||||
- gosimple
|
||||
- ineffassign
|
||||
- misspell
|
||||
|
|
|
@ -3,11 +3,10 @@ package benchmark
|
|||
import (
|
||||
"flag"
|
||||
"math/rand"
|
||||
"testing"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBenchmark(t *testing.T) {
|
||||
|
@ -15,9 +14,7 @@ func TestBenchmark(t *testing.T) {
|
|||
RunSpecs(t, "Benchmark Suite")
|
||||
}
|
||||
|
||||
var (
|
||||
size int // file size in MB, will be read from flags
|
||||
)
|
||||
var size int // file size in MB, will be read from flags
|
||||
|
||||
func init() {
|
||||
flag.IntVar(&size, "size", 50, "data length (in MB)")
|
||||
|
|
|
@ -243,7 +243,6 @@ var _ = Describe("Connection ID Manager", func() {
|
|||
StatelessResetToken: protocol.StatelessResetToken{16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1},
|
||||
})).To(Succeed())
|
||||
Expect(m.Get()).To(Equal(protocol.ConnectionID{1, 2, 3, 4}))
|
||||
|
||||
})
|
||||
|
||||
It("initiates subsequent updates when enough packets are sent", func() {
|
||||
|
|
|
@ -22,9 +22,7 @@ func createHandshakeMessage(len int) []byte {
|
|||
}
|
||||
|
||||
var _ = Describe("Crypto Stream", func() {
|
||||
var (
|
||||
str cryptoStream
|
||||
)
|
||||
var str cryptoStream
|
||||
|
||||
BeforeEach(func() {
|
||||
str = newCryptoStream()
|
||||
|
|
|
@ -21,9 +21,11 @@ import (
|
|||
"github.com/lucas-clemente/quic-go/internal/wire"
|
||||
)
|
||||
|
||||
var cert, clientCert *tls.Certificate
|
||||
var certPool, clientCertPool *x509.CertPool
|
||||
var sessionTicketKey = [32]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}
|
||||
var (
|
||||
cert, clientCert *tls.Certificate
|
||||
certPool, clientCertPool *x509.CertPool
|
||||
sessionTicketKey = [32]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}
|
||||
)
|
||||
|
||||
func init() {
|
||||
priv, err := rsa.GenerateKey(rand.Reader, 1024)
|
||||
|
@ -183,6 +185,7 @@ func (r *runner) OnError(err error) {
|
|||
(*r.client).Close()
|
||||
(*r.server).Close()
|
||||
}
|
||||
|
||||
func (r *runner) Errored() bool {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
@ -190,8 +193,10 @@ func (r *runner) Errored() bool {
|
|||
}
|
||||
func (r *runner) DropKeys(protocol.EncryptionLevel) {}
|
||||
|
||||
const alpn = "fuzzing"
|
||||
const alpnWrong = "wrong"
|
||||
const (
|
||||
alpn = "fuzzing"
|
||||
alpnWrong = "wrong"
|
||||
)
|
||||
|
||||
func toEncryptionLevel(n uint8) protocol.EncryptionLevel {
|
||||
switch n % 3 {
|
||||
|
@ -238,8 +243,10 @@ func getTransportParameters(seed uint8) *wire.TransportParameters {
|
|||
}
|
||||
|
||||
// PrefixLen is the number of bytes used for configuration
|
||||
const PrefixLen = 12
|
||||
const confLen = 5
|
||||
const (
|
||||
PrefixLen = 12
|
||||
confLen = 5
|
||||
)
|
||||
|
||||
// Fuzz fuzzes the TLS 1.3 handshake used by QUIC.
|
||||
//go:generate go run ./cmd/corpus.go
|
||||
|
|
|
@ -33,7 +33,7 @@ func WriteCorpusFile(path string, data []byte) error {
|
|||
}
|
||||
}
|
||||
hash := sha1.Sum(data)
|
||||
return ioutil.WriteFile(filepath.Join(path, hex.EncodeToString(hash[:])), data, 0644)
|
||||
return ioutil.WriteFile(filepath.Join(path, hex.EncodeToString(hash[:])), data, 0o644)
|
||||
}
|
||||
|
||||
// WriteCorpusFileWithPrefix writes data to a corpus file in directory path.
|
||||
|
|
|
@ -19,8 +19,10 @@ import (
|
|||
// Note that 0-RTT data doesn't provide replay protection.
|
||||
const MethodGet0RTT = "GET_0RTT"
|
||||
|
||||
const defaultUserAgent = "quic-go HTTP/3"
|
||||
const defaultMaxResponseHeaderBytes = 10 * 1 << 20 // 10 MB
|
||||
const (
|
||||
defaultUserAgent = "quic-go HTTP/3"
|
||||
defaultMaxResponseHeaderBytes = 10 * 1 << 20 // 10 MB
|
||||
)
|
||||
|
||||
var defaultQuicConfig = &quic.Config{
|
||||
MaxIncomingStreams: -1, // don't allow the server to create bidirectional streams
|
||||
|
|
|
@ -22,8 +22,10 @@ type responseWriter struct {
|
|||
logger utils.Logger
|
||||
}
|
||||
|
||||
var _ http.ResponseWriter = &responseWriter{}
|
||||
var _ http.Flusher = &responseWriter{}
|
||||
var (
|
||||
_ http.ResponseWriter = &responseWriter{}
|
||||
_ http.Flusher = &responseWriter{}
|
||||
)
|
||||
|
||||
func newResponseWriter(stream io.Writer, logger utils.Logger) *responseWriter {
|
||||
return &responseWriter{
|
||||
|
|
|
@ -23,6 +23,7 @@ type mockClient struct {
|
|||
func (m *mockClient) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
return &http.Response{Request: req}, nil
|
||||
}
|
||||
|
||||
func (m *mockClient) Close() error {
|
||||
m.closed = true
|
||||
return nil
|
||||
|
|
|
@ -35,13 +35,11 @@ type contextKey struct {
|
|||
|
||||
func (k *contextKey) String() string { return "quic-go/http3 context value " + k.name }
|
||||
|
||||
var (
|
||||
// ServerContextKey is a context key. It can be used in HTTP
|
||||
// handlers with Context.Value to access the server that
|
||||
// started the handler. The associated value will be of
|
||||
// type *http3.Server.
|
||||
ServerContextKey = &contextKey{"http3-server"}
|
||||
)
|
||||
// ServerContextKey is a context key. It can be used in HTTP
|
||||
// handlers with Context.Value to access the server that
|
||||
// started the handler. The associated value will be of
|
||||
// type *http3.Server.
|
||||
var ServerContextKey = &contextKey{"http3-server"}
|
||||
|
||||
type requestError struct {
|
||||
err error
|
||||
|
|
|
@ -356,7 +356,6 @@ var _ = Describe("Handshake tests", func() {
|
|||
Expect(err).To(HaveOccurred())
|
||||
Expect(err.(*qerr.QuicError).ErrorCode).To(Equal(qerr.ConnectionRefused))
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
Context("ALPN", func() {
|
||||
|
|
|
@ -16,8 +16,10 @@ import (
|
|||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var sentHeaders []*logging.ExtendedHeader
|
||||
var receivedHeaders []*logging.ExtendedHeader
|
||||
var (
|
||||
sentHeaders []*logging.ExtendedHeader
|
||||
receivedHeaders []*logging.ExtendedHeader
|
||||
)
|
||||
|
||||
func countKeyPhases() (sent, received int) {
|
||||
lastKeyPhase := protocol.KeyPhaseOne
|
||||
|
@ -75,6 +77,7 @@ func (t *connTracer) BufferedPacket(logging.PacketType)
|
|||
func (t *connTracer) DroppedPacket(logging.PacketType, logging.ByteCount, logging.PacketDropReason) {}
|
||||
func (t *connTracer) UpdatedMetrics(rttStats *logging.RTTStats, cwnd, bytesInFlight logging.ByteCount, packetsInFlight int) {
|
||||
}
|
||||
|
||||
func (t *connTracer) LostPacket(logging.EncryptionLevel, logging.PacketNumber, logging.PacketLossReason) {
|
||||
}
|
||||
func (t *connTracer) UpdatedCongestionState(logging.CongestionState) {}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package quicproxy
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestQuicGo(t *testing.T) {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package ackhandler
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCrypto(t *testing.T) {
|
||||
|
|
|
@ -9,9 +9,7 @@ import (
|
|||
)
|
||||
|
||||
var _ = Describe("receivedPacketHistory", func() {
|
||||
var (
|
||||
hist *receivedPacketHistory
|
||||
)
|
||||
var hist *receivedPacketHistory
|
||||
|
||||
BeforeEach(func() {
|
||||
hist = newReceivedPacketHistory()
|
||||
|
|
|
@ -88,8 +88,10 @@ type sentPacketHandler struct {
|
|||
logger utils.Logger
|
||||
}
|
||||
|
||||
var _ SentPacketHandler = &sentPacketHandler{}
|
||||
var _ sentPacketTracker = &sentPacketHandler{}
|
||||
var (
|
||||
_ SentPacketHandler = &sentPacketHandler{}
|
||||
_ sentPacketTracker = &sentPacketHandler{}
|
||||
)
|
||||
|
||||
func newSentPacketHandler(
|
||||
initialPacketNumber protocol.PacketNumber,
|
||||
|
|
|
@ -232,10 +232,11 @@ var _ = Describe("SentPacketHandler", func() {
|
|||
ping := &wire.PingFrame{}
|
||||
handler.SentPacket(ackElicitingPacket(&Packet{
|
||||
PacketNumber: 13,
|
||||
Frames: []Frame{{Frame: ping, OnAcked: func(f wire.Frame) {
|
||||
Expect(f).To(Equal(ping))
|
||||
acked = true
|
||||
},
|
||||
Frames: []Frame{{
|
||||
Frame: ping, OnAcked: func(f wire.Frame) {
|
||||
Expect(f).To(Equal(ping))
|
||||
acked = true
|
||||
},
|
||||
}},
|
||||
}))
|
||||
ack := &wire.AckFrame{AckRanges: []wire.AckRange{{Smallest: 13, Largest: 13}}}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package congestion
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCongestion(t *testing.T) {
|
||||
|
|
|
@ -17,9 +17,11 @@ import (
|
|||
|
||||
// 1024*1024^3 (first 1024 is from 0.100^3)
|
||||
// where 0.100 is 100 ms which is the scaling round trip time.
|
||||
const cubeScale = 40
|
||||
const cubeCongestionWindowScale = 410
|
||||
const cubeFactor protocol.ByteCount = 1 << cubeScale / cubeCongestionWindowScale / maxDatagramSize
|
||||
const (
|
||||
cubeScale = 40
|
||||
cubeCongestionWindowScale = 410
|
||||
cubeFactor protocol.ByteCount = 1 << cubeScale / cubeCongestionWindowScale / maxDatagramSize
|
||||
)
|
||||
|
||||
const defaultNumConnections = 1
|
||||
|
||||
|
|
|
@ -63,8 +63,10 @@ type cubicSender struct {
|
|||
tracer logging.ConnectionTracer
|
||||
}
|
||||
|
||||
var _ SendAlgorithm = &cubicSender{}
|
||||
var _ SendAlgorithmWithDebugInfos = &cubicSender{}
|
||||
var (
|
||||
_ SendAlgorithm = &cubicSender{}
|
||||
_ SendAlgorithmWithDebugInfos = &cubicSender{}
|
||||
)
|
||||
|
||||
// NewCubicSender makes a new cubic sender
|
||||
func NewCubicSender(clock Clock, rttStats *utils.RTTStats, reno bool, tracer logging.ConnectionTracer) *cubicSender {
|
||||
|
|
|
@ -9,8 +9,10 @@ import (
|
|||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
const initialCongestionWindowPackets = 10
|
||||
const defaultWindowTCP = protocol.ByteCount(initialCongestionWindowPackets) * maxDatagramSize
|
||||
const (
|
||||
initialCongestionWindowPackets = 10
|
||||
defaultWindowTCP = protocol.ByteCount(initialCongestionWindowPackets) * maxDatagramSize
|
||||
)
|
||||
|
||||
type mockClock time.Time
|
||||
|
||||
|
|
|
@ -9,11 +9,13 @@ import (
|
|||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
const numConnections uint32 = 2
|
||||
const nConnectionBeta float32 = (float32(numConnections) - 1 + beta) / float32(numConnections)
|
||||
const nConnectionBetaLastMax float32 = (float32(numConnections) - 1 + betaLastMax) / float32(numConnections)
|
||||
const nConnectionAlpha float32 = 3 * float32(numConnections) * float32(numConnections) * (1 - nConnectionBeta) / (1 + nConnectionBeta)
|
||||
const maxCubicTimeInterval = 30 * time.Millisecond
|
||||
const (
|
||||
numConnections uint32 = 2
|
||||
nConnectionBeta float32 = (float32(numConnections) - 1 + beta) / float32(numConnections)
|
||||
nConnectionBetaLastMax float32 = (float32(numConnections) - 1 + betaLastMax) / float32(numConnections)
|
||||
nConnectionAlpha float32 = 3 * float32(numConnections) * float32(numConnections) * (1 - nConnectionBeta) / (1 + nConnectionBeta)
|
||||
maxCubicTimeInterval = 30 * time.Millisecond
|
||||
)
|
||||
|
||||
var _ = Describe("Cubic", func() {
|
||||
var (
|
||||
|
|
|
@ -17,8 +17,10 @@ const hybridStartMinSamples = uint32(8)
|
|||
// Exit slow start if the min rtt has increased by more than 1/8th.
|
||||
const hybridStartDelayFactorExp = 3 // 2^3 = 8
|
||||
// The original paper specifies 2 and 8ms, but those have changed over time.
|
||||
const hybridStartDelayMinThresholdUs = int64(4000)
|
||||
const hybridStartDelayMaxThresholdUs = int64(16000)
|
||||
const (
|
||||
hybridStartDelayMinThresholdUs = int64(4000)
|
||||
hybridStartDelayMaxThresholdUs = int64(16000)
|
||||
)
|
||||
|
||||
// HybridSlowStart implements the TCP hybrid slow start algorithm
|
||||
type HybridSlowStart struct {
|
||||
|
|
|
@ -9,9 +9,7 @@ import (
|
|||
)
|
||||
|
||||
var _ = Describe("Hybrid slow start", func() {
|
||||
var (
|
||||
slowStart HybridSlowStart
|
||||
)
|
||||
var slowStart HybridSlowStart
|
||||
|
||||
BeforeEach(func() {
|
||||
slowStart = HybridSlowStart{}
|
||||
|
@ -71,5 +69,4 @@ var _ = Describe("Hybrid slow start", func() {
|
|||
// RTT provided.
|
||||
Expect(slowStart.ShouldExitSlowStart(rtt+10*time.Millisecond, rtt, 100)).To(BeTrue())
|
||||
})
|
||||
|
||||
})
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package flowcontrol
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCrypto(t *testing.T) {
|
||||
|
|
|
@ -137,8 +137,10 @@ type cryptoSetup struct {
|
|||
has1RTTOpener bool
|
||||
}
|
||||
|
||||
var _ qtls.RecordLayer = &cryptoSetup{}
|
||||
var _ CryptoSetup = &cryptoSetup{}
|
||||
var (
|
||||
_ qtls.RecordLayer = &cryptoSetup{}
|
||||
_ CryptoSetup = &cryptoSetup{}
|
||||
)
|
||||
|
||||
// NewCryptoSetupClient creates a new crypto setup for the client
|
||||
func NewCryptoSetupClient(
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"crypto/tls"
|
||||
"encoding/hex"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/lucas-clemente/quic-go/internal/qtls"
|
||||
|
||||
|
@ -11,8 +12,6 @@ import (
|
|||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestHandshake(t *testing.T) {
|
||||
|
|
|
@ -26,7 +26,6 @@ func newHeaderProtector(suite *qtls.CipherSuiteTLS13, trafficSecret []byte, isLo
|
|||
default:
|
||||
panic(fmt.Sprintf("Invalid cipher suite id: %d", suite.ID))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
type aesHeaderProtector struct {
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
var retryAEAD cipher.AEAD
|
||||
|
||||
func init() {
|
||||
var key = [16]byte{0xcc, 0xce, 0x18, 0x7e, 0xd0, 0x9a, 0x09, 0xd0, 0x57, 0x28, 0x15, 0x5a, 0x6c, 0xb9, 0x6b, 0xe1}
|
||||
key := [16]byte{0xcc, 0xce, 0x18, 0x7e, 0xd0, 0x9a, 0x09, 0xd0, 0x57, 0x28, 0x15, 0x5a, 0x6c, 0xb9, 0x6b, 0xe1}
|
||||
|
||||
aes, err := aes.NewCipher(key[:])
|
||||
if err != nil {
|
||||
|
@ -26,9 +26,11 @@ func init() {
|
|||
retryAEAD = aead
|
||||
}
|
||||
|
||||
var retryBuf bytes.Buffer
|
||||
var retryMutex sync.Mutex
|
||||
var retryNonce = [12]byte{0xe5, 0x49, 0x30, 0xf9, 0x7f, 0x21, 0x36, 0xf0, 0x53, 0x0a, 0x8c, 0x1c}
|
||||
var (
|
||||
retryBuf bytes.Buffer
|
||||
retryMutex sync.Mutex
|
||||
retryNonce = [12]byte{0xe5, 0x49, 0x30, 0xf9, 0x7f, 0x21, 0x36, 0xf0, 0x53, 0x0a, 0x8c, 0x1c}
|
||||
)
|
||||
|
||||
// GetRetryIntegrityTag calculates the integrity tag on a Retry packet
|
||||
func GetRetryIntegrityTag(retry []byte, origDestConnID protocol.ConnectionID) *[16]byte {
|
||||
|
|
|
@ -61,8 +61,10 @@ type updatableAEAD struct {
|
|||
nonceBuf []byte
|
||||
}
|
||||
|
||||
var _ ShortHeaderOpener = &updatableAEAD{}
|
||||
var _ ShortHeaderSealer = &updatableAEAD{}
|
||||
var (
|
||||
_ ShortHeaderOpener = &updatableAEAD{}
|
||||
_ ShortHeaderSealer = &updatableAEAD{}
|
||||
)
|
||||
|
||||
func newUpdatableAEAD(rttStats *utils.RTTStats, tracer logging.ConnectionTracer, logger utils.Logger) *updatableAEAD {
|
||||
return &updatableAEAD{
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package protocol
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestProtocol(t *testing.T) {
|
||||
|
|
|
@ -61,7 +61,7 @@ func (s StreamID) InitiatedBy() Perspective {
|
|||
return PerspectiveServer
|
||||
}
|
||||
|
||||
//Type says if this is a unidirectional or bidirectional stream
|
||||
// Type says if this is a unidirectional or bidirectional stream
|
||||
func (s StreamID) Type() StreamType {
|
||||
if s%4 >= 2 {
|
||||
return StreamTypeUni
|
||||
|
|
|
@ -52,7 +52,6 @@ var _ = Describe("QUIC Transport Errors", func() {
|
|||
err := NewCryptoError(42, "")
|
||||
Expect(err.IsCryptoError()).To(BeTrue())
|
||||
Expect(err.IsApplicationError()).To(BeFalse())
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -10,9 +10,7 @@ import (
|
|||
)
|
||||
|
||||
var _ = Describe("RTT stats", func() {
|
||||
var (
|
||||
rttStats *RTTStats
|
||||
)
|
||||
var rttStats *RTTStats
|
||||
|
||||
BeforeEach(func() {
|
||||
rttStats = NewRTTStats()
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package utils
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCrypto(t *testing.T) {
|
||||
|
|
|
@ -197,7 +197,6 @@ var _ = Describe("ACK Frame (for IETF QUIC)", func() {
|
|||
Expect(err).To(MatchError(io.EOF))
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@ var _ = Describe("Frame logging", func() {
|
|||
}
|
||||
LogFrame(logger, frame, false)
|
||||
Expect(buf.String()).To(ContainSubstring("\t<- &wire.CryptoFrame{Offset: 42, Data length: 123, Offset + Data length: 165}\n"))
|
||||
|
||||
})
|
||||
|
||||
It("logs STREAM frames", func() {
|
||||
|
|
|
@ -27,7 +27,7 @@ func parseMaxDataFrame(r *bytes.Reader, _ protocol.VersionNumber) (*MaxDataFrame
|
|||
return frame, nil
|
||||
}
|
||||
|
||||
//Write writes a MAX_STREAM_DATA frame
|
||||
// Write writes a MAX_STREAM_DATA frame
|
||||
func (f *MaxDataFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error {
|
||||
b.WriteByte(0x10)
|
||||
utils.WriteVarInt(b, uint64(f.MaximumData))
|
||||
|
|
|
@ -315,7 +315,7 @@ func (p *TransportParameters) readNumericTransportParameter(
|
|||
func (p *TransportParameters) Marshal(pers protocol.Perspective) []byte {
|
||||
b := &bytes.Buffer{}
|
||||
|
||||
//add a greased value
|
||||
// add a greased value
|
||||
utils.WriteVarInt(b, uint64(27+31*rand.Intn(100)))
|
||||
length := rand.Intn(16)
|
||||
randomData := make([]byte, length)
|
||||
|
|
|
@ -2,13 +2,12 @@ package wire
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"github.com/lucas-clemente/quic-go/internal/protocol"
|
||||
"github.com/lucas-clemente/quic-go/internal/utils"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestWire(t *testing.T) {
|
||||
|
|
|
@ -33,7 +33,7 @@ func GetQLOGWriter() (func(perspective logging.Perspective, connID []byte) io.Wr
|
|||
return nil, nil
|
||||
}
|
||||
if _, err := os.Stat(qlogDir); os.IsNotExist(err) {
|
||||
if err := os.MkdirAll(qlogDir, 0666); err != nil {
|
||||
if err := os.MkdirAll(qlogDir, 0o666); err != nil {
|
||||
return nil, fmt.Errorf("failed to create qlog dir %s: %s", qlogDir, err.Error())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -196,6 +196,7 @@ func (t *connTracer) LostPacket(encLevel logging.EncryptionLevel, _ logging.Pack
|
|||
lostPackets.M(1),
|
||||
)
|
||||
}
|
||||
|
||||
func (t *connTracer) UpdatedPTOCount(value uint32) {
|
||||
if value == 0 {
|
||||
return
|
||||
|
|
|
@ -89,7 +89,8 @@ func (t *connectionTracer) run() {
|
|||
},
|
||||
EventFields: eventFields[:],
|
||||
},
|
||||
}}
|
||||
},
|
||||
}
|
||||
if err := enc.Encode(tl); err != nil {
|
||||
panic(fmt.Sprintf("qlog encoding into a bytes.Buffer failed: %s", err))
|
||||
}
|
||||
|
|
|
@ -2,12 +2,11 @@ package quic
|
|||
|
||||
import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestQuicGo(t *testing.T) {
|
||||
|
|
|
@ -52,8 +52,10 @@ type receiveStream struct {
|
|||
version protocol.VersionNumber
|
||||
}
|
||||
|
||||
var _ ReceiveStream = &receiveStream{}
|
||||
var _ receiveStreamI = &receiveStream{}
|
||||
var (
|
||||
_ ReceiveStream = &receiveStream{}
|
||||
_ receiveStreamI = &receiveStream{}
|
||||
)
|
||||
|
||||
func newReceiveStream(
|
||||
streamID protocol.StreamID,
|
||||
|
|
|
@ -57,8 +57,10 @@ type sendStream struct {
|
|||
version protocol.VersionNumber
|
||||
}
|
||||
|
||||
var _ SendStream = &sendStream{}
|
||||
var _ sendStreamI = &sendStream{}
|
||||
var (
|
||||
_ SendStream = &sendStream{}
|
||||
_ sendStreamI = &sendStream{}
|
||||
)
|
||||
|
||||
func newSendStream(
|
||||
streamID protocol.StreamID,
|
||||
|
|
|
@ -103,8 +103,10 @@ type baseServer struct {
|
|||
logger utils.Logger
|
||||
}
|
||||
|
||||
var _ Listener = &baseServer{}
|
||||
var _ unknownPacketHandler = &baseServer{}
|
||||
var (
|
||||
_ Listener = &baseServer{}
|
||||
_ unknownPacketHandler = &baseServer{}
|
||||
)
|
||||
|
||||
type earlyServer struct{ *baseServer }
|
||||
|
||||
|
|
|
@ -213,9 +213,11 @@ type session struct {
|
|||
logger utils.Logger
|
||||
}
|
||||
|
||||
var _ Session = &session{}
|
||||
var _ EarlySession = &session{}
|
||||
var _ streamSender = &session{}
|
||||
var (
|
||||
_ Session = &session{}
|
||||
_ EarlySession = &session{}
|
||||
_ streamSender = &session{}
|
||||
)
|
||||
|
||||
var newSession = func(
|
||||
conn sendConn,
|
||||
|
|
|
@ -2701,6 +2701,5 @@ var _ = Describe("Client Session", func() {
|
|||
tracer.EXPECT().DroppedPacket(gomock.Any(), gomock.Any(), gomock.Any())
|
||||
Expect(sess.handlePacketImpl(wrapPacket(initialPacket))).To(BeFalse())
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
|
|
|
@ -53,8 +53,10 @@ type streamI interface {
|
|||
handleMaxStreamDataFrame(*wire.MaxStreamDataFrame)
|
||||
}
|
||||
|
||||
var _ receiveStreamI = (streamI)(nil)
|
||||
var _ sendStreamI = (streamI)(nil)
|
||||
var (
|
||||
_ receiveStreamI = (streamI)(nil)
|
||||
_ sendStreamI = (streamI)(nil)
|
||||
)
|
||||
|
||||
// A Stream assembles the data from StreamFrames and provides a super-convenient Read-Interface
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue