Agent protocol
This is a summary of the protocol between the nodes and the gateways:
- Start: the agent reads
https://www.cloud.me/api/agent/bootstrap(or its cached copy) for the gateway list and the fallback entry point. - Pick a gateway: it measures latency and connects to the fastest:
wss://<gateway>/v1/ws. If names do not work it connects to the gateways' IP addresses (certificates checked by public-key pin), and only then to the fallback. - Handshake:
hello(version, channel, capabilities) → nonce → the agent signs it with its key →welcomeand its configuration. - Tasks: the agent checks each task (capabilities, limits, target policy) and answers
ack, thenresult; after the gateway has stored it, it answersresult_ack. Until then the agent keeps the result and resends it after reconnecting. - Heartbeat every 25 seconds, with traffic counters.
- Upgrades: signed upgrade information; the agent verifies the signature before replacing itself.
- Gateway list changes: the configuration carries the list's version; when it changes the agent fetches the bootstrap again and, if needed, moves to a new gateway at a random moment within tens of minutes.
Before any task the agent checks the target: private and reserved addresses and its own local network are refused, and every HTTP request's User-Agent starts with CloudMeTest/.