Skip to content

Release 0.7.0: run torrential on a server or a NAS - #123

Merged
nexxeln merged 70 commits into
mainfrom
next
Nov 17, 2026
Merged

nexxeln merged 70 commits into
mainfrom
next

Conversation

@nexxeln

@nexxeln nexxeln commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Brings 0.7 to main: a server install with Tailscale, Docker for NAS, torrential connect and pull, Save to this device, torrent_interface, private and local trackers with torrential indexers, and fixes for iPhone playback, network folders that hang, and Windows downloads.

PRs: #99, #100, #102–#106, #108–#122.

Proved before release:

  • Release workflow built every platform and the Docker image from the release branch (run 44127618230).
  • A 0.6.1 install under the systemd login service, with a download and a paired browser, took 0.7.0 over: the download, the device and its cookie carried over, and the service binary notice showed while 0.6.1 still ran.
  • A Linux server set up with torrential server install on a real tailnet; an iPhone paired through the MagicDNS link and played, seeked and survived a lock.
  • The 0.7 engine on a Mac: IPv6 sockets, torrent_interface, the notice for an older login service, and a second CLI paired over the LAN.

🤖 Generated with Claude Code

0.6 answered on 0.5's Unix socket so a 0.5 torrential could update itself to
0.6, and asked a 0.5 engine left running to make way. 0.7 removes both: the
bridge05 module, the engine task that served it, the make-way step before a
command starts its engine, and the two tests that played a 0.5 client and a
0.5 engine.

A 0.5 install that never ran 0.6 now needs install.sh to reach 0.7. A 0.5
engine still running after that is one the command line cannot reach, so
commands say another engine holds the state folder and point to
torrential engine stop, which stops it with a signal.
…e hid

The bridge module's #[cfg(unix)] stayed behind when the module went, and
attached itself to the cast module below it.
torrential connect <address> pairs this torrential with an engine on another machine as a
device, with the code or link torrential devices add prints there, and saves the address and
device token in state/remotes.json, which only this user can read. Every command, its JSON, and
the terminal UI then drive that engine over POST /engine, and torrential connect --local
switches back. An engine that does not answer is an error that names it; no local engine starts
in its place. Commands that only make sense here (play, setup, engine stop) are refused by a
table in client::runs, and engine status shows the engine's address and this machine's device.

The engine takes a paired device's token at /engine and gives it the requests
Request::refused_to_device allows: no stopping the engine, no device management, no paths on
the engine's machine. Proved by a two-engine test and by two real engines on boxd.
PR 96 put the owner's first look at a download folder on a thread of its own. After that look
the owner still called the disk on its own thread, so a network share that dropped later, or a
disk gone to sleep, stopped every command, the web app and paired phones until it came back.

Every call the owner makes on a download's folder now goes through Reach::ask, which runs it on
a thread of its own and waits at most a second. A folder that takes longer is waited for as on
a first look: commands that need it answer that torrential is waiting for access to it, its
downloads start once it answers, and the engine answers everyone else meanwhile. The owner no
longer holds the Disk port, so a new call cannot skip Reach. The Disk port gains identity, found
and open_folder, the calls the owner made beside it, and FakeDisk::stall now stalls every call
in a folder.

Tests stall a folder with FakeDisk::stall at each call site. On boxd, an NFS mount whose server
was stopped froze torrential 0.6.0 (status, get and engine status all timed out at 20 s); with
this change status answered in 0.4 s and get said it was waiting.
A torrent_interface line in config.yaml binds libtorrent's listen and
outgoing sockets to that interface (listen_interfaces and
outgoing_interfaces), so peers, trackers, the DHT and web seeds use it
alone. While it is missing or down nothing leaves by another route:
downloads that need peers carry waiting_for, which torrential status,
wait, the TUI and the web app show as waiting for that interface, with
rates and peers at zero. When it comes back, every torrent asks its
trackers and the DHT for peers at once. Windows refuses the setting.

Proved on boxd with a WireGuard tunnel and tcpdump on eth0: with wg0
down or deleted no tracker, DHT or peer packet left eth0, and with wg0
up Sintel downloaded through it.
On Linux, torrential server install turns on lingering for the person, so
systemd starts their services at boot and keeps them after logout; writes
server: true to config.yaml; installs and starts the login service; and
prints a QR code and a link that pair the first device. install.sh --server
does the same after it installs. torrential server uninstall turns lingering
off when install turned it on, takes server: true out, and stops the engine.
On macOS and Windows the command says it runs only on Linux.

A server listens on the network with nothing paired, and lets a paired device
in by any host name and port, such as a forwarded port or a DNS name. It still
refuses requests other websites make, and a browser that is not paired still
gets only the pairing page. Pairing offers on a machine whose best address is
public show that address instead of a .local name, and container bridges such
as docker0 no longer count as addresses a device reaches the machine by.
…iring

# Conflicts:
#	crates/torrential/src/client/connect.rs
On the owner's Mac during 0.6 checks, the login service started an older torrential binary from
another install path, and the command line used that older engine without a word. Each time it
also stopped the older engine to start its own, and the service started the old binary again.

After a command, torrential now says on stderr when the engine runs another version, or when the
login service starts another binary than the one the person ran, with the fix: torrential engine
install points the service at this binary. torrential engine status shows the same, and its
--json gains this_version, service_binary and notice. A command uses the engine that runs when the
service would only start the other binary again, instead of restarting it, and uses an engine
newer by its patch number alone instead of refusing it.

service::starts_another reads the binary and TORRENTIAL_HOME back out of the launchd, systemd and
Task Scheduler units, and a test checks that each unit reads back what it wrote. Process tests
cover the service case and a newer patch. On boxd, a real systemd user service started the 0.6.0
release binary; this build's status and engine status named it, and after engine install the
service ran this build and the notice was gone.
…alls

fix(engine): keep the engine answering when a download folder stops answering
Keep torrent traffic on one network interface, such as a VPN's
# Conflicts:
#	crates/daemon/src/config.rs
fix(cli): say when the engine or the login service is not this torrential
…iring

# Conflicts:
#	crates/torrential/src/client/connect.rs
#	crates/torrential/src/client/engine.rs
#	crates/torrential/src/client/snapshots/torrential__client__tests__daemon_status_running_stopped_and_on_another_machine.snap
#	crates/torrential/src/client/tests.rs
Run the engine as a server: torrential server install
public_address in config.yaml, such as https://tv.example.com behind Caddy or
a tailnet name, is what pairing links and QR codes use first, and a device that
pairs through it over HTTPS gets its cookie with Secure. A request a reverse
proxy on this machine forwards, which names the public address or carries
X-Forwarded-For, counts as one from the network, from the forwarded address: it
needs a paired device's cookie and never gets this machine's access or the
local token's.

While Tailscale runs, the engine reads tailscale status for its MagicDNS name
and tailnet address, or falls back to an address in 100.64.0.0/10. The pairing
offer then carries a tailnet link, which torrential devices and the Devices
page show next to the LAN link, and the HTTP guard takes the MagicDNS name. The
engine listens dual-stack on the network, so the tailnet's IPv6 range reaches
it too.

The offer's addresses are now whole origins with the scheme, since the public
address may be HTTPS.
An address that offers more than 30 tokens that open nothing in a minute,
device cookies or bearer tokens, gets 429 with Retry-After: 60 for any request
carrying a token until the minute ends, and none of its tokens are checked.
Pairing tries keep their own limit of 10 a minute on the same counter.
Pairing offers now last 10 minutes.

Each device records the address of its last request. torrential devices
shows it in a FROM column, the JSON and the Devices page carry it, and a
migration adds the column.

Every answer says X-Content-Type-Options: nosniff, and the web app's page
gets a Content-Security-Policy that allows only its own scripts, styles and
engine, with no unsafe-inline or unsafe-eval.
S2: drive an engine on another machine with torrential connect
#100 decides for each command where it runs while this torrential drives an engine on another
machine, in a match with no catch-all arm, and #104 added torrential server alongside it. The two
merged separately, so next no longer compiled. torrential server installs or removes this
machine's engine as a server, so it runs on this machine whatever engine this torrential drives.
…ial pull

Each finished download in the web app's Downloads list has Save to this device: a plain link to
the film's file on the engine's file route with its real name, which the browser downloads. The
route now sends an ETag made of the infohash and the file index, which never names other bytes,
so a browser can resume a cut download with a range.

torrential pull <id> copies a finished download's files from the engine on another machine into
this machine's download folder, laid out as the engine lays them out. Each file grows in
name.part until it is whole; a cut connection is asked again from where it stopped, and a pull
that was killed goes on from its .part file when it runs again. It checks each file's size, and
refuses a name from the engine that would land outside the folder.
#104 added the server command and #100 the table of where each command runs; they merged within minutes of each other and next stopped compiling. server install sets up this machine's engine, so it refuses while the CLI is connected elsewhere, like engine stop.
Bring the 0.6.1 hotfix into next, and fix next's build
Run torrential's engine from a Docker image
macOS lets a socket on 127.0.0.1 share a port with another program's socket on every address. A second engine on a Mac (another TORRENTIAL_HOME, or a client whose connect failed) took 127.0.0.1:47919 beside the first engine's *:47919, so the browser and CLI on that Mac reached the wrong engine. Found while testing 0.7 on a Mac. The engine now skips a preferred port that something answers on at 127.0.0.1. The new test fails on macOS without the change.
Windows refuses a UDP port it reserves, as Hyper-V and WSL have it do, or one another account holds
on every address, even where TCP binds the same port. libtorrent binds TCP first, then UDP on that
port, and moves to another port only when a bind says the port is in use, so it listened nowhere on
the address. This is how 18 engine tests and six swarm seeders failed on Windows CI during 0.7 work,
with error 10013 on the uTP bind. The test finds such a port on the machine and asks a session for
it.
iOS refuses play() a few seconds after the tap on Play, and buffers nothing until a tap starts the video, so the tap-to-play button, shown only once the video had buffered, never appeared: an iPhone sat on Getting ready to play for minutes. The button now shows while the video waits too.

After the phone locked mid-play, Try again reused the source whose stream had died, and WebKit refused it with an invalid state error each time. Try again now builds the source anew at the last position, and coming back to the page after a failure tries again by itself.

Found on a real iPhone playing from a server over Tailscale.
With torrent_interface set and that interface down, torrential play
<title> and Play in the web app tried six sources for up to three minutes
and then blamed them. A title play now asks the owner whether the
interface is down and, if it is, fails at once with network_unavailable:
"torrential is waiting for wg0, the torrent_interface in config.yaml, to
come up", with a hint to bring it up or remove the setting. A finished
download here still plays. libtorrent's adapter reports the interface on
its first poll, so a play right at engine start knows too.

Proved by a new test with the fake engine, and on boxd with a real
WireGuard interface brought down: the CLI play failed after 1.1 s instead
of 112 s, the web play after 0.04 s instead of 180 s.
…latform shows

Refusals and hints about pairing, devices and TVs said "the Mac" for the
computer running the engine, which is wrong on a Linux server or a
Windows PC. They now name torrential, "the computer running torrential",
or, where only that computer reads them, "this computer". The ranking
line keeps "this Mac", since it already follows the detected OS.

Proved by the workspace and web tests on boxd, with the tests and
snapshots that quote these messages updated.
Two torrential pull runs of one file wrote the same name.part at once.
A pull now locks name.part until it renames it into place, and a second
pull meanwhile fails at once with path_conflict ("another torrential pull
is copying <path> now") and leaves the file alone.

Proved by a new unit test, and on boxd with two real pulls of a 747 MiB
file: before, the second took over the first's file and the first failed
with storage_error; now the second is refused and the first's copy
matches the server's byte for byte.
…answers

A download whose file list arrived while its folder did not answer
stopped with "waiting for access" and needed torrential resume. The owner
now keeps it in the engine with no file selected and runs the same
checks (plan, size, conflicts, free space) once the folder answers.

Proved by the updated stall test, and on boxd with a hard NFS mount whose
server was stopped when Sintel's file list came: before, the download
stayed stopped after the server went on; now it was downloading 4 s
after.
Pass over a port another engine already answers on
After torrential server install, the link shown first and put in the QR code was the .local name, which answers only on the home network, with the tailnet link third. Tailscale is how 0.7 reaches a server, so a server with a tailnet now offers its MagicDNS link first. A computer at home still leads with its .local name, and a public_address still comes before both.
A session now checks each listen address before libtorrent sees it, binding TCP and UDP there with
the options libtorrent uses. Port 0, or a port either bind finds taken or refused, becomes one the OS
offers for TCP where UDP binds too. On Windows that fixes an engine that listened nowhere when its
saved listen port fell in a UDP range Windows reserves (a GitHub runner reserved 64202 to 64401 for
UDP alone) or one another account held, and the test engines and seeders that failed on CI the same
way. Without the change the new test fails on Windows with 10013 on the uTP bind; with it, it passes.
libtorrent 2.1 flushes a file to the disk after every write on Windows by default. On a GitHub
Windows runner a 400 MiB loopback download wrote at 12.7 and 13.1 MiB/s that way, and pausing it took
3.5 s and 2.5 s while the queue drained; through the system cache, as on macOS and Linux, it wrote at
78.4 and 80.5 MiB/s and paused in 0.17 s and 0.12 s. With up to 100 MiB queued, a stop on a slower
disk ran past the 10 s the engine waits for writes to stop and the 20 s engine stop waits for the
exit, which is how the windows-install job's engine stop failed after Sintel downloaded fast.

The windows-install job now says how long engine stop took and prints the engine log when it fails,
and waits for the local release server to answer instead of sleeping 2 s, which once let install.ps1
ask before the server listened.
The play tests that pin the release that sends its file list gave it the 500 ms the other tests use
to give up on a dead swarm quickly. On a busy Windows runner the file list took longer, and the test
that checks a play never writes into the person's own folder of the same name failed before it
checked anything. Those tests now give each wait the play's whole budget, so they wait as long as
the file list and first bytes take and no longer.
The test failed once on Windows with exit code 6 from its first get and no message. It now prints the command's stderr, how long it took, and the engine log, so the next failure says whether the engine did not start in time or was refused.
…hange at once

An indexer in config.yaml can now hold its key as api_key, beside api_key_env; both is a config error that names the line. The login service passes only TORRENTIAL_HOME, so an api_key_env indexer stopped a service engine from starting, and that error now says to write the key as api_key. Any write that leaves a key in config.yaml makes the file readable by its owner alone, and the key prints as redacted wherever it could reach a log.

Three new requests (wire version 12) let a paired device or this machine's torrential manage the indexers of the engine it drives. Adding asks the address for t=caps first and refuses with a plain reason; a Prowlarr or Jackett server's own address adds each of its indexers. The engine writes config.yaml keeping every other line and the comments of entries that stay, then swaps the search's source list without a restart.

Tests cover the key rules, the line-keeping edits, the file mode, caps parsing against Jackett's and Prowlarr's real answers, a reconfigured search, and a 401 for a stranger, a token no device holds, this machine's token from another machine, and a removed device, each leaving config.yaml unchanged.
…e it drives

`torrential indexers add <address> --key <key>` takes a Torznab feed or Prowlarr's or Jackett's own address, `torrential indexers` shows whether each answers and its categories, and `torrential indexers remove <name>` takes one out. Each takes --json, and through torrential connect each acts on the server's engine.

End-to-end tests run a stand-in Torznab indexer and a stand-in Prowlarr: refusals for a missing key, a wrong key, a 404, a web page and a closed port, a search that uses a new indexer with no restart, a Prowlarr import of only its enabled torrent indexers, and no key in any output or log. The remote test adds an indexer from a paired laptop and finds it in the server's config.yaml.

The README gets a short "Private and local trackers" section, and the agent skill one line.
Let an iPhone start a play, and recover after it locks
Refuse a title play at once while the torrent interface is down
Say the computer running torrential, not the Mac
Lead a server's pairing link with its tailnet address
Add, list and remove Torznab indexers with torrential indexers
Refuse a second pull of a file another pull is copying
Download a file list that came while its folder hung once the folder answers
The engine started answering requests and posted "Updated torrential to …" a moment later, so a web app or test that asked in that moment heard no notice. The notice is now on the board before the engine serves anything. This is why under_the_login_service_an_update_installs_while_a_film_plays_and_starts_once_it_ends failed once on Linux CI.
Set the update notice before the engine answers
Fix the Windows engine stop and listen port bugs behind 0.7's CI flakes
The README now says the pairing link of a server with Tailscale uses its tailnet name, as #118 made it.
@nexxeln
nexxeln merged commit c4eb18d into main Nov 17, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant