Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CertificateGetter ¶
type CertificateGetter struct {
// contains filtered or unexported fields
}
CertificateGetter allows to load certificates. The GetCertificate method satisfies the tls.GetCertificate function signature.
func NewCertificateGetter ¶
func NewCertificateGetter(certFile, keyFile string) *CertificateGetter
func (*CertificateGetter) GetCertificate ¶
func (cg *CertificateGetter) GetCertificate(_ *tls.ClientHelloInfo) (*tls.Certificate, error)
func (*CertificateGetter) Load ¶
func (cg *CertificateGetter) Load() error
type Config ¶
type Config struct {
Port int `yaml:"port" description:"Port number API listens on" default:"8080"`
StatsPort int `yaml:"stats_port" description:"Port number stats server listens on" default:"8081"`
UseTLS bool `yaml:"use_tls" description:"Use TLS for API calls"`
TLSCert string `yaml:"tls_cert" description:"API TLS cert location"`
TLSKey string `yaml:"tls_key" description:"API TLS key location"`
TLSCA string `yaml:"tls_ca" description:"Optional CA certificate"` //nolint:tagliatelle
TLSUseClientCert bool `yaml:"tls_use_client_cert" description:"Require and verify client certificate"`
TLSClientCA string `yaml:"tls_client_ca" description:"Certificate Authority file for checking the authenticity of client"`
CORS bool `yaml:"cors" description:"Allow CORS"`
Token string `yaml:"token" description:"Secret auth token"`
RateLimit rate.Limit `yaml:"rate_limit" description:"Rate limit (RPS)" default:"10000"`
OpenConnLimit int `yaml:"open_conn_limit" description:"Open incoming connection limit" default:"1000"`
ReadTimeout time.Duration `yaml:"read_timeout" description:"Server read timeout (closes idle keep-alive connection)" default:"5m"`
ShutdownTimeout time.Duration `yaml:"shutdown_timeout" description:"Server shutdown timeout" default:"2s"`
Metrics metrics.Config `yaml:"metrics" description:"Server metrics configuration"`
}
Config defines server parameters
type ConnectionWatcher ¶
type ConnectionWatcher struct {
// contains filtered or unexported fields
}
func NewConnectionWatcher ¶
func NewConnectionWatcher(metricsRegistry prometheus.Registerer, logger log.MetaLogger) *ConnectionWatcher
func (*ConnectionWatcher) Count ¶
func (cw *ConnectionWatcher) Count() int64
Count returns the current number of open connections
func (*ConnectionWatcher) OnStateChange ¶
func (cw *ConnectionWatcher) OnStateChange(conn net.Conn, state http.ConnState)
OnStateChange records open connections in response to connection state changes
type HandlerWithResult ¶
HandlerWithResult is an HTTP handler that returns status code and error
type ListenerConfig ¶
type Router ¶
type Router interface {
ServeHTTP(w http.ResponseWriter, r *http.Request)
// Handle(pattern string, handler http.Handler)
HandleFunc(method, pattern string, handler func(http.ResponseWriter, *http.Request))
}
Router implements a basic router interface. Currently in this repo you can find a gorilla/mux router wrapper and a standard ServeMux router wrapper. You can create a wrapper for your favourite router/multiplexer and pass it as Router to a NewServer() func.
type Server ¶
type Server interface {
Run(ctx context.Context) error
HandleFunc(service, endpoint, method, path string, handler HandlerWithResult)
}
Server implements basic Kube-dispatched HTTP server
type UnknownCNBehavior ¶
type UnknownCNBehavior string
const ( UCNAllow UnknownCNBehavior = "allow" UCNWarn UnknownCNBehavior = "warn" UCNBlock UnknownCNBehavior = "block" )