Walk like an egyptian

After quite some struggle, I finally got my OCaml env set up how I wanted it. I cursed at Atom, Merlin, Opam and pretty much any tool that could not hide quick enough, until I finally realised I just forgot to install the package highlighted as “unbound”. Now, with my hello world TLS client running, I am pretty amazed at the package management. Time for some planning.

I decided that a nice project would be to revamp my postfix address mapping server. That server maps an incoming email’s recipient address to the address that should be looked up in the database. Sounds simple enough — currently it’s just a python regex that removes dots, underscores, #suffixes — but it could use some features. For example, I’d like to be able to specify the applied maps without restarting the server, and adding temporary aliases on demand would also be nice. While I’m at it, I’d also like to get rid of MySQL in the process, but this strongly depends on the flexibility of dovecot. In the long run, I’d love to try out etcd, but there’s no OCaml native client available, and writing one will be difficult because ocaml-protoc does not support proto3 syntax yet.

So what is the mapping server going to look like? I imagine a specification of transformation/validation chains serialised as S-expressions, which would make them swappable at runtime. It also needs a bit of protocol implementation (request types and return codes specified by postfix) and socket handling. These two should be easy enough to figure out, but complex enough to give me some further insights into the OCaml world.