2017-04-03 13:23:45 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/gin-gonic/gin"
|
2017-04-03 15:30:46 +00:00
|
|
|
"golang.org/x/crypto/acme/autocert"
|
2017-04-03 13:23:45 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
r := gin.Default()
|
|
|
|
|
2017-04-03 15:30:46 +00:00
|
|
|
gin.AutoTLSManager.Cache = autocert.DirCache("/var/www/.cache")
|
|
|
|
|
2017-04-03 13:23:45 +00:00
|
|
|
// Ping handler
|
|
|
|
r.GET("/ping", func(c *gin.Context) {
|
|
|
|
c.String(200, "pong")
|
|
|
|
})
|
|
|
|
|
|
|
|
// Listen and Server in 0.0.0.0:443
|
2017-04-03 15:34:00 +00:00
|
|
|
r.RunAutoTLS("example1.com", "example2.com")
|
2017-04-03 13:23:45 +00:00
|
|
|
}
|