acmetest

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: BSD-3-Clause Imports: 26 Imported by: 0

Documentation

Overview

Package acmetest provides types for testing acme and autocert packages.

TODO: Consider moving this to x/crypto/acme/internal/acmetest for acme tests as well.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CAServer

type CAServer struct {
	// contains filtered or unexported fields
}

CAServer is a simple test server which implements ACME spec bits needed for testing.

func NewCAServer

func NewCAServer(t *testing.T) *CAServer

NewCAServer creates a new ACME test server. The returned CAServer issues certs signed with the CA roots available in the Roots field.

func (*CAServer) ChallengeTypes

func (ca *CAServer) ChallengeTypes(types ...string) *CAServer

ChallengeTypes sets the supported challenge types.

func (*CAServer) ExternalAccountRequired

func (ca *CAServer) ExternalAccountRequired() *CAServer

ExternalAccountRequired makes an EAB JWS required for account registration.

func (*CAServer) IssuerName

func (ca *CAServer) IssuerName(name pkix.Name) *CAServer

IssuerName sets the name of the issuing CA.

func (*CAServer) LeafCert

func (ca *CAServer) LeafCert(name, keyType string, notBefore, notAfter time.Time) *tls.Certificate

LeafCert issues a leaf certificate.

func (*CAServer) Resolve

func (ca *CAServer) Resolve(domain, addr string)

Resolve adds a domain to address resolution for the ca to dial to when validating challenges for the domain authorization.

func (*CAServer) ResolveGetCertificate

func (ca *CAServer) ResolveGetCertificate(domain string, f getCertificateFunc)

ResolveGetCertificate redirects TLS connections for domain to f when validating challenges for the domain authorization.

func (*CAServer) ResolveHandler

func (ca *CAServer) ResolveHandler(domain string, h http.Handler)

ResolveHandler redirects HTTP requests for domain to f when validating challenges for the domain authorization.

func (*CAServer) Roots

func (ca *CAServer) Roots() *x509.CertPool

Roots returns a pool cointaining the CA root.

func (*CAServer) Start

func (ca *CAServer) Start() *CAServer

Start starts serving requests. The server address becomes available in the URL field.

func (*CAServer) URL

func (ca *CAServer) URL() string

URL returns the server address, after Start has been called.

Jump to

Keyboard shortcuts

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