-- Leo's gemini proxy

-- Connecting to gemini.ctrl-c.club:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

sr-71, a small web server


                                 ,
                                dMb,
                              ,dMMMMb,          ,,
                           ,dMMMMMMMMMb, eeee8888"
                        ,mMMm!!!!XXXXMMMMM"""
                      ,d!!XXMMXX88888888W"
                     `MX88dMM8888WWWMMMMMMb,
                         '""MMMMMMMMMMMMMMMMb
                           MMMMMMMMMMMMMMMMMMb,
                          dMMMMMMMMMMMMMMMMMMMMb,,
              _,dMMMMMMMMMMXXXX!!!!!!!!!!!!!!XXXXXMP
         _,dMMXX!!!!!!!!!!!!!!!!!!XXXXX888888888WWC
     _,dMMX!!!MMMM!!!!!!!!XXXXXX888888888888WWMMMMMb,
    dMMX!!!!!MMM!XXXXXX88888888888888888WWMMMMMMMMMMMb
   dMMXXXXXX8MMMM88888888888888888WWWMMMMMMMMMMMMMMMMMb    ,d8
   MMMMWW888888MMMMM8888888WWMMMMMMMMMMMMMMMMMMMMMMMMMMM,d88P'
    YMMMMMWW888888WWMMMMMMMMMMP"""'    `"YMMMMMMMMMMMXMMMMMP
       `""YMMMMMMMMMMMMMP""'            mMMMm!XXXXX8888888e,
                                      ,d!!XXMM888888888888WW
                                     "MX88dMM888888WWWMMMMMMb
                                          """``'"YMMMMMMMYMMM
                                                     `"YMMMMM
                                                        `"YMP

The last airplane designed without the use of electronic calculators, the SR-71 was developed from concept to first flight in just over 2 years. It flew higher and faster than any jet of its time holding the speed record to this day, and pioneered low-observability (stealth) characteristics.


This sr-71 project is a small web server, able to host your pages on the gemini, gopher, spartan, nex, and finger protocols.


Getting it


sr-71 is a single-package go project, so using the go toolchain installing is as simple as:


go install tildegit.org/tjp/sr-71@latest

Currently binaries are not made available for download, so the go command is a requirement.


Running it


sr-71 requires a configuration file, the path of which is provided as the only command-line argument.


sr-71 /path/to/sr71.conf

Highlights


sr-71 isn't just a multi-protocol static file server. It also features:

virtualhosting on protocols which support it

SNI support when virtualhosting with TLS

CGI

extensions to the gophermap format borrowed from gophernicus

automatic generation of atom resources from subscribable gemini pages

privilege dropping

client TLS certificate authentication

support for titan (the gemini "write" companion protocol) with separately-configurable auth

git repository viewers with overridable templates

user-specific paths for shared hosting environments


Configuration File


The format of the config file is designed to be straightforward, and human-readable and -writable.


Here's a simple configuration that would get you off the ground:


systemuser nobody

gemini {
	host myhostname.com, gemini.myhostname.com
	servertls key /path/to/tls/keyfile cert /path/to/tls/certfile

	static /var/gemini at / with dirdefault index.gmi, dirlist
}

gopher {
	host myhostname.com

	static /var/gopher at / with dirdefault gophermap, dirlist, extendedgophermap
}

spartan {
	host myhostname.com

	static /var/spartan at / with dirdefault index.gmi, dirlist
}

finger {
	static ~/.finger
}

With the above configuration, sr-71 will:

drop privileges to the "nobody" user

respond to any gemini requests to the domains myhostname.com or gemini.myhostname.com by reading files out of /var/gemini

for gemini directory requests, it will first look for an index.gmi file, then fall back to listing the directory's contents in gemtext

serve gopher by reading out of /var/gopher

for gopher directory requests, it will look for a file called "gophermap", then fall back to listing the contents as gopher menu

for any gopher files, it will apply the "extended gophermap" parsing (see REFERENCE.gmi)

serve spartan by reading files from /var/spartan (perhaps imagine this being a symlink to /var/gemini)

serve spartan directory requests by looking for index.gmi and falling back to a directory listing

serve finger requests by reading a ".finger" file in the requested user's home directory


More information is in the reference documentation


-- Response ended

-- Page fetched on Tue May 21 12:04:05 2024