mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 02:00:43 +00:00
Don't decode the certificates everytime we create an AppClient.
This commit is contained in:
@@ -2,6 +2,7 @@ package xfer
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
@@ -14,6 +15,16 @@ import (
|
||||
// ID is currently set to the a random string on probe startup.
|
||||
const ScopeProbeIDHeader = "X-Scope-Probe-ID"
|
||||
|
||||
var certPool *x509.CertPool
|
||||
|
||||
func init() {
|
||||
var err error
|
||||
certPool, err = gocertifi.CACerts()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// ProbeConfig contains all the info needed for a probe to do HTTP requests
|
||||
type ProbeConfig struct {
|
||||
Token string
|
||||
@@ -46,10 +57,6 @@ func (pc ProbeConfig) getHTTPTransport(hostname string) (*http.Transport, error)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
certPool, err := gocertifi.CACerts()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &http.Transport{
|
||||
TLSClientConfig: &tls.Config{
|
||||
RootCAs: certPool,
|
||||
|
||||
Reference in New Issue
Block a user