tlslocal

package
v0.72.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureServerTLSConfig

func EnsureServerTLSConfig(opts Options) (*tls.Config, error)

func ParseSANs added in v0.72.0

func ParseSANs(entries []string) (dnsNames []string, ips []net.IP, err error)

ParseSANs validates the tls.extra_sans entries and splits them into DNS names and IP addresses. An entry is an IP literal ("192.168.1.10", "fd7a::1") or a host name made of letters, digits, '-' and '_' separated by dots; it is not a URL, has no port and no wildcard. DNS names are lower-cased, and an entry that repeats another one, or one of the names every certificate already carries (localhost, 127.0.0.1, ::1), is dropped. The error names the zero-based index and the offending value.

func ServeWithTLS

func ServeWithTLS(srv *http.Server, ln net.Listener, cfg *tls.Config) error

Types

type Options

type Options struct {
	Dir               string // e.g., ~/.mcpproxy/certs
	RequireClientCert bool

	// ExtraSANs are DNS names and IP literals added to the generated server
	// certificate (tls.extra_sans). Ignored when CertFile is set.
	ExtraSANs []string
	// CertFile and KeyFile (tls.cert_file, tls.key_file) name an operator-
	// provided certificate and key, served instead of a generated one. Both or
	// neither.
	CertFile string
	KeyFile  string
}

Jump to

Keyboard shortcuts

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