chore: sticke v0.38

This commit is contained in:
darshankabariya 2026-03-02 17:39:00 +05:30
parent 9e707c10f7
commit 24df1cb939
No known key found for this signature in database
GPG Key ID: 9A92CCD9899F0D22
3 changed files with 121 additions and 21 deletions

122
README.md
View File

@ -1,26 +1,108 @@
# Waku Rust bindings
# logos-delivery Rust Bindings
[![Crates.io][crates-badge]][crates-url]
[![Documentation][docs-badge]][docs-url]
[![Build Status][actions-badge]][actions-url]
[![Codecov Status][codecov-badge]][codecov-url]
[Crates.io][crates-url]
[Documentation][docs-url]
[Build Status][actions-url]
[Codecov Status][codecov-url]
Rust bindings for [logos-delivery](https://github.com/logos-messaging/logos-delivery) (Waku) v0.38.0-beta,
built on top of the [C FFI](https://github.com/logos-messaging/logos-delivery/blob/master/library/libwaku.h).
## Prerequisites
- **Rust** (stable) — [rustup.rs](https://rustup.rs)
- **Nim 2.x** — required to compile the native `libwaku` library
-
- **Make**
- **GCC or Clang**
## Setup
Clone the repository:
```bash
git clone https://github.com/logos-messaging/logos-delivery-rust-bindings.git
cd logos-delivery-rust-bindings
```
The first `cargo build` / `cargo run` automatically:
1. Initializes and updates git submodules
2. Compiles the native `libwaku` static library via `make libwaku STATIC=1`
3. Generates Rust FFI bindings via `bindgen`
## Running the Examples
### basic
Two Waku nodes in the same process. Node 1 publishes a message; node 2 receives it via relay subscription.
```bash
cd examples/basic
cargo run
```
### toy-chat
Multi-participant chat room over Waku relay. Pass your nickname as argument.
```bash
cd examples/toy-chat
cargo run "Alice"
```
Start another instance in a separate terminal (or on another machine) to chat:
```bash
cargo run "Bob"
```
### tic-tac-toe-gui
Multiplayer tic-tac-toe with a native GUI (eframe). Start two instances — locally or on separate machines.
```bash
cd examples/tic-tac-toe-gui
cargo run
```
## Running the Tests
Tests start real Waku nodes and bind to local TCP ports, so they **must run serially**:
```bash
# from repo root
cargo test -p waku-bindings -- --test-threads=1
# or from waku-bindings/
cd waku-bindings
cargo test
```
To see log output:
```bash
cargo test -- --nocapture
```
## Crates
| Crate | Description |
| -------------------------------- | ------------------------------ |
| [`waku-bindings`](waku-bindings/) | High-level Rust API |
| [`waku-sys`](waku-sys/) | Low-level bindgen FFI bindings |
## About Waku
[Waku](https://waku.org/) is a family of robust, censorship-resistant communication protocols for Web3. Private. Secure. Runs anywhere.
Read the [Waku docs](https://docs.waku.org/)
[crates-badge]: https://img.shields.io/crates/v/waku-bindings.svg
[crates-url]: https://crates.io/crates/waku-bindings
[docs-badge]: https://docs.rs/waku-bindings/badge.svg
[docs-url]: https://docs.rs/waku-bindings
[actions-badge]: https://github.com/logos-messaging/logos-messaging-rust-bindings/workflows/CI/badge.svg
[actions-url]: https://github.com/logos-messaging/logos-messaging-rust-bindings/actions/workflows/main.yml?query=workflow%3ACI+branch%3Amaster
[codecov-badge]: https://codecov.io/github/logos-messaging/logos-messaging-rust-bindings/branch/main/graph/badge.svg?token=H4CQWRUCUS
[codecov-url]: https://codecov.io/github/logos-messaging/logos-messaging-rust-bindings
Rust layer on top of [`logos-delivery`](https://github.com/logos-messaging/logos-delivery) [C FFI bindings](https://github.com/logos-messaging/logos-delivery/blob/master/library/libwaku.h).
## About Waku
[Waku](https://waku.org/) is a family of robust and censorship-resistant communication protocols enabling privacy-focused messaging for Web3 applications.
Private. Secure. Runs anywhere.
Read the [Waku docs](https://docs.waku.org/)
[actions-badge]: https://github.com/logos-messaging/logos-delivery-rust-bindings/workflows/CI/badge.svg
[actions-url]: https://github.com/logos-messaging/logos-delivery-rust-bindings/actions/workflows/main.yml?query=workflow%3ACI+branch%3Amaster
[codecov-badge]: https://codecov.io/github/logos-messaging/logos-delivery-rust-bindings/branch/main/graph/badge.svg?token=H4CQWRUCUS
[codecov-url]: https://codecov.io/github/logos-messaging/logos-delivery-rust-bindings

View File

@ -97,6 +97,24 @@ fn generate_bindgen_code(project_dir: &Path) {
);
println!("cargo:rustc-link-lib=static=natpmp");
// Link librln (built by `make librln` as part of `make libwaku`)
// The file is named librln_v<version>.a and lives in the vendor root.
if let Ok(entries) = std::fs::read_dir(&nwaku_path) {
for entry in entries.flatten() {
let name = entry.file_name();
let name_str = name.to_string_lossy();
if name_str.starts_with("librln_") && name_str.ends_with(".a") {
let lib_name = name_str.trim_start_matches("lib").trim_end_matches(".a");
println!(
"cargo:rustc-link-search=native={}",
nwaku_path.display()
);
println!("cargo:rustc-link-lib=static={}", lib_name);
break;
}
}
}
println!("cargo:rustc-link-lib=dl");
println!("cargo:rustc-link-lib=m");

@ -1 +1 @@
Subproject commit ba85873f03a1da6ab04287949849815fd97b7bfd
Subproject commit 104ce6e5ac16b9c5e818788e2fb2858c36f36bbf