Skip to content

Commit

Permalink
Merge branch 'master' into feat/autoshard-lightpush
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitanyaprem authored Sep 28, 2023
2 parents 4827020 + 88d69eb commit 154287e
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ nix develop
docker run -i -t -p 60000:60000 -p 9000:9000/udp \
wakuorg/go-waku:latest \ # or, the image:tag of your choice
--dns-discovery:true \
--dns-discovery-url:enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@prod.waku.nodes.status.im \
--dns-discovery-url:enrtree://ANEDLO25QVUGJOUTQFRYKWX6P4Z4GKVESBMHML7DZ6YK4LGS5FC5O@prod.wakuv2.nodes.status.im \
--discv5-discovery
```

Expand Down
12 changes: 6 additions & 6 deletions cmd/waku/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ var (
Destination: &options.CircuitRelay,
EnvVars: []string{"WAKUNODE2_CIRCUIT_RELAY"},
})
ForceUnreachable = altsrc.NewBoolFlag(&cli.BoolFlag{
Name: "unreachable",
Usage: "Force the node to be unreachable. WARNING: This flag is created for testing circuit relay and is not meant to be used in production",
Value: false,
ForceReachability = altsrc.NewStringFlag(&cli.StringFlag{
Name: "force-reachability",
Usage: "Force the node reachability. WARNING: This flag is created for testing circuit relay and is not meant to be used in production. Use 'public' or 'private'",
Value: "",
Hidden: true,
Destination: &options.ForceUnreachable,
EnvVars: []string{"WAKUNODE2_UNREACHABLE"},
Destination: &options.ForceReachability,
EnvVars: []string{"WAKUNODE2_REACHABILITY"},
})
ResourceScalingMemoryPercent = altsrc.NewFloat64Flag(&cli.Float64Flag{
Name: "resource-scaling-memory-percentage",
Expand Down
2 changes: 1 addition & 1 deletion cmd/waku/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func main() {
ExtMultiaddresses,
ShowAddresses,
CircuitRelay,
ForceUnreachable,
ForceReachability,
ResourceScalingMemoryPercent,
ResourceScalingFDPercent,
LogLevel,
Expand Down
14 changes: 11 additions & 3 deletions cmd/waku/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,18 @@ func Execute(options NodeOptions) {
libp2pOpts = append(libp2pOpts, libp2p.EnableRelayService())
}

if options.ForceUnreachable {
logger.Warn("node forced to be unreachable!")
libp2pOpts = append(libp2pOpts, libp2p.EnableRelay(), libp2p.ForceReachabilityPrivate())
if options.ForceReachability != "" {
libp2pOpts = append(libp2pOpts, libp2p.EnableRelay())
nodeOpts = append(nodeOpts, node.WithCircuitRelayParams(2*time.Second, 2*time.Second))
if options.ForceReachability == "private" {
logger.Warn("node forced to be unreachable!")
libp2pOpts = append(libp2pOpts, libp2p.ForceReachabilityPrivate())
} else if options.ForceReachability == "public" {
logger.Warn("node forced to be publicly reachable!")
libp2pOpts = append(libp2pOpts, libp2p.ForceReachabilityPublic())
} else {
failOnErr(errors.New("invalid reachability value"), "Reachability")
}
}

if options.UserAgent != "" {
Expand Down
2 changes: 1 addition & 1 deletion cmd/waku/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ type NodeOptions struct {
AdvertiseAddresses []multiaddr.Multiaddr
ShowAddresses bool
CircuitRelay bool
ForceUnreachable bool
ForceReachability string
ResourceScalingMemoryPercent float64
ResourceScalingFDPercent float64
LogLevel string
Expand Down
4 changes: 2 additions & 2 deletions docs/api/dnsdisc.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
)

func main() {
discoveryURL := "enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@test.waku.nodes.status.im"
discoveryURL := "enrtree://AO47IDOLBKH72HIZZOXQP6NMRESAN7CHYWIBNXDXWRJRZWLODKII6@test.wakuv2.nodes.status.im"
nodes, err := dnsdisc.RetrieveNodes(context.Background(), discoveryURL)
if err != nil {
panic(err)
Expand All @@ -40,4 +40,4 @@ func main() {
}
```

`dnsdisc.RetrieveNodes` can also accept a `WithNameserver(nameserver string)` option which can be used to specify the nameserver to use to retrieve the TXT record from the domain name
`dnsdisc.RetrieveNodes` can also accept a `WithNameserver(nameserver string)` option which can be used to specify the nameserver to use to retrieve the TXT record from the domain name
6 changes: 3 additions & 3 deletions docs/operators/how-to/configure-dns-disc.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ A node will attempt connection to all discovered nodes.

This can be used, for example, to connect to one of the existing fleets.
Current URLs for the published fleet lists:
- production fleet: `enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@prod.waku.nodes.status.im`
- test fleet: `enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@test.waku.nodes.status.im`
- production fleet: `enrtree://ANEDLO25QVUGJOUTQFRYKWX6P4Z4GKVESBMHML7DZ6YK4LGS5FC5O@prod.wakuv2.nodes.status.im`
- test fleet: `enrtree://AO47IDOLBKH72HIZZOXQP6NMRESAN7CHYWIBNXDXWRJRZWLODKII6@test.wakuv2.nodes.status.im`

See the [separate tutorial](../../tutorial/dns-disc.md) for a complete guide to DNS discovery.
See the [separate tutorial](../../tutorial/dns-disc.md) for a complete guide to DNS discovery.
8 changes: 4 additions & 4 deletions docs/operators/how-to/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Discovery v5 will attempt to extract the ENRs of the discovered nodes as bootstr
```sh
./build/waku \
--dns-discovery=true \
--dns-discovery-url=enrtree://ANTL4SLG2COUILKAPE7EF2BYNL2SHSHVCHLRD5J7ZJLN5R3PRJD2Y@prod.waku.nodes.status.im \
--dns-discovery-url=enrtree://ANEDLO25QVUGJOUTQFRYKWX6P4Z4GKVESBMHML7DZ6YK4LGS5FC5O@prod.wakuv2.nodes.status.im \
--discv5-discovery=true
```

Expand All @@ -150,7 +150,7 @@ Discovery v5 will attempt to extract the ENRs of the discovered nodes as bootstr
```sh
./build/waku \
--dns-discovery=true \
--dns-discovery-url=enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@test.waku.nodes.status.im \
--dns-discovery-url=enrtree://AO47IDOLBKH72HIZZOXQP6NMRESAN7CHYWIBNXDXWRJRZWLODKII6@test.wakuv2.nodes.status.im \
--discv5-discovery=true
```

Expand All @@ -169,7 +169,7 @@ appears below.
--db-path=/mnt/go-waku/data/db1/ \
--store-capacity=150000 \
--dns-discovery=true \
--dns-discovery-url=enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@test.waku.nodes.status.im \
--dns-discovery-url=enrtree://AO47IDOLBKH72HIZZOXQP6NMRESAN7CHYWIBNXDXWRJRZWLODKII6@test.wakuv2.nodes.status.im \
--discv5-discovery=true
```

Expand All @@ -181,4 +181,4 @@ A running go-waku node can be interacted with using the [Waku v2 JSON RPC API](h

> **Note:** Private and Admin API functionality are disabled by default.
To configure a go-waku node with these enabled,
use the `--rpc-admin:true` and `--rpc-private:true` CLI options.
use the `--rpc-admin:true` and `--rpc-private:true` CLI options.
2 changes: 1 addition & 1 deletion examples/c-bindings/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ int main(int argc, char *argv[])
WAKU_CALL(waku_connect("/dns4/node-01.gc-us-central1-a.wakuv2.test.statusim.net/tcp/30303/p2p/16Uiu2HAmJb2e28qLXxT5kZxVUUoJt72EMzNGXB47Rxx5hw3q4YjS", 0, handle_error)); // Connect to a node

// To use dns discovery, and retrieve nodes from a enrtree url
WAKU_CALL( waku_dns_discovery("enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@test.waku.nodes.status.im", "", 0, handle_ok, handle_error)); // Discover Nodes
WAKU_CALL( waku_dns_discovery("enrtree://AO47IDOLBKH72HIZZOXQP6NMRESAN7CHYWIBNXDXWRJRZWLODKII6@test.wakuv2.nodes.status.im", "", 0, handle_ok, handle_error)); // Discover Nodes
printf("Discovered nodes: %s\n", result);

WAKU_CALL(waku_default_pubsub_topic(handle_ok));
Expand Down
4 changes: 2 additions & 2 deletions examples/chat2/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,10 @@ func (c *Chat) discoverNodes(connectionWg *sync.WaitGroup) {
var dnsDiscoveryUrl string
if options.Fleet != fleetNone {
if options.Fleet == fleetTest {
dnsDiscoveryUrl = "enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@test.waku.nodes.status.im"
dnsDiscoveryUrl = "enrtree://AO47IDOLBKH72HIZZOXQP6NMRESAN7CHYWIBNXDXWRJRZWLODKII6@test.wakuv2.nodes.status.im"
} else {
// Connect to prod by default
dnsDiscoveryUrl = "enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@prod.waku.nodes.status.im"
dnsDiscoveryUrl = "enrtree://ANEDLO25QVUGJOUTQFRYKWX6P4Z4GKVESBMHML7DZ6YK4LGS5FC5O@prod.wakuv2.nodes.status.im"
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/noise/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func main() {
func discoverFleetNodes(wakuNode *node.WakuNode) error {
log.Info("Connecting to test fleet...")

dnsDiscoveryUrl := "enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@test.waku.nodes.status.im"
dnsDiscoveryUrl := "enrtree://AO47IDOLBKH72HIZZOXQP6NMRESAN7CHYWIBNXDXWRJRZWLODKII6@test.wakuv2.nodes.status.im"
nodes, err := dnsdisc.RetrieveNodes(context.Background(), dnsDiscoveryUrl)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion waku/v2/dnsdisc/enr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
// TestRetrieveNodes uses a live connection, so it could be
// flaky, it should though pay for itself and should be fairly stable
func TestRetrieveNodes(t *testing.T) {
url := "enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@test.waku.nodes.status.im"
url := "enrtree://AO47IDOLBKH72HIZZOXQP6NMRESAN7CHYWIBNXDXWRJRZWLODKII6@test.wakuv2.nodes.status.im"

nodes, err := RetrieveNodes(context.Background(), url)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion waku/v2/node/wakunode2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func TestUpAndDown(t *testing.T) {
key1, _ := tests.RandomHex(32)
prvKey1, _ := crypto.HexToECDSA(key1)

nodes, err := dnsdisc.RetrieveNodes(context.Background(), "enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@prod.waku.nodes.status.im")
nodes, err := dnsdisc.RetrieveNodes(context.Background(), "enrtree://ANEDLO25QVUGJOUTQFRYKWX6P4Z4GKVESBMHML7DZ6YK4LGS5FC5O@prod.wakuv2.nodes.status.im")
require.NoError(t, err)

var bootnodes []*enode.Node
Expand Down

0 comments on commit 154287e

Please sign in to comment.