Formatting with gofumpt

This commit is contained in:
9seconds
2026-03-12 19:13:33 +01:00
parent 00403e3a94
commit ffd3ab03cc
6 changed files with 23 additions and 31 deletions
+4 -4
View File
@@ -42,10 +42,10 @@ func (suite *HttpsURLTestSuite) TestUnmarshalFail() {
func (suite *HttpsURLTestSuite) TestUnmarshalOk() { func (suite *HttpsURLTestSuite) TestUnmarshalOk() {
testData := map[string]string{ testData := map[string]string{
"https://example.com": "https://example.com", "https://example.com": "https://example.com",
"https://example.com:8443": "https://example.com:8443", "https://example.com:8443": "https://example.com:8443",
"https://example.com/path?q=1": "https://example.com/path?q=1", "https://example.com/path?q=1": "https://example.com/path?q=1",
"https://user:pass@example.com": "https://user:pass@example.com", "https://user:pass@example.com": "https://user:pass@example.com",
} }
for k, v := range testData { for k, v := range testData {
+1 -2
View File
@@ -13,8 +13,7 @@ import (
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
) )
type SimpleNetwork struct { type SimpleNetwork struct{}
}
func (s SimpleNetwork) Dial(network, address string) (essentials.Conn, error) { func (s SimpleNetwork) Dial(network, address string) (essentials.Conn, error) {
return s.DialContext(context.Background(), network, address) return s.DialContext(context.Background(), network, address)
+2 -4
View File
@@ -22,10 +22,8 @@ const (
TypeApplicationData = 0x17 TypeApplicationData = 0x17
) )
var ( // TLS 1.2 is used for both TLS 1.2 and 1.3
// TLS 1.2 is used for both TLS 1.2 and 1.3 var TLSVersion = [SizeVersion]byte{3, 3}
TLSVersion = [SizeVersion]byte{3, 3}
)
// Conn presents an established TLS 1.3 connection, after handshake // Conn presents an established TLS 1.3 connection, after handshake
type Conn struct { type Conn struct {
+5 -7
View File
@@ -5,13 +5,11 @@ import (
"sync" "sync"
) )
var ( var bytesPool = sync.Pool{
bytesPool = sync.Pool{ New: func() any {
New: func() any { return &bytes.Buffer{}
return &bytes.Buffer{} },
}, }
}
)
func acquireBuffer() *bytes.Buffer { func acquireBuffer() *bytes.Buffer {
return bytesPool.Get().(*bytes.Buffer) return bytesPool.Get().(*bytes.Buffer)
@@ -45,5 +45,4 @@ func FuzzReadClientHello(f *testing.F) {
_, err := fake.ReadClientHello(r, secret.Key[:], secret.Host, time.Hour) _, err := fake.ReadClientHello(r, secret.Key[:], secret.Host, time.Hour)
assert.Error(t, err) assert.Error(t, err)
}) })
} }
+11 -13
View File
@@ -20,19 +20,17 @@ const (
EllipticCurveLen = 32 EllipticCurveLen = 32
) )
var ( var serverHelloSuffix = []byte{
serverHelloSuffix = []byte{ 0x00, // no compression
0x00, // no compression 0x00, 0x2e, // 46 bytes of data
0x00, 0x2e, // 46 bytes of data 0x00, 0x2b, // Extension - Supported Versions
0x00, 0x2b, // Extension - Supported Versions 0x00, 0x02, // 2 bytes are following
0x00, 0x02, // 2 bytes are following 0x03, 0x04, // TLS 1.3
0x03, 0x04, // TLS 1.3 0x00, 0x33, // Extension - Key Share
0x00, 0x33, // Extension - Key Share 0x00, 0x24, // 36 bytes
0x00, 0x24, // 36 bytes 0x00, 0x1d, // x25519 curve
0x00, 0x1d, // x25519 curve 0x00, 0x20, // 32 bytes of key
0x00, 0x20, // 32 bytes of key }
}
)
func SendServerHello(w io.Writer, secret []byte, clientHello *ClientHello) ([]byte, error) { func SendServerHello(w io.Writer, secret []byte, clientHello *ClientHello) ([]byte, error) {
buf := &bytes.Buffer{} buf := &bytes.Buffer{}