Giter VIP home page Giter VIP logo

spacecookie's Introduction

 ____                                       _    _      
/ ___| _ __   __ _  ___ ___  ___ ___   ___ | | _(_) ___ 
\___ \| '_ \ / _` |/ __/ _ \/ __/ _ \ / _ \| |/ / |/ _ \
 ___) | |_) | (_| | (_|  __/ (_| (_) | (_) |   <| |  __/
|____/| .__/ \__,_|\___\___|\___\___/ \___/|_|\_\_|\___|
      |_|    – 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.

WP

What is Spacecookie?

Spacecookie is a gopher server that implements RFC1436. It supports comment lines (i-Type) as 100% compatible protocol extension (which is widely used). Support for the popular gophermap format to denote menus is in place.

Spacecookie's features

  • Simple unix gopher daemon
  • Simple configuration
  • Support for gophermaps
  • Just works™

Building

You can either use cabal, stack or nix-shell plus cabal. The necessary files are provided.

Configuration

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.

Running

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 per-default acts as a simple file server of any files that are beneath the root directory excluding files that start with a ..

If you are not happy with the automaticly generated gopher menus you can customize them using the gophermap file format:

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	/	gopher.floodgap.com	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 (taken from the pygopherd man page).

spacecookie's People

Contributors

sternenseemann avatar verbosemode avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.