Simplify internals

This commit is contained in:
9seconds
2019-09-09 17:35:53 +03:00
parent 9534cb19d0
commit 691954bd16
8 changed files with 50 additions and 63 deletions
-21
View File
@@ -1,21 +0,0 @@
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
}
+5 -7
View File
@@ -2,21 +2,19 @@ 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
ConnectionType() conntypes.ConnectionType
ConnectionProtocol() conntypes.ConnectionProtocol
DC() conntypes.DC
}
type ClientProtocolMaker func() ClientProtocol
type TelegramProtocol interface {
Handshake(*TelegramRequest) (wrappers.Wrap, error)
}
type TelegramProtocolMaker func(telegram.Telegram) TelegramProtocol
type ClientProtocolMaker func() ClientProtocol
type TelegramProtocolMaker func() TelegramProtocol