update for cache config and readme

This commit is contained in:
dre 2021-07-10 01:09:51 +08:00
parent b61a139851
commit 6449637324
2 changed files with 7 additions and 2 deletions

View file

@ -5,11 +5,14 @@ to accompany a hugo blog served via httpd and makes it available via the [gemini
protocol](https://gemini.circumlunar.space/docs/specification.gmi). Why built yet another gemini
server? Because it's educational and that's the spirit of the protocol.
Features
**Features**
- **zero conf**, if no certificate is available, gmifs generates a self-signed cert
- **zero dependencies**, Go standard library only
- directory listing support `-autoindex`
- reloads ssl certs and reopens log files on SIGHUP, e.g. after Let's Encrypt renewal
- response writer interceptor and middleware support
- simple middleware for lru document cache
- concurrent request limiter
- KISS, single file gemini implementation, handler func in main
- modern tls ciphers (from [Mozilla's TLS ciphers recommendations](https://statics.tls.security.mozilla.org/server-side-tls-conf.json))

View file

@ -33,12 +33,13 @@ const (
func main() {
var addr, root, crt, key, host, logs string
var maxconns, timeout int
var maxconns, timeout, cache int
var debug, autoindex bool
flag.StringVar(&addr, "addr", defaultAddress, "address to listen on. E.g. 127.0.0.1:1965")
flag.IntVar(&maxconns, "max-conns", defaultMaxConns, "maximum number of concurrently open connections")
flag.IntVar(&timeout, "timeout", defaultTimeout, "connection timeout in seconds")
flag.IntVar(&cache, "cache", 0, "simple lru document cache for n items. Disabled when zero.")
flag.StringVar(&root, "root", defaultRootPath, "server root directory to serve from")
flag.StringVar(&host, "host", defaultHost, "hostname / x509 Common Name when using temporary self-signed certs")
flag.StringVar(&crt, "cert", defaultCertPath, "TLS chain of one or more certificates")
@ -71,6 +72,7 @@ func main() {
mux := gemini.NewMux()
mux.Use(middleware.Logger(flogger))
mux.Use(middleware.Cache(64))
mux.Handle(gemini.HandlerFunc(fileserver.Serve(root, autoindex)))
server := &gemini.Server{