Skip to content

Telegram MTProto API library in Rust for creating the reliable clients, or bots.

License

Notifications You must be signed in to change notification settings

dimentyy/hungry-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

196 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HUNGRY-RS

Telegram MTProto API client in Rust, with RELIABILITY as the top priority.

Ideas for this project were massively inspired by ★ gramme.rs libraries.

Overview

This project is NOT a framework — it's a library, meaning there is NO session management, input peer cache, or any high-level convenient API methods. The user shall adapt the library for their own specific use-case, rather than their projects, with HUNGRY-RS providing a stable base for Telegram clients.

Unbite

See the crate, currently in this repository. This is a replacement of bytes, designed for efficient, compile-time checked operations on contiguous memory, with support for constant-sized buffers.

Current status

Work in progress.

Milestones:

  • TL generation
  • MTProto Transports
  • Reader, Writer
  • Sender
    • Container
    • Deserialization
    • Gzip compression
    • Salts
    • Acknowledgment of Receipt
    • RPC results
    • Error recovery
  • Client
  • Stabilization
  • Active testing

Binaries

Libraries

  • hungry — client, connection and protocol logic
  • hungry-tl — generated TL-schema, their traits
  • hungry-tl-gen — TL-generator for hungry-tl

Todo

  • Safe serialization buffer. (&mut [MaybeUninit<u8>] => &mut [u8])
  • Generate an enum with all bare types (determined by CONSTRUCTOR_ID) to catch deserialization failures early.
    • Box large variants.
    • Optimize this monster.
  • Wrapper for storing precalculated serialized length.
  • unbite::DynRaw container to easily unsplit buffers after they are received?
  • Write safety comments.
  • Scrape documentation for types and functions?
  • Support Gzip containers.
  • Logging. tracing / log?
  • Lower amount of unsafe code in hungry-tl (current: ~5170).
  • Actual documentation.
  • Remove TODOs.
    • todo!() & .unwrap() panics.
    • // TODO: comments.
  • Plain sender.
    • Base. (hungry::plain)
  • Stabilize unbite crate.
    • Guarantee memory-safety.
    • Reduce split/unsplit mess.
  • Follow all security guidelines.
    • Diffie-Hellman key exchange
    • MTProto Encrypted Messages
      • Checking SHA256 hash value of msg_key.
      • Checking message length.
      • Checking session_id.
      • Checking msg_id.
    • Seq no checking.
  • Authorization / Sign in.
    • Full error handling.
    • Auth key generation.
    • Bot sign in via token.
    • Connection to different DC?
  • Transport.
    • Abridged.
    • Intermediate.
      • Quick ACK.
      • Test.
    • Padded intermediate.
    • Full.
    • Obfuscation.
      • Test.
    • Support quick ACKs higher than transport functions.
  • Nice way to initialize transport.
    • OwnedWrite?
  • Encrypted sender.
    • Message container.
    • Gzipping.
  • "Zero-Copy" file uploading?
  • Handle msgs_ack.
  • Salt management.
  • Sendable and Cloneable Client to use the Sender.
  • Use #[forbid(clippy::todo)] and #[forbid(unsafe_code)] as much as possible.

The repository will be recreated once this project is complete and refactored.

License

This project is licensed under the MIT license.

About

Telegram MTProto API library in Rust for creating the reliable clients, or bots.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Languages