mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 14:04:02 +03:00
Update golangci-lint to 1.44.2
This commit is contained in:
@@ -12,7 +12,7 @@ var bytesBufferPool = sync.Pool{
|
||||
}
|
||||
|
||||
func acquireBytesBuffer() *bytes.Buffer {
|
||||
return bytesBufferPool.Get().(*bytes.Buffer)
|
||||
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)
|
||||
return recordPool.Get().(*Record) // nolint: forcetypeassert
|
||||
}
|
||||
|
||||
func ReleaseRecord(r *Record) {
|
||||
|
||||
@@ -21,7 +21,7 @@ var (
|
||||
)
|
||||
|
||||
func acquireSha256Hasher() hash.Hash {
|
||||
return sha256HasherPool.Get().(hash.Hash)
|
||||
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)
|
||||
return bytesBufferPool.Get().(*bytes.Buffer) // nolint: forcetypeassert
|
||||
}
|
||||
|
||||
func releaseBytesBuffer(buf *bytes.Buffer) {
|
||||
|
||||
@@ -69,7 +69,7 @@ func (suite *ServerHandshakeTestSuite) TestSendToTelegram() {
|
||||
Once().
|
||||
Run(func(args mock.Arguments) {
|
||||
message := make([]byte, len(messageToTelegram))
|
||||
suite.decryptor.XORKeyStream(message, args.Get(0).([]byte))
|
||||
suite.decryptor.XORKeyStream(message, args.Get(0).([]byte)) // nolint: forcetypeassert
|
||||
suite.Equal(messageToTelegram, message)
|
||||
})
|
||||
|
||||
@@ -89,7 +89,7 @@ func (suite *ServerHandshakeTestSuite) TestRecieveFromTelegram() {
|
||||
Run(func(args mock.Arguments) {
|
||||
message := make([]byte, len(messageFromTelegram))
|
||||
suite.encryptor.XORKeyStream(message, messageFromTelegram)
|
||||
copy(args.Get(0).([]byte), message)
|
||||
copy(args.Get(0).([]byte), message) // nolint: forcetypeassert
|
||||
})
|
||||
|
||||
n, err := suite.proxyConn.Read(buffer)
|
||||
|
||||
@@ -11,7 +11,7 @@ var copyBufferPool = sync.Pool{
|
||||
}
|
||||
|
||||
func acquireCopyBuffer() *[]byte {
|
||||
return copyBufferPool.Get().(*[]byte)
|
||||
return copyBufferPool.Get().(*[]byte) // nolint: forcetypeassert
|
||||
}
|
||||
|
||||
func releaseCopyBuffer(buf *[]byte) {
|
||||
|
||||
+6
-3
@@ -106,7 +106,7 @@ func (p *Proxy) Serve(listener net.Listener) error { // nolint: cyclop
|
||||
}
|
||||
}
|
||||
|
||||
ipAddr := conn.RemoteAddr().(*net.TCPAddr).IP
|
||||
ipAddr := conn.RemoteAddr().(*net.TCPAddr).IP // nolint: forcetypeassert
|
||||
logger := p.logger.BindStr("ip", ipAddr.String())
|
||||
|
||||
if p.whitelist != nil && !p.whitelist.Contains(ipAddr) {
|
||||
@@ -255,7 +255,10 @@ func (p *Proxy) doTelegramCall(ctx *streamContext) error {
|
||||
}
|
||||
|
||||
p.eventStream.Send(ctx,
|
||||
NewEventConnectedToDC(ctx.streamID, conn.RemoteAddr().(*net.TCPAddr).IP, ctx.dc))
|
||||
NewEventConnectedToDC(ctx.streamID,
|
||||
conn.RemoteAddr().(*net.TCPAddr).IP, // nolint: forcetypeassert
|
||||
ctx.dc),
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -316,7 +319,7 @@ func NewProxy(opts ProxyOpts) (*Proxy, error) {
|
||||
|
||||
pool, err := ants.NewPoolWithFunc(opts.getConcurrency(),
|
||||
func(arg interface{}) {
|
||||
proxy.ServeConn(arg.(essentials.Conn))
|
||||
proxy.ServeConn(arg.(essentials.Conn)) // nolint: forcetypeassert
|
||||
},
|
||||
ants.WithLogger(opts.getLogger("ants")),
|
||||
ants.WithNonblocking(true))
|
||||
|
||||
@@ -49,7 +49,7 @@ func (s *streamContext) Close() {
|
||||
}
|
||||
|
||||
func (s *streamContext) ClientIP() net.IP {
|
||||
return s.clientConn.RemoteAddr().(*net.TCPAddr).IP
|
||||
return s.clientConn.RemoteAddr().(*net.TCPAddr).IP // nolint: forcetypeassert
|
||||
}
|
||||
|
||||
func newStreamContext(ctx context.Context, logger Logger, clientConn essentials.Conn) *streamContext {
|
||||
|
||||
Reference in New Issue
Block a user