MTProto protocol and schema implementation in Rust.
Intended to provide low-level features to create a robust foundation for
higher-level libraries such as telegram-rs
.
Supports Rust 1.19 or newer. Older versions may work, but not guaranteed to.
Currently implemented and planned features include:
- Code autogeneration for TL-schema
(implemented in
tl_codegen
) - MTProto binary [de]serialization
(handled by
serde_mtproto
) - Encryption facilities which enforce security guidelines
- Key exchange
- Seamless RPC:
- Schema functions are modeled as structs
- Sending requests and receiving responses are automatically provided by associated methods
- Handling sessions and messages
There are 3 examples which you can build and run:
Fetches authorization key over TCP. Supports 3 modes: abridged, intermediate and full (this example uses all three).
Based on tokio.
$ cargo run --example tcp_auth
# For verbose output use
$ RUST_LOG=tcp_auth=info cargo run --example tcp_auth
Same as tcp_auth
but over HTTP which only has 1 mode.
$ cargo run --example http_auth
# For verbose output use
$ RUST_LOG=http_auth=info cargo run --example http_auth
Dynamic typing using TLObject
in action.
$ cargo run --example dynamic
# For verbose output use
$ RUST_LOG=dynamic=info cargo run --example dynamic
You can also look at tests for more use cases which are automatically tested.
MTProto-rs is licensed under either of
- Apache License, Version 2.0, (LICENSE_APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE_MIT or http://opensource.org/licenses/MIT)
at your option.