Skip to content

Connect Clusters

Two clusters are connected by exchanging public keys and using common relays.

1. Get the public key

curl -s http://bridge-a:8080/v1/status -H "Authorization: Bearer $AGENT_TOKEN"

pubkey is the cluster's key. Transfer it over a channel you trust.

2. Trust each other

In each cluster, add the other one:

curl -s http://bridge-a:8080/v1/config -H "Authorization: Bearer $CONFIG_TOKEN"

Take the value of the answer, add "cluster-b": "<public key>" to trusted, and write it back with the version:

curl -s -X PUT http://bridge-a:8080/v1/config -H "Authorization: Bearer $CONFIG_TOKEN" -d @config.json
{"version": 1, "value": {"advertise": {}, "messages": {}, "trusted": {"cluster-b": "<public key>"}, "max_payload": 900000}}

advertise and messages are shortened here. Status 409 means that the configuration was changed in the meantime.

3. Check

GET /v1/status lists connected clusters in peers. Connections are created when a subject of the other cluster is used.

Requirements

  • At least one relay in common.
  • Outgoing UDP for Hyperswarm. Hole punching handles NAT.
  • Unique cluster identifiers.

Disconnect

Remove the cluster from trusted. Its routes are deleted and its connection is closed.