A simple static Gopher server in OCaml
git clone git://git.luxferre.top/osmol.git
Log | Files | Refs | README | LICENSE

README.md (1984B)

      1 # OSmol: the simplest static Gopher server in OCaml
      3 This is a really small (under 45 SLOC) server for serving static content on the small net, namely Gopher. It was written more like as an exercise on writing simple server applications in OCaml, but actually is powering the author's gopherhole at [hoi.st](gopher://hoi.st) as a single set-and-forget static binary with zero host-side dependencies.
      5 ## Building
      7 OSmol is expected to be built using the (POSIX-compatible) Makefile supplied in the repo, which, in turn, requires installing [musl-gcc](https://wiki.musl-libc.org/getting-started.html) and two packages from Opam:
      8 ```
      9 opam install ocaml-option-static ocaml-option-flambda
     10 ```
     12 Of course, if you need other options, you can tweak the Makefile or build OSmol with the toolchain of your choice. The only module dependency here is `unix.cmxa` which comes with any OCaml installation.
     14 ## Usage
     16 Run `./osmol --help` to see all command-line options. As of now, they are as follows:
     18 - `-p`: the TCP port to listen on. Defaults to 70.
     19 - `-d`: the root directory where your content resides. Defaults to `.` (the current working directory).
     20 - `-i`: the name of the file that must be present in all directories you want to make directly accessible. Without this file, the directory selector cannot be opened. Defaults to `index.map`.
     22 The files whose name is customizable with the `-i` switch usually follow standard Gophermap format.
     24 You can also run Osmol as a daemon, logging its start and other output (not much at the moment), for example, like this:
     25 ```
     26 nohup ./osmol -d ./content -p 70 </dev/null 2>&1 | logger &
     27 ```
     29 ## Limitations
     31 - No CGI or search selectors support (by design).
     32 - No Gopher+ selector support (by design).
     33 - No directory autoindexing (all maps must be created with other tools or by hand).
     34 - No SSL/TLS support (use Traefik or other reverse proxy to enable it).
     36 ## Credits
     38 Created by Luxferre in 2023, released into public domain.
     40 Made in Ukraine.