z3bra, the stripes apart

Do you gopher ?

— 03 February, 2015

Pocket gophers, commonly referred to as gophers, are burrowing rodents of the family Geomyidae.[3] There are approximately 35 species of gopher living in Central and North America.[4] They are commonly known for their extensive tunneling activities. Gophers are endemic to North and Central America.

-- wikipedia

This article is not about them.

The gopher I'll cover here is the TCP/IP protocol. It is a simple protocol used to share resources across the internet. The goal is to make the all internet look like a giant filesystem, where everything is read-only.

How does it looks?

$ curl -s gopher://
iYou found me. Happy browsing ! Err   70
i============================== Err   70
i   Err   70
0prolog /prolog.txt   70
1notes  /notes   70
1ascii  /ascii   70
1images /img   70
h  URL:   70

We'll come back on this later. First, how does it works?

gopher indexes

Gopher is a text based protocol, where each line either points to an index (directory), or an item (items being files). The items will either be files or text (see file types later). To understand what the indexes are, let's assume we have the following filesystem:

├── img
│   ├── index.gph
│   ├── dad.png
│   ├── mom.png
│   └── son.png
├── index.gph
├── notes
│   ├── index.gph
│   ├── memories.txt
│   └── tricks.txt
└── hello.txt

2 directories, 9 files

The files index.gph are the equivalent for index.html for most HTTP servers. In this case, each index.gph lists the content of the directory, so from a gopher client, we'll see:

├── img [index]
│   ├── dad.png [file]
│   ├── mom.png [file]
│   └── son.png [file]
├── hello.txt [file]
└── notes [index]
    ├── memories.txt [file]
    └── tricks.txt [file]

Pretty simple. You could however create a more difficult architecture by making .gph point to other files not in their directories and such.. but that's not the point here.

the protocol

To put it simply, each gopher "line" is composed of 5 distinct parts:

<type><description> <path>  <server>    <port>

So each line is a link to another file, which could be on any server.

A gopher index is then just a list of links, each one pointing to a file which can be anywhere accross the world. And you don't need any unreadable markup language for this!

file types

The gopher protocol implements a rudimentary filetype thingy, by putting a character at the beginning of each line, indicating what the "item" points to. For example:

0this is a file /path/to/the/file   domain.tld  port
1this is an index   path/to/the/index   domain.tld  port
9this is a binary file  /path/to/the/binary domain.tld  port
Ithis is an image   /path/to/the/image  domain.tld  port

There is also a special type: 'i', which doesn't point to anything, so it is only used to display text:

iThe following is a set of cat pictures Err domain.tld  port
Icat1.png   /img/cats/1.png domain.tld  port
Icat2.png   /img/cats/2.png domain.tld  port
Icat3.png   /img/cats/3.png domain.tld  port
Icat4.png   /img/cats/4.png domain.tld  port

gopher holes

Gopher spaces are commonly named "holes". All you need now is a gopher to crawl this huge gallery. Here are a few I recommend:

Or you could use an HTTP proxy :

final thoughs

As you might have noticed (or not), I run my own gopher hole. I first wanted to move this whole blog over gopher, but finally decided to keep it as is (because I'm kind of attached to it after all!), and use my gopher space to share some quick thoughs & notes about POSIX systems and other IT related subjects.

Because of this, I might reduce the freequency of posts I publish here, in favor of more notes on my gopher space. So see you there!