tlsconfig

package
v3.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package tlsconfig provides more convenient way to create "tls.Config".

Usage:

package main

import "fmt"
import "go.ligato.io/vpp-agent/v3/cmd/agentctl/client/tlsconfig"

func main() {
	tc, err := tlsconfig.New(
		tlsconfig.CA("/path/to/ca.crt"),
		tlsconfig.CertKey("/path/to/server.crt", "/path/to/server.key"),
	)

	if err != nil {
		fmt.Printf("Error while creating TLS config: %v\n", err)
		return
	}
	fmt.Println("TLS config is ready to use")

	// `tc` usage
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(options ...Option) (*tls.Config, error)

New returns tls.Config with all options applied.

Types

type Option

type Option func(config *tls.Config) error

Option applies a modification on a tls.Config.

func CA

func CA(path string) Option

CA adds CA certificate from file to tls.Config. If not using this Option, then TLS will be using the host's root CA set.

func CertKey

func CertKey(certPath, keyPath string) Option

CertKey adds certificate with key to tls.Config.

func SkipServerVerification

func SkipServerVerification() Option

SkipServerVerification turns off verification of server's certificate chain and host name.

Jump to

Keyboard shortcuts

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