Skip to content

Resolvers

github-actions[bot] edited this page Dec 1, 2026 · 6 revisions

Resolvers

From v1.5.0, Outpace can ask open resolvers that you configure for a stream's descriptor, alongside the AceStream catalog. A resolver is an HTTP service speaking the open resolver protocol: you give it a content id or an infohash and it answers with a descriptor that Outpace checks before playing.

This helps when the catalog is blocked or down on your network: a resolver you can reach answers instead, about a second after the start. Bundles do the same without any server: a file of descriptors copied from a machine that played the channels before.

The Outpace project runs no resolver, no public relay and no catalog of names, and publishes none. Nothing is asked unless you list a resolver. Run your own (any Outpace daemon can be one: see Running a relay), or use one run by someone you trust: every lookup tells the resolver which stream you are starting.

Turning it on

List up to four resolvers (or bundle files) in OUTPACE_RESOLVERS, comma-separated, in the order to ask them:

OUTPACE_RESOLVERS=https://resolver.example.net token-file=/run/secrets/resolver-token

Each entry is a URL followed by optional space-separated options:

Option Meaning
token-file=PATH Send the token in this file (trailing newline ignored) as Authorization: Bearer …. Works with Docker and systemd secrets.
token-env=NAME Send the token in the environment variable NAME. Use one of token-file and token-env.
trust=acestream The default. Trust this resolver to say which stream a content id is.
trust=none Use it only for answers that check themselves (infohashes), or that carry an attestation by a key in OUTPACE_RESOLVER_ATTESTERS. For relays you don't fully trust. Without OUTPACE_RESOLVER_ATTESTERS, it is never asked for content ids, since none of its answers could be used.
attesters=KEY[+KEY…] With the default trust: also require each content-id answer to carry an attestation by one of these 64-hex ed25519 keys, or by a key in OUTPACE_RESOLVER_ATTESTERS.
  • URLs. https:// with a host name or address, an optional port and an optional base path (requests go to <URL>/v1/...). No user name, query or fragment.
  • Plain http:// is accepted only to this machine: localhost, 127.0.0.0/8 or [::1]. A resolver on this machine, over http:// or https://, is always reached directly, never through the outbound proxy. Anything else must use HTTPS, so a token never crosses a network in clear text. Resolvers on your LAN need HTTPS with a certificate from a public authority; Outpace uses its bundled root certificates.
  • Tokens are 16 to 512 characters of the RFC 6750 bearer-token alphabet. Each token goes only to the resolver it is listed with, never to another one or across a redirect (Outpace follows no redirects). Tokens never appear in logs, errors or /server/api output.
  • OUTPACE_RESOLVER_ATTESTERS lists trusted attestation keys for all resolvers, comma-separated 64-hex ed25519 public keys. An answer carrying a valid attestation by one of them is accepted from any resolver you list, whatever its trust= or attesters=. A key a resolver advertises in its /v1/info is not trusted unless you list it here or in attesters=.
  • A malformed entry, an unreadable token file or more than four resolvers stops the daemon at startup with a message naming the entry's position. Resolvers can't be used in private peer mode.

What is asked, and when

  • Content ids and infohashes. cid:<id> / acestream://<id> starts (live and VOD) and bare-infohash starts. A resolver's /v1/info is read once in the background; a resolver that says it doesn't serve content ids or infohashes isn't asked for them. An info reply without a namespaces list is ignored, and the resolver is asked for both.
  • The catalog first. A start whose descriptor isn't already cached asks the catalog at once and the first resolver one second later, the next resolver a second after that, and so on. A healthy catalog answers in well under a second, so resolvers normally aren't asked at all. If the catalog fails at once (connection refused, name not resolvable), the first resolver is asked at once. Each later resolver still waits for its own second, unless every source before it has already ended without an answer. The first acceptable answer wins and the others are cancelled.
  • Catalog outage with a saved descriptor. While the catalog is remembered as down, a start whose id has a last-known-good descriptor asks the resolvers at once and waits at most 2 seconds for a fresh answer. Then it plays the saved descriptor and cancels the resolvers still running.
  • Not found. When no source gives an acceptable answer, the start fails with the catalog's reason, as it would without resolvers. The id is refused only when every applicable source said "not found". For a bare infohash, every resolver that serves btih applies. For a content id, only resolvers trusted for content ids apply. A trust=none resolver, asked only because attester keys are set, can still answer with a trusted attestation, but its "not found" or outage does not count toward the result. If the catalog said "not found" but an applicable resolver was down or gave an unusable answer, the start fails as a network error, and a bare infohash is not held back from an immediate retry. A resolver's "not found" is remembered for the time it gives (at most an hour).
  • Down resolvers. A resolver that times out, refuses, answers 503 or 429, or rejects its token is skipped for 5 seconds, then for longer while it stays down (up to a minute), or for as long as its Retry-After asks (up to 10 minutes). The first request after that wait gets 2 seconds instead of the usual 8, so a resolver that is still down costs little.
  • Caching. An answer is reused for the ttl the resolver gives (at most a day), then revalidated with its ETag. Answers are kept in memory only, at most 64 per resolver.

Key names

(from v1.5.0) A key name, key:<public key>[/<label>], is a stream name a broadcaster owns. It needs no catalog and no trusted resolver: every answer must carry the owner's ed25519 signature, so any source may answer, and resolvers and bundles are only untrusted caches.

  • The DHT first. A start for a key name looks the name's pointer up in the BitTorrent DHT at once (BEP 44: at most 8 seconds for the pointer, stopping after 4 agreeing replies), checks its signature and expiry, and then fetches the descriptor it names by hash, within 10 more seconds: from this daemon's own broadcasts, or, asked at the same time, from your resolvers (GET /v1/resolve/sha256:<hash>) and the broadcaster's peers over the peer wire. The answer's resolution.source is dht. A DHT that can't be used at all (no node answers) counts as unavailable, not as "not found".
  • Resolvers 3 seconds later, the next one 3 seconds after that, and at once if the DHT lookup ended without an answer. They are asked for the key name itself. The DHT goes first because the broadcaster writes there, so it holds the newest pointer; a resolver may lag.
  • Bundles last, only once every other source ended without an answer: a bundle is a snapshot, and its pointer is probably older.
  • Newer wins. Pointers carry a sequence number. Outpace remembers the highest one it accepted for each name (up to 1024 names, for the life of the process) and never uses an older pointer from any source. When the DHT only has an older or expired one, the answer already accepted keeps playing while it hasn't expired, and its resolution reports it as a saved copy (saved_age_s).
  • Not found means no source holds a current pointer. A broadcaster's pointers are valid for 2 days, so a stopped broadcast's name stops answering within that time.
  • Not in private peer mode, which uses neither the DHT nor resolvers, and no DHT lookup while the outbound proxy is active (resolvers are still asked).
  • Privacy. A DHT lookup tells the DHT nodes near the name which name you look up, and your address. The name itself is public.
  • Relays. An Outpace relay answers key names from its own DHT lookup as well as its upstream resolvers, so a client that can't reach the DHT can still resolve them, and it accepts pointers broadcasters publish to it (Publishing to a relay). A relay is still only an untrusted cache for key names: the client checks the owner's signature on every answer.

What is checked

Every answer is checked before use, whatever the resolver:

  • the descriptor's SHA-256 matches its content hash, and it is for the name that was asked;
  • it is a live or VOD AceStream transport that passes the protocol's acceptance rules. A live descriptor must carry an RSA source key that parses, so every piece is signature-checked. HLS-origin, multi-file and protected descriptors are rejected;
  • an infohash answer must derive that infohash;
  • a key name's pointer must carry a valid signature by the name's key, be unexpired and no older than one already accepted, and name the descriptor's hash (and its infohash and peer locator, when it gives them);
  • attestations, when present, must be valid and unexpired (with 5 minutes of clock skew), and never older than one already seen for the same id and key.

A content id can't be checked from the descriptor alone: the answer is as good as whoever vouches for it. With the default trust=acestream, that is the resolver. With pinned attesters, it must carry an attestation by one of those keys or by a key in OUTPACE_RESOLVER_ATTESTERS. With trust=none, it must carry an attestation by a key in OUTPACE_RESOLVER_ATTESTERS; with none listed, the resolver isn't asked for content ids at all, so it is never told the content ids you start. It still sees your infohash lookups.

An answer that fails a check is ignored and logged as [resolver] resolver=N gave an answer that failed its checks: ….

Where answers go

A resolver's answer plays like any other, and the session's resolution reports source: "resolver" ("bundle" for a bundle). It never enters the stores that hold only catalog answers: it isn't saved as a last-known-good descriptor, and it doesn't make the stream's infohash playable on its own.

With the outbound proxy active, resolver requests go through it, with host names resolved by the proxy. Resolvers on localhost or a loopback address, over http:// or https://, are always reached directly. A proxy URL the HTTP client can't use as given (for example one with a non-ASCII host name) makes resolver requests fail; they never fall back to a direct connection.

Bundles

(from v1.5.0) A bundle is a file of the same signed or self-checking records a resolver answers with, for sharing descriptors offline. For example, copy a bundle from a machine that played your channels yesterday to one whose network blocks the catalog today. The format is §6 of the protocol; files use the .resolver-bundle extension.

A bundle shows what its creator watched. Treat it as personal data: share it only with people you would tell that, and never commit one to a repository.

Making one

head -c 32 /dev/urandom > ~/.config/outpace-bundle.key && chmod 600 ~/.config/outpace-bundle.key
outpace descriptors export --sign-key ~/.config/outpace-bundle.key --out channels.resolver-bundle

export writes, with their provenance:

  • the last-known-good descriptors this machine saved from the catalog, marked "origin": "catalog". Only descriptors saved by v1.5.0 or later carry what a bundle needs; older ones are exported once the catalog answers for them again. On Windows the saved descriptors live in memory only, so an export there has none;
  • the entries of the bundles you imported as trusted, marked "origin": "bundle". Entries of bundles imported with --trust none aren't re-exported, except self-checking ones.

Expired entries are left out, and the result is checked exactly as an import will check it. --out replaces the file in one step, so a failed export leaves an earlier one as it was. On Linux and macOS the file is readable only by you (mode 0600); on Windows it takes the folder's permissions, so write it to a folder only you can read. With --sign-key, export prints the signing key's public half: give it to whoever imports the bundle, by a channel other than the bundle itself. See Command Line.

Importing one

outpace descriptors import channels.resolver-bundle --signer <64-hex public key>

import checks the whole file first, every entry exactly as if a resolver had sent it, and stores nothing if any part fails: a bad header, a line or file over its limit, an invalid or duplicate entry, anything after the signature, or a signature that doesn't verify. An entry that has expired doesn't fail the import, but one that is also wrong in any other way does. It then copies the file into <data dir>/bundles/, which holds at most 8 bundles. Restart outpace serve to use a newly imported bundle; outpace play reads them at each start. import needs only OUTPACE_DATA_DIR, so it works before any resolver is configured, for example to add the first bundle of a setup that trusts only OUTPACE_RESOLVER_ATTESTERS.

  • With --signer, the bundle must be signed by that key, and its content-id entries are vouched for by that signer.
  • Without --signer, a signature only proves the file is intact, since anyone can sign with a key of their own. Such a bundle is imported as --trust none unless you add --trust acestream, which warns: whoever made the file then decides what its content ids play.
  • --trust none keeps the bundle for entries that check themselves (infohashes), or that carry an attestation by a key in OUTPACE_RESOLVER_ATTESTERS. It is the default without --signer; --trust acestream is the default with it.

Importing the same file again replaces the earlier import, in whatever trust mode, so you can change how a bundle is trusted by importing it again. A bundle from the same signer replaces that signer's earlier import, but one older than it (by the created time in its header) is refused unless you pass --force, so an old bundle can't roll your mappings back.

A bundle vouches for content ids on its own for 30 days after its created time, as long as the catalog's saved copies last. After that, its content-id entries answer only with an attestation by a trusted key; infohash entries keep answering. export writes the oldest time any content-id entry in it was resolved as created, so passing a bundle on never extends that. export prints how much of that time is left, and import warns, with the number of content-id entries affected, when a bundle it trusts for content ids is already past it, undated, or dated in the future.

To remove an imported bundle, delete its file from <data dir>/bundles/ and restart.

Bundle files as sources

A file:// entry in OUTPACE_RESOLVERS reads a bundle in place instead of importing it, for example one that another tool keeps up to date:

OUTPACE_RESOLVERS=file:///srv/outpace/channels.resolver-bundle signer=<64-hex public key>
Option Meaning
signer=KEY The bundle must be signed by this 64-hex ed25519 public key.
trust=acestream / trust=none As for resolvers. The default is acestream with signer= and none without it. An unsigned bundle with trust=acestream is trusted as an unsigned bundle, and the startup log warns.
attesters=KEY[+KEY…] As for resolvers.

The path must be absolute (file:///C:/… on Windows). Outpace checks the whole file when it is first used and again whenever it changes, keeps only an index of where each entry is, and reads just the matching entry for each lookup. A file that fails a check answers nothing until it is fixed ([bundle] source=N file=1 is rejected as a whole: …).

When bundles are asked

Bundles take part in starts exactly like resolvers: a file:// entry at its place in OUTPACE_RESOLVERS, and the imported bundles as one more source after the listed entries, each starting a second after the previous one, or at once when the catalog has already failed. A healthy catalog still answers first. A name missing from a bundle doesn't stop the catalog's saved copy from being used. Expired entries don't answer, nor do content-id entries more than 30 days past their bundle's created time without a trusted attestation. An entry whose attestation has expired doesn't answer even from a bundle you trust for content ids: the attestation sets its own end date. Bundles aren't used in private peer mode, which resolves only through its own descriptors.

Logs

Logs name a resolver by its position in OUTPACE_RESOLVERS (resolver=1), never by URL, and never show ids or tokens:

[resolver] resolver=1 transport=https token=yes acestream_trust=source pinned_attesters=0
[resolver] resolver=1 info: namespaces=acestream+btih attestation_keys=1 (listed keys are not trusted unless configured)
[resolver] resolver=1 answered: vouched_by=resolver claimed_origin=catalog hops=0
[resolver] resolver=2 has trust=none and OUTPACE_RESOLVER_ATTESTERS is unset: no content-id answer from it could be accepted, so it is asked for infohashes only
[resolver] resolver=1 unavailable: unauthorized (token missing, invalid or not permitted: check its token); skipping it for a while
[bundle] source=2 file=1 kind=imported signer=ed4928c6 acestream_trust=source pinned_attesters=0
[bundle] source=2 file=1 validated: entries=2 signature=signer:ed4928c6
[bundle] source=2 file=1 answered: vouched_by=bundle-signer:ed4928c6 claimed_origin=catalog hops=0

The startup line's transport is https, https-loopback or http-loopback; the loopback ones are reached directly, never through the proxy.

Bundle lines name the source by its position, and each of its files by number.

Running a relay

From v1.5.0, any outpace serve can also be a resolver for your other devices: a relay. Run it somewhere the catalog isn't blocked (a VPS, a friend's connection, a home server on another ISP) and point your devices' OUTPACE_RESOLVERS at it. It answers from its own sources: the AceStream catalog for content ids, and the resolvers and bundles in its own OUTPACE_RESOLVERS (resolvers can be other relays) and its imported bundles, for everything they serve.

It is off by default. Turn it on with a listener of its own:

OUTPACE_RESOLVER_BIND=127.0.0.1:8653
OUTPACE_RESOLVER_TOKENS_FILE=/etc/outpace/relay-tokens
  • A separate listener. The relay serves only /v1 on OUTPACE_RESOLVER_BIND; playback stays on OUTPACE_BIND, which can stay on loopback.
  • Tokens. On any address other than loopback (including 0.0.0.0), the daemon refuses to start without OUTPACE_RESOLVER_TOKENS or OUTPACE_RESOLVER_TOKENS_FILE. Once tokens are set, every lookup needs one (401 otherwise), on loopback too. Give each user their own, so you can revoke one. Behind a reverse proxy the relay binds loopback but faces the internet: set tokens there too.
  • HTTPS comes from a reverse proxy: the relay speaks plain HTTP. See the Caddy example. Clients only send tokens over https://, except to loopback.
  • Limits. Each token may look up OUTPACE_RESOLVER_RATE names a minute (default 120); every name in a batch counts, and over the limit the relay answers 429 with Retry-After. Batches hold at most 32 names in at most 16 KiB, sent within 10 seconds.
  • Time. One lookup, waiting for a free slot included, gets an answer within 6.5 seconds (plus at most 250 ms of bookkeeping), so a client's normal 8-second request never gives up on the relay first. If all its lookup slots stay busy for that long, the answer is 503 with Retry-After (the relay itself is overloaded); if its sources fail or don't answer in time, it is 504 upstream_unavailable, about that lookup only. The one shorter wait is the first request after a client skipped the relay for a while, which gets 2 seconds and may time out on a slow lookup. A batch gets at most 40 seconds; names not answered by then come back unavailable.
  • Connections. At most 256 connections at once, counted apart from the playback API, and at most 16 from one address other than loopback; more wait (or, past the per-address cap, are closed). A connection serves at most 100 requests, and an error reply (400, 401, 404, 405) closes it. Request headers must arrive within 10 seconds, and a connection with nothing moving for 60 seconds is closed. Behind a reverse proxy every connection comes from the proxy's own address, so the per-address cap doesn't apply: set limits in the proxy.
  • Nothing to browse. The relay answers lookups of names a client already has (GET /v1/resolve/{name}, POST /v1/resolve), accepts published key names (PUT /v1/records/{name}, below), and serves GET /v1/info. There is no list, search or view of its cache.
  • No names in logs. The relay logs counts and modes, never names, tokens, content hashes or client addresses.
  • Relays can't run in private peer mode.

What a relay answers

  • Catalog answers are the relay's own: the descriptor with an empty chain and the origin catalog. A client trusts them as much as it trusts the relay (the default trust=acestream). The relay reuses a catalog answer for 5 minutes.
  • Answers from its resolvers and bundles are passed on with their signatures and claimed origin unchanged, and hops one higher. They are checked exactly as a client checks them before they are served; an answer that fails is never passed on.
  • With an attestation key (OUTPACE_RESOLVER_ATTESTATION_KEY_FILE, a 64-hex ed25519 secret seed), the relay also signs a 24-hour attestation onto every content-id answer it serves and lists the public key in its /v1/info. The one exception is an upstream answer that already carries four attestations, the most a chain may hold: it is passed on as it came, and a client that trusts only the relay's key can't accept it on that key. A client that lists that key in OUTPACE_RESOLVER_ATTESTERS then accepts the relay's answers even through a relay or resolver it doesn't trust (trust=none). A key in /v1/info is never trusted on its own. To make a seed: (umask 077; openssl rand -hex 32 > /etc/outpace/relay-attestation.key). On Unix the daemon refuses to start if the file is readable by everyone or writable by anyone but its owner; group-readable (0640, 0440) is fine. In Kubernetes, mount the secret with defaultMode: 0400. Elsewhere (Windows) the file's permissions are not checked: restrict it to the daemon's account yourself.
  • Outcomes. Found; not found (404) only when every source it asked said so; or unavailable when a source it needed couldn't answer: 504 upstream_unavailable, about that one lookup. The relay keeps 503 with Retry-After for its own overload (all its lookup slots busy), and 429 for a token over its rate. Clients, Outpace included, never skip a relay because of a 504, so one user's failed lookup can't make it look down to everyone. A name in a namespace no source can answer gets 400 unsupported_namespace, and /v1/info lists only the namespaces its sources answer: content ids when it has the catalog or a resolver that may vouch for them, key names when it looks them up in the DHT or accepts published ones, and what each resolver's own /v1/info lists (asked again at most hourly).
  • Key names from the DHT. When the daemon plays streams (the default ace network), the relay looks key names up in the BitTorrent DHT itself, exactly as a client does, and fetches the descriptor the pointer names from the broadcaster's peers or, when its loop guard lets it forward, from its own resolvers. There is no setting: it is on whenever the relay can use the DHT (not behind the outbound proxy). Such an answer has the origin dht and hops 0, is reused for 5 minutes, and a name the DHT doesn't have is not found for 60 seconds. The lookup shares the relay's 6.5-second budget, so a slow DHT gives a 504 rather than holding the client up. Its upstream resolvers start 1 second after the DHT.
  • Bundles among its sources answer like resolvers, but their answers are never kept in the relay's cache, so deleting a bundle stops the relay answering from it at once. Clients that already got a bundle answer may still reuse it for its ttl, up to 5 minutes.

Publishing to a relay

A relay with its cache on (OUTPACE_RESOLVER_CACHE_ENTRIES above 0) accepts key-name pointers from broadcasters with PUT /v1/records/key:<public key>[/<label>], and lists records-put in its /v1/info features. The body is the record set a lookup returns: the name, a chain holding the one signed pointer, and the descriptor as content, at most 2 MiB in all. Only key names are accepted, since nobody needs to trust the sender: the owner's signature is the proof.

curl -X PUT -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
  --data @record.json \
  https://relay.example/v1/records/key:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef/my-channel
  • Checked on arrival, exactly as a client checks an answer: the signature, the expiry (a pointer that has already expired is refused), the content's hash and media type. A failed check is 400 invalid_request; a name other than a key name is 403 not_self_certifying.
  • Never older. A pointer with a lower sequence number than the one the relay holds or accepted, or the same number with a different value, is 409 stale_sequence. Sending the same pointer again is a refresh. The relay remembers the highest number per name for its cached answers, and for up to 1024 names it accepted beyond those, for as long as it runs; kept answers raise it again after a restart. A name it no longer remembers or holds can be published again from any number.
  • Content may be left out when the relay already holds it, for example after re-signing a pointer to the same descriptor. Otherwise it is 409 content_required.
  • Success is 204. The relay serves the record with the origin publisher, whatever the body claimed. It answers from it for 5 minutes, then asks its sources for a newer pointer (a restarted broadcast signs one) and answers from the published record again while they have none, until the pointer expires. The record is kept in the cache, and survives a restart, but like any cached answer it can be evicted early when the cache is full.
  • Limits. A token is needed as for lookups. Each publish uses 4 names' worth of the token's OUTPACE_RESOLVER_RATE, and a key may be published (accepted) at most 30 times a minute, whatever the token; over either limit the answer is 429 with Retry-After.
  • Outpace broadcasts don't publish to relays yet: they write their pointers to the DHT, which a relay reads anyway.

Cache

  • The relay keeps up to OUTPACE_RESOLVER_CACHE_ENTRIES answers (default 1024, at most 16 MiB), in memory and in <OUTPACE_DATA_DIR>/resolver-relay, a directory only the daemon's user can read. Kept answers survive a restart, but only while the source that gave them is still configured and still trusted for them. Where that private directory isn't available (Windows), or can't be opened, answers are kept in memory only and a restart starts empty.
  • A source's stale-if-error limits how long its answers may be served stale; without one, the limit is 7 days. The relay tells its own clients the same limit in Cache-Control (stale-if-error=), never past the answer's signed expiry.
  • A kept answer is served while its ttl lasts. After that, it is served stale ("stale": true, ttl 0) only when the source that gave it is unavailable, for at most 7 days after its ttl ran out, and never once a signature in it has expired.
  • Answers with ttl 0 and stale answers from upstream relays are passed on once and never kept, so a chain of relays can't extend how long an answer lives.
  • The cache is shared by everyone with a token: response times and stale answers can show that someone else looked a name up recently. Give tokens only to people who may know that about each other.

Relays of relays

A relay's OUTPACE_RESOLVERS can list other relays. Each relay names itself in an Open-Resolver-Via header when it forwards a lookup: a relay that sees its own name answers 508 loop_detected (so pointing a relay at itself fails fast), and one that sees four relays already answers without forwarding, or with 508 hop_limit when it has nothing to answer with.

A 508 is about that one lookup: whoever asked chose its Open-Resolver-Via, so neither relays nor Outpace clients ever skip a resolver because of one. A relay logs it as its own misconfiguration only when the lookup started with it.

[relay] serving the open resolver API: tokens=required catalog=yes upstream_resolvers=1 attestation_key=none namespaces=sha256+btih+key+acestream
[relay] catalog unreachable; answering from upstream resolvers and cached answers for a while
[resolver] resolver=1 refused a lookup this relay forwarded: a relay loop or too many relays in a row (check its OUTPACE_RESOLVERS)

Related pages

Clone this wiki locally