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 CloseOnCancel(ctx context.Context, c io.Closer)
- func MessageRequireToAck(msg tl.Object) bool
- func RpcErrorToNative(r *objects.RpcError) 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) GetSeqNo() int32
- func (m *MTProto) GetServerSalt() int64
- func (m *MTProto) GetSessionID() int64
- func (m *MTProto) LoadSession(s *session.Session)
- func (m *MTProto) MakeRequest(msg tl.Object) (any, error)
- func (m *MTProto) MakeRequestWithHintToDecoder(msg tl.Object, expectedTypes ...reflect.Type) (any, error)
- func (m *MTProto) Reconnect() error
- func (m *MTProto) SaveSession() (err error)
- func (m *MTProto) SetAuthKey(key []byte)
- func (m *MTProto) SetDCList(in map[int]string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MessageRequireToAck ¶
func RpcErrorToNative ¶
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)
// if set, all critical errors writing to this channel
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) GetAuthKey ¶
GetAuthKey returns decryption key of current session salt 🧐
func (*MTProto) GetServerSalt ¶
GetServerSalt returns current server salt 🧐
func (*MTProto) GetSessionID ¶
GetSessionID returns the current session id 🧐
func (*MTProto) LoadSession ¶
func (*MTProto) MakeRequestWithHintToDecoder ¶
func (*MTProto) SaveSession ¶
func (*MTProto) SetAuthKey ¶
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
|
|
|
get_updates
command
|
|
|
internal
|
|
|
cmd/tlgen
command
|
|
|
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!