autotls

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

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

Go to latest
Published: Apr 26, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

README

echo-autotls

HTTPS server using certificates automatically installed from https://letsencrypt.org

Archived

The problem #1231 has been solved #1305

Usage

func main() {
	e := echo.New()
	e.Pre(middleware.HTTPSRedirect())

	e.Use(middleware.Recover())
	e.Use(middleware.Logger())
	e.GET("/", func(c echo.Context) error {
		return c.HTML(http.StatusOK, `
			<h1>Welcome to Echo!</h1>
			<h3>TLS certificates automatically installed from Let's Encrypt :)</h3>
		`)
	})
	e.Logger.Fatal(e.StartServer(autotls.DefaultManager("example.com").StartAutoTLS(":443")))

	// m := autotls.AutoTLSManager{}
	// m.Prompt = autocert.AcceptTOS
	// m.Cache = autocert.DirCache("/var/www/.cache")
	// e.Logger.Fatal(e.StartServer(m.StartAutoTLS(":443")))
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoTLSManager

type AutoTLSManager struct {
	autocert.Manager
	DisableHTTP2 bool
}

func DefaultManager

func DefaultManager(domains ...string) *AutoTLSManager

func (AutoTLSManager) StartAutoTLS

func (m AutoTLSManager) StartAutoTLS(address string) *http.Server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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