mirror of
https://github.com/labstack/echo.git
synced 2025-05-13 22:06:36 +02:00
Error for non 443 port for auto tls
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
parent
900a463715
commit
7025f55cab
10
echo.go
10
echo.go
@ -546,8 +546,16 @@ func (e *Echo) StartTLS(address string, certFile, keyFile string) (err error) {
|
|||||||
return e.startTLS(address)
|
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 {
|
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 := e.TLSServer
|
||||||
s.TLSConfig = new(tls.Config)
|
s.TLSConfig = new(tls.Config)
|
||||||
s.TLSConfig.GetCertificate = e.AutoTLSManager.GetCertificate
|
s.TLSConfig.GetCertificate = e.AutoTLSManager.GetCertificate
|
||||||
|
@ -39,9 +39,9 @@ type (
|
|||||||
// - latency_human (Human readable)
|
// - latency_human (Human readable)
|
||||||
// - bytes_in (Bytes received)
|
// - bytes_in (Bytes received)
|
||||||
// - bytes_out (Bytes sent)
|
// - bytes_out (Bytes sent)
|
||||||
// - header:<name>
|
// - header:<NAME>
|
||||||
// - query:<name>
|
// - query:<NAME>
|
||||||
// - form:<name>
|
// - form:<NAME>
|
||||||
//
|
//
|
||||||
// Example "${remote_ip} ${status}"
|
// Example "${remote_ip} ${status}"
|
||||||
//
|
//
|
||||||
|
@ -64,9 +64,9 @@ LoggerConfig struct {
|
|||||||
// - latency_human (Human readable)
|
// - latency_human (Human readable)
|
||||||
// - bytes_in (Bytes received)
|
// - bytes_in (Bytes received)
|
||||||
// - bytes_out (Bytes sent)
|
// - bytes_out (Bytes sent)
|
||||||
// - header:<name>
|
// - header:<NAME>
|
||||||
// - query:<name>
|
// - query:<NAME>
|
||||||
// - form:<name>
|
// - form:<NAME>
|
||||||
//
|
//
|
||||||
// Example "${remote_ip} ${status}"
|
// Example "${remote_ip} ${status}"
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user