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
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Support Let's Encrypt for a Go server application.
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))