server

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2021 License: Apache-2.0 Imports: 63 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(ctx context.Context, zpagesEnabled bool) error

func XForwardedHostUnaryServerInterceptor

func XForwardedHostUnaryServerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

Types

type AdminAPIConf

type AdminAPIConf struct {
	// Enabled defines whether the admin API is enabled.
	Enabled bool `yaml:"enabled"`
	// AdminCredentials defines the admin user credentials.
	AdminCredentials *AdminCredentialsConf `yaml:"adminCredentials"`
}

type AdminCredentialsConf

type AdminCredentialsConf struct {
	// Username is the hardcoded username to use for authentication.
	Username string `yaml:"username"`
	// PasswordHash is the bcrypt hash of the password to use for authentication.
	PasswordHash string `yaml:"passwordHash"`
}

type CORSConf

type CORSConf struct {
	// Disabled sets whether CORS is disabled.
	Disabled bool `yaml:"enabled"`
	// AllowedOrigins is the contents of the allowed-origins header.
	AllowedOrigins []string `yaml:"allowedOrigins"`
	// AllowedHeaders is the contents of the allowed-headers header.
	AllowedHeaders []string `yaml:"allowedHeaders"`
	// MaxAge is the max age of the CORS preflight check.kk
	MaxAge time.Duration `yaml:"maxAge"`
}

type Codec

type Codec struct {
	// contains filtered or unexported fields
}

Codec implements the grpc Codec interface to delegate encoding to VT where possible.

func (Codec) Marshal

func (c Codec) Marshal(v interface{}) ([]byte, error)

func (Codec) Name

func (c Codec) Name() string

func (Codec) Unmarshal

func (c Codec) Unmarshal(data []byte, v interface{}) error

type Conf

type Conf struct {
	// HTTPListenAddr is the dedicated HTTP address.
	HTTPListenAddr string `yaml:"httpListenAddr"`
	// GRPCListenAddr is the dedicated GRPC address.
	GRPCListenAddr string `yaml:"grpcListenAddr"`
	// TLS defines the TLS configuration for the server.
	TLS *TLSConf `yaml:"tls"`
	// CORS defines the CORS configuration for the server.
	CORS CORSConf `yaml:"cors"`
	// MetricsEnabled defines whether the metrics endpoint is enabled.
	MetricsEnabled bool `yaml:"metricsEnabled"`
	// LogRequestPayloads defines whether the request payloads should be logged.
	LogRequestPayloads bool `yaml:"logRequestPayloads"`
	// PlaygroundEnabled defines whether the playground API is enabled.
	PlaygroundEnabled bool `yaml:"playgroundEnabled"`
	// AdminAPI defines the admin API configuration.
	AdminAPI AdminAPIConf `yaml:"adminAPI"`
}

Conf holds configuration pertaining to the server.

func (*Conf) Key

func (c *Conf) Key() string

func (*Conf) SetDefaults

func (c *Conf) SetDefaults()

func (*Conf) Validate

func (c *Conf) Validate() error

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(conf *Conf) *Server

func (*Server) Start

func (s *Server) Start(ctx context.Context, store storage.Store, eng *engine.Engine, auditLog audit.Log, zpagesEnabled bool) error

type TLSConf

type TLSConf struct {
	// Cert is the path to the TLS certificate file.
	Cert string `yaml:"cert"`
	// Key is the path to the TLS private key file.
	Key string `yaml:"key"`
	//	CACert is the path to the optional CA certificate for verifying client requests.
	CACert string `yaml:"caCert"`
}

TLSConf holds TLS configuration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL