srv

command module
v0.0.0-...-66aa6d5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2020 License: BSD-3-Clause Imports: 14 Imported by: 0

README

srv

Srv is a simple static file server. It accepts a directory path as input from which it will serve any requested file.

It optionally supports TLS encryption using Let's Encrypt and autocert. The server supports clean shutdown by trapping OS signals and subsequently forcing the serve to shut down gracefully.

The server comes with sane read/write and idle timeouts to ensure safe behaviour when exposed to the internet.

When run on Linux, the server supports the use of systemd sockets by specifying the listener address as a socket name, prefixed with "systemd:".

Usage

$ go get github.com/hexaflex/srv

To serve contents in the current working directory on localhost:

$ srv

To serve a specific directory on a fixed address/port:

$ srv -addr ":8080" assets/

To use TLS encryption, specify the -tls flag. Note that this will only work when the server is accessible through a public domain:

$ srv -tls -addr "mydomain.org:8080" assets/

When using TLS, certificates are cached in $TEMP/srv-certs.

License

Unless otherwise stated, this project and its contents are provided under a 3-Clause BSD license. Refer to the LICENSE file for its contents.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL