diff options
author | 2020-09-08 16:36:06 +0300 | |
---|---|---|
committer | 2020-09-08 21:36:06 +0800 | |
commit | 04af1c692c24e260bd75163d9e52be367c5ab5c4 (patch) | |
tree | 71e822b7a15ab0a93ae06c89963b4606bda14f41 /plugin | |
parent | ca43f845eb2b6331ed154dee025dad7351b8ae0f (diff) | |
download | coredns-04af1c692c24e260bd75163d9e52be367c5ab5c4.tar.gz coredns-04af1c692c24e260bd75163d9e52be367c5ab5c4.tar.zst coredns-04af1c692c24e260bd75163d9e52be367c5ab5c4.zip |
plugin/forward: init ClientSessionCache in tls.Config (#4108)
* plugin/forward: init ClientSessionCache in tls.Config
- ClientSessionCache may speed up a TLS handshake in upcoming connections
to the same TLS server
Signed-off-by: Ruslan Drozhdzh <rdrozhdzh@infoblox.com>
* add comment
Signed-off-by: Ruslan Drozhdzh <rdrozhdzh@infoblox.com>
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/forward/setup.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/plugin/forward/setup.go b/plugin/forward/setup.go index fff6ce33f..0c2455dfe 100644 --- a/plugin/forward/setup.go +++ b/plugin/forward/setup.go @@ -1,6 +1,7 @@ package forward import ( + "crypto/tls" "errors" "fmt" "strconv" @@ -117,6 +118,11 @@ func parseStanza(c *caddy.Controller) (*Forward, error) { if f.tlsServerName != "" { f.tlsConfig.ServerName = f.tlsServerName } + + // Initialize ClientSessionCache in tls.Config. This may speed up a TLS handshake + // in upcoming connections to the same TLS server. + f.tlsConfig.ClientSessionCache = tls.NewLRUClientSessionCache(len(f.proxies)) + for i := range f.proxies { // Only set this for proxies that need it. if transports[i] == transport.TLS { |