2019-03-14 08:30:04 +00:00
|
|
|
package tcp
|
|
|
|
|
|
|
|
import (
|
|
|
|
"crypto/tls"
|
|
|
|
)
|
|
|
|
|
|
|
|
// TLSHandler handles TLS connections
|
|
|
|
type TLSHandler struct {
|
|
|
|
Next Handler
|
|
|
|
Config *tls.Config
|
|
|
|
}
|
|
|
|
|
|
|
|
// ServeTCP terminates the TLS connection
|
2019-09-13 15:46:04 +00:00
|
|
|
func (t *TLSHandler) ServeTCP(conn WriteCloser) {
|
2019-03-14 08:30:04 +00:00
|
|
|
t.Next.ServeTCP(tls.Server(conn, t.Config))
|
|
|
|
}
|