spacecookie: gopher server daemon

[ gpl, library, network, program ] [ Propose Tags ]

simple gopher server daemon

[Skip to Readme]
Versions [faq]
Change log
Dependencies aeson, attoparsec, base (>= && <5), bytestring, containers, directory, fast-logger (>=2.4.0 && <2.5), filepath, hxt-unicode, mtl, socket, spacecookie, transformers, unix [details]
License GPL-3.0-only
Author Lukas Epple
Category Network
Home page
Bug tracker
Source repo head: git clone git://
Uploaded by sternenseemann at Thu May 23 08:24:43 UTC 2019
Distributions NixOS:
Executables spacecookie
Downloads 78 total (12 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2019-05-23 [all 1 reports]


[Index] [Quick Jump]


Maintainer's Corner

For package maintainers and hackage trustees

Readme for spacecookie-

[back to package description]
 ____                                       _    _      
/ ___| _ __   __ _  ___ ___  ___ ___   ___ | | _(_) ___ 
\___ \| '_ \ / _` |/ __/ _ \/ __/ _ \ / _ \| |/ / |/ _ \
 ___) | |_) | (_| | (_|  __/ (_| (_) | (_) |   <| |  __/
|____/| .__/ \__,_|\___\___|\___\___/ \___/|_|\_\_|\___|
      |_|    – haskell gopher server

What is Gopher?

The Gopher protocol /ˈɡoʊfər/ is a TCP/IP application layer protocol designed for distributing, searching, and retrieving documents over the Internet. The Gopher protocol was strongly oriented towards a menu-document design and presented an alternative to the World Wide Web in its early stages, but ultimately HTTP became the dominant protocol. The Gopher ecosystem is often regarded as the effective predecessor of the World Wide Web.


What is Spacecookie?

Spacecookie is a gopher server and…

  • is RFC1436-compliant
  • supports info-line in menus (compatible protocol extension)
  • supports gophermaps (see below)
  • includes a library for custom gopher applications


In order to run your new gopher server, you got to configure it first. The example configuration file is ./etc/spacecookie.json.

Let's have a quick look at the options:

option | meaning
-----------|-------------------------------------------------------------------------------------------------------- hostname | The hostname your spacecookie will be reachable through. user | The user that just run spacecookie. It is used to drop root priveleges after binding the server socket. port | The port spacecookie should listen on. The well-known port for gopher is 70. root | The directory which the files to serve via gopher are located in.


After you've created your config file just start spacecookie like this:

spacecookie /path/to/spacecookie.json

Of course it is more convenient to run it as a system wide demon. For that reason a systemd spacecookie.service is provided. You can use it like this:

systemctl enable spacecookie.service
systemctl start  spacecookie.service

Please note that you have to move the necessary file in place manually at the moment.

Adding Content

Spacecookie acts as a simple file server, only excluding files that start with a dot. It generates gopher menus automatically; however you can use custom ones by adding a gophermap file.

Spacecookie checks for .gophermap in every directory it serves and, if present, uses the menu specified in there.

Such a file looks like this:

You can just start writing text that
will be displayed by the gopher client
without a link to a file. Empty lines are
also possible.

1Menu Entry for a directory full of funny stuff /funny
iFunny Image    /funy.jpg
gcat gif    /cat.gif
0about me   /about.txt
1Floodgap's gopher server   / 70

So what does that all mean? These are the rules for a gophermap file:

  • comment lines (called info lines in spacecookie's code) are just lines of text. They must not contain a tab! They will be displayed as lines of text by the gopher client.
  • menu entries for files or directories start with a single char which specifies the file type, followed by the text for that file without a space or tab between them! Then the path is added after a tab.
  • "Links" to other servers are like file/directory menu entries but the server's hostname and its port must be added (tab-separated).

The file type characters are defined in RFC1436. Detailed documentation on the gophermap format can be found here.