fabric experimental
Expose and dial
Expose and dial are how any tool reaches a service on another machine without touching the network.
fabric exposepublishes a local service under a protocol name.fabric dial, on a trusted peer, creates a local endpoint that tunnels to it.
Expose
The service can be a Unix socket, a local TCP port, or a command that fabric starts for each connection:
fabric expose demo-http --tcp 127.0.0.1:8080 # a TCP service
fabric expose notes-api --socket /tmp/notes.sock # a Unix socket
fabric expose pty-remote --exec -- pty remote-serve --stdio # a command per connection
Exposures persist across daemon restarts. Remove one with fabric unexpose.
Only peers whose grants name an exposure can reach it. If no trusted peer can reach a new exposure, fabric warns you and names the peers that would need it.
Dial
On the other machine, dial the peer and the protocol:
fabric dial machine-b demo-http --tcp 127.0.0.1:9080
Programs on that machine can now use 127.0.0.1:9080 as if the service were local. Without --tcp, fabric dial creates a local Unix socket and prints its path.
The local socket facade
This is the whole contract for other tools. A tool:
- asks fabric to dial a peer and a protocol,
- connects to the local socket it gets back,
- speaks its own protocol over it.
It never imports a networking library, parses relay addresses or checks allow-lists. Only fabric knows about those. That's how pty reaches remote sessions, and how smalltalk replicates its graph.
Resumable tunnels
Tunnels carry framed bytes with acknowledgements. When the network drops for a moment or an address changes, fabric reconnects and replays whatever wasn't acknowledged. The local socket stays open, and the far end keeps talking to the same process instead of starting over.
There is a limit: a disconnected tunnel is held for a bounded time, and after that the far side cleans it up.