tls¶
Hardened, framework-free TLS plumbing for Go — one curated, secure
crypto/tls.Config, a typed certificate Pair, ServerConfig/ClientConfig
builders, and a CertPool helper for trusting private CAs.
gitlab.com/phpboyscout/go/tls gives every Go server and client the same
opinionated, secure TLS posture without a framework in tow: a TLS 1.2 floor,
AEAD-only cipher suites, and modern curve preferences, applied consistently to both
sides of a connection. It is the TLS layer extracted from
go-tool-base, where it backs the
HTTP, gRPC and gateway transports.
Why¶
- Secure by default.
DefaultConfigfixes a TLS 1.2 minimum, six curated ECDHE-AEAD cipher suites, and X25519/P-256 curve preferences — no knobs to get wrong. See the threat model for the rationale behind every choice. - Framework-free. The only external dependency is
cockroachdb/errors. No config framework, no TUI, no OpenTelemetry — adepfootprint_test.goguard keeps the dependency graph minimal so it stays cheap to embed anywhere. - Typed values in, hardened config out. The package works entirely from typed
Pairvalues — you own how they are sourced (flags, environment, a config file). One shared certificate can serve many listeners viaResolvePair. - Mutual TLS without hand-rolling it.
client_casandclient_authon the samePairturn on server-side client-certificate verification, and every ambiguous combination either enforces more or fails to build.
What it does not do¶
It is not a PKI: no certificate issuance, no renewal, no reload of a rotated file. It does no revocation checking, presents no client certificate on the client side, and offers no way to skip verification or lower the floor. The full list, with what to do instead, is What this package does not do.
Where next¶
- Serve HTTPS with hardened defaults — from an empty directory to a working HTTPS server.
- Require a client certificate — mutual TLS end to end, including the CA.
- Harden a server & client — ALPN, private-CA trust, mTLS, rotation, and shared/per-transport resolution.
- Configuration keys — every
field of
Pair, its default, and what a wrong value does. - Errors — every message the package produces, and what to change.
- Security threat model — why the TLS floor, cipher suites, and curves are what they are.
Part of the phpboyscout Go toolkit — small, framework-free Go modules extracted from go-tool-base.
Further reading¶
The blog carries a curated route through this subject: Building a web service in Go collects everything written about it, ordered so you can start at the beginning rather than newest-first.
Ask phpbotscout

He answers questions about the projects over on the Discord, citing the docs where they already cover it, and offering to raise an issue where they don't. Bring a bug, an idea, or a questionable engineering decision.