Skip to content
akasamqPublic

About

A no-std MQTT client

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

19 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Masaka

Modular, no_std-oriented async MQTT client for Rust, built on mqtt-proto (v3.1.1 / v5). Transport and time sources are pluggable (Tokio TCP vs Embassy TCP).

Features

Feature Meaning
std Standard library–oriented deps (see Cargo.toml).
embassy Embassy-net TCP TcpTransport + Embassy time default.
tokio Tokio TCP TcpTransport + Tokio time default (implies std).
tls A small, from-scratch TLS 1.3 client (no_std, no alloc; secp256r1 + TLS_AES_128_GCM_SHA256 only) — see src/tls/. Record layer and handshake message codec so far; not yet wired to a transport.
rustls TlsTransport for the tokio runtime, backed by rustls (implies tokio + tls). The no_std/embassy path stays on the src/tls/ client above instead.

Do not enable embassy and tokio together

Quick start (Tokio, host)

[dependencies]
masaka = { version = "*", default-features = false, features = ["tokio"] }
tokio = { version = "1", features = ["macros", "rt-multi-thread", "net", "time"] }
use masaka::{
    protocol::V3Handler, ClientConfig, MqttClient, PublishConfig, QoS,
    transport::TcpTransport,
};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let transport = TcpTransport::new("127.0.0.1:1883").await?;
    let config = ClientConfig::new("masaka_demo").with_keep_alive(60);
    let mut client = MqttClient::new(transport, V3Handler::new(), config);

    client.connect().await?;

    let topic = masaka::topic!("demo/topic");
    client
        .publish(&topic, b"hello", PublishConfig::qos0())
        .await?;

    Ok(())
}

Building & tests

cargo check
cargo test --no-default-features --features tokio

TLS interop smoke test (manual)

examples/tls_probe.rs sends a real ClientHello (built with src/tls/) to a live TLS 1.3 server over a plain TCP socket and decodes the ServerHello it gets back — a live check against an independent implementation, complementing the static RFC 8448 vector tests in src/tls/rfc8448.rs. It does not complete a handshake (no key derivation/AEAD yet); it only checks the wire codec. Not part of cargo test — run manually against a local server restricted to this client's one supported cipher suite/group:

openssl req -new -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 \
    -nodes -keyout key.pem -out cert.pem -days 1 -subj "//CN=localhost"
openssl s_server -accept 18443 -tls1_3 -cert cert.pem -key key.pem \
    -ciphersuites TLS_AES_128_GCM_SHA256 -groups P-256 -quiet &
cargo run --example tls_probe --no-default-features --features tls,std,tokio -- 127.0.0.1:18443

TLS + akasa integration test (manual)

tests/tls_connect.rs runs a real MqttClient<TlsTransport, V3Handler> (the rustls backend) against a real akasa-core broker over TLS — CONNECT, PUBLISH, DISCONNECT, all encrypted. #[ignore]d because it shells out to openssl to generate a throwaway self-signed cert; run explicitly:

cargo test --no-default-features --features rustls,tls --test tls_connect -- --ignored

About

A no-std MQTT client

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages