tlstest

package
v0.0.0-...-1b709f2 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package tlstest contains code to help test Tailscale's TLS support without depending on real WebPKI roots or certificates during tests.

Index

Constants

View Source
const (
	ProxyServer = Domain("proxy.tstest")

	// ControlPlane is a domain name for a test control plane server.
	ControlPlane = Domain("controlplane.tstest")

	// Derper is a domain name for a test DERP server.
	Derper = Domain("derp.tstest")
)

ProxyServer is a domain name for a hypothetical proxy server.

Variables

This section is empty.

Functions

func TestRootCA

func TestRootCA() []byte

TestRootCA returns a self-signed ECDSA root CA certificate (as PEM) for testing purposes.

Typical use in a test is like:

bakedroots.ResetForTest(t, tlstest.TestRootCA())

Types

type Domain

type Domain string

Domain is a fake domain name used in TLS tests.

They don't have real DNS records. Tests are expected to fake DNS lookups and dials for these domains.

func (Domain) CertPEM

func (d Domain) CertPEM() []byte

CertPEM returns a PEM-encoded certificate for the domain.

func (Domain) KeyPEM

func (d Domain) KeyPEM() []byte

KeyPEM returns a PEM-encoded private key for the domain.

func (Domain) ServerTLSConfig

func (d Domain) ServerTLSConfig() *tls.Config

ServerTLSConfig returns a TLS configuration suitable for a server using the KeyPair's certificate and private key.

Jump to

Keyboard shortcuts

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