Gopher is a direct competitor of HTTP.
It failed to evolve and is stuck with a basic set of features but it does provide links.
Thus it is a really light alternative to what became the WWW (websites + browsers).
I always wanted to dig in this world where there are still a hundred (or a thousand) of users.
And I created pygopher and its main library pygopher_server.
This project allows me to:
- learn Python (as I don’t know it really well)
- manage a daemon in Python
- discover the Gopher space
The code uses the impressive Flask-Gopher library maintained by Michael Lazar to handle the Gopher protocol (requests and responses). It is itself based on Flask, the well-known Python Web framework.
The features I added:
- some security features
- remote content (JSON) can be gathered before being displayed
- Jinja2 can be used
- templates can display: “banner” or figlets
- templates can be cached
- basic “plugins” system to add new
- basic implementations of the PROXY protocol: v1 and v2 versions
- provide some statistics about usage
- rework of the documentation
An instance is publicly available here: gopher://gopher.t18s.fr
No need to write a client,
lynx runs great.
$ lynx gopher://gopher.t18s.fr
But if you want to use a SSL connection, the use of a third-party tunneling program is needed (like ptlstunnel).
pygopher daemon must be run behind a HAProxy (or an alternative) instance.
It adds some features I will never implement:
- manage a SSL certificate, even if the
gopherprotocol does not support this (Flask-Gopher can handle TLS now)
- add basic security with rate-limit
I use pyenv to manage the Python version.
Of course, there is an Ansible playbook to deploy everything.
Some useful links
Some Gopher proxies (HTTP -> Gopher):