A gophermap file is a means of defining menus for gopher content. The gophermap provides a virtual view of the content available allowing one to rename files, hide them, or even link to content on other servers. The gophermap is supported by both Bucktooth and PyGopherd. These servers must perform some processing on the gophermap file before sending the menu back to the client. For example, Bucktooth will send any RFC 1436 compliant line to the client. Since it would be a major drag to always have to type things out in full, Bucktooth allows the following shortcuts:
- If you don't specify a port, Bucktooth provides the one your server is using (almost always 70).
- If you don't specify a host, Bucktooth provides your server's hostname.
- If you only specify a relative selector and not an absolute path, Bucktooth sticks on the path they're browsing.
gophermap File Format
The gophermap file consists of zero or more lines containing lines that can be one of the following types.
- Comment Lines
Comment lines contain plaintext without any tabs. These are sent unchanged to the client and can be used for descriptions or for welcome banners.
- Selector Lines
Selector lines are tab-delimited records that specify all the information a gopher client needs to retrieve the particular resource including the itemtype, display string, server, and port. In the example below <TAB> signifies the tab character (CTRL-I, 0x09).
The above selector line generates a link to "/home" selector on gopher.floodgap.com, port 70 with an itemtype of 1 and a display string of "gopher.floodgap.com home". (The selector can be left empty. A null selector is the same as the root of the mountpoint.)
Valid itemtypes include (defined in RFC 1436)
- 0 = text
- 1 = gopher menu
- 5 = zip file
- 7 = search server
- 9 = generic binary
- I = generic image
- g = gif image
- s = sound or audio file
- h = HTML (or URL referencing any other non-gopher protocol). Note that when itemtype = h and it points to an outside URL (and not just an internal HTML file) the URL must be preceded by a literal "URL:", as shown below.
hLibrary of Congress<TAB>URL:http://www.loc.gov