server

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package server provides functionality so that other uses of sansshell can provide their own main.go without having to cargo-cult everything across for common use cases. i.e. adding additional modules that are locally defined.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, opts ...Option)

Run takes the given context and RunState and starts up a sansshell server. As this is intended to be called from main() it doesn't return errors and will instead exit on any errors.

Types

type Option added in v1.6.0

type Option interface {
	// contains filtered or unexported methods
}

func WithAuthzHook added in v1.6.0

func WithAuthzHook(hook rpcauth.RPCAuthzHook) Option

WithAuthzHook adds an additional authz hook to be applied to the server.

func WithCredSource added in v1.6.0

func WithCredSource(credSource string) Option

WithCredSource applies a registered credential source with the mtls package.

func WithHostPort added in v1.6.0

func WithHostPort(hostport string) Option

WithHostport applies the host:port to run the server.

func WithJustification added in v1.6.0

func WithJustification(j bool) Option

WithJustification applies the justification param. Justification if true requires justification to be set in the incoming RPC context Metadata (to the key defined in the telemetry package).

func WithJustificationHook added in v1.6.0

func WithJustificationHook(hook func(string) error) Option

WithJustificationFunc applies a justification function. This function will be called if Justication is true and a justification entry is found. The supplied function can then do any validation it wants in order to ensure it's compliant.

func WithLogger added in v1.6.0

func WithLogger(l logr.Logger) Option

WithLogger applies a logger that is used for all logging. A discard based one is used if none is supplied.

func WithPolicy added in v1.6.0

func WithPolicy(policy string) Option

WithPolicy applies an OPA policy used against incoming RPC requests.

func WithStreamInterceptor added in v1.6.0

func WithStreamInterceptor(i grpc.StreamServerInterceptor) Option

WithStreamInterceptor adds an additional stream server interceptor. These become any additional interceptors to be added to streaming RPCs served from this instance. They will be added after logging and authz checks.

func WithUnaryInterceptor added in v1.6.0

func WithUnaryInterceptor(i grpc.UnaryServerInterceptor) Option

WithUnaryInterceptor adds an additional unary server interceptor. These become any additional interceptors to be added to unary RPCs served from this instance. They will be added after logging and authz checks.

Jump to

Keyboard shortcuts

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