gin-gonic/autotls

Name: autotls

Owner: Gin-Gonic

Description: Support Let's Encrypt for a Go server application.

Created: 2017-04-16 08:58:27.0

Updated: 2018-05-17 12:21:04.0

Pushed: 2018-04-26 09:12:51.0

Homepage: null

Size: 14

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

autotls

Build Status Go Report Card GoDoc Join the chat at https://gitter.im/gin-gonic/autotls

Support Let's Encrypt for a Go server application.

example

example for 1-line LetsEncrypt HTTPS servers.

age main

rt (
"log"

"github.com/gin-gonic/autotls"
"github.com/gin-gonic/gin"


 main() {
r := gin.Default()

// Ping handler
r.GET("/ping", func(c *gin.Context) {
    c.String(200, "pong")
})

log.Fatal(autotls.Run(r, "example1.com", "example2.com"))

example for custom autocert manager.

age main

rt (
"log"

"github.com/gin-gonic/autotls"
"github.com/gin-gonic/gin"
"golang.org/x/crypto/acme/autocert"


 main() {
r := gin.Default()

// Ping handler
r.GET("/ping", func(c *gin.Context) {
    c.String(200, "pong")
})

m := autocert.Manager{
    Prompt:     autocert.AcceptTOS,
    HostPolicy: autocert.HostWhitelist("example1.com", "example2.com"),
    Cache:      autocert.DirCache("/var/www/.cache"),
}

log.Fatal(autotls.RunWithManager(r, &m))


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.