A name and a certificate

A browser will only load media from an address whose certificate it already trusts, and nobody can get a public certificate for 192.168.1.20. So we host two things for any provider that asks: a DNS name, and a certificate for it.

Both are optional. Serve from any name, with any certificate a browser trusts, and skip this page.

Point a name at your address

Every library has a name on our domain, <bridgeId>.letsdj.io — for instance 0123456789abcdef.letsdj.io. You are told it when you pair, and again in every response below. Use hostname as given. Do not build it yourself.

The name is an A record. You tell us what it points at.

POST https://api.lets.dj/providers/address
Authorization: Bearer <sync token>
Content-Type: application/json

{ "address": "192.168.1.20" }
{
  "ok": true,
  "hostname": "0123456789abcdef.letsdj.io",
  "address": "192.168.1.20",
  "ttl": 60,
  "changed": false
}
Field Meaning
hostname The library’s name. Use it as given.
address The address now published.
ttl Time to live of the record, in seconds. Always 60.
changed true if the record had to be written, false if it already held that value.

Report your address when you start, and again whenever it changes.

The address must be IPv4, in dotted-quad form, and unreachable from the internet. Anything else is refused.

Range Kind
10.0.0.0/8 Private
172.16.0.0/12 Private
192.168.0.0/16 Private
169.254.0.0/16 Link-local
100.64.0.0/10 Carrier-grade NAT

Octets with a leading zero are refused. Send 10.0.0.1, not 010.0.0.1.

Status code Meaning
400 invalid_address Not an IPv4 address in dotted-quad form.
400 address_not_private A valid address, but not in one of the ranges above.
401 missing_token No bearer token.
403 unknown_sync_token Token not recognized.
502 dns_unavailable The record could not be written just now. Try again shortly.
503 dns_not_configured This deployment cannot publish names at all.

A name that has not been heard from in thirty days is taken down. Reporting an address, or fetching the certificate, counts as being heard from. A provider that comes back after a long silence simply has its record made again.

DNS rebinding protection. Some routers and DNS filtering services refuse to answer when a public name points at a private address. The name then does not resolve for anyone behind them, and the Stage cannot reach you. There is no fix from our side. On routers that allow it, exempt letsdj.io.

Fetch a certificate

GET https://api.lets.dj/providers/certificate
Authorization: Bearer <sync token>
{
  "hostname": "0123456789abcdef.letsdj.io",
  "cert": "-----BEGIN CERTIFICATE-----\n…",
  "key": "-----BEGIN PRIVATE KEY-----\n…",
  "notAfter": 1798000000000
}
Field Meaning
hostname The library’s name. Use it as given.
cert Certificate, PEM.
key Private key, PEM.
notAfter Expiry, in milliseconds since the epoch.

The certificate is for *.letsdj.io, so it covers your hostname on any port. Every provider receives the same certificate and key, together with its own hostname. The response is marked Cache-Control: no-store.

Ask for it when you start, then a few times a day. Swap a new one in without restarting, so renewals and any forced reissue reach a running provider. Keep the last good certificate on disk, so a provider that starts with no network can still serve until it expires.

Status code Meaning
401 missing_token No bearer token.
403 unknown_sync_token Token not recognized.
503 certificate_unavailable None has been issued yet. Sent with Retry-After: 300.
503 secrets_unavailable The service cannot read its stored secrets just now.

What we will not do

We do not ship, bundle, pre-install, endorse, link to, or recommend any third-party provider.

We host these two routes, on the same terms for every provider. Both authenticate a sync token and read nothing else.

Neither touches content. Media is fetched by the Stage straight from the provider and never passes through us. A catalog is the metadata a provider chose to send, which we neither review nor curate.