mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 20:04:02 +03:00
Update golangci-lint
This commit is contained in:
+3
-3
@@ -24,7 +24,7 @@ func (c connTraffic) Read(b []byte) (int, error) {
|
||||
c.stream.Send(c.ctx, NewEventTraffic(c.streamID, uint(n), true))
|
||||
}
|
||||
|
||||
return n, err // nolint: wrapcheck
|
||||
return n, err //nolint: wrapcheck
|
||||
}
|
||||
|
||||
func (c connTraffic) Write(b []byte) (int, error) {
|
||||
@@ -34,7 +34,7 @@ func (c connTraffic) Write(b []byte) (int, error) {
|
||||
c.stream.Send(c.ctx, NewEventTraffic(c.streamID, uint(n), false))
|
||||
}
|
||||
|
||||
return n, err // nolint: wrapcheck
|
||||
return n, err //nolint: wrapcheck
|
||||
}
|
||||
|
||||
type connRewind struct {
|
||||
@@ -49,7 +49,7 @@ func (c *connRewind) Read(p []byte) (int, error) {
|
||||
c.mutex.RLock()
|
||||
defer c.mutex.RUnlock()
|
||||
|
||||
return c.active.Read(p) // nolint: wrapcheck
|
||||
return c.active.Read(p) //nolint: wrapcheck
|
||||
}
|
||||
|
||||
func (c *connRewind) Rewind() {
|
||||
|
||||
@@ -22,7 +22,7 @@ type ConnRewindBaseConn struct {
|
||||
func (c *ConnRewindBaseConn) Read(p []byte) (int, error) {
|
||||
c.Called(p)
|
||||
|
||||
return c.readBuffer.Read(p) // nolint: wrapcheck
|
||||
return c.readBuffer.Read(p) //nolint: wrapcheck
|
||||
}
|
||||
|
||||
type ConnTrafficTestSuite struct {
|
||||
@@ -69,7 +69,7 @@ func (suite *ConnTrafficTestSuite) TestReadOk() {
|
||||
suite.Equal(10, n)
|
||||
}
|
||||
|
||||
func (suite *ConnTrafficTestSuite) TestReadErr() { // nolint: dupl
|
||||
func (suite *ConnTrafficTestSuite) TestReadErr() { //nolint: dupl
|
||||
suite.eventStreamMock.
|
||||
On("Send", mock.Anything, mock.Anything).
|
||||
Once().
|
||||
@@ -125,7 +125,7 @@ func (suite *ConnTrafficTestSuite) TestWriteOk() {
|
||||
suite.Equal(10, n)
|
||||
}
|
||||
|
||||
func (suite *ConnTrafficTestSuite) TestWriteErr() { // nolint: dupl
|
||||
func (suite *ConnTrafficTestSuite) TestWriteErr() { //nolint: dupl
|
||||
suite.eventStreamMock.
|
||||
On("Send", mock.Anything, mock.Anything).
|
||||
Once().
|
||||
|
||||
+3
-3
@@ -110,9 +110,9 @@ const (
|
||||
// This knowledge is encapsulated into instances of such interface.
|
||||
//
|
||||
// mtglib uses Network for:
|
||||
// 1. Dialing to Telegram
|
||||
// 2. Dialing to front domain
|
||||
// 3. Doing HTTP requests (for example, for FireHOL ipblocklist).
|
||||
// 1. Dialing to Telegram
|
||||
// 2. Dialing to front domain
|
||||
// 3. Doing HTTP requests (for example, for FireHOL ipblocklist).
|
||||
type Network interface {
|
||||
// Dial establishes context-free TCP connections.
|
||||
Dial(network, address string) (essentials.Conn, error)
|
||||
|
||||
@@ -56,7 +56,7 @@ func ParseClientHello(secret, handshake []byte) (ClientHello, error) {
|
||||
if len(handshake)-4 != int(handshakeLength) {
|
||||
return hello,
|
||||
fmt.Errorf("incorrect handshake size. manifested=%d, real=%d",
|
||||
handshakeLength, len(handshake)-4) // nolint: gomnd
|
||||
handshakeLength, len(handshake)-4) //nolint: gomnd
|
||||
}
|
||||
|
||||
copy(hello.Random[:], handshake[ClientHelloRandomOffset:])
|
||||
@@ -72,7 +72,7 @@ func ParseClientHello(secret, handshake []byte) (ClientHello, error) {
|
||||
// mac is calculated for the whole record, not only
|
||||
// for the payload part
|
||||
mac := hmac.New(sha256.New, secret)
|
||||
rec.Dump(mac) // nolint: errcheck
|
||||
rec.Dump(mac) //nolint: errcheck
|
||||
|
||||
computedRandom := mac.Sum(nil)
|
||||
|
||||
@@ -100,7 +100,7 @@ func parseSessionID(hello *ClientHello, handshake []byte) {
|
||||
}
|
||||
|
||||
func parseCipherSuite(hello *ClientHello, handshake []byte) {
|
||||
cipherSuiteOffset := ClientHelloSessionIDOffset + len(hello.SessionID) + 3 // nolint: gomnd
|
||||
cipherSuiteOffset := ClientHelloSessionIDOffset + len(hello.SessionID) + 3 //nolint: gomnd
|
||||
hello.CipherSuite = binary.BigEndian.Uint16(handshake[cipherSuiteOffset : cipherSuiteOffset+2])
|
||||
}
|
||||
|
||||
|
||||
@@ -25,14 +25,14 @@ func (c *Conn) Read(p []byte) (int, error) {
|
||||
|
||||
for {
|
||||
if err := rec.Read(c.Conn); err != nil {
|
||||
return 0, err // nolint: wrapcheck
|
||||
return 0, err //nolint: wrapcheck
|
||||
}
|
||||
|
||||
switch rec.Type { // nolint: exhaustive
|
||||
switch rec.Type { //nolint: exhaustive
|
||||
case record.TypeApplicationData:
|
||||
rec.Payload.WriteTo(&c.readBuffer) // nolint: errcheck
|
||||
rec.Payload.WriteTo(&c.readBuffer) //nolint: errcheck
|
||||
|
||||
return c.readBuffer.Read(p) // nolint: wrapcheck
|
||||
return c.readBuffer.Read(p) //nolint: wrapcheck
|
||||
case record.TypeChangeCipherSpec:
|
||||
default:
|
||||
return 0, fmt.Errorf("unsupported record type %v", rec.Type)
|
||||
@@ -60,13 +60,13 @@ func (c *Conn) Write(p []byte) (int, error) {
|
||||
|
||||
rec.Payload.Reset()
|
||||
rec.Payload.Write(p[:chunkSize])
|
||||
rec.Dump(sendBuffer) // nolint: errcheck
|
||||
rec.Dump(sendBuffer) //nolint: errcheck
|
||||
|
||||
p = p[chunkSize:]
|
||||
}
|
||||
|
||||
if _, err := c.Conn.Write(sendBuffer.Bytes()); err != nil {
|
||||
return 0, err // nolint: wrapcheck
|
||||
return 0, err //nolint: wrapcheck
|
||||
}
|
||||
|
||||
return lenP, nil
|
||||
|
||||
@@ -24,13 +24,13 @@ type ConnMock struct {
|
||||
func (m *ConnMock) Read(p []byte) (int, error) {
|
||||
m.Called(p)
|
||||
|
||||
return m.readBuffer.Read(p) // nolint: wrapcheck
|
||||
return m.readBuffer.Read(p) //nolint: wrapcheck
|
||||
}
|
||||
|
||||
func (m *ConnMock) Write(p []byte) (int, error) {
|
||||
m.Called(p)
|
||||
|
||||
return m.writeBuffer.Write(p) // nolint: wrapcheck
|
||||
return m.writeBuffer.Write(p) //nolint: wrapcheck
|
||||
}
|
||||
|
||||
type ConnTestSuite struct {
|
||||
@@ -61,14 +61,14 @@ func (suite *ConnTestSuite) TestRead() {
|
||||
rec.Version = record.Version12
|
||||
|
||||
rec.Payload.WriteByte(0x01)
|
||||
rec.Dump(&suite.connMock.readBuffer) // nolint: errcheck
|
||||
rec.Dump(&suite.connMock.readBuffer) //nolint: errcheck
|
||||
rec.Reset()
|
||||
|
||||
rec.Type = record.TypeApplicationData
|
||||
rec.Version = record.Version12
|
||||
|
||||
rec.Payload.Write([]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10})
|
||||
rec.Dump(&suite.connMock.readBuffer) // nolint: errcheck
|
||||
rec.Dump(&suite.connMock.readBuffer) //nolint: errcheck
|
||||
|
||||
resultBuffer := &bytes.Buffer{}
|
||||
buf := make([]byte, 2)
|
||||
@@ -95,14 +95,14 @@ func (suite *ConnTestSuite) TestReadUnexpected() {
|
||||
rec.Version = record.Version12
|
||||
|
||||
rec.Payload.WriteByte(0x01)
|
||||
rec.Dump(&suite.connMock.readBuffer) // nolint: errcheck
|
||||
rec.Dump(&suite.connMock.readBuffer) //nolint: errcheck
|
||||
rec.Reset()
|
||||
|
||||
rec.Type = record.TypeHandshake
|
||||
rec.Version = record.Version12
|
||||
|
||||
rec.Payload.Write([]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10})
|
||||
rec.Dump(&suite.connMock.readBuffer) // nolint: errcheck
|
||||
rec.Dump(&suite.connMock.readBuffer) //nolint: errcheck
|
||||
|
||||
buf := make([]byte, 2)
|
||||
|
||||
@@ -141,7 +141,7 @@ func (suite *ConnTestSuite) TestWrite() {
|
||||
|
||||
suite.Equal(record.TypeApplicationData, rec.Type)
|
||||
suite.Equal(record.Version12, rec.Version)
|
||||
rec.Payload.WriteTo(buf) // nolint: errcheck
|
||||
rec.Payload.WriteTo(buf) //nolint: errcheck
|
||||
}
|
||||
|
||||
suite.Equal(dataToRec, buf.Bytes())
|
||||
|
||||
@@ -12,7 +12,7 @@ var bytesBufferPool = sync.Pool{
|
||||
}
|
||||
|
||||
func acquireBytesBuffer() *bytes.Buffer {
|
||||
return bytesBufferPool.Get().(*bytes.Buffer) // nolint: forcetypeassert
|
||||
return bytesBufferPool.Get().(*bytes.Buffer) //nolint: forcetypeassert
|
||||
}
|
||||
|
||||
func releaseBytesBuffer(b *bytes.Buffer) {
|
||||
|
||||
@@ -11,7 +11,7 @@ var recordPool = sync.Pool{
|
||||
}
|
||||
|
||||
func AcquireRecord() *Record {
|
||||
return recordPool.Get().(*Record) // nolint: forcetypeassert
|
||||
return recordPool.Get().(*Record) //nolint: forcetypeassert
|
||||
}
|
||||
|
||||
func ReleaseRecord(r *Record) {
|
||||
|
||||
@@ -23,24 +23,24 @@ func SendWelcomePacket(writer io.Writer, secret []byte, clientHello ClientHello)
|
||||
rec.Version = record.Version12
|
||||
|
||||
generateServerHello(&rec.Payload, clientHello)
|
||||
rec.Dump(buf) // nolint: errcheck
|
||||
rec.Dump(buf) //nolint: errcheck
|
||||
rec.Reset()
|
||||
|
||||
rec.Type = record.TypeChangeCipherSpec
|
||||
rec.Version = record.Version12
|
||||
rec.Payload.WriteByte(ChangeCipherValue)
|
||||
|
||||
rec.Dump(buf) // nolint: errcheck
|
||||
rec.Dump(buf) //nolint: errcheck
|
||||
rec.Reset()
|
||||
|
||||
rec.Type = record.TypeApplicationData
|
||||
rec.Version = record.Version12
|
||||
|
||||
if _, err := io.CopyN(&rec.Payload, rand.Reader, int64(1024+mrand.Intn(3092))); err != nil { // nolint: gomnd
|
||||
if _, err := io.CopyN(&rec.Payload, rand.Reader, int64(1024+mrand.Intn(3092))); err != nil { //nolint: gomnd
|
||||
panic(err)
|
||||
}
|
||||
|
||||
rec.Dump(buf) // nolint: errcheck
|
||||
rec.Dump(buf) //nolint: errcheck
|
||||
|
||||
packet := buf.Bytes()
|
||||
mac := hmac.New(sha256.New, secret)
|
||||
@@ -51,7 +51,7 @@ func SendWelcomePacket(writer io.Writer, secret []byte, clientHello ClientHello)
|
||||
copy(packet[WelcomePacketRandomOffset:], mac.Sum(nil))
|
||||
|
||||
if _, err := writer.Write(packet); err != nil {
|
||||
return err // nolint: wrapcheck
|
||||
return err //nolint: wrapcheck
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -87,6 +87,6 @@ func generateServerHello(writer io.Writer, clientHello ClientHello) {
|
||||
binary.BigEndian.PutUint32(header[:], uint32(bodyBuf.Len()))
|
||||
header[0] = HandshakeTypeServer
|
||||
|
||||
writer.Write(header[:]) // nolint: errcheck
|
||||
bodyBuf.WriteTo(writer) // nolint: errcheck
|
||||
writer.Write(header[:]) //nolint: errcheck
|
||||
bodyBuf.WriteTo(writer) //nolint: errcheck
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ func (suite *ClientHandshakeTestSuite) SetupSuite() {
|
||||
|
||||
func (suite *ClientHandshakeTestSuite) TestCannotRead() {
|
||||
buf := bytes.NewBuffer([]byte{1, 2, 3})
|
||||
_, _, _, err := obfuscated2.ClientHandshake([]byte{1, 2, 3}, buf) // nolint: dogsled
|
||||
_, _, _, err := obfuscated2.ClientHandshake([]byte{1, 2, 3}, buf) //nolint: dogsled
|
||||
|
||||
suite.Error(err)
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ type Conn struct {
|
||||
func (c Conn) Read(p []byte) (int, error) {
|
||||
n, err := c.Conn.Read(p)
|
||||
if err != nil {
|
||||
return n, err // nolint: wrapcheck
|
||||
return n, err //nolint: wrapcheck
|
||||
}
|
||||
|
||||
c.Decryptor.XORKeyStream(p, p[:n])
|
||||
@@ -33,5 +33,5 @@ func (c Conn) Write(p []byte) (int, error) {
|
||||
payload := buf.Bytes()
|
||||
c.Encryptor.XORKeyStream(payload, payload)
|
||||
|
||||
return c.Conn.Write(payload) // nolint: wrapcheck
|
||||
return c.Conn.Write(payload) //nolint: wrapcheck
|
||||
}
|
||||
|
||||
@@ -23,20 +23,20 @@ var handshakeConnectionType = []byte{0xdd, 0xdd, 0xdd, 0xdd}
|
||||
|
||||
// A structure of obfuscated2 handshake frame is following:
|
||||
//
|
||||
// [frameOffsetFirst:frameOffsetKey:frameOffsetIV:frameOffsetMagic:frameOffsetDC:frameOffsetEnd].
|
||||
// [frameOffsetFirst:frameOffsetKey:frameOffsetIV:frameOffsetMagic:frameOffsetDC:frameOffsetEnd].
|
||||
//
|
||||
// - 8 bytes of noise
|
||||
// - 32 bytes of AES Key
|
||||
// - 16 bytes of AES IV
|
||||
// - 4 bytes of 'connection type' - this has some setting like a connection type
|
||||
// - 2 bytes of 'DC'. DC is little endian int16
|
||||
// - 2 bytes of noise
|
||||
// - 8 bytes of noise
|
||||
// - 32 bytes of AES Key
|
||||
// - 16 bytes of AES IV
|
||||
// - 4 bytes of 'connection type' - this has some setting like a connection type
|
||||
// - 2 bytes of 'DC'. DC is little endian int16
|
||||
// - 2 bytes of noise
|
||||
type handshakeFrame struct {
|
||||
data [handshakeFrameLen]byte
|
||||
}
|
||||
|
||||
func (h *handshakeFrame) dc() int {
|
||||
idx := int16(h.data[handshakeFrameOffsetDC]) | int16(h.data[handshakeFrameOffsetDC+1])<<8 // nolint: gomnd, lll // little endian for int16 is here
|
||||
idx := int16(h.data[handshakeFrameOffsetDC]) | int16(h.data[handshakeFrameOffsetDC+1])<<8 //nolint: gomnd, lll // little endian for int16 is here
|
||||
|
||||
switch {
|
||||
case idx > 0:
|
||||
|
||||
@@ -57,7 +57,7 @@ func (suite *HandshakeFrameTestSuite) TestDC() {
|
||||
suite.T().Run(strconv.Itoa(int(incoming)), func(t *testing.T) {
|
||||
frame := handshakeFrame{}
|
||||
|
||||
rand.Read(frame.data[:]) // nolint: errcheck
|
||||
rand.Read(frame.data[:]) //nolint: errcheck
|
||||
|
||||
frame.data[handshakeFrameOffsetDC] = byte(incoming)
|
||||
frame.data[handshakeFrameOffsetDC+1] = byte(incoming >> 8)
|
||||
|
||||
@@ -21,7 +21,7 @@ var (
|
||||
)
|
||||
|
||||
func acquireSha256Hasher() hash.Hash {
|
||||
return sha256HasherPool.Get().(hash.Hash) // nolint: forcetypeassert
|
||||
return sha256HasherPool.Get().(hash.Hash) //nolint: forcetypeassert
|
||||
}
|
||||
|
||||
func releaseSha256Hasher(h hash.Hash) {
|
||||
@@ -30,7 +30,7 @@ func releaseSha256Hasher(h hash.Hash) {
|
||||
}
|
||||
|
||||
func acquireBytesBuffer() *bytes.Buffer {
|
||||
return bytesBufferPool.Get().(*bytes.Buffer) // nolint: forcetypeassert
|
||||
return bytesBufferPool.Get().(*bytes.Buffer) //nolint: forcetypeassert
|
||||
}
|
||||
|
||||
func releaseBytesBuffer(buf *bytes.Buffer) {
|
||||
|
||||
@@ -47,12 +47,12 @@ func generateServerHanshakeFrame() serverHandshakeFrame {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if frame.data[0] == 0xef { // nolint: gomnd // taken from tg sources
|
||||
if frame.data[0] == 0xef { //nolint: gomnd // taken from tg sources
|
||||
continue
|
||||
}
|
||||
|
||||
switch binary.LittleEndian.Uint32(frame.data[:4]) {
|
||||
case 0x44414548, 0x54534f50, 0x20544547, 0x4954504f, 0xeeeeeeee: // nolint: gomnd // taken from tg sources
|
||||
case 0x44414548, 0x54534f50, 0x20544547, 0x4954504f, 0xeeeeeeee: //nolint: gomnd // taken from tg sources
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ func FuzzServerSend(f *testing.F) {
|
||||
Once().
|
||||
Run(func(args mock.Arguments) {
|
||||
message := make([]byte, len(data))
|
||||
handshakeData.decryptor.XORKeyStream(message, args.Get(0).([]byte)) // nolint: forcetypeassert
|
||||
handshakeData.decryptor.XORKeyStream(message, args.Get(0).([]byte)) //nolint: forcetypeassert
|
||||
assert.Equal(t, message, data)
|
||||
})
|
||||
|
||||
@@ -45,7 +45,7 @@ func FuzzServerReceive(f *testing.F) {
|
||||
Run(func(args mock.Arguments) {
|
||||
message := make([]byte, len(data))
|
||||
handshakeData.encryptor.XORKeyStream(message, data)
|
||||
copy(args.Get(0).([]byte), message) // nolint: forcetypeassert
|
||||
copy(args.Get(0).([]byte), message) //nolint: forcetypeassert
|
||||
})
|
||||
|
||||
n, err := handshakeData.proxyConn.Read(buffer)
|
||||
|
||||
@@ -30,7 +30,7 @@ func (suite *ServerHandshakeTestSuite) TestSendToTelegram() {
|
||||
Once().
|
||||
Run(func(args mock.Arguments) {
|
||||
message := make([]byte, len(messageToTelegram))
|
||||
suite.data.decryptor.XORKeyStream(message, args.Get(0).([]byte)) // nolint: forcetypeassert
|
||||
suite.data.decryptor.XORKeyStream(message, args.Get(0).([]byte)) //nolint: forcetypeassert
|
||||
suite.Equal(messageToTelegram, message)
|
||||
})
|
||||
|
||||
@@ -50,7 +50,7 @@ func (suite *ServerHandshakeTestSuite) TestRecieveFromTelegram() {
|
||||
Run(func(args mock.Arguments) {
|
||||
message := make([]byte, len(messageFromTelegram))
|
||||
suite.data.encryptor.XORKeyStream(message, messageFromTelegram)
|
||||
copy(args.Get(0).([]byte), message) // nolint: forcetypeassert
|
||||
copy(args.Get(0).([]byte), message) //nolint: forcetypeassert
|
||||
})
|
||||
|
||||
n, err := suite.data.proxyConn.Read(buffer)
|
||||
|
||||
@@ -11,7 +11,7 @@ var copyBufferPool = sync.Pool{
|
||||
}
|
||||
|
||||
func acquireCopyBuffer() *[]byte {
|
||||
return copyBufferPool.Get().(*[]byte) // nolint: forcetypeassert
|
||||
return copyBufferPool.Get().(*[]byte) //nolint: forcetypeassert
|
||||
}
|
||||
|
||||
func releaseCopyBuffer(buf *[]byte) {
|
||||
|
||||
@@ -35,8 +35,8 @@ func Relay(ctx context.Context, log Logger, telegramConn, clientConn essentials.
|
||||
}
|
||||
|
||||
func pump(log Logger, src, dst essentials.Conn, direction string) {
|
||||
defer src.CloseRead() // nolint: errcheck
|
||||
defer dst.CloseWrite() // nolint: errcheck
|
||||
defer src.CloseRead() //nolint: errcheck
|
||||
defer dst.CloseWrite() //nolint: errcheck
|
||||
|
||||
copyBuffer := acquireCopyBuffer()
|
||||
defer releaseCopyBuffer(copyBuffer)
|
||||
|
||||
+3
-3
@@ -106,7 +106,7 @@ func (p *Proxy) Serve(listener net.Listener) error {
|
||||
}
|
||||
}
|
||||
|
||||
ipAddr := conn.RemoteAddr().(*net.TCPAddr).IP // nolint: forcetypeassert
|
||||
ipAddr := conn.RemoteAddr().(*net.TCPAddr).IP //nolint: forcetypeassert
|
||||
logger := p.logger.BindStr("ip", ipAddr.String())
|
||||
|
||||
if !p.allowlist.Contains(ipAddr) {
|
||||
@@ -253,7 +253,7 @@ func (p *Proxy) doTelegramCall(ctx *streamContext) error {
|
||||
|
||||
p.eventStream.Send(ctx,
|
||||
NewEventConnectedToDC(ctx.streamID,
|
||||
conn.RemoteAddr().(*net.TCPAddr).IP, // nolint: forcetypeassert
|
||||
conn.RemoteAddr().(*net.TCPAddr).IP, //nolint: forcetypeassert
|
||||
ctx.dc),
|
||||
)
|
||||
|
||||
@@ -316,7 +316,7 @@ func NewProxy(opts ProxyOpts) (*Proxy, error) {
|
||||
|
||||
pool, err := ants.NewPoolWithFunc(opts.getConcurrency(),
|
||||
func(arg interface{}) {
|
||||
proxy.ServeConn(arg.(essentials.Conn)) // nolint: forcetypeassert
|
||||
proxy.ServeConn(arg.(essentials.Conn)) //nolint: forcetypeassert
|
||||
},
|
||||
ants.WithLogger(opts.getLogger("ants")),
|
||||
ants.WithNonblocking(true))
|
||||
|
||||
@@ -86,7 +86,7 @@ func (suite *ProxyTestSuite) SetupSuite() {
|
||||
|
||||
suite.listener = listener
|
||||
|
||||
go suite.p.Serve(suite.listener) // nolint: errcheck
|
||||
go suite.p.Serve(suite.listener) //nolint: errcheck
|
||||
}
|
||||
|
||||
func (suite *ProxyTestSuite) TearDownSuite() {
|
||||
@@ -179,7 +179,7 @@ func (suite *ProxyTestSuite) TestHTTPSRequest() {
|
||||
|
||||
addr := fmt.Sprintf("https://%s/headers", suite.ProxyAddress())
|
||||
|
||||
resp, err := client.Get(addr) // nolint: noctx
|
||||
resp, err := client.Get(addr) //nolint: noctx
|
||||
suite.NoError(err)
|
||||
|
||||
defer resp.Body.Close()
|
||||
@@ -191,7 +191,7 @@ func (suite *ProxyTestSuite) TestHTTPSRequest() {
|
||||
|
||||
jsonStruct := struct {
|
||||
Headers struct {
|
||||
TraceID string `json:"X-Amzn-Trace-Id"` // nolint: tagliatelle
|
||||
TraceID string `json:"X-Amzn-Trace-Id"` //nolint: tagliatelle
|
||||
} `json:"headers"`
|
||||
}{}
|
||||
|
||||
@@ -221,7 +221,7 @@ func (suite *ProxyTestSuite) TestMakeRealRequest() {
|
||||
_, err := tg.NewClient(tgClient).HelpGetConfig(ctx)
|
||||
suite.NoError(err)
|
||||
|
||||
return err // nolint: wrapcheck
|
||||
return err //nolint: wrapcheck
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ func (s *Secret) Set(text string) error {
|
||||
return fmt.Errorf("incorrect secret format: %w", err)
|
||||
}
|
||||
|
||||
if len(decoded) < 2 { // nolint: gomnd // we need at least 1 byte here
|
||||
if len(decoded) < 2 { //nolint: gomnd // we need at least 1 byte here
|
||||
return fmt.Errorf("secret is truncated, length=%d", len(decoded))
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ func (s *streamContext) Done() <-chan struct{} {
|
||||
}
|
||||
|
||||
func (s *streamContext) Err() error {
|
||||
return s.ctx.Err() // nolint: wrapcheck
|
||||
return s.ctx.Err() //nolint: wrapcheck
|
||||
}
|
||||
|
||||
func (s *streamContext) Value(key interface{}) interface{} {
|
||||
@@ -49,7 +49,7 @@ func (s *streamContext) Close() {
|
||||
}
|
||||
|
||||
func (s *streamContext) ClientIP() net.IP {
|
||||
return s.clientConn.RemoteAddr().(*net.TCPAddr).IP // nolint: forcetypeassert
|
||||
return s.clientConn.RemoteAddr().(*net.TCPAddr).IP //nolint: forcetypeassert
|
||||
}
|
||||
|
||||
func newStreamContext(ctx context.Context, logger Logger, clientConn essentials.Conn) *streamContext {
|
||||
|
||||
@@ -24,7 +24,7 @@ func (suite *StreamContextTestSuite) SetupSuite() {
|
||||
|
||||
func (suite *StreamContextTestSuite) SetupTest() {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
ctx = context.WithValue(ctx, "key", "value") // nolint: golint, revive, staticcheck
|
||||
ctx = context.WithValue(ctx, "key", "value") //nolint: golint, staticcheck
|
||||
|
||||
suite.ctxCancel = cancel
|
||||
suite.connMock = &testlib.EssentialsConnMock{}
|
||||
|
||||
Reference in New Issue
Block a user