Protocol¶
Advertisement¶
An addressable event of kind 30510, signed by the cluster key:
| Part | Meaning |
|---|---|
d, subject_id |
Subject |
cluster, region |
Owner |
service |
One tag for each service |
hyperswarm |
DHT topic of the cluster's bridge |
protocol |
nats-leaf-v1 |
| Content | Metadata as JSON |
It is published again every hour. A withdrawal is a deletion event of kind 5.
Topic¶
topic = sha256("mesh/topic/v1/" + cluster + "/" + public key)
Session¶
Bridges meet at the topic over Hyperswarm. Each proves possession of its cluster key by signing the handshake, and checks the other's key against trusted. A shared secret of the cluster keys protects the session with ChaCha20-Poly1305, in addition to the encryption of Hyperswarm. Each message has a counter, so repeated or reordered messages are refused.
Forwarding¶
| Message | Effect |
|---|---|
| Subscribe, unsubscribe | Interest of agents in the other cluster |
| Message | Published in the owning cluster, or delivered to interested clusters |
| Reply | Returned to the caller. Reply addresses are valid for 120 seconds |
The owning cluster distributes events of its subjects. A cluster receives only messages for subjects in which one of its agents is interested.
NATS¶
The bridge speaks the NATS leaf node protocol. No change to NATS or to NATS clients is required.