-- Leo's gemini proxy

-- Connecting to clifton.kaznocha.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini; charset=utf-8; lang=en

                                                                             _|
                    _|_|_|  _|  _|      _|_|    _|                          _|
      ____        _|        _|        _|      _|_|_|_|    _|_|    _|_|_|        _|_|_|
     |    |       _|        _|  _|  _|_|_|_|    _|      _|    _|  _|    _|    _|_|
     |____|       _|        _|  _|    _|        _|      _|    _|  _|    _|        _|_|
    /      \        _|_|_|  _|  _|    _|          _|_|    _|_|    _|    _|    _|_|_|
   /  __    \
  /  / /     \      _|_|_|                                          _|
 /  /_/       \   _|          _|_|_|  _|_|_|      _|_|_|  _|    _|  _|    _|_|
/______________\  _|        _|    _|  _|    _|  _|_|      _|    _|  _|  _|_|_|_|
\______________/  _|        _|    _|  _|    _|      _|_|  _|    _|  _|  _|
                    _|_|_|    _|_|_|  _|_|_|    _|_|_|      _|_|_|  _|    _|_|_|
                                      _|
                                      _|


A New Gemini Server Framework

November 06, 2021


I've been interested in the Gemini protocol for a little bit. It reminds me of GeoCities and how fun the internet was when you could just FTP an HTML file to some free host. The regular internet is different now, that's fine, it's just different. I have a little bit of motivation to work on FOSS in my free time these days and some ideas...


I'm starting with a Gemini server framework for Go. There are already lots of Gemini server frameworks and several of them are for Go so why am I making another one?


I got to start somewhere. My ultimate goal is not to make a server framework but I can't make what I want without one. I genuinely enjoy implementing network protocols. The more esoteric the better I suppose. I've done a few for real jobs and they’ve always been my favorite projects.


The Go stdlib net/http package is great but it could be better. Most of the Gemini packages I've looked at try to match net/http as close as possible. Lots of learning has happened since net/http was created and the language has evolved. The Go stdlib is beholden to decisions it made a long time ago but I'm not. I've spent a lot of time thinking about and debating net/http with some very smart folks. I'm not talking about anything major here, just little differences. It's also important to me that Gemini is not HTTP, I want to do what makes sense for Gemini. Besides, there's always room for more. People are still making new HTTP frameworks, I've done it. That's a cool thing about FOSS.


My server framework is ready for release. I'm calling it `gemini` because why not. It's currently running this capsule. Here's an example of a simple "hello world" server:


package main

import (
	"context"
	"fmt"
	"log"

	"clifton.kaznocha.net/gemini" // URL TBD.
)

func main() {
	mux := gemini.NewServeMux()
	mux.HandleFunc("/", func(ctx context.Context, w gemini.ResponseWriter, r *gemini.Request) {
		fmt.Fprintln(w.Success(ctx, ""), "Hello, Gemini!")
	})

	server := &gemini.Server{Handler: mux}
	log.Fatal(server.ListenAndServeTLS("localhost:1965", "cert.pem", "key.pem"))
}

I'm not publishing the package just yet. Not because it needs more work but because I'm still not sure where I want to publish it. I've been lurking the Gemini mailing list and there are lots of opinions about source hosting platforms. I want to put it somewhere that will be the most comfortable for Geminauts, I just don't know where that is... yet.


There are a few things I want to hack on now that my server framework is in decent shape:


A loadbalancer. Gemini's use of client certs for identity makes this tricky. That's why I think it'll be fun to build.

A server benchmarking tool. I wanna know if the things I make are going to be fast on the cheap servers I use.

Add Titan support to my server framework.

Something still secret but should be super cool 🤫


-- Clifton


🔙 Gemlog

🏡 Capsule Home

A New Gemini Server Framework © 2021 by Clifton Kaznocha is licensed under CC BY 4.0.

View a copy of this license

-- Response ended

-- Page fetched on Fri May 3 12:20:26 2024