mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
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:
parent
1bf751a474
commit
5564de94ba
2 changed files with 38 additions and 6 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue