2017-04-17 08:41:47 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"github.com/gin-gonic/autotls"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"golang.org/x/crypto/acme/autocert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func 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"),
|
|
|
|
}
|
|
|
|
|
2017-07-03 08:55:21 +03:00
|
|
|
log.Fatal(autotls.RunWithManager(r, &m))
|
2017-04-17 08:41:47 +03:00
|
|
|
}
|