From ffd3ab03ccfc70e080853cedb7615c95c9360b29 Mon Sep 17 00:00:00 2001 From: 9seconds Date: Thu, 12 Mar 2026 19:13:33 +0100 Subject: [PATCH] Formatting with gofumpt --- internal/config/type_https_url_test.go | 8 +++---- mtglib/internal/doppel/init_test.go | 3 +-- mtglib/internal/tls/conn.go | 6 ++--- mtglib/internal/tls/fake/bytes_pool.go | 12 ++++------ .../tls/fake/client_side_fuzz_test.go | 1 - mtglib/internal/tls/fake/server_side.go | 24 +++++++++---------- 6 files changed, 23 insertions(+), 31 deletions(-) diff --git a/internal/config/type_https_url_test.go b/internal/config/type_https_url_test.go index 6c7db83..79a39fe 100644 --- a/internal/config/type_https_url_test.go +++ b/internal/config/type_https_url_test.go @@ -42,10 +42,10 @@ func (suite *HttpsURLTestSuite) TestUnmarshalFail() { func (suite *HttpsURLTestSuite) TestUnmarshalOk() { testData := map[string]string{ - "https://example.com": "https://example.com", - "https://example.com:8443": "https://example.com:8443", - "https://example.com/path?q=1": "https://example.com/path?q=1", - "https://user:pass@example.com": "https://user:pass@example.com", + "https://example.com": "https://example.com", + "https://example.com:8443": "https://example.com:8443", + "https://example.com/path?q=1": "https://example.com/path?q=1", + "https://user:pass@example.com": "https://user:pass@example.com", } for k, v := range testData { diff --git a/mtglib/internal/doppel/init_test.go b/mtglib/internal/doppel/init_test.go index e8eec5e..8723959 100644 --- a/mtglib/internal/doppel/init_test.go +++ b/mtglib/internal/doppel/init_test.go @@ -13,8 +13,7 @@ import ( "github.com/stretchr/testify/suite" ) -type SimpleNetwork struct { -} +type SimpleNetwork struct{} func (s SimpleNetwork) Dial(network, address string) (essentials.Conn, error) { return s.DialContext(context.Background(), network, address) diff --git a/mtglib/internal/tls/conn.go b/mtglib/internal/tls/conn.go index 86c5f59..e889310 100644 --- a/mtglib/internal/tls/conn.go +++ b/mtglib/internal/tls/conn.go @@ -22,10 +22,8 @@ const ( TypeApplicationData = 0x17 ) -var ( - // TLS 1.2 is used for both TLS 1.2 and 1.3 - TLSVersion = [SizeVersion]byte{3, 3} -) +// TLS 1.2 is used for both TLS 1.2 and 1.3 +var TLSVersion = [SizeVersion]byte{3, 3} // Conn presents an established TLS 1.3 connection, after handshake type Conn struct { diff --git a/mtglib/internal/tls/fake/bytes_pool.go b/mtglib/internal/tls/fake/bytes_pool.go index 2eaca15..533ed24 100644 --- a/mtglib/internal/tls/fake/bytes_pool.go +++ b/mtglib/internal/tls/fake/bytes_pool.go @@ -5,13 +5,11 @@ import ( "sync" ) -var ( - bytesPool = sync.Pool{ - New: func() any { - return &bytes.Buffer{} - }, - } -) +var bytesPool = sync.Pool{ + New: func() any { + return &bytes.Buffer{} + }, +} func acquireBuffer() *bytes.Buffer { return bytesPool.Get().(*bytes.Buffer) diff --git a/mtglib/internal/tls/fake/client_side_fuzz_test.go b/mtglib/internal/tls/fake/client_side_fuzz_test.go index 28f3337..6de5c82 100644 --- a/mtglib/internal/tls/fake/client_side_fuzz_test.go +++ b/mtglib/internal/tls/fake/client_side_fuzz_test.go @@ -45,5 +45,4 @@ func FuzzReadClientHello(f *testing.F) { _, err := fake.ReadClientHello(r, secret.Key[:], secret.Host, time.Hour) assert.Error(t, err) }) - } diff --git a/mtglib/internal/tls/fake/server_side.go b/mtglib/internal/tls/fake/server_side.go index 14e0cde..3a0d43a 100644 --- a/mtglib/internal/tls/fake/server_side.go +++ b/mtglib/internal/tls/fake/server_side.go @@ -20,19 +20,17 @@ const ( EllipticCurveLen = 32 ) -var ( - serverHelloSuffix = []byte{ - 0x00, // no compression - 0x00, 0x2e, // 46 bytes of data - 0x00, 0x2b, // Extension - Supported Versions - 0x00, 0x02, // 2 bytes are following - 0x03, 0x04, // TLS 1.3 - 0x00, 0x33, // Extension - Key Share - 0x00, 0x24, // 36 bytes - 0x00, 0x1d, // x25519 curve - 0x00, 0x20, // 32 bytes of key - } -) +var serverHelloSuffix = []byte{ + 0x00, // no compression + 0x00, 0x2e, // 46 bytes of data + 0x00, 0x2b, // Extension - Supported Versions + 0x00, 0x02, // 2 bytes are following + 0x03, 0x04, // TLS 1.3 + 0x00, 0x33, // Extension - Key Share + 0x00, 0x24, // 36 bytes + 0x00, 0x1d, // x25519 curve + 0x00, 0x20, // 32 bytes of key +} func SendServerHello(w io.Writer, secret []byte, clientHello *ClientHello) ([]byte, error) { buf := &bytes.Buffer{}