Meshly Docs
Features

Services

The four client-side service tables — [[expose]], [[static]], [[ssh]] and [[ssh_forward]] — plus [[consume]] and how they interoperate.

All client-side tables share one service-name namespace and one wire protocol: ALPN meshly-core/<name>, an HMAC-SHA256 handshake on the first bi-stream, then a raw byte bridge. The kind of a service is advisory metadata for humans and UIs — it is never a protocol difference, so a peer can consume your [[ssh]] service with a plain [[consume]], and vice versa.

[[expose]] — forward a local TCP port

[[expose]]
name          = "web"
local_addr    = "127.0.0.1:18081"
shared_secret = "web-secret"

Consumed by a peer with [[consume]]:

[[consume]]
name          = "web"
local_bind    = "127.0.0.1:19090"
shared_secret = "web-secret"

local_bind may use port 0 to let the OS pick a free port; the resolved address is logged at startup and reported by meshly run -c client.toml --status under runtime.consumers.<name>.local_addr.

[[static]] — host a folder

Publishes a local directory as an HTTP/1.1 file service. Consumers browse or download files rooted at root_dir.

[[static]]
name                    = "files"
root_dir                = "/Users/me/photos"
allow_directory_listing = true
shared_secret           = "long-random-string-shared-with-grantees"
  • allow_directory_listing = true renders an HTML index for a GET on a directory; when false, directories return 403.
  • root_dir must exist and be a directory at config load time.

[[ssh]] — publish this host's sshd

[[ssh]]
name          = "home"
local_addr    = "127.0.0.1:22"
shared_secret = "long-random-string"
user          = "ubuntu"   # optional login hint, shown in logs / --status
# keepalive_secs = 15      # optional QUIC keep-alive override (default 5s)

Declaring SSH explicitly buys you three things over a plain [[expose]]:

  • a service the GUI and startup log render as SSH rather than anonymous TCP,
  • an explicit keep-alive knob for long-lived, mostly-idle sessions that NATs and corporate firewalls otherwise reap,
  • a login hint (user) so the client can print the exact command to run. It is never used for authentication — sshd still does that.

keepalive_secs is optional. Omit it (or set 0) to keep Iroh's default, already an aggressive 5s. There is deliberately no "disable keep-alive" spelling: 0 means unset.

[[ssh_forward]] — log in to a peer's SSH service

[[ssh_forward]]
name          = "office"
local_bind    = "127.0.0.1:0"   # port 0 = let the OS pick a free port
shared_secret = "long-random-string"
user          = "root"

At startup the client prints the command to run, using the port it actually bound:

INFO consumer service ready service=office requested=127.0.0.1:0 local=127.0.0.1:51871
INFO connect with: ssh -p 51871 root@127.0.0.1 service=office

Reconnect tuning

[reconnect]
initial_backoff_ms = 50
max_backoff_ms     = 5000
prefer_direct      = true

With prefer_direct = true the consumer tries a direct P2P path first and only falls back to the server relay when that fails.

Validation checklist

  • name matches [a-z0-9-]{1,32} and is unique across all client tables.
  • shared_secret matches on provider and consumer.
  • Each process on a machine has its own [common].identity_path.
  • Top-level keys (server_node_id, group_token, [[…]] tables) come before any [common.*] block.

On this page