Documentation
¶
Overview ¶
also why gocritic detects false positive, but if i write explanation, golangci-lint throws error that description expected as lintrer??? //TODO nolint: lll
Index ¶
- func CatchResponseErrorCode(data []byte) error
- func IsPacketEncrypted(data []byte) bool
- func MessageRequireToAck(msg tl.Object) bool
- func RpcErrorToNative(r *objects.RpcError) error
- func SaveSession(s *Session, path string) error
- func TryExpandError(errStr string) (nativeErrorName string, additionalData any)
- type BadMsgError
- type BadSystemMessageCode
- type Config
- type ErrResponseCode
- type MTProto
- func (m *MTProto) AddCustomServerRequestHandler(handler customHandlerFunc)
- func (m *MTProto) CreateConnection() error
- func (m *MTProto) Disconnect() error
- func (m *MTProto) GetAuthKey() []byte
- func (m *MTProto) GetLastSeqNo() int32
- func (m *MTProto) GetServerSalt() int64
- func (m *MTProto) GetSessionID() int64
- func (m *MTProto) LoadSession() (err error)
- func (m *MTProto) MakeRequest(msg tl.Object) (any, error)
- func (m *MTProto) MakeRequestWithHintToDecoder(msg tl.Object, expectedTypes ...reflect.Type) (any, error)
- func (m *MTProto) SaveSession() (err error)
- func (m *MTProto) SetAuthKey(key []byte)
- func (m *MTProto) SetDCStorages(in map[int]string)
- func (m *MTProto) Stop() error
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CatchResponseErrorCode ¶
func IsPacketEncrypted ¶
func MessageRequireToAck ¶
func RpcErrorToNative ¶
func SaveSession ¶
func TryExpandError ¶
Types ¶
type BadMsgError ¶
type BadMsgError struct {
*objects.BadMsgNotification
Description string
}
func BadMsgErrorFromNative ¶
func BadMsgErrorFromNative(in *objects.BadMsgNotification) *BadMsgError
func (*BadMsgError) Error ¶
func (e *BadMsgError) Error() string
type BadSystemMessageCode ¶
type BadSystemMessageCode int32
const ( ErrBadMsgUnknown BadSystemMessageCode = 0 ErrBadMsgIdTooLow BadSystemMessageCode = 16 ErrBadMsgIdTooHigh BadSystemMessageCode = 17 ErrBadMsgIncorrectMsgIdBits BadSystemMessageCode = 18 ErrBadMsgWrongContainerMsgId BadSystemMessageCode = 19 // this must never happen ErrBadMsgMessageTooOld BadSystemMessageCode = 20 ErrBadMsgSeqNoTooLow BadSystemMessageCode = 32 ErrBadMsgSeqNoTooHigh BadSystemMessageCode = 33 ErrBadMsgSeqNoExpectedEven BadSystemMessageCode = 34 ErrBadMsgSeqNoExpectedOdd BadSystemMessageCode = 35 ErrBadMsgServerSaltIncorrect BadSystemMessageCode = 48 ErrBadMsgInvalidContainer BadSystemMessageCode = 64 )
type ErrResponseCode ¶
type ErrResponseCode struct {
Code int
Message string
Description string
AdditionalInfo any // some errors has additional data like timeout seconds, dc id etc.
}
func (*ErrResponseCode) Error ¶
func (e *ErrResponseCode) Error() string
type MTProto ¶
type MTProto struct {
//! DEPRECATED RecoverFunc используется только до того момента, когда из пакета будут убраны все паники
RecoverFunc func(i any)
// если задан, то в канал пишутся ошибки
Warnings chan error
// contains filtered or unexported fields
}
func NewMTProto ¶
func (*MTProto) AddCustomServerRequestHandler ¶
func (m *MTProto) AddCustomServerRequestHandler(handler customHandlerFunc)
func (*MTProto) CreateConnection ¶
func (*MTProto) Disconnect ¶
Disconnect is closing current TCP connection and stopping all routines like pinging, reading etc.
func (*MTProto) GetSessionID ¶
получает текущий идентификатор сессии
func (*MTProto) LoadSession ¶
func (*MTProto) MakeRequestWithHintToDecoder ¶
func (*MTProto) SaveSession ¶
func (*MTProto) SetAuthKey ¶
func (*MTProto) SetDCStorages ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
auth
command
|
|
|
auth_bot
command
Example of using Mtproto for Telegram bot
|
Example of using Mtproto for Telegram bot |
|
get_channel_users
command
|
|
|
get_chats
command
|
|
|
get_configs_for_calls
command
|
|
|
get_saved_contacts
command
|
|
|
get_self
command
|
|
|
internal
|
|
|
internal/srp
Пакет srp реализует Secure Random Password protocol, который телеграм использует для реализации 2FA.
|
Пакет srp реализует Secure Random Password protocol, который телеграм использует для реализации 2FA. |
Click to show internal directories.
Click to hide internal directories.
Full-native implementation of MTProto protocol on Golang!
All code, from sending requests to encryption serialization is written on pure golang. You don't need to fetch any additional dependencies.
Lib is supports all the API and MTProto features, including video calls and post comments. You can create additional pull request to push api updates!
All changes in TDLib and Android client are monitoring to get the latest features and changes in TL schemas. New methods are creates by adding new lines into TL schema and updating generated code!
No more SQLite databases and caching unnecessary files, that you don't need. Also you can control how sessions are stored, auth process and literally everything that you want to!
You can use more than 10 accounts at same time! xelaj/MTProto doesn't create huge overhead in memory or cpu consumption as TDLib. Thanks for that, you can create huge number of connection instances and don't worry about memory overload!