No description
Find a file
Douglas Creager 838f3ad8cb Update dependencies to make cargo install work
Right now, you get an error trying to `cargo install agate`:

    error[E0277]: the trait bound `TlsAcceptor: From<Arc<ServerConfig>>` is not satisfied
      --> src/main.rs:91:8
       |
    91 |     Ok(TlsAcceptor::from(Arc::new(config)))
       |        ^^^^^^^^^^^^^^^^^ the trait `From<Arc<ServerConfig>>` is not implemented for `TlsAcceptor`
       |
       = help: the following implementations were found:
                 <TlsAcceptor as From<Arc<rustls::server::ServerConfig>>>
                 <TlsAcceptor as From<rustls::server::ServerConfig>>
       = note: required by `from`

This stems a recent point upgrade of async-tls.  The newest version
(0.10.2) now depends on rustls 0.19.  The previous version in agate's
lock file (0.10.0) depended on rustls 0.18.  Agate itself also depended
on rustls 0.18.

The default behavior of `cargo install` is to ignore the lock file and
run a `cargo update` before building and installing.  That causes agate
and async-tls to compile against different versions of rustls, causing
the compiler error above.

Arguably, async-tls's recent release should have been a breaking
release, to 0.11, but since that ship has sailed, we can bump agate's
requirements to the latest published versions.  Everything seems to
build correctly, and the server still seems to work fine.
2020-12-08 08:28:11 -08:00
src Refactor error handling code 2020-11-21 10:44:06 -08:00
.gitignore Initial commit 2020-05-16 22:16:46 -07:00
Cargo.lock Update dependencies to make cargo install work 2020-12-08 08:28:11 -08:00
Cargo.toml Update dependencies to make cargo install work 2020-12-08 08:28:11 -08:00
LICENSE-APACHE Initial commit 2020-05-16 22:16:46 -07:00
LICENSE-MIT Initial commit 2020-05-16 22:16:46 -07:00
README.md Fix typo in README 2020-11-20 14:46:50 -08:00

Agate

Simple Gemini server for static files

Agate is a server for the Gemini network protocol, built with the Rust programming language. Agate has very few features, and can only serve static files. It uses async I/O, and should be quite efficient even when running on low-end hardware and serving many concurrent requests.

Learn more

Installation and setup

  1. Download and unpack the pre-compiled binary.

    Or, if you have the Rust toolchain installed, run cargo install agate to install agate from crates.io.

    Or download the source code and run cargo build --release inside the source repository, then find the binary at target/release/agate.

  2. Generate a self-signed TLS certificate and private key. For example, if you have OpenSSL 1.1 installed, you can use a command like the following. (Replace the hostname with the address of your Gemini server.)

openssl req -x509 -newkey rsa:4096 -keyout key.rsa -out cert.pem \
    -days 3650 -nodes -subj "/CN=example.com"
  1. Run the server. The command line arguments are agate <addr:port> <content_dir> <cert_file> <key_file> [<domain>]. For example, to listen on the standard Gemini port (1965) on all interfaces:
agate 0.0.0.0:1965 path/to/content/ cert.pem key.rsa

Agate will check that the port part of the requested URL matches the port specified in the 1st argument. If <domain> is specified, agate will also check that the host part of the requested URL matches this domain.

When a client requests the URL gemini://example.com/foo/bar, Agate will respond with the file at path/to/content/foo/bar. If there is a directory at that path, Agate will look for a file named index.gmi inside that directory.

Optionally, set a log level via the AGATE_LOG environment variable. Logging is powered by the env_logger crate:

AGATE_LOG=info 0.0.0.0:1965 path/to/content/ cert.pem key.rsa