2026-08-06 15:43:57 +00:00
|
|
|
/**
|
|
|
|
|
* The virtual relays the container serves, and the only place their names are written down.
|
|
|
|
|
*
|
2026-09-02 13:50:57 +00:00
|
|
|
* zooid binds a config to a Host header and serves any number of them from one process, so a second
|
|
|
|
|
* space costs a toml in docker/config and nothing else. The names are a union rather than a string
|
|
|
|
|
* so that a scenario naming a relay that has no config fails to compile instead of hanging on a 404
|
|
|
|
|
* from the dispatcher.
|
2026-08-06 15:43:57 +00:00
|
|
|
*
|
2026-09-02 13:50:57 +00:00
|
|
|
* Each host resolves nowhere, and `.test` is reserved by rfc 2606, so a url that escapes this
|
|
|
|
|
* process fails to connect rather than reaching a host. transport.ts covers why the container is
|
|
|
|
|
* told to call itself this rather than its loopback address.
|
2026-08-06 15:43:57 +00:00
|
|
|
*/
|
|
|
|
|
export const tenants = {
|
|
|
|
|
space: "space.test",
|
|
|
|
|
other: "other.test",
|
2026-09-02 13:50:57 +00:00
|
|
|
// Policy space.toml cannot express at the same time. `closed` refuses a join without an invite,
|
|
|
|
|
// `unsigned` serves events with their signatures stripped.
|
2026-08-20 20:33:20 +00:00
|
|
|
closed: "closed.test",
|
|
|
|
|
unsigned: "unsigned.test",
|
2026-08-06 15:43:57 +00:00
|
|
|
} as const
|
|
|
|
|
|
|
|
|
|
export type TenantName = keyof typeof tenants
|
|
|
|
|
|
|
|
|
|
export const tenantUrl = (name: TenantName) => `wss://${tenants[name]}/`
|
|
|
|
|
|
|
|
|
|
export const tenantNames = Object.keys(tenants) as TenantName[]
|
|
|
|
|
|
2026-09-02 13:50:57 +00:00
|
|
|
// Which tenant a url belongs to, for the transport's Host header.
|
2026-08-06 15:43:57 +00:00
|
|
|
export const tenantByUrl = new Map(tenantNames.map(name => [tenantUrl(name), tenants[name]]))
|