Igor Sirotin c3768ff3fc refactor: address review on the Node facades
Move the Messaging API back out of pkg/kernel: ffi.Handle becomes a
defined type in the internal package, so kernel can hand the context to
pkg/messaging through kernel.Handle without the kernel layer knowing the
tier exists, and without the type being nameable outside this module.

Split Discovery into DiscV5, PeerExchange and DNSDiscovery, group the
node's identity and health under Debug(), and give every facade a pointer
receiver. Drop the node name, the per-operation logging that duplicates
what the library already writes, and GetFreePortIfNeeded — port 0 already
means "let the OS pick".

Heavy kernel tests now mark themselves with requiresNode and skip under
-short, so the gate runs `go test -short ./...` instead of naming tests
in a regexp.
2026-08-25 00:46:13 +01:00

Logos Delivery Go Bindings

Go bindings for Logos Delivery.

Packages

  • pkg/messaging — the high-level Messaging API, and the one to reach for. A MessagingClient mirrors the Nim MessagingClient: it drives 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 node itself. A kernel.Node owns the library context, and the kernel (waku_*) protocols hang off it as facades: Relay(), Store(), Peers(), DiscV5(), PeerExchange(), DNSDiscovery() and Debug(). Unsupported and subject to change without notice.

Both tiers drive one node. A client hands its node over with Node(), so the kernel protocols are reachable without a second node and without a raw handle:

client, err := messaging.New(messaging.Config{Preset: kernel.PresetLogosDev})
defer client.Close()

client.Send(ctx, contentTopic, payload, false)

node := client.Node()
resp, err := node.Store().Query(ctx, request, peerInfo)
peers, err := node.Peers().Connected()
id, err := node.Debug().PeerID()

Install

go get github.com/logos-messaging/logos-delivery-go-bindings

Building

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.

nimble setup                # resolve logos-delivery at the pinned revision
nimble liblogosdelivery     # build it, via logos-delivery's own build task

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:

LIBLOGOSDELIVERY_OUT="$PWD/build" NIM_PARAMS="-d:disable_rln" nimble liblogosdelivery

Then point cgo at the headers and the library:

export CGO_CFLAGS="-I$(nimble path logos_delivery | tail -1)/library"
export CGO_LDFLAGS="-L$PWD/build -llogosdelivery -Wl,-rpath,$PWD/build"

go build ./...
go test ./pkg/messaging/

Development

No clone of logos-delivery is needed: nimble setup fetches it at the pinned revision.

To work against a local checkout instead — testing a logos-delivery change before repinning here — shadow the resolved package:

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:

requires "https://github.com/logos-messaging/logos-delivery#<rev>"
S
Description
No description provided
Readme
20 MiB
Languages
Go 99.1%
Makefile 0.9%