Skip to content

Mesh

Your laptop runs one runy daemon and your Mac mini another, and the mini runs a vm that publishes notes.sandbox.vm.runy.localhost and ssh.sandbox.vm.runy.localhost in its proxy. On the mini those names work. On the laptop they do not, because the laptop’s proxy has never heard of them.

A mesh fixes that. Once the two daemons are paired, the laptop’s proxy knows the mini’s domains and forwards requests for them to the mini over an encrypted connection, where the mini’s daemon connects the backend as it always did. The laptop opens the same URL, and ssh ssh.sandbox.vm.runy.localhost works through runy connect. *.localhost already resolves to the loopback on every machine, so nothing changes in DNS, and the proxy still serves loopback clients only.

A mesh is not the same as machines. A machine is a hub’s link to a daemon it drives through that daemon’s API. A mesh is peer to peer and routes domains, the daemons’ APIs among them.

On the mini:

Terminal window
runy mesh invite

It prints a ticket, runy-mesh-..., and the command for the other box. The ticket is good for 10 minutes and for one use. On the laptop:

Terminal window
runy mesh join runy-mesh-...

The laptop prints joined <name> (<id>). Both sides now know each other, and either can be the one that dials. Check with:

Terminal window
runy mesh
Mesh: laptop <id>
Listening: 192.168.1.20:51234
Relay: off
Peer Id State Path Routes Since
mini 3f9a1c0b7d42 connected direct 4 2026-11-08T10:12:00Z

Each daemon has a name, by default the hostname; runy mesh name <name> changes it. A mesh name that is one DNS label is also the daemon’s host label, the label its route names end with (px0.umka.mini.runy.localhost), unless runy daemon host overrides it. Each daemon announces its host label with its routes, so its peers use the label it chose, and runy mesh shows each peer’s in the Host column. A host label a peer announced is not yours to take: runy daemon host mini is refused while a peer has it. runy mesh forget mini (a name, a full id or an id prefix of at least 8 characters) removes a peer from this side. The other side shows the link as disconnected until it forgets too.

Only two things:

  • Routes. Each daemon sends its peers the domains it serves itself, with the resource behind each, and sends the whole table again whenever it changes. A daemon’s own domains win: a remote domain that collides with a local one is ignored and a warning is logged, and between two peers the first to announce it stays. The proxy’s 404 page lists remote domains as <url> - <resource> via <peer> (with this proxy’s own URL for the host), and runy mesh shows how many routes each peer announced.
  • Tunnels. For a remote domain the proxy opens a stream to the peer and the peer connects the route’s local backend. HTTP requests (one stream each), WebSocket upgrades and CONNECT all work. If the peer is down or its backend refuses, the proxy answers a 502 page naming the resource, the peer and the error.

A hub’s machine routes are among the domains it announces, as its own, and a peer’s connection for one is tunnelled on through the link to the machine. The daemon inside a machine runs with the mesh off and is not a peer. So are the names of its own ports, <port>.<namespace>.<workspace>.<host>.runy.localhost.

When two daemons of a mesh each hold a machine of the same name, the names without a host label (ssh.box.runy.localhost) would mean two machines. A third peer then routes neither daemon’s short names, only the host-qualified ones (ssh.box.mini.runy.localhost, ssh.box.laptop.runy.localhost); each of the two keeps its own short names and routes the other’s host-qualified ones, and the daemon logs a warning naming the machine. Once one of the machines is gone, the other’s short names come back. On the CLI, -m box then asks for the holder’s host label (-m box --host mini).

A peer sees a secret as its placeholder and cannot ask any daemon for a value. The gateway’s names are not announced, so a peer cannot reach them.

Only one hop is made. A peer announces the routes it serves itself and answers tunnels only for those, never for routes it learned from a third daemon.

The mesh is on by default. runy daemon start --mesh off (or RUNY_MESH=off) turns it off, and --mesh-addr <ip:port> binds a specific UDP address instead of 0.0.0.0 with a random port. The mesh endpoint is not handed over on an in-place upgrade: the new daemon binds a fresh one on a new UDP port, and peers reconnect through mDNS, or through the stored addresses when --mesh-addr is explicit.

On one network, daemons find each other by mDNS and connect directly; the Path column shows direct. Across networks a direct connection needs a reachable address, and a relay can carry the traffic when there is none. Relays are off by default:

Terminal window
runy mesh relay n0 # iroh's public relays, for development and testing
runy mesh relay https://relay.example.com
runy mesh relay off

n0 is a public service and meant for trying things out; for anything you rely on, run your own iroh-relay and give its URL. The relay carries encrypted traffic and cannot read it. The setting applies at once and also goes into the tickets the daemon creates. When a connection runs through a relay the Path column shows relay.

A peer is a key you paired by hand. An endpoint that is not a peer can do nothing except present a valid, unused, unexpired invite token; anything else closes the connection. A peer can subscribe to your routes and open a tunnel to a domain your daemon serves locally.

Pairing grants control. Your daemon’s API is one of the domains it serves, at api.<host>.runy.localhost, so a paired peer can call every API of your daemon: start and stop processes, apply documents, and run commands in your machines. That is remote command execution between the paired computers, in both directions, and there is no separate setting for it. Pair only computers whose users you trust with this one. The console uses this access to show a peer’s workspaces, and the CLI’s --host <label> to run a command against the peer’s daemon (runy ps --host mini). The API answers web pages only from the console’s own origins (loopback, runy.localhost, the names your daemon or a peer routes to their own ports and APIs, never a machine’s), and a page may not make the admin calls (upgrade, terminate, pairing, mesh and host settings), so another site open in a peer’s browser, or a page served by a machine, cannot use it.

A tunnel also reaches the backend of every published route. Every running port resource is published by its default name; set routes: false on a port that peers should not reach. Treat a ticket as a secret until it is used or expires.