From f68d3160d289f13faf74431e4ee9d3087b7b340d Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Fri, 4 Apr 2014 16:30:06 -0700 Subject: [PATCH] consul: Server initializes pool with TLS settings --- consul/server.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/consul/server.go b/consul/server.go index 9a4a6a59f0..d428842546 100644 --- a/consul/server.go +++ b/consul/server.go @@ -1,6 +1,7 @@ package consul import ( + "crypto/tls" "fmt" "github.com/hashicorp/raft" "github.com/hashicorp/serf/serf" @@ -122,13 +123,22 @@ func NewServer(config *Config) (*Server, error) { config.LogOutput = os.Stderr } + // Create the tlsConfig + var tlsConfig *tls.Config + var err error + if config.VerifyOutgoing { + if tlsConfig, err = config.OutgoingTLSConfig(); err != nil { + return nil, err + } + } + // Create a logger logger := log.New(config.LogOutput, "", log.LstdFlags) // Create server s := &Server{ config: config, - connPool: NewPool(time.Minute), + connPool: NewPool(time.Minute, tlsConfig), eventChLAN: make(chan serf.Event, 256), eventChWAN: make(chan serf.Event, 256), logger: logger, @@ -156,7 +166,6 @@ func NewServer(config *Config) (*Server, error) { go s.wanEventHandler() // Initialize the lan Serf - var err error s.serfLAN, err = s.setupSerf(config.SerfLANConfig, s.eventChLAN, serfLANSnapshot) if err != nil {