srv

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSubdomainInUse   = status.Error(codes.AlreadyExists, "subdomain already in use")
	ErrSubdomainMissing = status.Error(codes.InvalidArgument, "missing subdomain")
	ErrSubdomainInvalid = status.Error(codes.InvalidArgument, "invalid subdomain")
)

Functions

This section is empty.

Types

type OptFunc

type OptFunc func(*opts)

func WithDebug

func WithDebug() OptFunc

WithDebug enables debug logs.

Default: disabled

func WithHTTPPort

func WithHTTPPort(port uint16) OptFunc

WithHTTPPort sets the port for the http web server. Ensure that the chosen port is available and not in use.

Default: 8080

func WithJSONLogger

func WithJSONLogger() OptFunc

WithJSONLogger configures logger to use JSON.

Default: disabled

func WithMaxMsgRecvSize

func WithMaxMsgRecvSize(size int) OptFunc

WithMaxMsgRecvSize sets the maximum gRPC receive message size.

Default: 1 MB (1024 * 1024)

func WithMaxMsgSendSize

func WithMaxMsgSendSize(size int) OptFunc

WithMaxMsgSendSize sets the maximum gRPC send message size.

Default: 1 MB (1024 * 1024)

func WithMaxRequestBodySize

func WithMaxRequestBodySize(size int64) OptFunc

WithMaxRequestBodySize sets a limit on the size of the HTTP request body to prevent potential abuse.

Default: 1 MB (1024 * 1024)

func WithPathToCertificate

func WithPathToCertificate(path string) OptFunc

WithPathToCertificate sets the path to the TLS certficiate file.

Defaullt: ./certs/srv-cert.pem

func WithPathToPrivateKey

func WithPathToPrivateKey(path string) OptFunc

WithPathToPrivateKey sets the path to the TLS private key file.

Defaullt: ./certs/srv-key.pem

func WithRPCPort

func WithRPCPort(port uint16) OptFunc

WithRPCPort sets the port for the gRPC server. Ensure that the chosen port is available and not in use.

Default: 2035

func WithReflection

func WithReflection() OptFunc

WithReflection enables gRPC reflection

Default: disabled

func WithServingUrlFormat

func WithServingUrlFormat(format string) OptFunc

WithServingUrlFormat sets the serving url format.

Default: "http://%s.localhost:8080"

func WithTLS

func WithTLS() OptFunc

WithTLS enables server-side TLS.

Default: false

type Srv

type Srv struct {
	pb.UnimplementedFleetServer
	// contains filtered or unexported fields
}

Srv is the Fleet gRPC server implementation.

func New

func New(optfns ...OptFunc) (*Srv, error)

New creates a new instance of Srv.

func (Srv) Listen

func (s Srv) Listen(stream pb.Fleet_ListenServer) error

Listen implements the gRPC Fleet service's Listen method. It facilitates communication between HTTP requests and connected gRPC clients, acting as a relay in between.

func (Srv) Run

func (s Srv) Run() error

Run starts the gRPC and HTTP servers, blocking until an error occurs. It returns an error if either server fails.

Jump to

Keyboard shortcuts

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