func (c Client) ServerStatus() (data []byte, err error) {
	now := time.Now()
	t := *c.url
	t.Path = path.Join(c.url.Path, "_status")
	resp, err := c.http().Get(t.String())
	if err != nil {
		c.Errorf("Error retrieving server status: %v", err)
		return nil, err
	}
	c.Infof("GET /_status %d %v", resp.StatusCode, time.Since(now))
	defer resp.Body.Close()
	data, err = ioutil.ReadAll(resp.Body)
	if err != nil {
		c.Errorf("Error reading response body for server status %v", err)
		return nil, err
	}
	return data, nil
}
ServerStatus returns raw JSON from the server's _status endpoint
package main
import (
	"crypto/tls"
	"crypto/x509"
	"errors"
	"io/ioutil"
	"net/http"
	"net/url"
	"path"
	"strings"
	"sync/atomic"
	"time"
	"unsafe"
	"github.com/rcrowley/go-metrics"
	"github.com/square/go-sq-metrics"
	klog "github.com/square/keywhiz-fs/log"
)
var clientRefresh = 10 * time.Minute
var ciphers = []uint16{
	tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
	tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
	tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
	tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
	tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
	tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
	tls.TLS_RSA_WITH_AES_128_CBC_SHA,
	tls.TLS_RSA_WITH_AES_256_CBC_SHA,
}
type Client struct {
	*klog.Logger
	http        func() *http.Client
	url         *url.URL
	params      httpClientParams
	failCount   metrics.Counter
	lastSuccess metrics.Gauge
}
type httpClientParams struct {
	CertFile string `json:"cert_file"`
	KeyFile  string `json:"key_file"`
	CaBundle string `json:"ca_bundle"`
	timeout  time.Duration
}
type SecretDeleted struct{}
func (e SecretDeleted) Error() string {
	return "deleted"
}
func (c Client) failCountInc() {
	c.failCount.Inc(1)
}
func (c Client) markSuccess() {
	c.failCount.Clear()
	c.lastSuccess.Update(time.Now().Unix())
}
func NewClient(certFile, keyFile, caFile string, serverURL *url.URL, timeout time.Duration, logConfig klog.Config, metricsHandle *sqmetrics.SquareMetrics) (client Client) {
	logger := klog.New("kwfs_client", logConfig)
	params := httpClientParams{certFile, keyFile, caFile, timeout}
	failCount := metrics.GetOrRegisterCounter("runtime.server.fails", metricsHandle.Registry)
	lastSuccess := metrics.GetOrRegisterGauge("runtime.server.lastsuccess", metricsHandle.Registry)
	var httpClient unsafe.Pointer
	getClient := func() *http.Client {
		return (*http.Client)(atomic.LoadPointer(&httpClient))
	}
	initial, err := params.buildClient()
	panicOnError(err)
	atomic.StorePointer(&httpClient, unsafe.Pointer(initial))
	go func() {
		for t := range time.Tick(clientRefresh) {
			if client, err := params.buildClient(); err == nil {
				logger.Infof("Updating http client at %v", t)
				atomic.StorePointer(&httpClient, unsafe.Pointer(client))
			} else {
				logger.Errorf("Error refreshing http client: %v", err)
			}
		}
	}()
	return Client{logger, getClient, serverURL, params, failCount, lastSuccess}
}