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
612 changes: 607 additions & 5 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ owo-colors = "4"
rand = "0.8.5"
regex = "1.10.6"
reqwest = { version = "0.13.3", features = ["blocking", "http2"] }
rustls = { version = "0.23.40", features = ["ring"] }
rustls-acme = { version = "0.15.2", features = ["axum"] }
serde = { version = "1.0.209", features = ["derive"] }
serde_ignored = "0.1.14"
serde_json = "1.0.127"
Expand All @@ -43,6 +45,7 @@ serde_yaml = "0.9.34"
sha2 = "0.10"
snafu = "0.8.4"
strum = { version = "0.27.2", features = ["derive"] }
sysinfo = { version = "0.39.1", default-features = false, features = ["system"] }
tempfile = "3.24.0"
tokio = { version = "1.52.3", features = ["fs", "io-util", "macros", "rt-multi-thread"] }
tokio-util = { version = "0.7.18", features = ["io"] }
Expand Down
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,24 @@ filepack verify --print | jq

### `filepack serve`

Start an HTTP file server. The filepack server has no authentication or disk
usage quota and should be considered experimental.
Start HTTP server. The filepack server has no authentication or disk usage
quota and should be considered experimental.

To serve HTTP on `0.0.0.0:80`:

```shell
filepack serve
```

To serve HTTPS on `0.0.0.0:443` with an ACME TLS certificate using the hostname
as the domain:

```shell
filepack serve --address 0.0.0.0:80
filepack serve --https
```

See `filepack serve --help` for more details.

Files can be uploaded with `filepack upload` and downloaded with
`filepack download`.

Expand Down
4 changes: 4 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ use super::*;
#[derive(Debug, Snafu)]
#[snafu(context(suffix(false)), visibility(pub(crate)))]
pub enum Error {
#[snafu(display("no hostname found for use as ACME domain"))]
AcmeHostname { backtrace: Option<Backtrace> },
#[snafu(display("file hash {actual} not equal to expected {expected}"))]
Assert {
backtrace: Option<Backtrace>,
Expand Down Expand Up @@ -311,6 +313,8 @@ pub enum Error {
status: StatusCode,
url: Url,
},
#[snafu(display("failed to install rustls ring crypto provider"))]
RustlsProvider { backtrace: Option<Backtrace> },
#[snafu(display("server failed"))]
Serve {
backtrace: Option<Backtrace>,
Expand Down
4 changes: 0 additions & 4 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ pub(crate) struct Server {
}

impl Server {
pub(crate) fn new(options: Options) -> Result<Self> {
Self::with_data_dir(&options.data_dir()?)
}

pub(crate) async fn open_file(&self, hash: Hash) -> ServerResult<(tokio::fs::File, u64)> {
let path = self.files.join(hash.to_string());

Expand Down
Loading
Loading