phetch is a terminal Gopher client designed to help you quickly navigate the Gophersphere securely. It includes support for browsing via TLS or Tor proxy, but can also be used the old fashioned way. The menu-based interface is driven entirely by your keyboard, and emphasis has been put on swiftness of navigation. Both "jump to link" and incremental search options are available.
We don't use any ncurses-style library for drawing but instead do
it manually, mainly in
UI. This is the application class that
prints to the screen and manages the loaded Gopher "views".
Meanwhile, the bulk of the menu system, responding to user
input, and rendering of the colored interface itself takes place
Menu view. The two work hand-in-hand.
This crate includes its own Gopher parsing and fetching library, which may eventually get extracted. It seems that most existing Gopher libraries in Rust allow you to parse menu lines individually into items, but phetch needs to know about the links' relationships to each other for its navigation/numbering/cursor system to work. So phetch parses all the lines in a Menu as a whole and knows which link is which.
Finally, a note on the code itself: this is not my first Rust program, but you probably wouldn't know that by looking at it! Suggestions and improvements are more than welcome.
args::parse() is used to parse command line arguments into a Config structure.
Bookmarks are enabled if you create a ~/.config/phetch/ directory
manually. They are stored as a simple Gophermap,
Terminal colors. Provides a macro to color text as well as sturcts to get their raw ansi codes.
phetch will load
phetch's Gopher library contains a few phetch-specific features: the ability to make requests or downloads over TLS or Tor, cleaning Unicode control characters from Gopher responses, and URL parsing that recognizes different protocols like telnet and IPv6 addresses.
phetch will append every URL visited to a Gophermap if a
The Menu is a View representing a Gopher menu. It renders the colorful representation, manages the cursor and selection state, and responds to input like the UP and DOWN arrows or other key combinations.
The phetchdir is
The terminal module mostly provides terminal escape sequences for things like clearing the screen or going into alternate mode, as well as raw mode borrowed from crossterm.
A View representing a Gopher text entry. Responds to user input by producing an Action which is then handed to the main UI to perform.
The UI is what drives the interactive phetch application: it spawns threads to fetch Gopher pages and download binary files, it manages the opened pages (Views), it asks the focused View to respond to user input, and it performs actions based on what the View returns - like opening a telnet client, or displaying an error on the status line.
Helper functions and macros.
Is the NO_COLOR env variable set? https://no-color.org/
Where to file issues. We try to catch and display all errors nicely, but if we have to crash we will try to show this.
Date when this release was built.
Git SHA of current build.
Current OS. Used to check for updates.
Whether we compiled with TLS support.
Whether we compiled with Tor support.
Current version of phetch.