An open API service indexing awesome lists of open source software.

https://github.com/twmb/tlscfg

Easy *tls.Config initialization for Go
https://github.com/twmb/tlscfg

Last synced: about 1 year ago
JSON representation

Easy *tls.Config initialization for Go

Awesome Lists containing this project

README

          

tlscfg
=====

This repo provides an option-driven Go package that simplifies initializing a
well configured `*tls.Config`.

Initializing a `*tls.Config` is a rote task, and often good, secure defaults
are not so obvious. This package aims to eliminate the chore of initializing a
`*tls.Config` correctly and securely.

New returns a valid config with system certificates and tls v1.2+ ciphers. The
With functions can be used to further add certificates or override settings as
appropriate.

Usage:

```go
cfg, err := tlscfg.New(
tlscfg.MaybeWithDiskCA( // optional CA
*flagCA,
tlscfg.ForClient,
),
tlscfg.WithDiskKeyPair( // required client cert+key pair
"cert.pem",
"key.pem",
),
)
if err != nil {
// handle
}
```