package mehari

All checked builds pass
  1. Overview
  2. Docs
A library for building Gemini servers

Install

dune-project
 Dependency

Authors

Maintainers

Sources

0.5.tar.gz
md5=035934743b73b6b5a593d3146533b0b2
sha512=570071e2fadd19e396f8fe86162c75069761acbe5c3b2ab3791c7c30a543a174b7f65bf5ba73bf5842ad5b071faabab071db23c19275b8ee8673190af9007cff

doc/README.html

Mehari

Mehari is a library for building Gemini servers. It fully implements the Gemini protocol specification.

It takes inspiration from Dream, a tidy feature-complete Web framework, and from Nightmare, a powerful typesafe layer compatible with Dream.

banner

Mehari provides several packages. See here. Many examples are also provided.

Installation

opam install mehari

Features

  • Mirage OS friendly
  • Type safe route API
  • Static files serving
  • MIME type inference from file content (using experimental Conan support)
  • Rate limiting
  • Virtual hosting using TLS SNI
  • CGI support
  • API documentation: https://docs.heyplzlookat.me/mehari/
  • Tutorial: https://docs.heyplzlookat.me/mehari/index.html#tutorial
  • Issues: https://github.com/Psi-Prod/Mehari/issues

Building the unikernel

Setup dev environment:

$ opam install mehari-mirage solo5 ocaml-solo5
$ opam install ca-certs-nss dns dns-client mfat
$ opam pin zarith.dev git+https://github.com/mirage/Zarith.git#df8969d9bb95cffca13e31a615189ab27ada0684

Vendor dependencies:

$ ./unikernel/vendor.sh

Setup network bridge:

$ ip link add name service type bridge
$ ip addr add 10.0.0.1/24 dev service
$ ip tuntap add name tap0 mode tap
$ ip link set tap0 master service
$ ip link set service up
$ ip link set tap0 up

Create dune and dune-workspace files at the root of the repo:

$ cat >dune<<EOF
(vendored_dirs vendors)
EOF
$ cat >dune-workspace<<EOF
(lang dune 3.23)
(context (default))
(context (default
 (name solo5)
 (host default)
 (toolchain solo5)
 (disable_dynamically_linked_foreign_archives true)))
EOF
$ mfat make -s 2048 certs.img
$ mfat write certs.img key.pem key.pem
$ mfat write certs.img certs.pem cert.pem

Compile and run the unikernel:

$ dune build --profile=release
$ solo5-hvt --net:service=tap0 --block:certs=certs.img -- ./_build/solo5/unikernel/unikernel.exe --solo5:quiet --ipv4=10.0.0.2/8

License

Distributed under the LGPL-3.0 License. See license for more information.