2026-08-23 11:39:58 +01:00
|
|
|
# Logos Delivery Go Bindings
|
2024-11-27 12:08:50 +02:00
|
|
|
|
2026-08-23 11:39:58 +01:00
|
|
|
Go bindings for Logos Delivery.
|
2024-11-27 12:08:50 +02:00
|
|
|
|
2026-08-24 11:53:36 +01:00
|
|
|
## Packages
|
|
|
|
|
|
|
|
|
|
- **`pkg/messaging`** — the high-level Messaging API, and the one to reach for.
|
|
|
|
|
A `MessagingClient` mirrors the Nim `MessagingClient`: it owns a node and
|
|
|
|
|
exposes `Start`/`Stop`/`Close`, `Subscribe`/`Unsubscribe`, `Send`, and a
|
|
|
|
|
typed `Events()` stream. See `examples/messaging` for a runnable demo.
|
|
|
|
|
- **`pkg/kernel`** — the low-level kernel (`waku_*`) protocols: relay, store,
|
|
|
|
|
filter, lightpush, discovery and peer management. Unsupported and subject to
|
|
|
|
|
change without notice.
|
|
|
|
|
|
2025-10-30 10:59:13 +00:00
|
|
|
## Install
|
2025-03-13 15:22:58 +02:00
|
|
|
|
|
|
|
|
```
|
2026-08-23 11:39:58 +01:00
|
|
|
go get github.com/logos-messaging/logos-delivery-go-bindings
|
2025-03-13 15:22:58 +02:00
|
|
|
```
|
2025-03-26 16:29:51 +02:00
|
|
|
|
2026-08-23 11:39:58 +01:00
|
|
|
## Building
|
2025-03-26 16:29:51 +02:00
|
|
|
|
2026-08-23 11:39:58 +01:00
|
|
|
`liblogosdelivery` is required at compile time. This repository is a Nimble package declaring the
|
|
|
|
|
minimum logos-delivery its C ABI works against, so a consumer picks the revision and can upgrade
|
|
|
|
|
without a release here.
|
2025-10-30 10:59:13 +00:00
|
|
|
|
2026-08-23 11:39:58 +01:00
|
|
|
```sh
|
|
|
|
|
nimble setup # resolve logos-delivery at the pinned revision
|
|
|
|
|
nimble liblogosdelivery # build it, via logos-delivery's own build task
|
|
|
|
|
```
|
2025-12-19 15:58:52 +05:30
|
|
|
|
2026-08-23 11:39:58 +01:00
|
|
|
The library is written to logos-delivery's package directory. Set `LIBLOGOSDELIVERY_OUT` to have it
|
|
|
|
|
copied somewhere of your choosing, and pass `NIM_PARAMS` for build defines — `-d:disable_rln` builds
|
|
|
|
|
without zerokit, so no Rust toolchain is needed:
|
2025-12-20 00:14:00 +05:30
|
|
|
|
2026-08-23 11:39:58 +01:00
|
|
|
```sh
|
|
|
|
|
LIBLOGOSDELIVERY_OUT="$PWD/build" NIM_PARAMS="-d:disable_rln" nimble liblogosdelivery
|
|
|
|
|
```
|
2025-12-19 15:58:52 +05:30
|
|
|
|
2026-08-23 11:39:58 +01:00
|
|
|
Then point cgo at the headers and the library:
|
2025-12-20 01:52:47 +05:30
|
|
|
|
2026-08-23 11:39:58 +01:00
|
|
|
```sh
|
|
|
|
|
export CGO_CFLAGS="-I$(nimble path logos_delivery | tail -1)/library"
|
|
|
|
|
export CGO_LDFLAGS="-L$PWD/build -llogosdelivery -Wl,-rpath,$PWD/build"
|
2025-10-30 10:59:13 +00:00
|
|
|
|
2026-08-23 11:39:58 +01:00
|
|
|
go build ./...
|
|
|
|
|
go test ./pkg/messaging/
|
2025-12-22 14:29:52 +05:30
|
|
|
```
|
2025-10-30 10:59:13 +00:00
|
|
|
|
|
|
|
|
## Development
|
|
|
|
|
|
2026-08-23 11:39:58 +01:00
|
|
|
No clone of logos-delivery is needed: `nimble setup` fetches it at the pinned revision.
|
2025-10-30 10:59:13 +00:00
|
|
|
|
2026-08-23 11:39:58 +01:00
|
|
|
To work against a local checkout instead — testing a logos-delivery change before repinning here —
|
|
|
|
|
shadow the resolved package:
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
nimble develop /path/to/logos-delivery
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
To choose a specific revision, require it from your own `.nimble` — it satisfies the range here and
|
|
|
|
|
wins resolution:
|
|
|
|
|
|
|
|
|
|
```nim
|
|
|
|
|
requires "https://github.com/logos-messaging/logos-delivery#<rev>"
|
|
|
|
|
```
|