transports

package
v0.6.10 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: BSD-3-Clause Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownMessageKind = fmt.Errorf("unknown message kind")

Functions

This section is empty.

Types

type Host

type Host interface {
	// Listen listens for incoming requests.
	// This function never returns unless an error occurs, or Close is called.
	Listen(ctx context.Context) error
	// Close closes the host.
	Close(ctx context.Context) error
}

Host is the interface implemented by types that can host a Bastion server.

func NewHost

func NewHost(address string, messageProcessor MessageProcessor) Host

NewHost creates a new Host listening on the given address.

type MessageHandler

type MessageHandler interface {
	// Register registers the given application.
	Register(ctx context.Context, message messages.RegistrationMessage) (*messages.RegistrationResponse, error)
	// Deregister removes the registration of the application with the given name.
	Deregister(ctx context.Context, message messages.DeregistrationMessage) (*messages.DeregistrationResponse, error)
	// ForwardRequest forwards the given request to the application specified in the request.
	ForwardRequest(ctx context.Context, message messages.ForwardRequestMessage) (*messages.ForwardRequestResponse, error)
}

MessageHandler allows the handling of incoming valid Bastion requests.

type MessageProcessor

type MessageProcessor interface {
	// ProcessMessage processes the given message and returns a response.
	ProcessMessage(ctx context.Context, message *funcie.Message) (*funcie.Response, error)
}

MessageProcessor dispatches messages to the appropriate handler.

func NewCachingMessageProcessor

func NewCachingMessageProcessor(underlyingProcessor MessageProcessor) MessageProcessor

NewCachingMessageProcessor creates a new caching MessageProcessor, forwarding requests to the underlying processor. If the underlying processor returns ErrNoConsumerFound, that result is cached for a minute or until registered.

func NewMessageProcessor

func NewMessageProcessor(handler MessageHandler) MessageProcessor

NewMessageProcessor creates a new MessageProcessor.

Directories

Path Synopsis
ws

Jump to

Keyboard shortcuts

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