URI: 
       tdo-you-gopher.txt - monochromatic - monochromatic blog: http://blog.z3bra.org
  HTML git clone git://z3bra.org/monochromatic
   DIR Log
   DIR Files
   DIR Refs
       ---
       tdo-you-gopher.txt (4583B)
       ---
            1 # Do you gopher ?
            2 
            3 03 February, 2015
            4 
            5 > Pocket gophers, commonly referred to as gophers, are burrowing rodents of the
            6 > family Geomyidae.[3] There are approximately 35 species of gopher living in
            7 > Central and North America.[4] They are commonly known for their extensive
            8 > tunneling activities. Gophers are endemic to North and Central America.
            9 >
           10 > -- wikipedia
           11 
           12 This article is not about them.
           13 
           14 The gopher I'll cover here is the TCP/IP protocol. It is a simple protocol used
           15 to share resources across the internet. The goal is to make the all internet
           16 look like a giant filesystem, where everything is read-only.
           17 
           18 How does it looks?
           19 
           20     $ curl -s gopher://z3bra.org
           21     iYou found me. Happy browsing !        Err        z3bra.org        70
           22     i==============================        Err        z3bra.org        70
           23     i        Err        z3bra.org        70
           24     0prolog        /prolog.txt        z3bra.org        70
           25     1notes        /notes        z3bra.org        70
           26     1ascii        /ascii        z3bra.org        70
           27     1images        /img        z3bra.org        70
           28     hhttp://blog.z3bra.org        URL:http://blog.z3bra.org        z3bra.org        70
           29     .
           30 
           31 We'll come back on this later. First, how does it works?
           32 
           33 ## gopher indexes
           34 
           35 Gopher is a text based protocol, where each line either points to an index
           36 (directory), or an item (items being files).
           37 The items will either be files or text (see file types later). To understand
           38 what the indexes are, let's assume we have the following filesystem:
           39 
           40     /var/gopher/
           41     ├── img
           42     │   ├── index.gph
           43     │   ├── dad.png
           44     │   ├── mom.png
           45     │   └── son.png
           46     ├── index.gph
           47     ├── notes
           48     │   ├── index.gph
           49     │   ├── memories.txt
           50     │   └── tricks.txt
           51     └── hello.txt
           52 
           53     2 directories, 9 files
           54 
           55 The files `index.gph` are the equivalent for `index.html` for most HTTP servers.
           56 In this case, each `index.gph` lists the content of the directory, so from a
           57 gopher client, we'll see:
           58 
           59     /
           60     ├── img [index]
           61     │   ├── dad.png [file]
           62     │   ├── mom.png [file]
           63     │   └── son.png [file]
           64     ├── hello.txt [file]
           65     └── notes [index]
           66         ├── memories.txt [file]
           67         └── tricks.txt [file]
           68 
           69 Pretty simple. You could however create a more difficult architecture by making
           70 `.gph` point to other files not in their directories and such.. but that's not
           71 the point here.
           72 
           73 ## the protocol
           74 
           75 To put it simply, each gopher "line" is composed of 5 distinct parts:
           76 
           77     <type><description>        <path>        <server>        <port>
           78 
           79 So each line is a link to another file, which could be on any server.
           80 
           81 * &lt;type&gt; : type of the line, usualy the type of the file pointed to
           82 * &lt;description&gt; : just text, to describe what the link points to
           83 * &lt;path&gt; : path to the item, from gopher's server root
           84 * &lt;server&gt; : the server which hosts the file
           85 * &lt;port&gt; : the port on which the server is listenning
           86 
           87 A gopher index is then just a list of links, each one pointing to a file which
           88 can be anywhere accross the world. And you don't need any unreadable markup
           89 language for this!
           90 
           91 ## file types
           92 
           93 The gopher protocol implements a rudimentary filetype thingy, by putting a
           94 character at the beginning of each line, indicating what the "item" points to.
           95 For example:
           96 
           97     0this is a file        /path/to/the/file        domain.tld        port
           98     1this is an index        path/to/the/index        domain.tld        port
           99     9this is a binary file        /path/to/the/binary        domain.tld        port
          100     Ithis is an image        /path/to/the/image        domain.tld        port
          101 
          102 There is also a special type: 'i', which doesn't point to anything, so it is
          103 only used to display text:
          104 
          105     iThe following is a set of cat pictures        Err        domain.tld        port
          106     Icat1.png        /img/cats/1.png        domain.tld        port
          107     Icat2.png        /img/cats/2.png        domain.tld        port
          108     Icat3.png        /img/cats/3.png        domain.tld        port
          109     Icat4.png        /img/cats/4.png        domain.tld        port
          110 
          111 ## gopher holes
          112 
          113 Gopher spaces are commonly named "holes". All you need now is a gopher to crawl
          114 this huge gallery. Here are a few I recommend:
          115 
          116 * gopher - http://gopher.quux.org:70/give-me-gopher/
          117 * cgo - https://github.com/kieselsteini/cgo
          118 
          119 Or you could use an HTTP proxy : http://gopher.floodgap.com/gopher/
          120 
          121 ## final thoughs
          122 
          123 As you might have noticed (or not), I run my own gopher hole. I first wanted to
          124 move this whole blog over gopher, but finally decided to keep it as is (because
          125 I'm kind of attached to it after all!), and use my gopher space to share some
          126 quick thoughs & notes about POSIX systems and other IT related subjects.
          127 
          128 Because of this, I might reduce the freequency of posts I publish here, in favor
          129 of more notes on my gopher space. So see you there!
          130 
          131     gopher://z3bra.org