 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
      Overview ¶
Package server implements the HTTP and gRPC server used throughout Grafana Agent Static.
It is a grafana/alloy-specific fork of github.com/weaveworks/common/server.
Index ¶
- Variables
- func GetClientAuthFromString(clientAuth string) (tls.ClientAuthType, error)
- type Config
- type DialContextFunc
- type Flags
- type GRPCConfig
- type GRPCFlags
- type HTTPConfig
- type HTTPFlags
- type LogLevel
- type TLSCipher
- type TLSConfig
- type TLSCurve
- type TLSVersion
- type WinCertStoreHandler
- type WindowsCertificateFilter
- type WindowsClientFilter
- type WindowsServerFilter
Constants ¶
This section is empty.
Variables ¶
var ( DefaultFlags = Flags{ RegisterInstrumentation: true, GracefulShutdownTimeout: 30 * time.Second, HTTP: DefaultHTTPFlags, GRPC: DefaultGRPCFlags, } DefaultHTTPFlags = HTTPFlags{ InMemoryAddr: "agent.internal:12345", ListenNetwork: "tcp", ListenAddress: "127.0.0.1:12345", ReadTimeout: 30 * time.Second, WriteTimeout: 30 * time.Second, IdleTimeout: 120 * time.Second, } DefaultGRPCFlags = GRPCFlags{ InMemoryAddr: "agent.internal:12346", ListenNetwork: "tcp", ListenAddress: "127.0.0.1:12346", MaxRecvMsgSize: 4 * 1024 * 1024, MaxSendMsgSize: 4 * 1024 * 1024, MaxConcurrentStreams: 100, MaxConnectionIdle: infinity, MaxConnectionAge: infinity, MaxConnectionAgeGrace: infinity, KeepaliveTime: 2 * time.Hour, KeepaliveTimeout: 20 * time.Second, MinTimeBetweenPings: 5 * time.Minute, } )
Default options structs.
var ( DefaultLogLevel = func() LogLevel { var lvl LogLevel lvl.RegisterFlags(emptyFlagSet) return lvl }() )
Default configuration structs.
Functions ¶
func GetClientAuthFromString ¶
func GetClientAuthFromString(clientAuth string) (tls.ClientAuthType, error)
Types ¶
type Config ¶
type Config struct {
	LogLevel  LogLevel `yaml:"log_level,omitempty"`
	LogFormat string   `yaml:"log_format,omitempty"`
	GRPC GRPCConfig `yaml:",inline"`
	HTTP HTTPConfig `yaml:",inline"`
}
    Config holds dynamic configuration options for a Server.
func DefaultConfig ¶
func DefaultConfig() Config
func (*Config) UnmarshalYAML ¶
UnmarshalYAML unmarshals the server config with defaults applied.
type DialContextFunc ¶
DialContextFunc is a function matching the signature of net.Dialer.DialContext.
type Flags ¶
type Flags struct {
	RegisterInstrumentation bool
	GracefulShutdownTimeout time.Duration
	LogSourceIPs       bool
	LogSourceIPsHeader string
	LogSourceIPsRegex  string
	GRPC GRPCFlags
	HTTP HTTPFlags
}
    Flags hold static configuration options for a Server.
func (*Flags) RegisterFlags ¶
RegisterFlags registers flags for c to the given FlagSet.
type GRPCConfig ¶
type GRPCConfig struct {
	TLSConfig TLSConfig `yaml:"grpc_tls_config,omitempty"`
}
    GRPCConfig holds dynamic configuration options for the gRPC server.
type GRPCFlags ¶
type GRPCFlags struct {
	UseTLS bool
	InMemoryAddr string
	ListenNetwork string
	ListenAddress string // host:port
	ConnLimit     int
	MaxRecvMsgSize           int
	MaxSendMsgSize           int
	MaxConcurrentStreams     uint
	MaxConnectionIdle        time.Duration
	MaxConnectionAge         time.Duration
	MaxConnectionAgeGrace    time.Duration
	KeepaliveTime            time.Duration
	KeepaliveTimeout         time.Duration
	MinTimeBetweenPings      time.Duration
	PingWithoutStreamAllowed bool
}
    GRPCFlags hold static configuration options for the gRPC server.
func (GRPCFlags) ListenHostPort ¶
ListenHostPort splits the ListenAddress into a listen host and listen port. Returns an error if the ListenAddress isn't valid.
func (*GRPCFlags) RegisterFlags ¶
RegisterFlags registers flags for c to the given FlagSet.
type HTTPConfig ¶
type HTTPConfig struct {
	TLSConfig TLSConfig `yaml:"http_tls_config,omitempty"`
}
    HTTPConfig holds dynamic configuration options for the HTTP server.
type HTTPFlags ¶
type HTTPFlags struct {
	UseTLS bool
	InMemoryAddr string
	ListenNetwork string
	ListenAddress string // host:port
	ConnLimit     int
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	IdleTimeout  time.Duration
}
    HTTPFlags hold static configuration options for the HTTP server.
func (HTTPFlags) ListenHostPort ¶
ListenHostPort splits the ListenAddress into a listen host and listen port. Returns an error if the ListenAddress isn't valid.
func (*HTTPFlags) RegisterFlags ¶
RegisterFlags registers flags for c to the given FlagSet.
type LogLevel ¶
LogLevel wraps the logging.Level type to allow defining IsZero, which is required to make omitempty work when marshalling YAML.
type TLSCipher ¶
type TLSCipher uint16
TLSCipher holds the ID of a tls.CipherSuite.
func (TLSCipher) MarshalYAML ¶
MarshalYAML marshals the name of the cipher suite.
func (*TLSCipher) UnmarshalYAML ¶
UnmarshalYAML unmarshals the name of a cipher suite to its ID.
type TLSConfig ¶
type TLSConfig struct {
	TLSCertPath              string                    `yaml:"cert_file,omitempty"`
	TLSKeyPath               string                    `yaml:"key_file,omitempty"`
	ClientAuth               string                    `yaml:"client_auth_type,omitempty"`
	ClientCAs                string                    `yaml:"client_ca_file,omitempty"`
	CipherSuites             []TLSCipher               `yaml:"cipher_suites,omitempty"`
	CurvePreferences         []TLSCurve                `yaml:"curve_preferences,omitempty"`
	MinVersion               TLSVersion                `yaml:"min_version,omitempty"`
	MaxVersion               TLSVersion                `yaml:"max_version,omitempty"`
	PreferServerCipherSuites bool                      `yaml:"prefer_server_cipher_suites,omitempty"`
	WindowsCertificateFilter *WindowsCertificateFilter `yaml:"windows_certificate_filter,omitempty"`
}
    TLSConfig holds dynamic configuration options for TLS.
type TLSCurve ¶
TLSCurve holds the ID of a TLS elliptic curve.
func (*TLSCurve) MarshalYAML ¶
MarshalYAML marshals the ID of a TLS elliptic curve into its name.
func (*TLSCurve) UnmarshalYAML ¶
UnmarshalYAML unmarshals the name of a TLS elliptic curve into its ID.
type TLSVersion ¶
type TLSVersion uint16
TLSVersion holds a TLS version ID.
func (*TLSVersion) MarshalYAML ¶
func (tv *TLSVersion) MarshalYAML() (interface{}, error)
MarshalYAML marshals the ID of a TLS version into its name.
func (*TLSVersion) UnmarshalYAML ¶
func (tv *TLSVersion) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals the name of a TLS version into its ID.
type WinCertStoreHandler ¶
type WinCertStoreHandler struct {
}
    func (WinCertStoreHandler) Run ¶
func (w WinCertStoreHandler) Run()
func (WinCertStoreHandler) Stop ¶
func (w WinCertStoreHandler) Stop()
type WindowsCertificateFilter ¶
type WindowsCertificateFilter struct {
	Server *WindowsServerFilter `yaml:"server,omitempty"`
	Client *WindowsClientFilter `yaml:"client,omitempty"`
}
    WindowsCertificateFilter represents the configuration for accessing the Windows store
type WindowsClientFilter ¶
type WindowsClientFilter struct {
	IssuerCommonNames []string `yaml:"issuer_common_names,omitempty"`
	SubjectRegEx      string   `yaml:"subject_regex,omitempty"`
	TemplateID        string   `yaml:"template_id,omitempty"`
}
    WindowsClientFilter is used to select a client root CA certificate
type WindowsServerFilter ¶
type WindowsServerFilter struct {
	Store             string   `yaml:"store,omitempty"`
	SystemStore       string   `yaml:"system_store,omitempty"`
	IssuerCommonNames []string `yaml:"issuer_common_names,omitempty"`
	TemplateID        string   `yaml:"template_id,omitempty"`
	RefreshInterval time.Duration `yaml:"refresh_interval,omitempty"`
}
    WindowsServerFilter is used to select a server certificate