server

package
v1.0.3-hotfix1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: MIT Imports: 24 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// RecommendedHomeDir defines the default directory used to place all bifrost service configurations.
	RecommendedHomeDir = ".bifrost"

	// RecommendedEnvPrefix defines the ENV prefix used by all bifrost service.
	RecommendedEnvPrefix = "BIFROST"
)

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(cfg string, defaultName string)

LoadConfig reads in config file and ENV variables if set.

func RequestShutdown

func RequestShutdown() bool

RequestShutdown emulates a received event that is considered as shutdown signal (SIGTERM/SIGINT) This returns whether a handler was notified.

func SetupSignalHandler

func SetupSignalHandler() <-chan struct{}

SetupSignalHandler registered for SIGTERM and SIGINT. A stop channel is returned which is closed on one of these signals. If a second signal is caught, the program is terminated with exit code 1.

Types

type CertKey

type CertKey struct {
	// CertFile is a file containing a PEM-encoded certificate, and possibly the complete certificate chain
	CertFile string
	// KeyFile is a file containing a PEM-encoded private key for the certificate specified by CertFile
	KeyFile string
}

CertKey contains configuration items related to certificate.

type CompletedConfig

type CompletedConfig struct {
	*Config
}

CompletedConfig is the completed configuration for GenericServer.

func (CompletedConfig) NewGRPCServer

func (c CompletedConfig) NewGRPCServer() (*GenericGRPCServer, error)

NewGRPCServer returns a new instance of GenericGRPCServer from the given config.

type Config

type Config struct {
	SecureServing   *SecureServingInfo
	InsecureServing *InsecureServingInfo
	RA              *RAInfo
	GRPCServing     *GRPCServingInfo
	Middlewares     []string
	Healthz         bool
	EnableProfiling bool
	EnableMetrics   bool
}

Config is a structure used to configure a GenericGRPCServer. Its members are sorted roughly in order of importance for composers.

func NewConfig

func NewConfig() *Config

NewConfig returns a Config struct with the default values.

func (*Config) Complete

func (c *Config) Complete() CompletedConfig

Complete fills in any fields not set that are required to have valid data and can be derived from other fields. If you're going to `ApplyOptions`, do that first. It's mutating the receiver.

type GRPCServingInfo

type GRPCServingInfo struct {
	ChunkSize    int
	RecvTimeoutM int
}

func NewGRPCSeringInfo

func NewGRPCSeringInfo() *GRPCServingInfo

type GenericGRPCServer

type GenericGRPCServer struct {

	// SecureServingInfo holds configuration of the TLS server.
	SecureServingInfo *SecureServingInfo

	// InsecureServingInfo holds configuration of the insecure grpc server.
	InsecureServingInfo *InsecureServingInfo

	// RAInfo holds configuration of th Registration Authority server.
	RAInfo *RAInfo

	// ChunkSize set chunk size of the grpc server.
	ChunkSize int

	// ReceiveTimeout is the timeout used for the grpc server receiving data.
	ReceiveTimeout time.Duration

	// ShutdownTimeout is the timeout used for server shutdown. This specifies the timeout before server
	// gracefully shutdown returns.
	ShutdownTimeout time.Duration
	// contains filtered or unexported fields
}

GenericGRPCServer contains state for a bifrost api server.

func (*GenericGRPCServer) Close

func (s *GenericGRPCServer) Close()

Close graceful shutdown the api server.

func (*GenericGRPCServer) InstallMiddlewares

func (s *GenericGRPCServer) InstallMiddlewares()

func (*GenericGRPCServer) InstallRAClient

func (s *GenericGRPCServer) InstallRAClient()

func (*GenericGRPCServer) InstallServices

func (s *GenericGRPCServer) InstallServices()

func (*GenericGRPCServer) RegisterServices

func (s *GenericGRPCServer) RegisterServices(registers map[string]service_register.ServiceRegister)

func (*GenericGRPCServer) Run

func (s *GenericGRPCServer) Run() error

Run spawns the http server. It only returns when the port cannot be listened on initially.

func (*GenericGRPCServer) Setup

func (s *GenericGRPCServer) Setup()

type InsecureServingInfo

type InsecureServingInfo struct {
	BindAddress string
	BindPort    int
}

InsecureServingInfo holds configuration of the insecure grpc server.

func (*InsecureServingInfo) Address

func (i *InsecureServingInfo) Address() string

type RAInfo

type RAInfo struct {
	Host string
	Port int
}

RAInfo holds configuration of the Registration Authority server.

type SecureServingInfo

type SecureServingInfo struct {
	BindAddress string
	BindPort    int
	CertKey     CertKey
}

SecureServingInfo holds configuration of the TLS server.

func (*SecureServingInfo) Address

func (s *SecureServingInfo) Address() string

Address join host IP address and host port number into an address string, like: 0.0.0.0:8443.

Jump to

Keyboard shortcuts

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