redicrypt

package module
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: MIT Imports: 7 Imported by: 0

README

redicrypt

A LetsEncrypt cert cache for redis

redicrypt is a drop-in replacement for the default autocert.DirCache in the acme package.

Install:
go get github.com/cohix/redicrypt

OR:

gvt fetch github.com/cohix/redicrypt
Example:
import (
	"github.com/cohix/redicrypt"
)

[...]

certCache, err := redicrypt.RediCryptWithAddr("redis:6739")
if err != nil {
	os.Exit(1)
}

m := &autocert.Manager{
	Cache:      certCache,
	Prompt:     autocert.AcceptTOS,
	HostPolicy: autocert.HostWhitelist(hosts...),
}

redicrypt is useful to circumvent LetsEncrypt rate limits when ephemeral containers requesting the same certs are in use. A persistent redis instance caching the cert files will allow containers to request the same certs across multiple invocations without needing to persist any of their filesystem.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RediCrypt

type RediCrypt struct {
	Addr   string
	Conn   redis.Conn
	Logger io.Writer
}

func RediCryptWithAddr

func RediCryptWithAddr(addr string) (*RediCrypt, error)

func (*RediCrypt) Delete

func (rc *RediCrypt) Delete(ctx context.Context, name string) error

Delete removes the specified redis key.

func (*RediCrypt) Get

func (rc *RediCrypt) Get(ctx context.Context, name string) ([]byte, error)

Get reads certificate data from redis.

func (*RediCrypt) Put

func (rc *RediCrypt) Put(ctx context.Context, name string, data []byte) error

Put writes certificate data to redis.

Jump to

Keyboard shortcuts

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