tlsdefaults

package module
v0.0.0-...-cf35cfd Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2017 License: Apache-2.0 Imports: 6 Imported by: 27

README

tlsdefaults provides sensible defaults for using TLS with Go.

Documentation

Overview

Package tlsdefaults provides sensible defaults for using TLS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildListenerConfig

func BuildListenerConfig(addr string, pkfile string, certfile string) (*tls.Config, error)

BuildListenerConfig builds a tls.Config for a listener at the given addr

func Listen

func Listen(addr, pkfile, certfile string) (net.Listener, error)

Listen opens a TLS listener at the given address using the private key and certificate PEM files at the given paths. If no files exists, it creates a new key and self-signed certificate at those locations.

func NewListener

func NewListener(l net.Listener, pkfile, certfile string) (net.Listener, error)

NewListener creates a TLS listener based on the given listener using the private key and certificate PEM files at the given paths. If no files exists, it creates a new key and self-signed certificate at those locations.

func NewListenerAddr

func NewListenerAddr(l net.Listener, addr string, pkfile, certfile string) (net.Listener, error)

NewListenerAddr is like NewListener but uses the specified addr to generate the cert.

func Server

func Server() *tls.Config

Server provides a tls.Config with sensible defaults for server use. At this point, it mostly trusts the defaults from Go (assumes Go version 1.5 or or newer).

Types

type CertContext

type CertContext struct {
	PKFile         string
	ServerCertFile string
	PK             *keyman.PrivateKey
	ServerCert     *keyman.Certificate
}

CertContext encapsulates the certificates used by a Server

Jump to

Keyboard shortcuts

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