run gofumpt, enable the gofumpt linter

This commit is contained in:
Marten Seemann
2020-10-25 12:43:26 +07:00
parent 598f975024
commit 8752576f26
50 changed files with 132 additions and 109 deletions

View File

@@ -1,10 +1,10 @@
package congestion
import (
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestCongestion(t *testing.T) {

View File

@@ -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

View File

@@ -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 {

View File

@@ -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

View File

@@ -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 (

View File

@@ -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 {

View File

@@ -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())
})
})