💾 Archived View for gemini.ctrl-c.club › ~tjp › c › sliderule captured on 2024-02-05 at 10:17:09. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-11-04)

-=-=-=-=-=-=-

sliderule: The small web toolkit for Go

sliderule is the toolkit for working with the small web in Go.

 _____________________________________________________________
|  |"!"|"!"|"!"|"!"|"!"|"!"|"!"|"!"|"!"|"!"|"!"|"!"|"!"|"!"|  |
|  0   1   2   3   4   5   6   7   8   9  10  11  12  13   4  |
|---------------------------=====+=====-----------------------|
|___:981,:,!,,2::!:3n:4:5:6|7891:|:!:!2|:!.3:!:4!5:67891!:!___|mmm
    |   |891"!"|""2""|"3n|4|5"6|7891"!"|"|2""!"3"|"4|5"67891"!|   |
    |                      |     I     |                          |
 ___|___9:1:1c2:3:4:5:67892|::!::|3n:C:|4::!:5:::6::7::8:9:1:1c___|
|   9!1"1"2"3"4"5"67892"|"||""3n"|""4""|"5"!"6""7""8"9"1"1    |===
|__________________________|_____|__apx|______________________|
                            =====+=====

You still have to write your server, but you can focus on the logic you want to implement knowing the protocol is already dealt with. It's been said of gemini that you can write your server in a day. Now you can write it in well under an hour.

The slide rule

sliderule is named after the iconic instrument used to perform approximate mathematical calculations before the advent of handheld electronic calculators. It was the predominant tool that identified an engineer during project Gemini, a sort of developer's tool of it's time.

The "sliderule" package

sliderule is carefully structured as composable building blocks. The top-level package defines the framework in which servers and clients can be built.

Protocols

The packages sliderule/gemini, sliderule/gopher, sliderule/finger, and sliderule/spartan provide concrete implementations specific to those protocols.

The primary text formats for those protocols have higher-level support provided in sub-packages:

Sub-packages in the text formats provide conversion functions to HTML, markdown, and Atom XML, using overridable templates.

Logging

sliderule borrows the logging interface from go-kit.

The logger interface from go-kit/log.

The sliderule/logging package provides everything you need to get a good basic start to producing helpful logs.

Routing

The router in the sliderule package supports slash-delimited path pattern strings. In the segments of these patterns:

Router also supports maintaining a list of middlewares at the router level, mounting sub-routers under a pattern, looking up the matching handler for any request, and of course acting as a Handler itself.

sliderule/contrib/*

This is where useful building blocks themselves start to come in. Sub-packages of contrib include Handler and Middleware implementations which accomplish the things your servers actually need to do.

The sub-packages include:

Tools

The tools directory contains main packages that implement useful cli tools for working with the small web. You can install them all at once with:

go install tildegit.org/tjp/sliderule/tools/...

They all have useful output when given the -h/--help flag.

Get it

Using sliderule in your project

To add it to your own go project:

$ go get tildegit.org/tjp/sliderule

Straight to the code please

The code is hosted here on tildegit.

The generated documentation is on the go package index.

Verify releases

Releases are signed with minisign. The signature file is included in the release downloads page, and the public key is RWSzQywJwHgjSMD0y0RXwXAGpapcMJplwbCVYQqabhAJ+NAnKAeh98Vb - this is also referenced on tjp's gemini home page.

tjp's home page, which also mentions the public key used for signing sliderule releases.

Previously

This project used to be called "gus", and the original project's old issues can be found at:

https://tildegit.org/tjp/gus

Contribute

There's lots still to do, and contributions are very welcome!

submit an issue or pull request on the tildegit repository,

send me an email directly,

or poke me on IRC: I'm @tjp on irc.tilde.chat where you'll find me in #gemini