tls

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: BSD-3-Clause Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextValue

func ContextValue(c *Config) cli.Action

func FlagsAndArgs

func FlagsAndArgs() cli.Action

func ListCiphers

func ListCiphers() cli.Action

func ListCurves

func ListCurves() cli.Action

func SetCACertFile

func SetCACertFile(path ...string) cli.Action

func SetCACertPath

func SetCACertPath(path ...string) cli.Action

func SetCiphers

func SetCiphers(v ...CipherSuites) cli.Action

func SetClientCertFile

func SetClientCertFile(path ...string) cli.Action

func SetCurves

func SetCurves(v ...CurveIDs) cli.Action

func SetInsecureSkipVerify

func SetInsecureSkipVerify(v ...bool) cli.Action

func SetKeyFile

func SetKeyFile(path ...string) cli.Action

func SetNextProtos

func SetNextProtos(s ...[]string) cli.Action

func SetServerName

func SetServerName(s ...string) cli.Action

func SetTLSv1

func SetTLSv1() cli.Action

func SetTLSv1_0

func SetTLSv1_0() cli.Action

func SetTLSv1_1

func SetTLSv1_1() cli.Action

func SetTLSv1_2

func SetTLSv1_2() cli.Action

func SetTLSv1_3

func SetTLSv1_3() cli.Action

func SetTime

func SetTime(s ...*cli.File) cli.Action

func SourceAnnotation

func SourceAnnotation() (string, string)

SourceAnnotation gets the name and value of the annotation added to the Data of all flags that are initialized from this package

Types

type CipherSuites

type CipherSuites []uint16

func (*CipherSuites) Set

func (c *CipherSuites) Set(arg string) error

func (*CipherSuites) String

func (c *CipherSuites) String() string

func (*CipherSuites) Synopsis

func (c *CipherSuites) Synopsis() string

type Config

type Config struct {
	*gotls.Config
	cli.Action
}

Config reepresents TLS configuration plus a default action.

func FromContext

func FromContext(ctx context.Context) *Config

FromContext obtains the server from the context.

func New

func New(opts ...Option) *Config

New creates a new TLS configuration. By default, it is also initialized with a default action that registers useful flags.

func (*Config) Apply

func (c *Config) Apply(opts ...Option)

func (*Config) Pipeline added in v0.7.3

func (c *Config) Pipeline() cli.Action

type CurveIDs

type CurveIDs []tls.CurveID

func (*CurveIDs) Set

func (c *CurveIDs) Set(arg string) error

func (*CurveIDs) String

func (c *CurveIDs) String() string

func (*CurveIDs) Synopsis

func (c *CurveIDs) Synopsis() string

type Option

type Option func(*Config) error

Option provides an option to the TLS configuration

func AddCertificate added in v0.7.2

func AddCertificate(cert gotls.Certificate) Option

AddCertificate adds a certificate to the pool

func AddRootCACertFile added in v0.7.2

func AddRootCACertFile(filename string) Option

AddRootCACertFile adds a CA certificate to the pool

func AddRootCACertPath added in v0.7.2

func AddRootCACertPath(path string) Option

AddRootCACertPath adds a search path to the CA certificate pool

func AddX509KeyPair added in v0.7.2

func AddX509KeyPair(certFile, keyFile string) Option

AddX509KeyPair adds a certificate to the pool

func WithAction added in v0.7.3

func WithAction(a cli.Action) Option

WithAction sets the action

func WithCiphers

func WithCiphers(ids CipherSuites) Option

WithCiphers sets up cipher suites

func WithCurves

func WithCurves(ids CurveIDs) Option

WithCurves sets up curves

func WithDefaultAction added in v0.7.3

func WithDefaultAction() Option

WithDefaultAction sets the action to the default

func WithInsecureSkipVerify

func WithInsecureSkipVerify(v bool) Option

WithInsecureSkipVerify sets up the option to skip verification in TLS handshake. This option is insecure.

func WithNextProtos

func WithNextProtos(s []string) Option

WithNextProtos sets next protos

func WithServerName

func WithServerName(s string) Option

WithServerName sets the server name

func WithTimeHelper

func WithTimeHelper(f *cli.File) Option

WithTimeHelper specifies the file whose modtime contains the time for the server

func (Option) Execute

func (o Option) Execute(c context.Context) error

Jump to

Keyboard shortcuts

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