Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrMissingInitFunc = errors.New("missing stream initializer function")
)
Functions ¶
func DefaultGrpcDialOptions ¶
func DefaultGrpcDialOptions(hostport string, s UsesAuthorizer, additionalOpts ...grpc.DialOption) (opts []grpc.DialOption)
DefaultGrpcDialOptions returns a set of sensible default list of grpc.DialOption values. It includes transport credentials and configures per-RPC credentials using an authorizer, if one is configured.
Types ¶
type Authorizer ¶
type Authorizer interface { credentials.PerRPCCredentials oauth2.TokenSource }
Authorizer represents an interface which provides a token used for authenticating a client in server-client communication. More specifically, this interfaces requires credentials.PerRPCCredentials, which enables this to be used by a gRPC client to communicate with a gRPC server that requires per-RPC credentials.
func NewOAuthAuthorizerFromClientCredentials ¶
func NewOAuthAuthorizerFromClientCredentials(config *clientcredentials.Config) Authorizer
NewOAuthAuthorizerFromClientCredentials creates a new authorizer based on an OAuth 2.0 client credentials.
func NewOAuthAuthorizerFromConfig ¶
func NewOAuthAuthorizerFromConfig(config *oauth2.Config, token *oauth2.Token) Authorizer
NewOAuthAuthorizerFromConfig creates a new authorizer based on an OAuth 2.0 config.
type InitFuncOf ¶ added in v1.4.4
type InitFuncOf[StreamType grpc.ClientStream] func(target string, additionalOpts ...grpc.DialOption) (stream StreamType, err error)
InitFuncOf describes a function with type parameters that creates any kind of stream towards a gRPC server specified in target and returns the stream or an error. Additional gRPC dial options can be specified in additionalOpts.
type StreamChannelOf ¶ added in v1.4.4
type StreamChannelOf[StreamType grpc.ClientStream, MsgType proto.Message] struct { // contains filtered or unexported fields }
StreamChannelOf provides a channel around a connection to a grpc.ClientStream to send messages of type MsgType to that particular stream, using an internal go routine. This is necessary, because gRPC does not allow sending to a stream from multiple goroutines directly.
func (*StreamChannelOf[StreamType, MsgType]) Send ¶ added in v1.4.4
func (c *StreamChannelOf[StreamType, MsgType]) Send(msg MsgType)
Send sends the message into the stream via the channel. Since this uses the receive operator on the channel, this function may block until the message is received on the sendLoop of this StreamChannelOf or if the buffer of the channel is full.
type StreamsOf ¶ added in v1.4.4
type StreamsOf[StreamType grpc.ClientStream, MsgType proto.Message] struct { // contains filtered or unexported fields }
StreamsOf handles stream channels to multiple gRPC servers, identified by a unique target (usually host and port). Since gRPC does only allow to send to a stream using one goroutine, each stream provides a go channel that can be used to send messages to the particular stream.
A stream for a given target can be retrieved with the GetStream function, which automatically initializes the stream if it does not exist.
func NewStreamsOf ¶ added in v1.4.4
func NewStreamsOf[StreamType grpc.ClientStream, MsgType proto.Message](opts ...StreamsOfOption[StreamType, MsgType]) (s *StreamsOf[StreamType, MsgType])
NewStreamsOf creates a new StreamsOf object and initializes all the necessary objects for it.
func (*StreamsOf[StreamType, MsgType]) GetStream ¶ added in v1.4.4
func (s *StreamsOf[StreamType, MsgType]) GetStream(target string, component string, init InitFuncOf[StreamType], opts ...grpc.DialOption) (c *StreamChannelOf[StreamType, MsgType], err error)
GetStream tries to retrieve a stream for the given target and component. If no stream exists, it tries to create a new stream using the supplied init function. An error is returned if the initialization is not successful.
type StreamsOfOption ¶ added in v1.4.4
type StreamsOfOption[StreamType grpc.ClientStream, MsgType proto.Message] func(*StreamsOf[StreamType, MsgType])
StreamsOfOption is a functional option type to configure the StreamOf type.
func WithLogger ¶ added in v1.4.4
func WithLogger[StreamType grpc.ClientStream, MsgType proto.Message](log *logrus.Entry) StreamsOfOption[StreamType, MsgType]
WithLogger can be used to specify a dedicated logger entry which is used for logging. Otherwise, the default logging entry of logrus is used.
type UsesAuthorizer ¶
type UsesAuthorizer interface { SetAuthorizer(auth Authorizer) Authorizer() Authorizer }
UsesAuthorizer is an interface to denote that a struct is willing to accept and use an Authorizer
Directories ¶
Path | Synopsis |
---|---|
Package assessment is a reverse proxy.
|
Package assessment is a reverse proxy. |
Package discovery is a reverse proxy.
|
Package discovery is a reverse proxy. |
Package evidence is a reverse proxy.
|
Package evidence is a reverse proxy. |
Package orchestrator is a reverse proxy.
|
Package orchestrator is a reverse proxy. |