Skip to main content

Module host

Module host 

Source
Expand description

choir host — a fresh machine to a running node, in one command.

Everything this does was already possible: choir init, then a certificate, then choir node install, then a wait, then choir repo create, then choir invite. Each is small. The problem was never any one of them — it was that the order differs by what the machine is, and the machine’s owner is the one person who cannot be expected to know which order applies to them before they have run anything.

So there are three shapes and one command:

you haveyou runyou get
a laptopchoir hostloopback, no certificate, seconds
a name pointing herechoir host --domain <name>https://<name>:8417
a VPS and no namechoir host --publichttps://<ip>.sslip.io:8417

§Why choir host and not choir node host

choir node … is the family for a node that exists — serve it, stop it, read its log. This is the command you run when there is no node, which is the same reason choir init is not choir node init. It sits beside init in “getting started”, and init is what it calls.

§Invariant 9 is the whole difficulty

The daemon refuses a non-loopback bind without TLS. That is not a setting; it is the privacy rule written as code. Which means mode 2 and mode 3 are not “the same thing with a different bind address” — they are a certificate first and a node second, and this module’s real job is to make the certificate step legible rather than to hide it. It never runs sudo on your behalf. It prints the one line and stops.

§Examples

use choir_cli::host::Exposure;

// A magic-DNS name so a box with no domain can still be issued a
// certificate with zero DNS work. Dashes, not dots: one label under
// the registrable domain, which is the form the Public Suffix List
// entry covers without ambiguity.
assert_eq!(
    Exposure::Public("203.0.113.7".into()).name().as_deref(),
    Some("203-0-113-7.sslip.io")
);
assert_eq!(Exposure::Local.name(), None);

Structs§

Options
What choir host was asked to do.

Enums§

Exposure
How this node will be reached.

Constants§

MAGIC_DNS
The magic-DNS provider used when there is no domain.

Functions§

detect_address
This machine’s own IPv4 address on the route to the outside.
firewall_hint
The firewall this machine runs, and the one line that opens a port.
is_public_v4
Whether an address is one the public internet can route to.
linger
Whether this user’s services survive a logout.
parse
Parses choir host’s arguments.
share_hint
How to let somebody else reach a loopback node.
username
This process’s login name.
wait_healthy
Waits for the node to answer /healthz.