Consumers resolve liblogosdelivery at the revision these bindings were written against, instead of pinning it themselves, and build it through the task here rather than reimplementing logos-delivery's flags. srcDir points at an empty directory, so nothing is contributed to a dependent's Nim path.
2.1 KiB
Logos Delivery Go Bindings
Go bindings for Logos Delivery.
Packages
pkg/messaging— the high-level Messaging API, and the one to reach for. AMessagingClientmirrors the NimMessagingClient: it owns a node and exposesStart/Stop/Close,Subscribe/Unsubscribe,Send, and a typedEvents()stream. Seeexamples/messagingfor 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.
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>"