# Gopher

Gopher is a network [protocol](protocol.md) for publishing, browsing and downloading files and is known as a much simpler alternative to the [World Wide Web](www.md) (i.e. to [HTTP](http.md) and [HTML](html.md)). In fact it competed with the Web in its early days and even though the Web won in the mainstream, gopher still remains used by a small community. Gopher is like the Web but well designed, it is the [suckless](suckless.md)/[KISS](kiss.md) way of doing what the Web does, it contains practically no [bloat](bloat.md) and so [we](lrs.md) highly advocate its use. Gopher inspired creation of [Gemini](gemini.md), a similar but bit more complex and "[modern](modern.md)" protocol, and the two together have recently become the main part of so called [Smol Internet](smol_internet.md).

As of 2022 the Veronica search engine reported 343 gopher servers in the world with 5+ million indexed selectors.

Gopher **doesn't use any [encryption](encryption.md)**. This is good, encryption is [bloat](bloat.md). Gopher also **only uses [ASCII](ascii.md)**, i.e. there's no [Unicode](unicode.md). That's also good, Unicode is bloat (and mostly serves trannies to insert emojis of pregnant men into readmes, we don't need that). Gopher simple design is intentional, the authors deemed simplicity a good feature. Gopher is so simple that you may very well write your own client and server and comfortably use them (it is also practically possible to browse gopher without a specialized client, just with standard [Unix](unix.md) [CLI](cli.md) tools).

From the user's perspective the most important distinction from the Web is that gopher is based on **menus** instead of "webpages"; a menu is simply a column of items of different predefined types, most importantly e.g. a *text file* (which clients can directly display), *directory* (link to another menu), *text label* (just shows some text), *binary file* etc. A menu can't be formatted or visually changed, there are no colors, images, scripts or [hypertext](hypertext.md) -- a menu is not a presentation tool, it is simply a navigation node towards files users are searching for (but the mentioned ASCII art and label items allow for somewhat mimicking "websites" anyway). Addressing works with [URLs](url.md) just as the Web, the URLs just differ by the protocol part (`gopher://` instead of `http://`), e.g.: `gopher://gopher.floodgap.com:70/1/gstats`. What on Web is called a "website" on gopher we call a **gopherhole** (i.e. a collection of resources usually under a single [domain](domain.md)) and the whole gopher network is called a **gopherspace**. [Blogs](blog.md) are common on gopher and are called **phlogs** (collectively a *phlogosphere*). As menus can refer to one another, gopher creates something akin a **global [file system](file_system.md)**, so browsing gopher is like browsing folders and can comfortably be handled with just 4 arrow keys. Note that as menus can link to any other menu freely, the structure of the "file system" is not a [tree](tree.md) but rather a general [graph](graph.md). Another difference from the Web is gopher's great emphasis on **[plaintext](plaintext.md) and [ASCII art](ascii_art.md)** as it cannot embed images and other media in the menus (even though of course the menus can link to them). There is also a support for sending text to a server so it is possible to implement [search engines](search_engine.md), guest books etc.

Gopher is just an [application layer](l7.md) [protocol](protocol.md) (officially running on [port](port.md) 70 assigned by [IANA](iana.md)), i.e it sits above lower layer protocols like [TCP](tcp.md) and takes the same role as [HTTP](http.md) on the Web and so only defines how clients and servers talk to each other -- the gopher protocol doesn't say how menus are written or stored on servers. Nevertheless for the creation of menus so called **gophermaps** have been established, which is a simple format for writing menus and are the gopher equivalent of Web's [HTML](html.md) files (just much simpler, basically just menu items on separate lines, the exact syntax is ultimately defined by server implementation). A server doesn't have to use gophermaps, it may be e.g. configured to create menus automatically from directories and files stored on the server, however gophermaps allow users to write custom menus manually. Typically in someone's gopherhole you'll be served a welcoming intro menu similar to a personal webpage that's been written as a gophermap, which may then link to directiories storing personal files or other hand written menus. Some gopher servers also allow creating dynamic content with scripts called **moles**.

**Gopher [software](software.md)**: sadly "[modern](modern.md)" browsers are so modern they have millions of lines of code but can't be bothered to support such a trivial protocol like gopher, however there are Web proxies you can use to explore gopherspace. Better browsers such as [lynx](lynx.md) (terminal) or [forg](forg.md) ([GUI](gui.md)) can be used for browsing gopherspace natively. As a server you may use e.g. Gophernicus (used by [SDF](sdf.md)) or search for another one, there are dozens. For the creation of gophermaps you simply use a plaintext editor. **Where to host gopher?** [Pubnixes](pubnix.md) such as [SDF](sdf.md), [tilde.town](tilde_town.md) and [Circumlunar community](circumlunar.md) offer gopher hosting but many people simply [self-host](self_hosting.md) servers e.g. on [Raspberry Pis](rpi.md), it's pretty simple.

## Example

TODO