Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,25 @@ Notable changes to Favonius. Format follows
While the major version is 0, the wire protocol and the CLI may both change
in a minor release. See [Stability](#stability).

## Unreleased

### Added

- `favonius check <host:port>` — a connectivity pre-flight. Probes the TCP
fallback, the UDP control port and the UDP data port, prints the firewall
rule to request, and exits non-zero when no transfer is possible. The
daemon answers a probe datagram with a reply of exactly the same length,
so the check cannot be used as a reflection amplifier.
- **TCP fallback.** `--transport tcp`, and a daemon listener on the TCP
socket bearing the control port's number, so a deployment opens one port
rather than two. No congestion control, no multi-stream, and no
performance claim — it exists so that "can we move a file at all" is
always yes on a network that blocks UDP. Streams to a `.part`, verifies
BLAKE3 before committing by rename, and reuses the same `--dest-root`
confinement as the UDP path. Disable with `--no-tcp-fallback`.
Senders remain unauthenticated, as on the UDP path.


## [0.1.0] — 2026-08-15

First public release.
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,61 @@ A **version mismatch is now reported as one**: the header decoder rejects
any protocol version it does not implement instead of decoding the packet
as if it were the current one.

## Before anything else: will your network carry this?

```bash
favonius check receiver.example.com:7801
```

The first thing that stops a deployment is not the security review, it is
the firewall. Enterprise ingress is closed by default and plenty of
policies decline inbound UDP outright — so find out in five seconds rather
than after a week of evaluation and a three-week change request.

It reports each path separately, prints the rule to send your network
team, and exits non-zero when no transfer is possible, so it can gate a
script:

```text
[ok ] TCP 7801 fallback path
[ok ] UDP 7801 control — handshake
[? ] UDP 7802 data — silent when idle, which is normal
```

UDP silence is ambiguous by nature — a firewall drop, a stopped daemon and
a lossy link look identical from outside — and the TCP line distinguishes
the first two: if TCP connects, something is listening and UDP is being
filtered.

## When UDP is blocked

Favonius falls back to TCP rather than failing:

```bash
favonius send big.bin receiver.example.com:7801:/srv/incoming/big.bin --transport tcp
```

The daemon listens for this on the **TCP socket bearing the control port's
number**, so a deployment asks for one port rather than two:

> permit 7801 to this host — UDP for speed, TCP as the fallback.

**It makes no performance claim.** There is no congestion control, no
multi-stream multiplexing, and none of the measurements in this README
apply to it; the kernel's TCP stack does the work. On the impaired links
Favonius exists for it will be markedly slower. That is the trade: a
transfer that arrives slowly beats one that needs a change request.

It keeps the guarantees that matter. Bytes stream to a `.part` file, are
hashed with BLAKE3 on the way past, and are renamed into place only when
the payload is complete *and* the trailing hash matches — so a truncated
or altered transfer is refused rather than written. `--dest-root`
confinement is the same code the UDP path uses, not a second
implementation. And it inherits the same limitation, stated in
[SECURITY.md](SECURITY.md): **senders are not authenticated**. Opening the
TCP port widens that posture from one protocol to two; permit both or
neither. Disable it with `--no-tcp-fallback`.

## Firewall Rules

Favonius uses UDP for its data plane. If UFW (or another firewall) is
Expand Down
1 change: 1 addition & 0 deletions crates/ahp-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ libc = "0.2"
io-uring = "0.7"

[dev-dependencies]
tempfile = "3"
ahp-api = { workspace = true }
ahp-daemon = { workspace = true }
tokio = { workspace = true }
Expand Down
2 changes: 2 additions & 0 deletions crates/ahp-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
pub mod fs_tree;
pub mod sync_plan;
pub mod net_probe;
pub mod preflight;
pub mod tcp_sender;
pub mod net_sender;
pub mod udt_transport;

Expand Down
72 changes: 70 additions & 2 deletions crates/ahp-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use clap::{Parser, Subcommand};
use ahp_cli::sync_plan::{self, Compare, SyncMode};
use ahp_cli::{fs_tree, FavoniusClient, CliError, net_sender, udt_transport};
use ahp_cli::{fs_tree, FavoniusClient, CliError, net_sender, preflight, tcp_sender, udt_transport};
use ahp_congestion::CongestionProfile;
use ahp_policy::{AdaptivePolicy, NetworkContext};
use ahp_proto::data::AckMode;
Expand All @@ -28,6 +28,21 @@ struct Cli {

#[derive(Subcommand, Debug)]
enum Command {
/// Check whether this network will carry a transfer
///
/// Run this before anything else. The first thing that stops a
/// deployment is not the security review, it is the firewall — and
/// finding that out in five seconds is worth more than finding out in
/// three weeks.
Check {
/// Destination host, with an optional control port: `host` or
/// `host:7801`
target: String,
/// AHP data port. Defaults to the control port plus one, which is
/// the daemon's own default.
#[arg(long)]
data_port: Option<u16>,
},
/// Send files to a destination
Send {
source: String,
Expand All @@ -54,7 +69,9 @@ enum Command {
/// Pacing mode: auto, batch (GSO/sendmmsg, default), perpacket, iouring (slower than GSO, debug only), xdp (experimental)
#[arg(long, default_value = "auto")]
pacing: String,
/// Transport backend: ahp (default), udt (sendfile/recvfile), xdp (AF_XDP zero-copy)
/// Transport backend: ahp (default), tcp (fallback for networks
/// that block UDP — correct but not accelerated), udt
/// (sendfile/recvfile), xdp (AF_XDP zero-copy)
#[arg(long, default_value = "ahp")]
transport: String,
/// Encrypt the transfer using AES-256-GCM with X25519 key exchange
Expand Down Expand Up @@ -191,6 +208,29 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = FavoniusClient::new(&cli.daemon);

match cli.command {
// ── Connectivity ─────────────────────────────────────────────
Command::Check { target, data_port } => {
let (host, control_port) = match target.rsplit_once(':') {
// Guard against an IPv6 literal being split on its own colons.
Some((h, p)) if !h.contains(':') || h.starts_with('[') => {
match p.parse::<u16>() {
Ok(port) => (h.trim_matches(|c| c == '[' || c == ']').to_string(), port),
Err(_) => (target.clone(), 7801),
}
}
_ => (target.clone(), 7801),
};
let data = data_port.unwrap_or(control_port.saturating_add(1));
let report = preflight::run(&host, control_port, data).await;
preflight::print(&report);
// A non-zero exit so this can gate a script or a CI step, not
// only inform a person reading a terminal.
if !report.transfer_possible() {
std::process::exit(1);
}
return Ok(());
}

Command::Send { source, destination, compression, congestion, ack_mode, streams, pacing, transport, encrypt, header_protect, resume, server_key, adaptive, policy_path, include, exclude, dry_run, bandwidth_limit } => {
// No code path reads this. It was destructured away with `..`,
// so `--bandwidth-limit 10` capped nothing and said nothing —
Expand All @@ -204,6 +244,34 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
(tc/qdisc), until it is.".into(),
)));
}
// TCP fallback: no AHP, no congestion control, no speed claim.
// Chosen explicitly here; `net_sender` falls back to it on its
// own when a handshake finds nothing at the far end.
if transport == "tcp" {
let Some((remote_addr, dest_path)) = net_sender::parse_remote_dest(&destination)
else {
return Err(Box::<dyn std::error::Error>::from(CliError::Config(
"--transport tcp needs a remote destination, host:port:/path".into(),
)));
};
eprintln!("Transport: TCP fallback (no acceleration — see `favonius check`)");
match tcp_sender::send_file(
std::path::Path::new(&source), remote_addr, &dest_path,
).await {
Ok(s) => {
println!(
"TCP fallback complete: {} bytes in {:.2}s ({:.1} MiB/s)",
s.bytes_sent, s.elapsed.as_secs_f64(), s.throughput_mib_s(),
);
return Ok(());
}
Err(e) => {
eprintln!("error: {e}");
std::process::exit(1);
}
}
}

// UDT transport: bypass AHP entirely, use sendfile/recvfile.
if transport == "udt" {
eprintln!("Transport: UDT (sendfile/recvfile baseline)");
Expand Down
Loading
Loading