s3cache

package module
v0.0.0-...-1d07f65 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2018 License: MIT Imports: 11 Imported by: 1

README

GoDoc Build Status Coverage Status Go Report Card

autocert-s3-cache

AWS S3 cache for acme/autocert written in Go.

Example

cache, err := s3cache.New("eu-west-1", "my-bucket")
if err != nil {
  // Handle error
}

m := autocert.Manager{
  Prompt:     autocert.AcceptTOS,
  HostPolicy: autocert.HostWhitelist("example.org"),
  Cache:      cache,
}

s := &http.Server{
  Addr:      ":https",
  TLSConfig: &tls.Config{GetCertificate: m.GetCertificate},
}

s.ListenAndServeTLS("", "")

Documentation

Overview

Package s3cache implements an autocert.Cache to store certificate data within an AWS S3 bucket.

See https://godoc.org/golang.org/x/crypto/acme/autocert

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// Prefix is used to prefix every objects key cached in s3.
	Prefix string
	// Logger is used for debug logging.
	Logger Logger
	// contains filtered or unexported fields
}

Cache provides a s3 backend to the autocert cache.

func New

func New(region, bucket string) (*Cache, error)

New creates an s3 instance that can be used with autocert.Cache. It returns any errors that could happen while connecting to S3.

func NewWithProvider

func NewWithProvider(p client.ConfigProvider, bucket string) (*Cache, error)

NewWithProvider creates a new s3 autocert.Cache from a client.ConfigProvider.

func NewWithS3

func NewWithS3(s3 s3iface.S3API, bucket string) (*Cache, error)

NewWithS3 creates a new s3 autocert.Cache from a s3iface.S3API.

func (*Cache) Delete

func (c *Cache) Delete(ctx context.Context, key string) error

Delete removes a certificate data from the cache under the specified key.

func (*Cache) Get

func (c *Cache) Get(ctx context.Context, key string) ([]byte, error)

Get returns a certificate data for the specified key.

func (*Cache) Put

func (c *Cache) Put(ctx context.Context, key string, data []byte) error

Put stores the data in the cache under the specified key.

type Logger

type Logger interface {
	Printf(format string, v ...interface{})
}

Logger for outputing logs.

Jump to

Keyboard shortcuts

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