Skip to content

Latest commit

 

History

History
86 lines (58 loc) · 2.22 KB

README.md

File metadata and controls

86 lines (58 loc) · 2.22 KB

MTProto-rs

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.

Features

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

Examples

There are 3 examples which you can build and run:

tcp_auth

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

http_auth

Same as tcp_auth but over HTTP which only has 1 mode.

Based on tokio and hyper.

$ cargo run --example http_auth
# For verbose output use
$ RUST_LOG=http_auth=info cargo run --example http_auth

dynamic

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.

License

MTProto-rs is licensed under either of

at your option.