Gemini on Caddy

I’ve posted before about wanting Caddy to support the Gopher protocol, presumably through a plugin, and that’s something I would still like to see happen.

However, what is now higher priority for me is the Gemini protocol. It’s an experimental effort to write a modern Gopher-like protocol, lighter/simpler than the Web, but including a few more features than Gopher, such as hyperlinks and mandatory TLS encryption.

Because Gopher is just plaintext, it’s easier to write software for and run on ancient/antique computers, but it’s worse for privacy.

Gemini requiring TLS seems it would benefit greatly from Caddy and its effortless TLS certificate renewals etc.

How would one go about writing a plugin for Caddy to support the Gemini protocol? I’m a total noob who hasn’t written a single line of Go yet, so I probably should not spearhead such an effort, but I am interested in seeing if there is some way I could help if someone else is interested.

P.S. if you want a good Gemini client, I’ve been enjoying Castor. It’s a basic graphical client written in Rust, and although it’s rather alpha and unpolished, it’s under active development and already works well on my Mac and Linux computers.

Here’s a more comprehensive list of Gemini-related software.

Worth noting is The Unsinkable Molly Brown, a Gemini server written in Go.

I looked at the gemini link but haven’t dived into the spec – I assume it doesn’t run on HTTP, so you probably wouldn’t write a module that integrates with Caddy’s existing http app.

Basically you’d write a new App module, as per the instructions here:

Take note of the little section called “Apps” on that page: https://caddyserver.com/docs/extending-caddy#apps

(I’m hoping to get around to expanding that one page into a whole section maybe this week or next.)

Basically, an app module has Start and Stop methods, and you’ll use an additional method Provision to set up guest modules. I haven’t read into how gemini works so I have no clue there, but feel free to post design docs and we can have a discussion if you want!

You won’t have to re-do the TLS stuff, since Caddy’s existing tls app is used to load and manage certificates: https://pkg.go.dev/github.com/caddyserver/caddy/v2/modules/caddytls?tab=doc

Once your gemini module knows the hostnames for which to manage certificates, you need only call ctx.App("tls") to get the tls app, then call its Manage method.

Your module will likely need to take a list of TLS Connection Policies so that the user can configure the TLS server. It has a method to give you a standard tls.Config.

1 Like

Thank you for the detailed guidance! I’ll read through these docs and the Gemini docs and see what I can figure out. I’m not optimistic about my abilities here, but Gemini is designed to be simple enough for individuals to implement, so maybe there’s hope.

Mostly I am hoping someone with more experience shows up.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.