simpletls

package module
v0.0.0-...-08e62ee Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: Apache-2.0 Imports: 12 Imported by: 3

README

simpletls

package simpletls helps setting up a TLS listener, by default with Let's Encrypt's autocert.

Documentation

Overview

package simpletls helps setting up a TLS listener with Let's Encrypt's autocert.

Index

Constants

This section is empty.

Variables

View Source
var (
	TLSKey    = filepath.Join(os.Getenv("HOME"), "keys", "key.pem")
	TLSCert   = filepath.Join(os.Getenv("HOME"), "keys", "cert.pem")
	CertCache = filepath.Join(os.Getenv("HOME"), "keys", "letsencrypt.cache")
)
View Source
var (
	FlagAutocert = flag.Bool("autocert", true, `Get https certificate from Let's Encrypt. The cached certificate(s) will be in CertCache.`)
)

Functions

func Config

func Config(hostport string) (*tls.Config, error)

Config returns a TLS config for hostport ("hostname:port") that uses autocert if FlagAutocert is true, or TLSKey and TLSCert otherwise.

func Listen

func Listen(hostport string) (net.Listener, error)

Listen returns a TLS listen for hostport set up with Config.

Types

This section is empty.

Jump to

Keyboard shortcuts

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