mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-09-01 12:24:02 +03:00
Propagate client addr with connection options
This commit is contained in:
@@ -32,6 +32,7 @@ func DirectInit(conn net.Conn, conf *config.Config) (*mtproto.ConnectionOpts, wr
|
|||||||
return nil, nil, errors.Annotate(err, "Cannot parse obfuscated frame")
|
return nil, nil, errors.Annotate(err, "Cannot parse obfuscated frame")
|
||||||
}
|
}
|
||||||
connOpts.ConnectionProto = mtproto.ConnectionProtocolAny
|
connOpts.ConnectionProto = mtproto.ConnectionProtocolAny
|
||||||
|
connOpts.ClientAddr = conn.RemoteAddr().(*net.TCPAddr)
|
||||||
|
|
||||||
socket := wrappers.NewTimeoutRWC(conn)
|
socket := wrappers.NewTimeoutRWC(conn)
|
||||||
socket = wrappers.NewStreamCipherRWC(socket, obfs2.Encryptor, obfs2.Decryptor)
|
socket = wrappers.NewStreamCipherRWC(socket, obfs2.Encryptor, obfs2.Decryptor)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package mtproto
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"net"
|
||||||
|
|
||||||
"github.com/juju/errors"
|
"github.com/juju/errors"
|
||||||
)
|
)
|
||||||
@@ -18,6 +19,7 @@ type ConnectionOpts struct {
|
|||||||
DC int16
|
DC int16
|
||||||
ConnectionType ConnectionType
|
ConnectionType ConnectionType
|
||||||
ConnectionProto ConnectionProtocol
|
ConnectionProto ConnectionProtocol
|
||||||
|
ClientAddr *net.TCPAddr
|
||||||
}
|
}
|
||||||
|
|
||||||
// Different connection types which user requests from Telegram.
|
// Different connection types which user requests from Telegram.
|
||||||
|
|||||||
Reference in New Issue
Block a user