Commit Graph
22 Commits
Author SHA1 Message Date
vladopajic a31c40d65c feat: logs filter (#95) 2026-08-01 20:22:42 +02:00
Dario LipicarandClaude Opus 5 ad00876e9d fix(lidl): give createXpr services and newPrivateKey a LIDL type (#97)
* fix(lidl): give createXpr services and newPrivateKey a LIDL type

logos-cpp-sdk#127 makes an unrecognised C++ spelling a build error
instead of silently publishing it as the opaque `any`, and two
declarations in plugin.h relied on that silence.

createXpr's `services` was `std::vector<std::pair<std::string,
std::string>>` — LIDL has no pair, so it published as `[any]`. The
pair's second element carries raw binary (it becomes a
ServiceInfoEntry's NimFfiBytes), but as a std::string it round-tripped
through UTF-8, which is lossy for non-UTF-8 bytes. It is now
`std::map<std::string, std::vector<uint8_t>>` — LIDL `{tstr: bstr}` —
which reaches the record byte for byte. decodeXpr's `services` becomes
an object keyed by service id to mirror it, so a decoded record feeds
back in without reshaping; `data` stays base64 there because that value
rides in an untyped `result`, not a typed slot.

newPrivateKey took `KeyScheme`, an enum, which LIDL also has no type
for. It now takes the scheme name — the vocabulary metadata.json
already documents for `keyType`, parsed the way parseTransport parses
"tcp"/"quic". The numeric KEY_SCHEME_* values belong to the Nim
binding and are no contract for a caller in another language.

decode_xpr now round-trips 0x01 0x00 0x02 0x80 0xfe 0xff 0x03 and
compares byte for byte, which is the lossiness this fixes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(lidl): keep the decoded-record services shape as it was

The previous commit also changed recordEntryToJson's `services` from
`[{id, data}]` to an object keyed by id, to mirror the map createXpr
now takes. That was wrong: recordEntryToJson serves discoLookup and
discoRandomLookup as well as decodeXpr, so it silently reshaped three
results, and tutorial 9 aborted iterating a lookup record —
`s["data"]` on what had become a bare base64 string throws
json type_error.305.

Keyed-by-id is also wrong on its own terms here. Lookup records come
from remote peers and may legitimately repeat a service id; an object
drops all but the last, while the array represents them faithfully.

createXpr's parameter stays `std::map<std::string,
std::vector<uint8_t>>` (`{tstr: bstr}`) — that is the typing fix and
the byte-exactness it buys, and it is unaffected. decode_xpr still
proves the round-trip, indexing the array instead of the object.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-07-31 14:35:59 -03:00
vladopajic 5e67df57fb chore: expose libp2p_ctx_new_private_key (#96)
* new private key

* add KeyScheme enum + arg
2026-07-31 15:23:05 +02:00
Gabriel Cruz 78952d5141 feat: use nim-ffi cbindings (#77) 2026-07-29 08:39:38 -03:00
Gabriel Cruz b0c6091b2d feat(config): configurable persistent private key (#64) 2026-07-01 11:31:59 -03:00
Gabriel Cruz 4586aa729e feat: run a libp2p node standalone via createNode/getNodeInfo (#71) 2026-06-30 13:54:08 -03:00
Gabriel Cruz 2e0babbc11 chore: extract utils (#73) 2026-06-30 11:46:32 -03:00
Gabriel Cruz 5c7dbcd91a chore: dedup the sync-over-async bridge, split plugin.h, surface init failure (#65) 2026-06-29 12:16:30 -03:00
Gabriel Cruz fd8b4e4d82 fix(tsan): guard emitEvent against the worker-thread data race (#66) 2026-06-25 14:59:06 -03:00
Gabriel Cruz de87823523 feat: user-provided XPRs (#62) 2026-06-25 10:10:16 -03:00
Gabriel Cruz 1e545b8ae7 feat(openmetrics): libp2p metrics (#56) 2026-06-22 13:22:57 -03:00
Gabriel Cruz 673b8e421b chore: extract mix bindings + bump logos-module-builder (#55) 2026-06-19 11:34:48 -03:00
Gabriel Cruz 739f72c5c0 fix: small improvements (#50) 2026-06-12 12:10:24 -03:00
Gabriel Cruz 5b1773ecbe feat: custom protocol registration (#45) 2026-05-18 12:10:21 -03:00
Radosław Kamiński f56c995ef5 chore(service-disco): rename startDiscovering to registerInterest (#46) 2026-05-11 13:21:44 -03:00
Iuri Matias 4ecd506183 update to new api (#44)
update to new api

avoid SyncCtx
2026-05-07 15:34:51 -03:00
af85f0ea80 feat: add service discovery (#40)
* feat: add service discovery

- Point nim-libp2p to feat/service-disco/cbind branch
- Update include/libp2p.h with new cbind API (mount_service_discovery,
  all libp2p_service_disco_* functions)
- Add serviceDiscovery option to Libp2pModuleOptions
- Add discoStart/Stop, discoStartDiscovering, discoStopDiscovering,
  discoLookup, discoRandomLookup (async + sync) following the same
  pattern as kad/gossipsub/mix
- Add src/service_discovery.cpp, example, and integration tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Update tests/integration_service_discovery.cpp

Co-authored-by: richΛrd <info@richardramos.me>

* Update include/libp2p.h

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update tests/integration_service_discovery.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* chore: add mountXXX options for mix, kad, service_disco and gossip

* fix: use header from nix pkg

* chore: bump nim-libp2p

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: richΛrd <info@richardramos.me>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-27 09:56:03 -03:00
Radosław Kamiński 7a416a9f3a feat: add circuit relay client (#35) 2026-03-14 07:12:36 -03:00
Radosław Kamiński 43f736b5ef refactor: introduce Libp2pModuleOptions struct and add config tests (#32) 2026-03-06 13:42:04 -03:00
Gabriel Cruz 96868dcfd1 feat(config): add autonat and circuit relay (#30) 2026-03-02 18:56:03 -03:00
Gabriel Cruz f963f979c0 feat: update config options (#28) 2026-03-02 18:55:16 -03:00
Gabriel Cruz 38b08b94fe feat: add mix functions (#18) 2026-02-23 11:37:43 -03:00