From 2af8cf7344945c73fcfd4e011ca68af1be1d80ff Mon Sep 17 00:00:00 2001 From: kaichao Date: Wed, 22 Nov 2023 19:35:20 +0800 Subject: [PATCH] chore: fix c-bindings example (#915) --- README.md | 2 +- examples/c-bindings/main.c | 4 +--- examples/chat2/README.md | 6 ++++++ examples/filter2/README.md | 4 ++-- waku/v2/protocol/relay/options.go | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 3bbfed9e..133e0f1b 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ make mobile-ios - [Send messages using Waku Lightpush](docs/api/lightpush.md) - [Encrypting and decrypting Waku Messages](docs/api/encoding.md) - [Retrieve message history using Waku Store](docs/api/store.md) -- [C Bindings](library/README.md) +- [C Bindings](library/c/README.md) - [Waku Specs](https://rfc.vac.dev/spec), has information of [waku topics](https://rfc.vac.dev/spec/23/), wakuv1/[wakuv2](https://rfc.vac.dev/spec/14/) message, [rln relay](https://rfc.vac.dev/spec/58/) etc. - [Enr](https://eips.ethereum.org/EIPS/eip-778), [Enrtree](https://eips.ethereum.org/EIPS/eip-1459) - [devp2p](https://github.com/ethereum/go-ethereum/tree/master/cmd/devp2p) tool for playing with enr/entree sync tree. [Tutorial](https://geth.ethereum.org/docs/developers/geth-developer/dns-discovery-setup) diff --git a/examples/c-bindings/main.c b/examples/c-bindings/main.c index de436a84..b46f4a7a 100644 --- a/examples/c-bindings/main.c +++ b/examples/c-bindings/main.c @@ -154,9 +154,7 @@ int main(int argc, char *argv[]) // To use dns discovery, and retrieve nodes from a enrtree url char *discoveredNodes = NULL; - waku_dns_discovery("enrtree://" - "AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV" - "6SAYBM@test.waku.nodes.status.im", + waku_dns_discovery("enrtree://AO47IDOLBKH72HIZZOXQP6NMRESAN7CHYWIBNXDXWRJRZWLODKII6@test.wakuv2.nodes.status.im", "", 0, on_response, (void *)&discoveredNodes); printf("Discovered nodes: %s\n", discoveredNodes); diff --git a/examples/chat2/README.md b/examples/chat2/README.md index bbec406c..fd04f5ad 100644 --- a/examples/chat2/README.md +++ b/examples/chat2/README.md @@ -17,6 +17,12 @@ To start the `chat2` application in its most basic form, run the following from ./build/chat2 ``` +You may need to set DNS server if behind a VPN, + +``` +./build/chat2 --dns-discovery-name-server 8.8.8.8 +``` + ## Specifying a static peer In order to connect to a *specific* node as [`relay`](https://specs.vac.dev/specs/waku/v2/waku-relay) peer, define that node's `multiaddr` as a `staticnode` when starting the app: diff --git a/examples/filter2/README.md b/examples/filter2/README.md index 46a3626b..7e93f56b 100644 --- a/examples/filter2/README.md +++ b/examples/filter2/README.md @@ -27,9 +27,9 @@ The app will run 2 nodes ("full" node and "light" node), with light node subscri 3. Light node submits a FilterSubscribeRequest through WakuFilterLightNode.Subscribe. This request is submitted to a particular peer. Filter is stored in WakuFilterLightNode.subscriptions map. That's it. 4. Now we wait on WakuFilterLightNode.onRequest to process any further messages. -5. On receiving a message check and notify all subscribers on relevant channel (which is part of subscription obbject). +5. On receiving a message check and notify all subscribers on relevant channel (which is part of subscription object). 6. If a broadcaster is specified, - WakuNode.Subscribe has a message loop extracting WakuMessages from a wakurelay.Subscription object.It denotes a pubsub topic subscription.All envelopes are then submitted to node.broadcaster. + WakuNode.Subscribe has a message loop extracting WakuMessages from a wakurelay.Subscription object. It denotes a pubsub topic subscription. All envelopes are then submitted to node.broadcaster. ### Full Node 1. Full node is created with option WithWakuFilterFullNode. 2. We read incoming messages in WithWakuFilterFullNode.onRequest(). It is set as a stream handler on wakunode.Host for WakuFilterProtocolId. diff --git a/waku/v2/protocol/relay/options.go b/waku/v2/protocol/relay/options.go index 9d7979fe..253a9fde 100644 --- a/waku/v2/protocol/relay/options.go +++ b/waku/v2/protocol/relay/options.go @@ -14,7 +14,7 @@ func WithPubSubTopic(pubsubTopic string) PublishOption { } } -// WithPubSubTopic is used to indicate that the message should be broadcasted in the default pubsub topic +// WithDefaultPubsubTopic is used to indicate that the message should be broadcasted in the default pubsub topic func WithDefaultPubsubTopic() PublishOption { return func(params *publishParameters) { params.pubsubTopic = DefaultWakuTopic