server

package
v0.0.0-...-ba7165a Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package server provides a server for handling worker gRPC communication.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Path to TLS certificate used for encryption on gRPC connections.
	// If empty, no TLS connection is used.
	TLSCertPath string

	// Path to TLS private key used for encryption on gRPC connections.
	// Only use this in conjunction with TLSCertPath.
	TLSKeyPath string

	// Secret is a basic auth token used for authentication.
	// Only use this in conjunction with TLSCertPath and TLSKeyPath.
	Secret string

	// ListenAdress contains the interface ip and port to listen on,
	// i.e. "127.0.0.1:50051".
	ListenAdress string
}

Config configures a server.

type WorkerServer

type WorkerServer struct {
	// Server is the gRPC server.
	Server *grpc.Server
	// contains filtered or unexported fields
}

WorkerServer is a server for handling worker gRPC requests. It implements the Worker interface.

func NewWorkerServer

func NewWorkerServer(cfg Config) (*WorkerServer, error)

NewWorkerServer returns a new WorkerServer or nil and an error, when something went wrong. It tries to create a network listener, loads TLS certificates and keys and configures authentication and request validation.

func (*WorkerServer) Serve

func (w *WorkerServer) Serve() error

Serve starts the gRPC server, listening for incoming requests.

func (*WorkerServer) Stop

func (w *WorkerServer) Stop()

Stop stops the gRPC server, not listening for incoming requests anymore.

Jump to

Keyboard shortcuts

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