mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 16:04:02 +03:00
Update golangci-lint
This commit is contained in:
+1
-2
@@ -4,11 +4,10 @@ import (
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/obfuscated2"
|
||||
"github.com/9seconds/mtg/protocol"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
const directPipeBufferSize = 1024
|
||||
|
||||
+6
-4
@@ -3,17 +3,17 @@ package proxy
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/protocol"
|
||||
"github.com/9seconds/mtg/wrappers/packetack"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func middleConnection(request *protocol.TelegramRequest) {
|
||||
telegramConn, err := packetack.NewProxy(request)
|
||||
if err != nil {
|
||||
request.Logger.Debugw("Cannot dial to Telegram", "error", err)
|
||||
|
||||
return
|
||||
}
|
||||
defer telegramConn.Close()
|
||||
@@ -27,7 +27,7 @@ func middleConnection(request *protocol.TelegramRequest) {
|
||||
clientConn = packetack.NewClientIntermediate(request.ClientConn)
|
||||
case conntypes.ConnectionTypeSecure:
|
||||
clientConn = packetack.NewClientIntermediateSecure(request.ClientConn)
|
||||
default:
|
||||
case conntypes.ConnectionTypeUnknown:
|
||||
panic("unknown connection type")
|
||||
}
|
||||
|
||||
@@ -53,15 +53,17 @@ func middlePipe(dst conntypes.PacketAckWriteCloser,
|
||||
|
||||
for {
|
||||
acks := conntypes.ConnectionAcks{}
|
||||
packet, err := src.Read(&acks)
|
||||
|
||||
packet, err := src.Read(&acks)
|
||||
if err != nil {
|
||||
logger.Debugw("Cannot read packet", "error", err)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if err = dst.Write(packet, &acks); err != nil {
|
||||
logger.Debugw("Cannot send packet", "error", err)
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -4,14 +4,13 @@ import (
|
||||
"context"
|
||||
"net"
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/9seconds/mtg/config"
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/protocol"
|
||||
"github.com/9seconds/mtg/stats"
|
||||
"github.com/9seconds/mtg/utils"
|
||||
"github.com/9seconds/mtg/wrappers/stream"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type Proxy struct {
|
||||
@@ -53,6 +52,7 @@ func (p *Proxy) accept(conn net.Conn) {
|
||||
|
||||
if err := utils.InitTCP(conn, config.C.ClientReadBuffer(), config.C.ClientWriteBuffer()); err != nil {
|
||||
logger.Errorw("Cannot initialize client TCP connection", "error", err)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -66,8 +66,8 @@ func (p *Proxy) accept(conn net.Conn) {
|
||||
defer clientConn.Close()
|
||||
|
||||
clientProtocol := p.ClientProtocolMaker()
|
||||
clientConn, err := clientProtocol.Handshake(clientConn)
|
||||
|
||||
clientConn, err := clientProtocol.Handshake(clientConn)
|
||||
if err != nil {
|
||||
stats.Stats.AuthenticationFailed()
|
||||
logger.Warnw("Cannot perform client handshake", "error", err)
|
||||
|
||||
Reference in New Issue
Block a user