devtls

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package devtls provides a shared, in-memory self-signed TLS certificate generator for gopherstack's opt-in/mandatory dev HTTPS listeners.

It is lifted out of cli.go's original generateSelfSignedCert (used by the main port's opt-in TLS mode) so that services/azurearm -- which must serve its ARM/AAD-discovery listener over HTTPS unconditionally, see AZURE.md section 10.8 -- can share the exact same cert-generation logic instead of duplicating it. cli.go now calls GenerateSelfSignedCert instead of defining its own copy.

Index

Constants

View Source
const DefaultValidity = 365 * 24 * time.Hour

DefaultValidity is the validity window of a generated certificate.

Variables

This section is empty.

Functions

func GenerateSelfSignedCert

func GenerateSelfSignedCert(hosts ...string) (tls.Certificate, error)

GenerateSelfSignedCert creates an in-memory self-signed certificate valid for localhost/127.0.0.1/::1, plus any extra DNS names or IP addresses passed in hosts (each entry is tried as an IP first, falling back to a DNS name). Suitable for an opt-in or mandatory dev HTTPS listener -- never for production use.

func GenerateSelfSignedCertPEM

func GenerateSelfSignedCertPEM(hosts ...string) ([]byte, []byte, error)

GenerateSelfSignedCertPEM is the PEM-returning variant of GenerateSelfSignedCert, used by callers (e.g. the terraform test harness) that need to write the certificate to disk for a child process (such as `tofu`/`terraform`) to trust via SSL_CERT_FILE.

Types

This section is empty.

Jump to

Keyboard shortcuts

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