Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Circuit relay #3112

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

chore: Circuit relay #3112

wants to merge 5 commits into from

Conversation

Ivansete-status
Copy link
Collaborator

@Ivansete-status Ivansete-status commented Oct 14, 2024

Description

Allow a node to act as a circuit-relay client/server. Also, start the Hole Punch server.
This is useful for nodes that are behind a NAT or firewall and hence are not directly reachable.

Changes

  • Avoid starting the waku relay protocol twice.
  • Move autonat service code into a separate module, autonate_service.
  • New external parameter, relay-client, which allows setting the node as a circuit-relay client.
  • Spawn nim-libp2p DiscoveryManager with rendezvous.
  • nat: add exception protection when calling getExternalIP.
  • Undo installation of libpcre because we forced ubuntu 22.04 (unrelated change.)

Pending to advertise circuit-relay address in ENR

How to test

Three nodes need to run. Two configured as relay-client and a third one configured as a relay server (default.)

  1. Start service node with the following in a VPS so that it is reachable:
ports-shift = 10
cluster-id = 1
log-level = "DEBUG"
nodekey = "1264d111d729a6eb6d2e6113e163f017b5ef03a6f94c9b5b7bb1bb36fa5cb07a9"

relay = false
rest-admin = true
rest = true
filter = true
lightpush = true
discv5-discovery = true
discv5-udp-port = 9000
discv5-enr-auto-update = false
metrics-server = true

rln-relay-eth-client-address="https://sepolia.infura.io/v3/456aa120320f4aec879150fba9e9b7b1"
rln-relay-tree-path="rln_tree"
  1. Start node A with the following configuration and behind a NAT. This will connect to the service node.
ports-shift = 1
cluster-id = 1
staticnode = [ "/ip4/162.19.247.156/tcp/60010/p2p/16Uiu2HAmCzWcYBCw3xKW8De16X9wtcbQrqD8x7CRRv4xpsFJ4oN8" ]

log-level = "DEBUG"
nodekey = "364d111d729a6eb6d2e6113e163f017b5ef03a6f94c9b5b7bb1bb36fa5cb07a9"

relay-client = true

rest-admin = true
rest = true
filter = true
lightpush = true
metrics-server = true

rln-relay-eth-client-address="https://sepolia.infura.io/v3/456aa120320f4aec879150fba9e9b7b1"
rln-relay-tree-path="rln_tree"

Wait for two minutes until the node A determines that it is not reachable. When that happens, the node A reserves a circuit-relay slot in the relay service node.

  1. Start node B that will establish a relay connection with node A, through the relay sever:
ports-shift = 3
cluster-id = 1
staticnode = [ "/ip4/162.19.247.156/tcp/60010/p2p/16Uiu2HAmCzWcYBCw3xKW8De16X9wtcbQrqD8x7CRRv4xpsFJ4oN8/p2p-circuit/p2p/16Uiu2HAm2eqzqp6xn32fzgGi8K4BuF88W4Xy6yxsmDcW8h1gj6ie" ]
log-level = "DEBUG"
nodekey = "764d111d729a6eb6d2e6113e163f017b5ef03a6f94c9b5b7bb1bb36fa5cb07a9"

relay-client = true

rest-admin = true
rest = true
filter = true
lightpush = true
metrics-server = true

rln-relay-eth-client-address="https://sepolia.infura.io/v3/456aa120320f4aec879150fba9e9b7b1"
rln-relay-tree-path="rln_tree_2"
  1. Stop the service node. In that case, node A and node B will still be connected even though they are not reachable due to the NAT condition.

Issue

closes #2514

Copy link

github-actions bot commented Oct 14, 2024

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:3112

Built from 2472c3e

@Ivansete-status Ivansete-status force-pushed the circuit-relay branch 3 times, most recently from b7f266c to 6acfe7f Compare October 15, 2024 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for discovery of circuit-relay peers
1 participant