plugin

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package plugin connects courier and a provider running as its own service over courier.plugin.v1.ProviderService. A plugin written in Go implements provider.Provider and calls Serve; one in another language implements the service from proto/courier/plugin/v1. Courier dials a plugin with Dial; where and how the plugin runs (a sidecar, another container, a process the image starts) is the deployment's concern.

Index

Constants

View Source
const ServiceName = "courier.plugin.v1.ProviderService"

ServiceName is the plugin service's name in the gRPC health protocol.

Variables

View Source
var ErrNotServing = errors.New("not serving")

ErrNotServing: the plugin's health is not SERVING.

Functions

func Serve

func Serve(address string, p provider.Provider, opts ...ServeOption) error

Serve runs p as a plugin on address (unix:///path or host:port) until SIGINT or SIGTERM.

func ServeListener

func ServeListener(ctx context.Context, lis net.Listener, p provider.Provider, opts ...ServeOption) error

ServeListener serves p on lis until ctx ends, with the standard gRPC health service: SERVING while it runs, NOT_SERVING once it stops.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a plugin as a provider.Provider.

func Dial

func Dial(target string, opts ...DialOption) (*Client, error)

Dial prepares a connection to a plugin: target is "unix:///path" or "host:port". Nothing connects until the first call; gRPC reconnects with backoff whenever the plugin goes away (to its new address when it moved), and keepalive pings notice a dead peer. Without WithTLS the connection is plaintext: keep such a plugin next to courier (a sidecar, a unix socket on a shared volume).

func (*Client) Check

func (c *Client) Check(ctx context.Context, ch provider.Channel) error

Check implements provider.Provider.

func (*Client) Close

func (c *Client) Close() error

Close the connection.

func (*Client) Describe

func (c *Client) Describe(ctx context.Context) (provider.Descriptor, error)

Describe implements provider.Provider.

func (*Client) Health

func (c *Client) Health(ctx context.Context) error

Health is the plugin's gRPC health: nil while it serves.

func (*Client) Send

func (c *Client) Send(ctx context.Context, d provider.Delivery) ([]byte, error)

Send implements provider.Provider.

func (*Client) Target

func (c *Client) Target() string

Target is the address dialed.

func (*Client) WaitDescribe

func (c *Client) WaitDescribe(ctx context.Context) (provider.Descriptor, error)

WaitDescribe is Describe that waits for the plugin to come up, until ctx ends: courier's startup, when the plugin may start after it.

type DialOption

type DialOption func(*[]grpc.DialOption)

DialOption configures Dial.

func WithDialOptions

func WithDialOptions(opts ...grpc.DialOption) DialOption

WithDialOptions adds gRPC dial options (interceptors, limits).

func WithTLS

func WithTLS(cfg *tls.Config) DialOption

WithTLS dials over TLS (mTLS when cfg carries a client certificate).

type ServeOption

type ServeOption func(*serveOptions)

ServeOption configures Serve and ServeListener.

func WithServerOptions

func WithServerOptions(opts ...grpc.ServerOption) ServeOption

WithServerOptions adds gRPC server options (interceptors, limits).

func WithServerTLS

func WithServerTLS(cfg *tls.Config) ServeOption

WithServerTLS serves over TLS (mTLS when cfg requires client certificates); courier dials with its plugin's tls settings.

Jump to

Keyboard shortcuts

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