mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 13:44:03 +03:00
Direct proxy works
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package protocol
|
||||
|
||||
import "github.com/9seconds/mtg/conntypes"
|
||||
|
||||
type BaseProtocol struct {
|
||||
ConnectionType conntypes.ConnectionType
|
||||
ConnectionProtocol conntypes.ConnectionProtocol
|
||||
DC conntypes.DC
|
||||
}
|
||||
|
||||
func (b *BaseProtocol) GetConnectionType() conntypes.ConnectionType {
|
||||
return b.ConnectionType
|
||||
}
|
||||
|
||||
func (b *BaseProtocol) GetConnectionProtocol() conntypes.ConnectionProtocol {
|
||||
return b.ConnectionProtocol
|
||||
}
|
||||
|
||||
func (b *BaseProtocol) GetDC() conntypes.DC {
|
||||
return b.DC
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package protocol
|
||||
|
||||
import (
|
||||
"github.com/9seconds/mtg/conntypes"
|
||||
"github.com/9seconds/mtg/telegram"
|
||||
"github.com/9seconds/mtg/wrappers"
|
||||
)
|
||||
|
||||
type ClientProtocol interface {
|
||||
Handshake(wrappers.StreamReadWriteCloser) (wrappers.StreamReadWriteCloser, error)
|
||||
GetConnectionType() conntypes.ConnectionType
|
||||
GetConnectionProtocol() conntypes.ConnectionProtocol
|
||||
GetDC() conntypes.DC
|
||||
}
|
||||
|
||||
type ClientProtocolMaker func() ClientProtocol
|
||||
|
||||
type TelegramProtocol interface {
|
||||
Handshake(*TelegramRequest) (wrappers.Wrap, error)
|
||||
}
|
||||
|
||||
type TelegramProtocolMaker func(telegram.Telegram) TelegramProtocol
|
||||
@@ -0,0 +1,18 @@
|
||||
package protocol
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/9seconds/mtg/wrappers"
|
||||
)
|
||||
|
||||
type TelegramRequest struct {
|
||||
Logger *zap.SugaredLogger
|
||||
ClientConn wrappers.StreamReadWriteCloser
|
||||
ConnID wrappers.ConnID
|
||||
Ctx context.Context
|
||||
Cancel context.CancelFunc
|
||||
ClientProtocol ClientProtocol
|
||||
}
|
||||
Reference in New Issue
Block a user