~ancarda/tls-redirector

2.4: Nice looking HTML error pages

This commit changes tls-redirector to output descriptive, nice looking
HTML error pages rather than the one-line text it used to output. This
is aimed at providing any would-be visitors with information indicating
why they are seeing pages from tls-redirector, and not the website
they (presumably) intended to visit.

The HTML is compiled into the binary by using `go generate' to copy
files on disk into constants.
Run `go build' and `strip' in one layer

Since `go build' will produce a new layer, the later layers will always
run, so we may as well run them in one go.
Sync with PicoTest's CONTRIBUTING file

This adds a short note about GitHub needing accounts and non-free
JavaScript to use.
Run `go mod download' before COPY *

This commit makes `docker build' faster by allowing third party
dependencies to be cached provided the go.{mod,sum} files do not
change and the layers previous to that haven't changed (i.e. version of
Go or Alpine Linux).

Without an explicit download step, `go build' will fetch dependencies.
This is normally skipped the next time you invoke the command, but with
Docker, there will never be a "next time" as the COPY command, provided
there are changes, will result in a new layer.

It's only necessary to pull down dependencies if they have changed,
therefore the build step is now exclusively for compiling and not
pulling down dependencies.
Run `apk add' before COPY

This commit makes `docker build' much faster by allowing the `apk add'
layer to be cached.
Lowercase constants

This commit fixes a golint warning -- the exit constants should not be
uppercased as they aren't exported.
Replace unversioned tags

This commit replaces all the unversioned tags with specific versions as
this should be more stable and easier to debug.
2.3

This commit finishes version 2.3. For release notes, see the tag that points
at this commit.
Lowercase license README shield
Add basic contributing guidelines

Issue: https://todo.sr.ht/~ancarda/tls-redirector/5
Pull in dependencies when building container

Recent changes to break up the project and add tests has resulted in Dockerfile
no longer building a container. This commit changes the script to copy
everything so the internal package `socketactivation' is pulled in as well as
go.{mod,sum}.

Additionally, `strip' from `binutils' was pulled in so the resulting binary
is smaller.
Switch to displaying the SPDX License identifier
Migrate to builds.sr.ht

This commit completes the move away from GitHub and other proprietary software!
Improve test coverage

This commit rewrites the `handleCliArgs' function to accept an `io.Writer'
rather than writing directly to stdout.

Additionally, minor tweaks were made to other test files to improve coverage
or the quality of the tests.
Lift default port into a constant
Don't check for number of listeners

This commit removes some dead code in `socketactivation/enabled.go'. Because
the number of listeners is already checked in `main()', the error message that
socketactivation generates for len(listeners) != 1 is never executed.
Move socket activation code out to its own package

This commit creates a new subpackage called socketactivation that houses the
wrapper around `github.com/coreos/go-systemd/activation'. Much of the existing
code was namespaced in some way -- files started with "socket_activation_" and
variables being prefixed with `sa'.

This commit massively cleans up that mistake by correctly namespacing.
Resolve lint warnings

This commit resolves all issues found by golint (`golang.org/x/lint/golint').
The `App' struct is no longer exported, and some variable names have changed.
Add unit tests to the HTTP handler

This commit introduces some unit tests for http.go by pulling in a filesystem
abstraction (`github.com/spf13/afero') and using that to test the reading of
ACME HTTP challenges.

Issue: https://todo.sr.ht/~ancarda/tls-redirector/2
Declare dependencies in Go module files

Issue: https://todo.sr.ht/~ancarda/tls-redirector/16
Improve detection of IPv6 addresses

This commit strips the square brackets that IPv6 addresses can be in when a
port number is suffixed on the end. The presence of these square brackets
would cause the `net.ParseIP' function to (correctly) determine the string to
not be an IP address.

If an IPv6 address with a port number is sent, it is already handled because
the `net.SplitHostPort' function is able to detect that. This commit fixes the
edge case where no port number is present, but square brackets are.

Issue: https://todo.sr.ht/~ancarda/tls-redirector/4
Next