func NewServer(c *config.ServerConfig) spi.Server {
	svr := &server{config: *c}
	return svr
}
NewServer create a new Consulate server.
package server
import (
	"context"
	"encoding/json"
	"errors"
	"fmt"
	"github.com/gin-gonic/gin"
	"github.com/json-iterator/go"
	"github.com/kadaan/consulate/caching"
	"github.com/kadaan/consulate/checks"
	"github.com/kadaan/consulate/client"
	"github.com/kadaan/consulate/config"
	"github.com/kadaan/consulate/spi"
	"github.com/kadaan/consulate/version"
	"github.com/kadaan/go-gin-prometheus"
	"github.com/prometheus/client_golang/prometheus"
	"log"
	"net/http"
	"strings"
)
const (
	consulChecksUrl        = "http://%s/v1/agent/checks"
	verifyCheckParamKey    = "check"
	verifyCheckParamTag    = ":" + verifyCheckParamKey
	verifyServiceParamKey  = "service"
	verifyServiceParamTag  = ":" + verifyServiceParamKey
	prettyQueryStringKey   = "pretty"
	verboseQueryStringKey  = "verbose"
	statusQueryStringKey   = "status"
	aboutRoute             = "/about"
	healthRoute            = "/health"
	verifyAllChecksRoute   = "/verify/checks"
	verifyCheckIdRoute     = verifyAllChecksRoute + "/id/" + verifyCheckParamTag
	verifyCheckNameRoute   = verifyAllChecksRoute + "/name/" + verifyCheckParamTag
	verifyServiceIdRoute   = "/verify/service/id/" + verifyServiceParamTag
	verifyServiceNameRoute = "/verify/service/name/" + verifyServiceParamTag
)
var (
	state = stopped
)
type serverState int
const (
	stopped serverState = iota
	started
)
type server struct {
	config     config.ServerConfig
	httpServer http.Server
	httpClient http.Client
	jsonApi    jsoniter.API
	cache      caching.Cache
}