1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-24 20:14:31 +02:00

Error for non 443 port for auto tls

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2017-01-23 15:39:19 -08:00
parent 900a463715
commit 7025f55cab
3 changed files with 15 additions and 7 deletions

10
echo.go
View File

@ -546,8 +546,16 @@ func (e *Echo) StartTLS(address string, certFile, keyFile string) (err error) {
return e.startTLS(address)
}
// StartAutoTLS starts an HTTPS server using certificates automatically from https://letsencrypt.org.
// StartAutoTLS starts an HTTPS server using certificates automatically installed from https://letsencrypt.org.
// Port in address must be 443.
func (e *Echo) StartAutoTLS(address string) error {
_, port, err := net.SplitHostPort(address)
if err != nil {
return err
}
if port != "443" {
return errors.New("port for auto tls must be 443")
}
s := e.TLSServer
s.TLSConfig = new(tls.Config)
s.TLSConfig.GetCertificate = e.AutoTLSManager.GetCertificate

View File

@ -39,9 +39,9 @@ type (
// - latency_human (Human readable)
// - bytes_in (Bytes received)
// - bytes_out (Bytes sent)
// - header:<name>
// - query:<name>
// - form:<name>
// - header:<NAME>
// - query:<NAME>
// - form:<NAME>
//
// Example "${remote_ip} ${status}"
//

View File

@ -64,9 +64,9 @@ LoggerConfig struct {
// - latency_human (Human readable)
// - bytes_in (Bytes received)
// - bytes_out (Bytes sent)
// - header:<name>
// - query:<name>
// - form:<name>
// - header:<NAME>
// - query:<NAME>
// - form:<NAME>
//
// Example "${remote_ip} ${status}"
//