util

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSelfSignedCertificate

func GenerateSelfSignedCertificate(config CertificateConfig) (tls.Certificate, error)

GenerateSelfSignedCertificate generates a self-signed certificate in memory. Returns a tls.Certificate ready for use with HTTP servers.

func GenerateSelfSignedCertificatePEM

func GenerateSelfSignedCertificatePEM(config CertificateConfig) (certPEM, keyPEM []byte, err error)

GenerateSelfSignedCertificatePEM generates a self-signed certificate and returns the certificate and private key as PEM-encoded bytes.

func GetCertificateHosts

func GetCertificateHosts(addr string) []string

GetCertificateHosts extracts hostnames/IPs from an address for certificate generation

func ParseAddress

func ParseAddress(addr string) (host string, port string, err error)

ParseAddress extracts host and port from an address string. Supports formats: "host:port", ":port", "host"

Types

type CertificateConfig

type CertificateConfig struct {
	Hosts    []string // Hostnames and IP addresses
	ValidFor time.Duration
}

CertificateConfig holds configuration for certificate generation

Jump to

Keyboard shortcuts

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