From 3e0880f6b4f520ad9c709ddfbdd4e7e66545db03 Mon Sep 17 00:00:00 2001 From: 9seconds Date: Mon, 30 Aug 2021 10:24:41 +0300 Subject: [PATCH] Upgrade golangci-lint for 1.42 --- .github/workflows/ci.yaml | 2 +- Makefile | 2 +- config/config.go | 60 +++++++++++------------ config/global_ips.go | 2 +- config/urls.go | 10 ++-- hub/hub.go | 2 +- obfuscated2/client_protocol.go | 10 ++-- proxy/direct.go | 9 ++-- tlstypes/server_hello.go | 4 +- utils/init_tcp.go | 2 +- utils/rlimit.go | 1 + utils/rlimit_windows.go | 1 + utils/signal_context.go | 1 + utils/signal_context_windows.go | 1 + wrappers/packet/mtproto_frame.go | 2 +- wrappers/packetack/client_abridged.go | 2 +- wrappers/packetack/client_intermediate.go | 2 +- wrappers/packetack/proxy.go | 2 +- wrappers/rwc/ping.go | 2 +- wrappers/stream/blockcipher.go | 6 +-- wrappers/stream/buffered_reader.go | 2 +- wrappers/stream/conn.go | 2 +- wrappers/stream/ctx.go | 10 ++-- wrappers/stream/faketls.go | 6 +-- wrappers/stream/obfuscated2.go | 6 +-- wrappers/stream/rewind.go | 10 ++-- wrappers/stream/stats_telegram.go | 8 +-- wrappers/stream/stats_traffic.go | 2 +- wrappers/stream/timeout.go | 10 ++-- 29 files changed, 90 insertions(+), 89 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4bd3b39..9ac9810 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -72,7 +72,7 @@ jobs: - name: Run linter uses: golangci/golangci-lint-action@v2 with: - version: v1.37.1 + version: v1.42.0 docker: name: Docker diff --git a/Makefile b/Makefile index 3f84fba..7a9fa1e 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ APP_NAME := $(IMAGE_NAME) CC_BINARIES := $(shell bash -c "echo -n $(APP_NAME)-{linux,freebsd,openbsd}-{386,amd64} $(APP_NAME)-linux-{arm,arm64}") -GOLANGCI_LINT_VERSION := v1.37.1 +GOLANGCI_LINT_VERSION := v1.42.0 VERSION_GO := $(shell go version) VERSION_DATE := $(shell date -Ru) diff --git a/config/config.go b/config/config.go index 5e97f86..b5a0209 100644 --- a/config/config.go +++ b/config/config.go @@ -79,29 +79,29 @@ const ( type Config struct { Bind *net.TCPAddr `json:"bind"` - PublicIPv4 *net.TCPAddr `json:"public_ipv4"` - PublicIPv6 *net.TCPAddr `json:"public_ipv6"` - StatsBind *net.TCPAddr `json:"stats_bind"` - StatsdAddr *net.TCPAddr `json:"stats_addr"` - StatsdTagsFormat *statsd.TagFormat `json:"statsd_tags_format"` + PublicIPv4 *net.TCPAddr `json:"public_ipv4"` // nolint: tagliatelle + PublicIPv6 *net.TCPAddr `json:"public_ipv6"` // nolint: tagliatelle + StatsBind *net.TCPAddr `json:"stats_bind"` // nolint: tagliatelle + StatsdAddr *net.TCPAddr `json:"stats_addr"` // nolint: tagliatelle + StatsdTagsFormat *statsd.TagFormat `json:"statsd_tags_format"` // nolint: tagliatelle - StatsNamespace string `json:"stats_namespace"` - CloakHost string `json:"cloak_host"` - StatsdTags map[string]string `json:"statsd_tags"` + StatsNamespace string `json:"stats_namespace"` // nolint: tagliatelle + CloakHost string `json:"cloak_host"` // nolint: tagliatelle + StatsdTags map[string]string `json:"statsd_tags"` // nolint: tagliatelle - WriteBuffer int `json:"write_buffer"` - ReadBuffer int `json:"read_buffer"` - CloakPort int `json:"cloak_port"` + WriteBuffer int `json:"write_buffer"` // nolint: tagliatelle + ReadBuffer int `json:"read_buffer"` // nolint: tagliatelle + CloakPort int `json:"cloak_port"` // nolint: tagliatelle - AntiReplayMaxSize int `json:"anti_replay_max_size"` + AntiReplayMaxSize int `json:"anti_replay_max_size"` // nolint: tagliatelle - MultiplexPerConnection int `json:"multiplex_per_connection"` + MultiplexPerConnection int `json:"multiplex_per_connection"` // nolint: tagliatelle Debug bool `json:"debug"` Verbose bool `json:"verbose"` - SecretMode SecretMode `json:"secret_mode"` - PreferIP PreferIP `json:"prefer_ip"` - NTPServers []string `json:"ntp_servers"` + SecretMode SecretMode `json:"secret_mode"` // nolint: tagliatelle + PreferIP PreferIP `json:"prefer_ip"` // nolint: tagliatelle + NTPServers []string `json:"ntp_servers"` // nolint: tagliatelle Secret []byte `json:"secret"` AdTag []byte `json:"adtag"` @@ -164,11 +164,11 @@ func Init(options ...Opt) error { // nolint: gocyclo, funlen, cyclop for _, opt := range options { switch opt.Option { case OptionTypeDebug: - C.Debug = opt.Value.(bool) + C.Debug = opt.Value.(bool) // nolint: forcetypeassert case OptionTypeVerbose: - C.Verbose = opt.Value.(bool) + C.Verbose = opt.Value.(bool) // nolint: forcetypeassert case OptionTypePreferIP: - value := opt.Value.(string) + value := opt.Value.(string) // nolint: forcetypeassert switch value { case "ipv4": C.PreferIP = PreferIPv4 @@ -178,25 +178,25 @@ func Init(options ...Opt) error { // nolint: gocyclo, funlen, cyclop return fmt.Errorf("incorrect direct IP mode %s", value) } case OptionTypeBind: - C.Bind = opt.Value.(*net.TCPAddr) + C.Bind = opt.Value.(*net.TCPAddr) // nolint: forcetypeassert case OptionTypePublicIPv4: - C.PublicIPv4 = opt.Value.(*net.TCPAddr) + C.PublicIPv4 = opt.Value.(*net.TCPAddr) // nolint: forcetypeassert if C.PublicIPv4 == nil { C.PublicIPv4 = &net.TCPAddr{} } case OptionTypePublicIPv6: - C.PublicIPv6 = opt.Value.(*net.TCPAddr) + C.PublicIPv6 = opt.Value.(*net.TCPAddr) // nolint: forcetypeassert if C.PublicIPv6 == nil { C.PublicIPv6 = &net.TCPAddr{} } case OptionTypeStatsBind: - C.StatsBind = opt.Value.(*net.TCPAddr) + C.StatsBind = opt.Value.(*net.TCPAddr) // nolint: forcetypeassert case OptionTypeStatsNamespace: - C.StatsNamespace = opt.Value.(string) + C.StatsNamespace = opt.Value.(string) // nolint: forcetypeassert case OptionTypeStatsdAddress: - C.StatsdAddr = opt.Value.(*net.TCPAddr) + C.StatsdAddr = opt.Value.(*net.TCPAddr) // nolint: forcetypeassert case OptionTypeStatsdTagsFormat: - value := opt.Value.(string) + value := opt.Value.(string) // nolint: forcetypeassert switch value { case "datadog": C.StatsdTagsFormat = statsd.TagFormatDatadog @@ -206,7 +206,7 @@ func Init(options ...Opt) error { // nolint: gocyclo, funlen, cyclop return fmt.Errorf("incorrect statsd tag %s", value) } case OptionTypeStatsdTags: - C.StatsdTags = opt.Value.(map[string]string) + C.StatsdTags = opt.Value.(map[string]string) // nolint: forcetypeassert case OptionTypeWriteBufferSize: C.WriteBuffer = int(opt.Value.(units.Base2Bytes)) case OptionTypeReadBufferSize: @@ -218,14 +218,14 @@ func Init(options ...Opt) error { // nolint: gocyclo, funlen, cyclop case OptionTypeMultiplexPerConnection: C.MultiplexPerConnection = int(opt.Value.(uint)) case OptionTypeNTPServers: - C.NTPServers = opt.Value.([]string) + C.NTPServers = opt.Value.([]string) // nolint: forcetypeassert if len(C.NTPServers) == 0 { return errors.New("ntp server list is empty") } case OptionTypeSecret: - C.Secret = opt.Value.([]byte) + C.Secret = opt.Value.([]byte) // nolint: forcetypeassert case OptionTypeAdtag: - C.AdTag = opt.Value.([]byte) + C.AdTag = opt.Value.([]byte) // nolint: forcetypeassert default: return fmt.Errorf("unknown tag %v", opt.Option) } diff --git a/config/global_ips.go b/config/global_ips.go index 0dd78da..c5564ea 100644 --- a/config/global_ips.go +++ b/config/global_ips.go @@ -41,7 +41,7 @@ func fetchIP(ctx context.Context, network string) (net.IP, error) { Timeout: ifconfigTimeout, Transport: &http.Transport{ DialContext: func(ctx context.Context, _, addr string) (net.Conn, error) { - return dialer.DialContext(ctx, network, addr) + return dialer.DialContext(ctx, network, addr) // nolint: wrapcheck }, }, } diff --git a/config/urls.go b/config/urls.go index f657e82..c5a9a58 100644 --- a/config/urls.go +++ b/config/urls.go @@ -8,16 +8,16 @@ import ( ) type URLs struct { - TG string `json:"tg_url"` - TMe string `json:"tme_url"` - TGQRCode string `json:"tg_qrcode"` - TMeQRCode string `json:"tme_qrcode"` + TG string `json:"tg_url"` // nolint: tagliatelle + TMe string `json:"tme_url"` // nolint: tagliatelle + TGQRCode string `json:"tg_qrcode"` // nolint: tagliatelle + TMeQRCode string `json:"tme_qrcode"` // nolint: tagliatelle } type IPURLs struct { IPv4 *URLs `json:"ipv4,omitempty"` IPv6 *URLs `json:"ipv6,omitempty"` - BotSecret string `json:"secret_for_mtproxybot"` + BotSecret string `json:"secret_for_mtproxybot"` // nolint: tagliatelle } func GetURLs() (urls IPURLs) { diff --git a/hub/hub.go b/hub/hub.go index edfc442..db81ded 100644 --- a/hub/hub.go +++ b/hub/hub.go @@ -18,7 +18,7 @@ func (h *hub) Register(req *protocol.TelegramRequest) (*ProxyConn, error) { } func (h *hub) getMux(req *protocol.TelegramRequest) *mux { - var key int32 = 32767 + int32(req.ClientProtocol.DC()) + 100000*int32(req.ClientProtocol.ConnectionProtocol()) + key := 32767 + int32(req.ClientProtocol.DC()) + 100000*int32(req.ClientProtocol.ConnectionProtocol()) h.mutex.RLock() m, ok := h.muxes[key] diff --git a/obfuscated2/client_protocol.go b/obfuscated2/client_protocol.go index 955ae9e..e7a6ff6 100644 --- a/obfuscated2/client_protocol.go +++ b/obfuscated2/client_protocol.go @@ -45,14 +45,14 @@ func (c *ClientProtocol) Handshake(socket conntypes.StreamReadWriteCloser) (conn } decHasher := sha256.New() - decHasher.Write(fm.Key()) // nolint: errcheck - decHasher.Write(config.C.Secret) // nolint: errcheck + decHasher.Write(fm.Key()) + decHasher.Write(config.C.Secret) decryptor := utils.MakeStreamCipher(decHasher.Sum(nil), fm.IV()) invertedFrame := fm.Invert() encHasher := sha256.New() - encHasher.Write(invertedFrame.Key()) // nolint: errcheck - encHasher.Write(config.C.Secret) // nolint: errcheck + encHasher.Write(invertedFrame.Key()) + encHasher.Write(config.C.Secret) encryptor := utils.MakeStreamCipher(encHasher.Sum(nil), invertedFrame.IV()) decryptedFrame := Frame{} @@ -106,7 +106,7 @@ type handshakeReader struct { } func (h handshakeReader) Read(p []byte) (int, error) { - return h.parent.ReadTimeout(p, clientProtocolHandshakeTimeout) + return h.parent.ReadTimeout(p, clientProtocolHandshakeTimeout) // nolint: wrapcheck } func MakeClientProtocol() protocol.ClientProtocol { diff --git a/proxy/direct.go b/proxy/direct.go index 03fd9af..8a817bd 100644 --- a/proxy/direct.go +++ b/proxy/direct.go @@ -4,7 +4,6 @@ import ( "io" "sync" - "github.com/9seconds/mtg/conntypes" "github.com/9seconds/mtg/obfuscated2" "github.com/9seconds/mtg/protocol" "go.uber.org/zap" @@ -18,16 +17,14 @@ func directConnection(request *protocol.TelegramRequest) error { return err // nolint: wrapcheck } - telegramConn := telegramConnRaw.(conntypes.StreamReadWriteCloser) - - defer telegramConn.Close() + defer telegramConnRaw.Close() wg := &sync.WaitGroup{} wg.Add(2) - go directPipe(telegramConn, request.ClientConn, wg, request.Logger) + go directPipe(telegramConnRaw, request.ClientConn, wg, request.Logger) - go directPipe(request.ClientConn, telegramConn, wg, request.Logger) + go directPipe(request.ClientConn, telegramConnRaw, wg, request.Logger) wg.Wait() diff --git a/tlstypes/server_hello.go b/tlstypes/server_hello.go index efd624c..e1000af 100644 --- a/tlstypes/server_hello.go +++ b/tlstypes/server_hello.go @@ -49,8 +49,8 @@ func (s ServerHello) WelcomePacket() []byte { packet := buf.Bytes() mac := hmac.New(sha256.New, config.C.Secret) - mac.Write(s.clientHello.Random[:]) // nolint: errcheck - mac.Write(packet) // nolint: errcheck + mac.Write(s.clientHello.Random[:]) + mac.Write(packet) copy(packet[11:], mac.Sum(nil)) return packet diff --git a/utils/init_tcp.go b/utils/init_tcp.go index d491472..2152759 100644 --- a/utils/init_tcp.go +++ b/utils/init_tcp.go @@ -6,7 +6,7 @@ import ( ) func InitTCP(conn net.Conn, readBufferSize int, writeBufferSize int) error { - tcpConn := conn.(*net.TCPConn) + tcpConn := conn.(*net.TCPConn) // nolint: forcetypeassert if err := tcpConn.SetNoDelay(true); err != nil { return fmt.Errorf("cannot set TCP_NO_DELAY: %w", err) diff --git a/utils/rlimit.go b/utils/rlimit.go index b474076..82fbb1e 100644 --- a/utils/rlimit.go +++ b/utils/rlimit.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package utils diff --git a/utils/rlimit_windows.go b/utils/rlimit_windows.go index 58bdf39..06229a3 100644 --- a/utils/rlimit_windows.go +++ b/utils/rlimit_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package utils diff --git a/utils/signal_context.go b/utils/signal_context.go index 6d3951f..e6d6065 100644 --- a/utils/signal_context.go +++ b/utils/signal_context.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package utils diff --git a/utils/signal_context_windows.go b/utils/signal_context_windows.go index d18ce71..92547ab 100644 --- a/utils/signal_context_windows.go +++ b/utils/signal_context_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package utils diff --git a/wrappers/packet/mtproto_frame.go b/wrappers/packet/mtproto_frame.go index 805f361..0051c2e 100644 --- a/wrappers/packet/mtproto_frame.go +++ b/wrappers/packet/mtproto_frame.go @@ -136,7 +136,7 @@ func (w *wrapperMtprotoFrame) Write(p conntypes.Packet) error { } func (w *wrapperMtprotoFrame) Close() error { - return w.parent.Close() + return w.parent.Close() // nolint: wrapcheck } func (w *wrapperMtprotoFrame) Conn() net.Conn { diff --git a/wrappers/packetack/client_abridged.go b/wrappers/packetack/client_abridged.go index 2952de0..6125604 100644 --- a/wrappers/packetack/client_abridged.go +++ b/wrappers/packetack/client_abridged.go @@ -104,7 +104,7 @@ func (w *wrapperClientAbridged) Write(packet conntypes.Packet, acks *conntypes.C } func (w *wrapperClientAbridged) Close() error { - return w.parent.Close() + return w.parent.Close() // nolint: wrapcheck } func (w *wrapperClientAbridged) Conn() net.Conn { diff --git a/wrappers/packetack/client_intermediate.go b/wrappers/packetack/client_intermediate.go index ac60fb4..c4d69a6 100644 --- a/wrappers/packetack/client_intermediate.go +++ b/wrappers/packetack/client_intermediate.go @@ -63,7 +63,7 @@ func (w *wrapperClientIntermediate) Write(packet conntypes.Packet, acks *conntyp } func (w *wrapperClientIntermediate) Close() error { - return w.parent.Close() + return w.parent.Close() // nolint: wrapcheck } func (w *wrapperClientIntermediate) Conn() net.Conn { diff --git a/wrappers/packetack/proxy.go b/wrappers/packetack/proxy.go index facbaa4..6910123 100644 --- a/wrappers/packetack/proxy.go +++ b/wrappers/packetack/proxy.go @@ -46,7 +46,7 @@ func (w *wrapperProxy) Write(packet conntypes.Packet, acks *conntypes.Connection buf.Grow(len(packet)) buf.Write(packet) - return w.proxy.Write(buf.Bytes()) + return w.proxy.Write(buf.Bytes()) // nolint: wrapcheck } func (w *wrapperProxy) Read(acks *conntypes.ConnectionAcks) (conntypes.Packet, error) { diff --git a/wrappers/rwc/ping.go b/wrappers/rwc/ping.go index 548bef8..6ac5fc8 100644 --- a/wrappers/rwc/ping.go +++ b/wrappers/rwc/ping.go @@ -36,7 +36,7 @@ func (w *wrapperPing) Write(p []byte) (int, error) { } func (w *wrapperPing) Close() error { - return w.parent.Close() + return w.parent.Close() // nolint: wrapcheck } func NewPing(ctx context.Context, parent io.ReadWriteCloser, channelPing chan<- struct{}) io.ReadWriteCloser { diff --git a/wrappers/stream/blockcipher.go b/wrappers/stream/blockcipher.go index 6503e4f..9423d65 100644 --- a/wrappers/stream/blockcipher.go +++ b/wrappers/stream/blockcipher.go @@ -26,7 +26,7 @@ func (w *wrapperBlockCipher) Write(p []byte) (int, error) { return 0, err } - return w.parent.Write(encrypted) + return w.parent.Write(encrypted) // nolint: wrapcheck } 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, return 0, err } - return w.parent.WriteTimeout(encrypted, timeout) + return w.parent.WriteTimeout(encrypted, timeout) // nolint: wrapcheck } func (w *wrapperBlockCipher) encrypt(p []byte) ([]byte, error) { @@ -50,7 +50,7 @@ func (w *wrapperBlockCipher) encrypt(p []byte) ([]byte, error) { } func (w *wrapperBlockCipher) Close() error { - return w.parent.Close() + return w.parent.Close() // nolint: wrapcheck } func (w *wrapperBlockCipher) Conn() net.Conn { diff --git a/wrappers/stream/buffered_reader.go b/wrappers/stream/buffered_reader.go index 6a551f7..834c1e3 100644 --- a/wrappers/stream/buffered_reader.go +++ b/wrappers/stream/buffered_reader.go @@ -33,7 +33,7 @@ func (b *bufferedReader) ReadTimeout(p []byte, _ time.Duration) (int, error) { func (b *bufferedReader) flush(p []byte) (int, error) { if b.buf.Len() > len(p) { - return b.buf.Read(p) + return b.buf.Read(p) // nolint: wrapcheck } sizeToReturn := b.buf.Len() diff --git a/wrappers/stream/conn.go b/wrappers/stream/conn.go index d55c55c..f1056d3 100644 --- a/wrappers/stream/conn.go +++ b/wrappers/stream/conn.go @@ -70,7 +70,7 @@ func (w *wrapperConn) Read(p []byte) (int, error) { func (w *wrapperConn) Close() error { w.logger.Debugw("Close connection") - return w.parent.Close() + return w.parent.Close() // nolint: wrapcheck } func (w *wrapperConn) Conn() net.Conn { diff --git a/wrappers/stream/ctx.go b/wrappers/stream/ctx.go index 86e7359..e948d2c 100644 --- a/wrappers/stream/ctx.go +++ b/wrappers/stream/ctx.go @@ -23,7 +23,7 @@ func (w *wrapperCtx) WriteTimeout(p []byte, timeout time.Duration) (int, error) return 0, fmt.Errorf("cannot write because context was closed: %w", w.ctx.Err()) default: - return w.parent.WriteTimeout(p, timeout) + return w.parent.WriteTimeout(p, timeout) // nolint: wrapcheck } } @@ -34,7 +34,7 @@ func (w *wrapperCtx) Write(p []byte) (int, error) { return 0, fmt.Errorf("cannot write because context was closed: %w", w.ctx.Err()) default: - return w.parent.Write(p) + return w.parent.Write(p) // nolint: wrapcheck } } @@ -45,7 +45,7 @@ func (w *wrapperCtx) ReadTimeout(p []byte, timeout time.Duration) (int, error) { return 0, fmt.Errorf("cannot write because context was closed: %w", w.ctx.Err()) default: - return w.parent.ReadTimeout(p, timeout) + return w.parent.ReadTimeout(p, timeout) // nolint: wrapcheck } } @@ -56,14 +56,14 @@ func (w *wrapperCtx) Read(p []byte) (int, error) { return 0, fmt.Errorf("cannot write because context was closed: %w", w.ctx.Err()) default: - return w.parent.Read(p) + return w.parent.Read(p) // nolint: wrapcheck } } func (w *wrapperCtx) Close() error { w.cancel() - return w.parent.Close() + return w.parent.Close() // nolint: wrapcheck } func (w *wrapperCtx) Conn() net.Conn { diff --git a/wrappers/stream/faketls.go b/wrappers/stream/faketls.go index 17a1fe6..74608d6 100644 --- a/wrappers/stream/faketls.go +++ b/wrappers/stream/faketls.go @@ -20,7 +20,7 @@ type wrapperFakeTLS struct { func (w *wrapperFakeTLS) Write(p []byte) (int, error) { return w.write(p, func(b []byte) (int, error) { - return w.parent.Write(b) + return w.parent.Write(b) // nolint: wrapcheck }) } @@ -30,7 +30,7 @@ func (w *wrapperFakeTLS) WriteTimeout(p []byte, timeout time.Duration) (int, err return w.write(p, func(b []byte) (int, error) { elapsed := time.Since(startTime) if elapsed > timeout { - return w.parent.WriteTimeout(b, timeout-elapsed) + return w.parent.WriteTimeout(b, timeout-elapsed) // nolint: wrapcheck } return 0, errors.New("timeout") @@ -73,7 +73,7 @@ func (w *wrapperFakeTLS) RemoteAddr() *net.TCPAddr { } func (w *wrapperFakeTLS) Close() error { - return w.parent.Close() + return w.parent.Close() // nolint: wrapcheck } func NewFakeTLS(socket conntypes.StreamReadWriteCloser) conntypes.StreamReadWriteCloser { diff --git a/wrappers/stream/obfuscated2.go b/wrappers/stream/obfuscated2.go index da2199a..6e7cc8e 100644 --- a/wrappers/stream/obfuscated2.go +++ b/wrappers/stream/obfuscated2.go @@ -48,7 +48,7 @@ func (w *wrapperObfuscated2) WriteTimeout(p []byte, timeout time.Duration) (int, w.encryptor.XORKeyStream(buf, buf) - return w.parent.WriteTimeout(buf, timeout) + return w.parent.WriteTimeout(buf, timeout) // nolint: wrapcheck } func (w *wrapperObfuscated2) Write(p []byte) (int, error) { @@ -60,7 +60,7 @@ func (w *wrapperObfuscated2) Write(p []byte) (int, error) { w.encryptor.XORKeyStream(buf, buf) - return w.parent.Write(buf) + return w.parent.Write(buf) // nolint: wrapcheck } func (w *wrapperObfuscated2) Conn() net.Conn { @@ -80,7 +80,7 @@ func (w *wrapperObfuscated2) RemoteAddr() *net.TCPAddr { } func (w *wrapperObfuscated2) Close() error { - return w.parent.Close() + return w.parent.Close() // nolint: wrapcheck } func NewObfuscated2(socket conntypes.StreamReadWriteCloser, diff --git a/wrappers/stream/rewind.go b/wrappers/stream/rewind.go index d8d7425..071db72 100644 --- a/wrappers/stream/rewind.go +++ b/wrappers/stream/rewind.go @@ -24,25 +24,25 @@ type wrapperRewind struct { } func (w *wrapperRewind) Write(p []byte) (int, error) { - return w.parent.Write(p) + return w.parent.Write(p) // nolint: wrapcheck } func (w *wrapperRewind) WriteTimeout(p []byte, timeout time.Duration) (int, error) { - return w.parent.WriteTimeout(p, timeout) + return w.parent.WriteTimeout(p, timeout) // nolint: wrapcheck } func (w *wrapperRewind) Read(p []byte) (int, error) { w.mutex.Lock() defer w.mutex.Unlock() - return w.activeReader.Read(p) + return w.activeReader.Read(p) // nolint: wrapcheck } func (w *wrapperRewind) ReadTimeout(p []byte, _ time.Duration) (int, error) { w.mutex.Lock() defer w.mutex.Unlock() - return w.activeReader.Read(p) + return w.activeReader.Read(p) // nolint: wrapcheck } func (w *wrapperRewind) Conn() net.Conn { @@ -64,7 +64,7 @@ func (w *wrapperRewind) RemoteAddr() *net.TCPAddr { func (w *wrapperRewind) Close() error { w.buf.Reset() - return w.parent.Close() + return w.parent.Close() // nolint: wrapcheck } func (w *wrapperRewind) Rewind() { diff --git a/wrappers/stream/stats_telegram.go b/wrappers/stream/stats_telegram.go index 9fe6d9e..eee6dfd 100644 --- a/wrappers/stream/stats_telegram.go +++ b/wrappers/stream/stats_telegram.go @@ -17,19 +17,19 @@ type wrapperTelegramStats struct { } func (w *wrapperTelegramStats) Write(p []byte) (int, error) { - return w.parent.Write(p) + return w.parent.Write(p) // nolint: wrapcheck } func (w *wrapperTelegramStats) WriteTimeout(p []byte, timeout time.Duration) (int, error) { - return w.parent.WriteTimeout(p, timeout) + return w.parent.WriteTimeout(p, timeout) // nolint: wrapcheck } func (w *wrapperTelegramStats) Read(p []byte) (int, error) { - return w.parent.Read(p) + return w.parent.Read(p) // nolint: wrapcheck } func (w *wrapperTelegramStats) ReadTimeout(p []byte, timeout time.Duration) (int, error) { - return w.parent.ReadTimeout(p, timeout) + return w.parent.ReadTimeout(p, timeout) // nolint: wrapcheck } func (w *wrapperTelegramStats) Conn() net.Conn { diff --git a/wrappers/stream/stats_traffic.go b/wrappers/stream/stats_traffic.go index cc7d224..8e9f101 100644 --- a/wrappers/stream/stats_traffic.go +++ b/wrappers/stream/stats_traffic.go @@ -58,7 +58,7 @@ func (w *wrapperTrafficStats) RemoteAddr() *net.TCPAddr { } func (w *wrapperTrafficStats) Close() error { - return w.parent.Close() + return w.parent.Close() // nolint: wrapcheck } func NewTrafficStats(parent conntypes.StreamReadWriteCloser) conntypes.StreamReadWriteCloser { diff --git a/wrappers/stream/timeout.go b/wrappers/stream/timeout.go index 2447fe2..a51a5b3 100644 --- a/wrappers/stream/timeout.go +++ b/wrappers/stream/timeout.go @@ -18,23 +18,23 @@ type wrapperTimeout struct { } func (w *wrapperTimeout) WriteTimeout(p []byte, timeout time.Duration) (int, error) { - return w.parent.WriteTimeout(p, timeout) + return w.parent.WriteTimeout(p, timeout) // nolint: wrapcheck } func (w *wrapperTimeout) Write(p []byte) (int, error) { - return w.parent.WriteTimeout(p, timeoutWrite) + return w.parent.WriteTimeout(p, timeoutWrite) // nolint: wrapcheck } func (w *wrapperTimeout) ReadTimeout(p []byte, timeout time.Duration) (int, error) { - return w.parent.ReadTimeout(p, timeout) + return w.parent.ReadTimeout(p, timeout) // nolint: wrapcheck } func (w *wrapperTimeout) Read(p []byte) (int, error) { - return w.parent.ReadTimeout(p, timeoutRead) + return w.parent.ReadTimeout(p, timeoutRead) // nolint: wrapcheck } func (w *wrapperTimeout) Close() error { - return w.parent.Close() + return w.parent.Close() // nolint: wrapcheck } func (w *wrapperTimeout) Conn() net.Conn {