transport

package
v0.37.403 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewKeepAliveListener

func NewKeepAliveListener(l net.Listener, scheme string, tlscfg *tls.Config) (net.Listener, error)

NewKeepAliveListener returns a listener that listens on the given address. Be careful when wrap around KeepAliveListener with another Listener if TLSInfo is not nil. Some pkgs (like go/http) might expect Listener to return TLSConn type to start TLS handshake. http://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html

func NewTLSListener

func NewTLSListener(l net.Listener, tlsinfo *TLSInfo) (net.Listener, error)

NewTLSListener handshakes TLS connections and performs optional CRL checking.

Types

type TLSInfo

type TLSInfo struct {
	CertFile            string
	KeyFile             string
	ClientCAFile        string
	TrustedCAFile       string
	ClientAuthType      tls.ClientAuthType
	CRLVerifier         crlcache.Verifier
	InsecureSkipVerify  bool
	SkipClientSANVerify bool

	// ServerName ensures the cert matches the given host in case of discovery / virtual hosting
	ServerName string

	// HandshakeFailure is optionally called when a connection fails to handshake. The
	// connection will be closed immediately afterwards.
	HandshakeFailure func(*tls.Conn, error)

	// CipherSuites is a list of supported cipher suites.
	// If empty, Go auto-populates it by default.
	// Note that cipher suites are prioritized in the given order.
	CipherSuites []string

	// AllowedCN is a CN which must be provided by a client.
	AllowedCN string

	// AllowedHostname is an IP address or hostname that must match the TLS
	// certificate provided by a client.
	AllowedHostname string

	// EmptyCN indicates that the cert must have empty CN.
	// If true, ClientConfig() will return an error for a cert with non empty CN.
	EmptyCN bool
	// contains filtered or unexported fields
}

TLSInfo provides TLS configuration

func (*TLSInfo) Close

func (info *TLSInfo) Close()

Close the resources

func (*TLSInfo) Config

func (info *TLSInfo) Config() *tls.Config

Config returns tls.Config

func (*TLSInfo) Empty

func (info *TLSInfo) Empty() bool

Empty returns true if TLS info is empty

func (*TLSInfo) ServerTLSWithReloader

func (info *TLSInfo) ServerTLSWithReloader() (*tls.Config, error)

ServerTLSWithReloader returns tls.Config with reloader

func (*TLSInfo) String

func (info *TLSInfo) String() string

Jump to

Keyboard shortcuts

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