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.
Mehari provides several packages. See here. Many examples are also provided.
opam install mehari
- Mirage OS friendly
- Type safe route API
- Static files serving
- MIME type inference from file content (using experimental Conan support)
- Rate limit
- 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
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#df8969d9bb95cffca13e31a615189ab27ada0684Vendor dependencies:
$ ./unikernel/vendor.shSetup 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 upCreate 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.pemCompile 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/8Distributed under the LGPL-3.0 License. See license for more information.
