server

package
v1.24.7 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package server provides helpers for building and running a sansshell server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildServer

func BuildServer(opts ...Option) (*grpc.Server, error)

BuildServer creates a gRPC server, attaches the OPA policy interceptor with supplied args and then registers all of the imported SansShell modules. Separating this from Serve primarily facilitates testing.

func Serve

func Serve(hostport string, opts ...Option) error

Serve wraps up BuildServer in a succinct API for callers passing along various parameters. It will automatically add an authz hook for HostNet based on the listener address. Additional hooks are passed along after this one.

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 authz hook which is checked by the installed authorizer.

func WithCredentials added in v1.6.0

func WithCredentials(c credentials.TransportCredentials) Option

WithCredentials applies credentials to be used by the RPC server.

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 one is used if none is supplied.

func WithParsedPolicy added in v1.19.2

func WithParsedPolicy(policy *opa.AuthzPolicy) Option

WithParsedPolicy applies an already-parsed OPA policy used against incoming RPC requests.

func WithPolicy added in v1.6.0

func WithPolicy(policy string) Option

WithPolicy applies an OPA policy used against incoming RPC requests.

func WithRawServerOption added in v1.9.0

func WithRawServerOption(s func(*grpc.Server)) Option

WithRawServerOption allows one access to the RPC Server object. Generally this is done to add additional registration functions for RPC services to be done before starting the server.

func WithStreamInterceptor added in v1.6.0

func WithStreamInterceptor(stream grpc.StreamServerInterceptor) Option

WithStreamInterceptor adds an additional stream interceptor installed after telemetry and authz.

func WithUnaryInterceptor added in v1.6.0

func WithUnaryInterceptor(unary grpc.UnaryServerInterceptor) Option

WithUnaryInterceptor adds an additional unary interceptor installed after telemetry and authz.

Jump to

Keyboard shortcuts

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