Просмотр исходного кода

Formatting with gofumpt

tags/v2.2.0^2^2
9seconds 1 месяц назад
Родитель
Сommit
ffd3ab03cc

+ 4
- 4
internal/config/type_https_url_test.go Просмотреть файл

@@ -42,10 +42,10 @@ func (suite *HttpsURLTestSuite) TestUnmarshalFail() {
42 42
 
43 43
 func (suite *HttpsURLTestSuite) TestUnmarshalOk() {
44 44
 	testData := map[string]string{
45
-		"https://example.com":            "https://example.com",
46
-		"https://example.com:8443":       "https://example.com:8443",
47
-		"https://example.com/path?q=1":   "https://example.com/path?q=1",
48
-		"https://user:pass@example.com":  "https://user:pass@example.com",
45
+		"https://example.com":           "https://example.com",
46
+		"https://example.com:8443":      "https://example.com:8443",
47
+		"https://example.com/path?q=1":  "https://example.com/path?q=1",
48
+		"https://user:pass@example.com": "https://user:pass@example.com",
49 49
 	}
50 50
 
51 51
 	for k, v := range testData {

+ 1
- 2
mtglib/internal/doppel/init_test.go Просмотреть файл

@@ -13,8 +13,7 @@ import (
13 13
 	"github.com/stretchr/testify/suite"
14 14
 )
15 15
 
16
-type SimpleNetwork struct {
17
-}
16
+type SimpleNetwork struct{}
18 17
 
19 18
 func (s SimpleNetwork) Dial(network, address string) (essentials.Conn, error) {
20 19
 	return s.DialContext(context.Background(), network, address)

+ 2
- 4
mtglib/internal/tls/conn.go Просмотреть файл

@@ -22,10 +22,8 @@ const (
22 22
 	TypeApplicationData  = 0x17
23 23
 )
24 24
 
25
-var (
26
-	// TLS 1.2 is used for both TLS 1.2 and 1.3
27
-	TLSVersion = [SizeVersion]byte{3, 3}
28
-)
25
+// TLS 1.2 is used for both TLS 1.2 and 1.3
26
+var TLSVersion = [SizeVersion]byte{3, 3}
29 27
 
30 28
 // Conn presents an established TLS 1.3 connection, after handshake
31 29
 type Conn struct {

+ 5
- 7
mtglib/internal/tls/fake/bytes_pool.go Просмотреть файл

@@ -5,13 +5,11 @@ import (
5 5
 	"sync"
6 6
 )
7 7
 
8
-var (
9
-	bytesPool = sync.Pool{
10
-		New: func() any {
11
-			return &bytes.Buffer{}
12
-		},
13
-	}
14
-)
8
+var bytesPool = sync.Pool{
9
+	New: func() any {
10
+		return &bytes.Buffer{}
11
+	},
12
+}
15 13
 
16 14
 func acquireBuffer() *bytes.Buffer {
17 15
 	return bytesPool.Get().(*bytes.Buffer)

+ 0
- 1
mtglib/internal/tls/fake/client_side_fuzz_test.go Просмотреть файл

@@ -45,5 +45,4 @@ func FuzzReadClientHello(f *testing.F) {
45 45
 		_, err := fake.ReadClientHello(r, secret.Key[:], secret.Host, time.Hour)
46 46
 		assert.Error(t, err)
47 47
 	})
48
-
49 48
 }

+ 11
- 13
mtglib/internal/tls/fake/server_side.go Просмотреть файл

@@ -20,19 +20,17 @@ const (
20 20
 	EllipticCurveLen = 32
21 21
 )
22 22
 
23
-var (
24
-	serverHelloSuffix = []byte{
25
-		0x00,       // no compression
26
-		0x00, 0x2e, // 46 bytes of data
27
-		0x00, 0x2b, // Extension - Supported Versions
28
-		0x00, 0x02, // 2 bytes are following
29
-		0x03, 0x04, // TLS 1.3
30
-		0x00, 0x33, // Extension - Key Share
31
-		0x00, 0x24, // 36 bytes
32
-		0x00, 0x1d, // x25519 curve
33
-		0x00, 0x20, // 32 bytes of key
34
-	}
35
-)
23
+var serverHelloSuffix = []byte{
24
+	0x00,       // no compression
25
+	0x00, 0x2e, // 46 bytes of data
26
+	0x00, 0x2b, // Extension - Supported Versions
27
+	0x00, 0x02, // 2 bytes are following
28
+	0x03, 0x04, // TLS 1.3
29
+	0x00, 0x33, // Extension - Key Share
30
+	0x00, 0x24, // 36 bytes
31
+	0x00, 0x1d, // x25519 curve
32
+	0x00, 0x20, // 32 bytes of key
33
+}
36 34
 
37 35
 func SendServerHello(w io.Writer, secret []byte, clientHello *ClientHello) ([]byte, error) {
38 36
 	buf := &bytes.Buffer{}

Загрузка…
Отмена
Сохранить