Skip to the content.

Architecture

Rustuya is designed with a layered architecture that separates network concerns, protocol logic, and user-facing APIs. This separation ensures high performance, reliability, and ease of maintenance.


Layer Overview

  1. User API Layer: Provides high-level interfaces for Rust and Python.
  2. Sync Wrapper Layer: Bridges the asynchronous core to synchronous APIs for ease of use in simple scripts.
  3. Core Logic Layer: Manages device lifecycle, connection pooling, and event dispatching.
  4. Protocol Layer: Handles Tuya-specific message framing, encryption, and decryption.
  5. Transport Layer: Manages low-level TCP/UDP communication using tokio.

Component Breakdown