tlsutil

package
v0.0.66 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package tlsutil provides shared TLS configuration utilities for parsing TLS settings and building crypto/tls.Config values. Callers should pass values from config.GetTLSMinVersionConfig / GetTLSCipherSuitesConfig.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildTLSConfig

func BuildTLSConfig(minVersion string, cipherSuites []string, opts ...TLSConfigOption) (*tls.Config, error)

BuildTLSConfig creates a tls.Config from TLS settings returned by config.GetTLSMinVersionConfig / GetTLSCipherSuitesConfig. Options (e.g., RootCAs, InsecureSkipVerify) are applied last.

func ParseTLSCipherSuites

func ParseTLSCipherSuites(suites []string) ([]uint16, error)

ParseTLSCipherSuites parses a slice of cipher suite names to their uint16 IDs. Returns nil if suites is empty or contains only empty strings (Go will use its default cipher suites).

func ParseTLSVersion

func ParseTLSVersion(version string) (uint16, error)

ParseTLSVersion parses a TLS version string (e.g., "1.2", "1.3") to a tls.Version constant. Returns tls.VersionTLS12 as default if version is empty.

Types

type TLSConfigOption

type TLSConfigOption func(*tls.Config)

TLSConfigOption is a function that modifies a tls.Config.

func WithInsecureSkipVerify

func WithInsecureSkipVerify(skip bool) TLSConfigOption

WithInsecureSkipVerify sets InsecureSkipVerify on the TLS config.

func WithRootCAs

func WithRootCAs(pool *x509.CertPool) TLSConfigOption

WithRootCAs sets custom root CAs on the TLS config.

Jump to

Keyboard shortcuts

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