소스 검색

Upgrade golangci-lint for 1.42

tags/v1.0.10
9seconds 4 년 전
부모
커밋
3e0880f6b4

+ 1
- 1
.github/workflows/ci.yaml 파일 보기

@@ -72,7 +72,7 @@ jobs:
72 72
       - name: Run linter
73 73
         uses: golangci/golangci-lint-action@v2
74 74
         with:
75
-          version: v1.37.1
75
+          version: v1.42.0
76 76
 
77 77
   docker:
78 78
     name: Docker

+ 1
- 1
Makefile 파일 보기

@@ -4,7 +4,7 @@ APP_NAME     := $(IMAGE_NAME)
4 4
 
5 5
 CC_BINARIES  := $(shell bash -c "echo -n $(APP_NAME)-{linux,freebsd,openbsd}-{386,amd64} $(APP_NAME)-linux-{arm,arm64}")
6 6
 
7
-GOLANGCI_LINT_VERSION := v1.37.1
7
+GOLANGCI_LINT_VERSION := v1.42.0
8 8
 
9 9
 VERSION_GO         := $(shell go version)
10 10
 VERSION_DATE       := $(shell date -Ru)

+ 30
- 30
config/config.go 파일 보기

@@ -79,29 +79,29 @@ const (
79 79
 
80 80
 type Config struct {
81 81
 	Bind             *net.TCPAddr      `json:"bind"`
82
-	PublicIPv4       *net.TCPAddr      `json:"public_ipv4"`
83
-	PublicIPv6       *net.TCPAddr      `json:"public_ipv6"`
84
-	StatsBind        *net.TCPAddr      `json:"stats_bind"`
85
-	StatsdAddr       *net.TCPAddr      `json:"stats_addr"`
86
-	StatsdTagsFormat *statsd.TagFormat `json:"statsd_tags_format"`
82
+	PublicIPv4       *net.TCPAddr      `json:"public_ipv4"`        // nolint: tagliatelle
83
+	PublicIPv6       *net.TCPAddr      `json:"public_ipv6"`        // nolint: tagliatelle
84
+	StatsBind        *net.TCPAddr      `json:"stats_bind"`         // nolint: tagliatelle
85
+	StatsdAddr       *net.TCPAddr      `json:"stats_addr"`         // nolint: tagliatelle
86
+	StatsdTagsFormat *statsd.TagFormat `json:"statsd_tags_format"` // nolint: tagliatelle
87 87
 
88
-	StatsNamespace string            `json:"stats_namespace"`
89
-	CloakHost      string            `json:"cloak_host"`
90
-	StatsdTags     map[string]string `json:"statsd_tags"`
88
+	StatsNamespace string            `json:"stats_namespace"` // nolint: tagliatelle
89
+	CloakHost      string            `json:"cloak_host"`      // nolint: tagliatelle
90
+	StatsdTags     map[string]string `json:"statsd_tags"`     // nolint: tagliatelle
91 91
 
92
-	WriteBuffer int `json:"write_buffer"`
93
-	ReadBuffer  int `json:"read_buffer"`
94
-	CloakPort   int `json:"cloak_port"`
92
+	WriteBuffer int `json:"write_buffer"` // nolint: tagliatelle
93
+	ReadBuffer  int `json:"read_buffer"`  // nolint: tagliatelle
94
+	CloakPort   int `json:"cloak_port"`   // nolint: tagliatelle
95 95
 
96
-	AntiReplayMaxSize int `json:"anti_replay_max_size"`
96
+	AntiReplayMaxSize int `json:"anti_replay_max_size"` // nolint: tagliatelle
97 97
 
98
-	MultiplexPerConnection int `json:"multiplex_per_connection"`
98
+	MultiplexPerConnection int `json:"multiplex_per_connection"` // nolint: tagliatelle
99 99
 
100 100
 	Debug      bool       `json:"debug"`
101 101
 	Verbose    bool       `json:"verbose"`
102
-	SecretMode SecretMode `json:"secret_mode"`
103
-	PreferIP   PreferIP   `json:"prefer_ip"`
104
-	NTPServers []string   `json:"ntp_servers"`
102
+	SecretMode SecretMode `json:"secret_mode"` // nolint: tagliatelle
103
+	PreferIP   PreferIP   `json:"prefer_ip"`   // nolint: tagliatelle
104
+	NTPServers []string   `json:"ntp_servers"` // nolint: tagliatelle
105 105
 
106 106
 	Secret []byte `json:"secret"`
107 107
 	AdTag  []byte `json:"adtag"`
@@ -164,11 +164,11 @@ func Init(options ...Opt) error { // nolint: gocyclo, funlen, cyclop
164 164
 	for _, opt := range options {
165 165
 		switch opt.Option {
166 166
 		case OptionTypeDebug:
167
-			C.Debug = opt.Value.(bool)
167
+			C.Debug = opt.Value.(bool) // nolint: forcetypeassert
168 168
 		case OptionTypeVerbose:
169
-			C.Verbose = opt.Value.(bool)
169
+			C.Verbose = opt.Value.(bool) // nolint: forcetypeassert
170 170
 		case OptionTypePreferIP:
171
-			value := opt.Value.(string)
171
+			value := opt.Value.(string) // nolint: forcetypeassert
172 172
 			switch value {
173 173
 			case "ipv4":
174 174
 				C.PreferIP = PreferIPv4
@@ -178,25 +178,25 @@ func Init(options ...Opt) error { // nolint: gocyclo, funlen, cyclop
178 178
 				return fmt.Errorf("incorrect direct IP mode %s", value)
179 179
 			}
180 180
 		case OptionTypeBind:
181
-			C.Bind = opt.Value.(*net.TCPAddr)
181
+			C.Bind = opt.Value.(*net.TCPAddr) // nolint: forcetypeassert
182 182
 		case OptionTypePublicIPv4:
183
-			C.PublicIPv4 = opt.Value.(*net.TCPAddr)
183
+			C.PublicIPv4 = opt.Value.(*net.TCPAddr) // nolint: forcetypeassert
184 184
 			if C.PublicIPv4 == nil {
185 185
 				C.PublicIPv4 = &net.TCPAddr{}
186 186
 			}
187 187
 		case OptionTypePublicIPv6:
188
-			C.PublicIPv6 = opt.Value.(*net.TCPAddr)
188
+			C.PublicIPv6 = opt.Value.(*net.TCPAddr) // nolint: forcetypeassert
189 189
 			if C.PublicIPv6 == nil {
190 190
 				C.PublicIPv6 = &net.TCPAddr{}
191 191
 			}
192 192
 		case OptionTypeStatsBind:
193
-			C.StatsBind = opt.Value.(*net.TCPAddr)
193
+			C.StatsBind = opt.Value.(*net.TCPAddr) // nolint: forcetypeassert
194 194
 		case OptionTypeStatsNamespace:
195
-			C.StatsNamespace = opt.Value.(string)
195
+			C.StatsNamespace = opt.Value.(string) // nolint: forcetypeassert
196 196
 		case OptionTypeStatsdAddress:
197
-			C.StatsdAddr = opt.Value.(*net.TCPAddr)
197
+			C.StatsdAddr = opt.Value.(*net.TCPAddr) // nolint: forcetypeassert
198 198
 		case OptionTypeStatsdTagsFormat:
199
-			value := opt.Value.(string)
199
+			value := opt.Value.(string) // nolint: forcetypeassert
200 200
 			switch value {
201 201
 			case "datadog":
202 202
 				C.StatsdTagsFormat = statsd.TagFormatDatadog
@@ -206,7 +206,7 @@ func Init(options ...Opt) error { // nolint: gocyclo, funlen, cyclop
206 206
 				return fmt.Errorf("incorrect statsd tag %s", value)
207 207
 			}
208 208
 		case OptionTypeStatsdTags:
209
-			C.StatsdTags = opt.Value.(map[string]string)
209
+			C.StatsdTags = opt.Value.(map[string]string) // nolint: forcetypeassert
210 210
 		case OptionTypeWriteBufferSize:
211 211
 			C.WriteBuffer = int(opt.Value.(units.Base2Bytes))
212 212
 		case OptionTypeReadBufferSize:
@@ -218,14 +218,14 @@ func Init(options ...Opt) error { // nolint: gocyclo, funlen, cyclop
218 218
 		case OptionTypeMultiplexPerConnection:
219 219
 			C.MultiplexPerConnection = int(opt.Value.(uint))
220 220
 		case OptionTypeNTPServers:
221
-			C.NTPServers = opt.Value.([]string)
221
+			C.NTPServers = opt.Value.([]string) // nolint: forcetypeassert
222 222
 			if len(C.NTPServers) == 0 {
223 223
 				return errors.New("ntp server list is empty")
224 224
 			}
225 225
 		case OptionTypeSecret:
226
-			C.Secret = opt.Value.([]byte)
226
+			C.Secret = opt.Value.([]byte) // nolint: forcetypeassert
227 227
 		case OptionTypeAdtag:
228
-			C.AdTag = opt.Value.([]byte)
228
+			C.AdTag = opt.Value.([]byte) // nolint: forcetypeassert
229 229
 		default:
230 230
 			return fmt.Errorf("unknown tag %v", opt.Option)
231 231
 		}

+ 1
- 1
config/global_ips.go 파일 보기

@@ -41,7 +41,7 @@ func fetchIP(ctx context.Context, network string) (net.IP, error) {
41 41
 		Timeout: ifconfigTimeout,
42 42
 		Transport: &http.Transport{
43 43
 			DialContext: func(ctx context.Context, _, addr string) (net.Conn, error) {
44
-				return dialer.DialContext(ctx, network, addr)
44
+				return dialer.DialContext(ctx, network, addr) // nolint: wrapcheck
45 45
 			},
46 46
 		},
47 47
 	}

+ 5
- 5
config/urls.go 파일 보기

@@ -8,16 +8,16 @@ import (
8 8
 )
9 9
 
10 10
 type URLs struct {
11
-	TG        string `json:"tg_url"`
12
-	TMe       string `json:"tme_url"`
13
-	TGQRCode  string `json:"tg_qrcode"`
14
-	TMeQRCode string `json:"tme_qrcode"`
11
+	TG        string `json:"tg_url"`     // nolint: tagliatelle
12
+	TMe       string `json:"tme_url"`    // nolint: tagliatelle
13
+	TGQRCode  string `json:"tg_qrcode"`  // nolint: tagliatelle
14
+	TMeQRCode string `json:"tme_qrcode"` // nolint: tagliatelle
15 15
 }
16 16
 
17 17
 type IPURLs struct {
18 18
 	IPv4      *URLs  `json:"ipv4,omitempty"`
19 19
 	IPv6      *URLs  `json:"ipv6,omitempty"`
20
-	BotSecret string `json:"secret_for_mtproxybot"`
20
+	BotSecret string `json:"secret_for_mtproxybot"` // nolint: tagliatelle
21 21
 }
22 22
 
23 23
 func GetURLs() (urls IPURLs) {

+ 1
- 1
hub/hub.go 파일 보기

@@ -18,7 +18,7 @@ func (h *hub) Register(req *protocol.TelegramRequest) (*ProxyConn, error) {
18 18
 }
19 19
 
20 20
 func (h *hub) getMux(req *protocol.TelegramRequest) *mux {
21
-	var key int32 = 32767 + int32(req.ClientProtocol.DC()) + 100000*int32(req.ClientProtocol.ConnectionProtocol())
21
+	key := 32767 + int32(req.ClientProtocol.DC()) + 100000*int32(req.ClientProtocol.ConnectionProtocol())
22 22
 
23 23
 	h.mutex.RLock()
24 24
 	m, ok := h.muxes[key]

+ 5
- 5
obfuscated2/client_protocol.go 파일 보기

@@ -45,14 +45,14 @@ func (c *ClientProtocol) Handshake(socket conntypes.StreamReadWriteCloser) (conn
45 45
 	}
46 46
 
47 47
 	decHasher := sha256.New()
48
-	decHasher.Write(fm.Key())        // nolint: errcheck
49
-	decHasher.Write(config.C.Secret) // nolint: errcheck
48
+	decHasher.Write(fm.Key())
49
+	decHasher.Write(config.C.Secret)
50 50
 	decryptor := utils.MakeStreamCipher(decHasher.Sum(nil), fm.IV())
51 51
 
52 52
 	invertedFrame := fm.Invert()
53 53
 	encHasher := sha256.New()
54
-	encHasher.Write(invertedFrame.Key()) // nolint: errcheck
55
-	encHasher.Write(config.C.Secret)     // nolint: errcheck
54
+	encHasher.Write(invertedFrame.Key())
55
+	encHasher.Write(config.C.Secret)
56 56
 	encryptor := utils.MakeStreamCipher(encHasher.Sum(nil), invertedFrame.IV())
57 57
 
58 58
 	decryptedFrame := Frame{}
@@ -106,7 +106,7 @@ type handshakeReader struct {
106 106
 }
107 107
 
108 108
 func (h handshakeReader) Read(p []byte) (int, error) {
109
-	return h.parent.ReadTimeout(p, clientProtocolHandshakeTimeout)
109
+	return h.parent.ReadTimeout(p, clientProtocolHandshakeTimeout) // nolint: wrapcheck
110 110
 }
111 111
 
112 112
 func MakeClientProtocol() protocol.ClientProtocol {

+ 3
- 6
proxy/direct.go 파일 보기

@@ -4,7 +4,6 @@ import (
4 4
 	"io"
5 5
 	"sync"
6 6
 
7
-	"github.com/9seconds/mtg/conntypes"
8 7
 	"github.com/9seconds/mtg/obfuscated2"
9 8
 	"github.com/9seconds/mtg/protocol"
10 9
 	"go.uber.org/zap"
@@ -18,16 +17,14 @@ func directConnection(request *protocol.TelegramRequest) error {
18 17
 		return err // nolint: wrapcheck
19 18
 	}
20 19
 
21
-	telegramConn := telegramConnRaw.(conntypes.StreamReadWriteCloser)
22
-
23
-	defer telegramConn.Close()
20
+	defer telegramConnRaw.Close()
24 21
 
25 22
 	wg := &sync.WaitGroup{}
26 23
 	wg.Add(2)
27 24
 
28
-	go directPipe(telegramConn, request.ClientConn, wg, request.Logger)
25
+	go directPipe(telegramConnRaw, request.ClientConn, wg, request.Logger)
29 26
 
30
-	go directPipe(request.ClientConn, telegramConn, wg, request.Logger)
27
+	go directPipe(request.ClientConn, telegramConnRaw, wg, request.Logger)
31 28
 
32 29
 	wg.Wait()
33 30
 

+ 2
- 2
tlstypes/server_hello.go 파일 보기

@@ -49,8 +49,8 @@ func (s ServerHello) WelcomePacket() []byte {
49 49
 	packet := buf.Bytes()
50 50
 
51 51
 	mac := hmac.New(sha256.New, config.C.Secret)
52
-	mac.Write(s.clientHello.Random[:]) // nolint: errcheck
53
-	mac.Write(packet)                  // nolint: errcheck
52
+	mac.Write(s.clientHello.Random[:])
53
+	mac.Write(packet)
54 54
 	copy(packet[11:], mac.Sum(nil))
55 55
 
56 56
 	return packet

+ 1
- 1
utils/init_tcp.go 파일 보기

@@ -6,7 +6,7 @@ import (
6 6
 )
7 7
 
8 8
 func InitTCP(conn net.Conn, readBufferSize int, writeBufferSize int) error {
9
-	tcpConn := conn.(*net.TCPConn)
9
+	tcpConn := conn.(*net.TCPConn) // nolint: forcetypeassert
10 10
 
11 11
 	if err := tcpConn.SetNoDelay(true); err != nil {
12 12
 		return fmt.Errorf("cannot set TCP_NO_DELAY: %w", err)

+ 1
- 0
utils/rlimit.go 파일 보기

@@ -1,3 +1,4 @@
1
+//go:build !windows
1 2
 // +build !windows
2 3
 
3 4
 package utils

+ 1
- 0
utils/rlimit_windows.go 파일 보기

@@ -1,3 +1,4 @@
1
+//go:build windows
1 2
 // +build windows
2 3
 
3 4
 package utils

+ 1
- 0
utils/signal_context.go 파일 보기

@@ -1,3 +1,4 @@
1
+//go:build !windows
1 2
 // +build !windows
2 3
 
3 4
 package utils

+ 1
- 0
utils/signal_context_windows.go 파일 보기

@@ -1,3 +1,4 @@
1
+//go:build windows
1 2
 // +build windows
2 3
 
3 4
 package utils

+ 1
- 1
wrappers/packet/mtproto_frame.go 파일 보기

@@ -136,7 +136,7 @@ func (w *wrapperMtprotoFrame) Write(p conntypes.Packet) error {
136 136
 }
137 137
 
138 138
 func (w *wrapperMtprotoFrame) Close() error {
139
-	return w.parent.Close()
139
+	return w.parent.Close() // nolint: wrapcheck
140 140
 }
141 141
 
142 142
 func (w *wrapperMtprotoFrame) Conn() net.Conn {

+ 1
- 1
wrappers/packetack/client_abridged.go 파일 보기

@@ -104,7 +104,7 @@ func (w *wrapperClientAbridged) Write(packet conntypes.Packet, acks *conntypes.C
104 104
 }
105 105
 
106 106
 func (w *wrapperClientAbridged) Close() error {
107
-	return w.parent.Close()
107
+	return w.parent.Close() // nolint: wrapcheck
108 108
 }
109 109
 
110 110
 func (w *wrapperClientAbridged) Conn() net.Conn {

+ 1
- 1
wrappers/packetack/client_intermediate.go 파일 보기

@@ -63,7 +63,7 @@ func (w *wrapperClientIntermediate) Write(packet conntypes.Packet, acks *conntyp
63 63
 }
64 64
 
65 65
 func (w *wrapperClientIntermediate) Close() error {
66
-	return w.parent.Close()
66
+	return w.parent.Close() // nolint: wrapcheck
67 67
 }
68 68
 
69 69
 func (w *wrapperClientIntermediate) Conn() net.Conn {

+ 1
- 1
wrappers/packetack/proxy.go 파일 보기

@@ -46,7 +46,7 @@ func (w *wrapperProxy) Write(packet conntypes.Packet, acks *conntypes.Connection
46 46
 	buf.Grow(len(packet))
47 47
 	buf.Write(packet)
48 48
 
49
-	return w.proxy.Write(buf.Bytes())
49
+	return w.proxy.Write(buf.Bytes()) // nolint: wrapcheck
50 50
 }
51 51
 
52 52
 func (w *wrapperProxy) Read(acks *conntypes.ConnectionAcks) (conntypes.Packet, error) {

+ 1
- 1
wrappers/rwc/ping.go 파일 보기

@@ -36,7 +36,7 @@ func (w *wrapperPing) Write(p []byte) (int, error) {
36 36
 }
37 37
 
38 38
 func (w *wrapperPing) Close() error {
39
-	return w.parent.Close()
39
+	return w.parent.Close() // nolint: wrapcheck
40 40
 }
41 41
 
42 42
 func NewPing(ctx context.Context, parent io.ReadWriteCloser, channelPing chan<- struct{}) io.ReadWriteCloser {

+ 3
- 3
wrappers/stream/blockcipher.go 파일 보기

@@ -26,7 +26,7 @@ func (w *wrapperBlockCipher) Write(p []byte) (int, error) {
26 26
 		return 0, err
27 27
 	}
28 28
 
29
-	return w.parent.Write(encrypted)
29
+	return w.parent.Write(encrypted) // nolint: wrapcheck
30 30
 }
31 31
 
32 32
 func (w *wrapperBlockCipher) WriteTimeout(p []byte, timeout time.Duration) (int, error) {
@@ -35,7 +35,7 @@ func (w *wrapperBlockCipher) WriteTimeout(p []byte, timeout time.Duration) (int,
35 35
 		return 0, err
36 36
 	}
37 37
 
38
-	return w.parent.WriteTimeout(encrypted, timeout)
38
+	return w.parent.WriteTimeout(encrypted, timeout) // nolint: wrapcheck
39 39
 }
40 40
 
41 41
 func (w *wrapperBlockCipher) encrypt(p []byte) ([]byte, error) {
@@ -50,7 +50,7 @@ func (w *wrapperBlockCipher) encrypt(p []byte) ([]byte, error) {
50 50
 }
51 51
 
52 52
 func (w *wrapperBlockCipher) Close() error {
53
-	return w.parent.Close()
53
+	return w.parent.Close() // nolint: wrapcheck
54 54
 }
55 55
 
56 56
 func (w *wrapperBlockCipher) Conn() net.Conn {

+ 1
- 1
wrappers/stream/buffered_reader.go 파일 보기

@@ -33,7 +33,7 @@ func (b *bufferedReader) ReadTimeout(p []byte, _ time.Duration) (int, error) {
33 33
 
34 34
 func (b *bufferedReader) flush(p []byte) (int, error) {
35 35
 	if b.buf.Len() > len(p) {
36
-		return b.buf.Read(p)
36
+		return b.buf.Read(p) // nolint: wrapcheck
37 37
 	}
38 38
 
39 39
 	sizeToReturn := b.buf.Len()

+ 1
- 1
wrappers/stream/conn.go 파일 보기

@@ -70,7 +70,7 @@ func (w *wrapperConn) Read(p []byte) (int, error) {
70 70
 func (w *wrapperConn) Close() error {
71 71
 	w.logger.Debugw("Close connection")
72 72
 
73
-	return w.parent.Close()
73
+	return w.parent.Close() // nolint: wrapcheck
74 74
 }
75 75
 
76 76
 func (w *wrapperConn) Conn() net.Conn {

+ 5
- 5
wrappers/stream/ctx.go 파일 보기

@@ -23,7 +23,7 @@ func (w *wrapperCtx) WriteTimeout(p []byte, timeout time.Duration) (int, error)
23 23
 
24 24
 		return 0, fmt.Errorf("cannot write because context was closed: %w", w.ctx.Err())
25 25
 	default:
26
-		return w.parent.WriteTimeout(p, timeout)
26
+		return w.parent.WriteTimeout(p, timeout) // nolint: wrapcheck
27 27
 	}
28 28
 }
29 29
 
@@ -34,7 +34,7 @@ func (w *wrapperCtx) Write(p []byte) (int, error) {
34 34
 
35 35
 		return 0, fmt.Errorf("cannot write because context was closed: %w", w.ctx.Err())
36 36
 	default:
37
-		return w.parent.Write(p)
37
+		return w.parent.Write(p) // nolint: wrapcheck
38 38
 	}
39 39
 }
40 40
 
@@ -45,7 +45,7 @@ func (w *wrapperCtx) ReadTimeout(p []byte, timeout time.Duration) (int, error) {
45 45
 
46 46
 		return 0, fmt.Errorf("cannot write because context was closed: %w", w.ctx.Err())
47 47
 	default:
48
-		return w.parent.ReadTimeout(p, timeout)
48
+		return w.parent.ReadTimeout(p, timeout) // nolint: wrapcheck
49 49
 	}
50 50
 }
51 51
 
@@ -56,14 +56,14 @@ func (w *wrapperCtx) Read(p []byte) (int, error) {
56 56
 
57 57
 		return 0, fmt.Errorf("cannot write because context was closed: %w", w.ctx.Err())
58 58
 	default:
59
-		return w.parent.Read(p)
59
+		return w.parent.Read(p) // nolint: wrapcheck
60 60
 	}
61 61
 }
62 62
 
63 63
 func (w *wrapperCtx) Close() error {
64 64
 	w.cancel()
65 65
 
66
-	return w.parent.Close()
66
+	return w.parent.Close() // nolint: wrapcheck
67 67
 }
68 68
 
69 69
 func (w *wrapperCtx) Conn() net.Conn {

+ 3
- 3
wrappers/stream/faketls.go 파일 보기

@@ -20,7 +20,7 @@ type wrapperFakeTLS struct {
20 20
 
21 21
 func (w *wrapperFakeTLS) Write(p []byte) (int, error) {
22 22
 	return w.write(p, func(b []byte) (int, error) {
23
-		return w.parent.Write(b)
23
+		return w.parent.Write(b) // nolint: wrapcheck
24 24
 	})
25 25
 }
26 26
 
@@ -30,7 +30,7 @@ func (w *wrapperFakeTLS) WriteTimeout(p []byte, timeout time.Duration) (int, err
30 30
 	return w.write(p, func(b []byte) (int, error) {
31 31
 		elapsed := time.Since(startTime)
32 32
 		if elapsed > timeout {
33
-			return w.parent.WriteTimeout(b, timeout-elapsed)
33
+			return w.parent.WriteTimeout(b, timeout-elapsed) // nolint: wrapcheck
34 34
 		}
35 35
 
36 36
 		return 0, errors.New("timeout")
@@ -73,7 +73,7 @@ func (w *wrapperFakeTLS) RemoteAddr() *net.TCPAddr {
73 73
 }
74 74
 
75 75
 func (w *wrapperFakeTLS) Close() error {
76
-	return w.parent.Close()
76
+	return w.parent.Close() // nolint: wrapcheck
77 77
 }
78 78
 
79 79
 func NewFakeTLS(socket conntypes.StreamReadWriteCloser) conntypes.StreamReadWriteCloser {

+ 3
- 3
wrappers/stream/obfuscated2.go 파일 보기

@@ -48,7 +48,7 @@ func (w *wrapperObfuscated2) WriteTimeout(p []byte, timeout time.Duration) (int,
48 48
 
49 49
 	w.encryptor.XORKeyStream(buf, buf)
50 50
 
51
-	return w.parent.WriteTimeout(buf, timeout)
51
+	return w.parent.WriteTimeout(buf, timeout) // nolint: wrapcheck
52 52
 }
53 53
 
54 54
 func (w *wrapperObfuscated2) Write(p []byte) (int, error) {
@@ -60,7 +60,7 @@ func (w *wrapperObfuscated2) Write(p []byte) (int, error) {
60 60
 
61 61
 	w.encryptor.XORKeyStream(buf, buf)
62 62
 
63
-	return w.parent.Write(buf)
63
+	return w.parent.Write(buf) // nolint: wrapcheck
64 64
 }
65 65
 
66 66
 func (w *wrapperObfuscated2) Conn() net.Conn {
@@ -80,7 +80,7 @@ func (w *wrapperObfuscated2) RemoteAddr() *net.TCPAddr {
80 80
 }
81 81
 
82 82
 func (w *wrapperObfuscated2) Close() error {
83
-	return w.parent.Close()
83
+	return w.parent.Close() // nolint: wrapcheck
84 84
 }
85 85
 
86 86
 func NewObfuscated2(socket conntypes.StreamReadWriteCloser,

+ 5
- 5
wrappers/stream/rewind.go 파일 보기

@@ -24,25 +24,25 @@ type wrapperRewind struct {
24 24
 }
25 25
 
26 26
 func (w *wrapperRewind) Write(p []byte) (int, error) {
27
-	return w.parent.Write(p)
27
+	return w.parent.Write(p) // nolint: wrapcheck
28 28
 }
29 29
 
30 30
 func (w *wrapperRewind) WriteTimeout(p []byte, timeout time.Duration) (int, error) {
31
-	return w.parent.WriteTimeout(p, timeout)
31
+	return w.parent.WriteTimeout(p, timeout) // nolint: wrapcheck
32 32
 }
33 33
 
34 34
 func (w *wrapperRewind) Read(p []byte) (int, error) {
35 35
 	w.mutex.Lock()
36 36
 	defer w.mutex.Unlock()
37 37
 
38
-	return w.activeReader.Read(p)
38
+	return w.activeReader.Read(p) // nolint: wrapcheck
39 39
 }
40 40
 
41 41
 func (w *wrapperRewind) ReadTimeout(p []byte, _ time.Duration) (int, error) {
42 42
 	w.mutex.Lock()
43 43
 	defer w.mutex.Unlock()
44 44
 
45
-	return w.activeReader.Read(p)
45
+	return w.activeReader.Read(p) // nolint: wrapcheck
46 46
 }
47 47
 
48 48
 func (w *wrapperRewind) Conn() net.Conn {
@@ -64,7 +64,7 @@ func (w *wrapperRewind) RemoteAddr() *net.TCPAddr {
64 64
 func (w *wrapperRewind) Close() error {
65 65
 	w.buf.Reset()
66 66
 
67
-	return w.parent.Close()
67
+	return w.parent.Close() // nolint: wrapcheck
68 68
 }
69 69
 
70 70
 func (w *wrapperRewind) Rewind() {

+ 4
- 4
wrappers/stream/stats_telegram.go 파일 보기

@@ -17,19 +17,19 @@ type wrapperTelegramStats struct {
17 17
 }
18 18
 
19 19
 func (w *wrapperTelegramStats) Write(p []byte) (int, error) {
20
-	return w.parent.Write(p)
20
+	return w.parent.Write(p) // nolint: wrapcheck
21 21
 }
22 22
 
23 23
 func (w *wrapperTelegramStats) WriteTimeout(p []byte, timeout time.Duration) (int, error) {
24
-	return w.parent.WriteTimeout(p, timeout)
24
+	return w.parent.WriteTimeout(p, timeout) // nolint: wrapcheck
25 25
 }
26 26
 
27 27
 func (w *wrapperTelegramStats) Read(p []byte) (int, error) {
28
-	return w.parent.Read(p)
28
+	return w.parent.Read(p) // nolint: wrapcheck
29 29
 }
30 30
 
31 31
 func (w *wrapperTelegramStats) ReadTimeout(p []byte, timeout time.Duration) (int, error) {
32
-	return w.parent.ReadTimeout(p, timeout)
32
+	return w.parent.ReadTimeout(p, timeout) // nolint: wrapcheck
33 33
 }
34 34
 
35 35
 func (w *wrapperTelegramStats) Conn() net.Conn {

+ 1
- 1
wrappers/stream/stats_traffic.go 파일 보기

@@ -58,7 +58,7 @@ func (w *wrapperTrafficStats) RemoteAddr() *net.TCPAddr {
58 58
 }
59 59
 
60 60
 func (w *wrapperTrafficStats) Close() error {
61
-	return w.parent.Close()
61
+	return w.parent.Close() // nolint: wrapcheck
62 62
 }
63 63
 
64 64
 func NewTrafficStats(parent conntypes.StreamReadWriteCloser) conntypes.StreamReadWriteCloser {

+ 5
- 5
wrappers/stream/timeout.go 파일 보기

@@ -18,23 +18,23 @@ type wrapperTimeout struct {
18 18
 }
19 19
 
20 20
 func (w *wrapperTimeout) WriteTimeout(p []byte, timeout time.Duration) (int, error) {
21
-	return w.parent.WriteTimeout(p, timeout)
21
+	return w.parent.WriteTimeout(p, timeout) // nolint: wrapcheck
22 22
 }
23 23
 
24 24
 func (w *wrapperTimeout) Write(p []byte) (int, error) {
25
-	return w.parent.WriteTimeout(p, timeoutWrite)
25
+	return w.parent.WriteTimeout(p, timeoutWrite) // nolint: wrapcheck
26 26
 }
27 27
 
28 28
 func (w *wrapperTimeout) ReadTimeout(p []byte, timeout time.Duration) (int, error) {
29
-	return w.parent.ReadTimeout(p, timeout)
29
+	return w.parent.ReadTimeout(p, timeout) // nolint: wrapcheck
30 30
 }
31 31
 
32 32
 func (w *wrapperTimeout) Read(p []byte) (int, error) {
33
-	return w.parent.ReadTimeout(p, timeoutRead)
33
+	return w.parent.ReadTimeout(p, timeoutRead) // nolint: wrapcheck
34 34
 }
35 35
 
36 36
 func (w *wrapperTimeout) Close() error {
37
-	return w.parent.Close()
37
+	return w.parent.Close() // nolint: wrapcheck
38 38
 }
39 39
 
40 40
 func (w *wrapperTimeout) Conn() net.Conn {

Loading…
취소
저장