when using tls, if no pinned key is set, pin the key from the cert. require that cert keys match a pinned key

This commit is contained in:
Arceliar 2021-06-19 09:53:11 -05:00
parent 1bf751a474
commit 5564de94ba
2 changed files with 38 additions and 6 deletions

View file

@ -54,7 +54,7 @@ type TcpListener struct {
}
type TcpUpgrade struct {
upgrade func(c net.Conn) (net.Conn, error)
upgrade func(c net.Conn, o *tcpOptions) (net.Conn, error)
name string
}
@ -361,7 +361,7 @@ func (t *tcp) handler(sock net.Conn, incoming bool, options tcpOptions) chan str
var upgraded bool
if options.upgrade != nil {
var err error
if sock, err = options.upgrade.upgrade(sock); err != nil {
if sock, err = options.upgrade.upgrade(sock, &options); err != nil {
t.links.core.log.Errorln("TCP handler upgrade failed:", err)
return nil
}