mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 22:24:02 +03:00
Now it is a time to start to make a handshake
This commit is contained in:
@@ -1,6 +0,0 @@
|
|||||||
package mtproto
|
|
||||||
|
|
||||||
type Extras struct {
|
|
||||||
QuickAck bool
|
|
||||||
SimpleAck bool
|
|
||||||
}
|
|
||||||
@@ -4,3 +4,8 @@ const (
|
|||||||
RPCNonceSeqNo = -2
|
RPCNonceSeqNo = -2
|
||||||
RPCHandshakeSeqNo = -1
|
RPCHandshakeSeqNo = -1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type Extras struct {
|
||||||
|
QuickAck bool
|
||||||
|
SimpleAck bool
|
||||||
|
}
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ type RPCProxyRequest struct {
|
|||||||
RemoteIPPort [rpcProxyRequestIPPortLength]byte
|
RemoteIPPort [rpcProxyRequestIPPortLength]byte
|
||||||
LocalIPPort [rpcProxyRequestIPPortLength]byte
|
LocalIPPort [rpcProxyRequestIPPortLength]byte
|
||||||
ADTag []byte
|
ADTag []byte
|
||||||
|
Extras Extras
|
||||||
Message *bytes.Buffer
|
Message *bytes.Buffer
|
||||||
Extras *mtproto.Extras
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RPCProxyRequest) Bytes() []byte {
|
func (r *RPCProxyRequest) Bytes() []byte {
|
||||||
@@ -65,7 +65,7 @@ func (r *RPCProxyRequest) Bytes() []byte {
|
|||||||
return buf.Bytes()
|
return buf.Bytes()
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRPCProxyRequest(connectionType mtproto.ConnectionType, local, remote *net.TCPAddr, adTag []byte, extras *mtproto.Extras) (*RPCProxyRequest, error) {
|
func NewRPCProxyRequest(connectionType mtproto.ConnectionType, local, remote *net.TCPAddr, adTag []byte, extras Extras) (*RPCProxyRequest, error) {
|
||||||
flags := RPCProxyRequestFlagsHasAdTag | RPCProxyRequestFlagsMagic | RPCProxyRequestFlagsExtMode2
|
flags := RPCProxyRequestFlagsHasAdTag | RPCProxyRequestFlagsMagic | RPCProxyRequestFlagsExtMode2
|
||||||
|
|
||||||
switch connectionType {
|
switch connectionType {
|
||||||
|
|||||||
+7
-1
@@ -8,13 +8,15 @@ import (
|
|||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
"github.com/9seconds/mtg/config"
|
"github.com/9seconds/mtg/config"
|
||||||
|
"github.com/9seconds/mtg/mtproto"
|
||||||
|
"github.com/9seconds/mtg/wrappers"
|
||||||
)
|
)
|
||||||
|
|
||||||
type middleTelegram struct {
|
type middleTelegram struct {
|
||||||
middleTelegramCaller
|
middleTelegramCaller
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMiddleTelegram(conf *config.Config, logger *zap.SugaredLogger) *middleTelegram {
|
func NewMiddleTelegram(conf *config.Config, logger *zap.SugaredLogger) Telegram {
|
||||||
tg := &middleTelegram{
|
tg := &middleTelegram{
|
||||||
middleTelegramCaller: middleTelegramCaller{
|
middleTelegramCaller: middleTelegramCaller{
|
||||||
baseTelegram: baseTelegram{
|
baseTelegram: baseTelegram{
|
||||||
@@ -35,3 +37,7 @@ func NewMiddleTelegram(conf *config.Config, logger *zap.SugaredLogger) *middleTe
|
|||||||
|
|
||||||
return tg
|
return tg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *middleTelegram) Init(connOpts *mtproto.ConnectionOpts, conn wrappers.ReadWriteCloserWithAddr) (wrappers.ReadWriteCloserWithAddr, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user