backend

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

README

ContainerSSH Backend Library

This library handles SSH requests and routes them to a container or other backends.

Using this library

This library can be used in conjunction with the sshserver to route SSH connections to containers.

You can create a new backend handler like this:

handler, err := backend.New(
    config,
    logger,
    loggerFactory,
    authBehavior,
)

This method accepts the following parameters:

config : The AppConfig struct from the configuration library. This is needed because this library performs a call to the config server if configured to fetch a connection-specific information.

logger : This variable is a logger from the log library.

loggerFactory : This is a logger factory used by the backend to create a logger for the instantiated backends after fetching the connection-specific configuration.

authBehavior : This variable can contain one of sshserver.AuthResponseSuccess, sshserver.AuthResponseFailure, or sshserver.AuthResponseUnavailable to indicate how the backend should react to authentication requests. Normally, this can be set to sshserver.AuthResponseUnavailable since the auth integration library will take care of the authentication.

The handler can be passed to the sshserver or to another overlay as a backend, for example auth integration.

Documentation

Index

Constants

View Source
const MetricHelpBackendError = "The number of failed requests to the backend."

MetricHelpBackendError is the help text of backend errors

View Source
const MetricHelpBackendRequests = "The number of requests to the backend."

MetricHelpBackendRequests is the help text of backend errors

View Source
const MetricLabelBackend = "backend"

MetricLabelBackend is the name for the backend label

View Source
const MetricNameBackendError = "containerssh_backend_errors_total"

MetricNameBackendError is the number of errors in the backend

View Source
const MetricNameBackendRequests = "containerssh_backend_requests_total"

MetricNameBackendRequests is the number of requests in the backend

View Source
const MetricUnitBackendError = "errors_total"

MetricUnitBackendError is the unit of backend errors

View Source
const MetricUnitBackendRequests = "requests_total"

MetricUnitBackendRequests is the unit of backend errors

Variables

This section is empty.

Functions

func New

func New(
	config config.AppConfig,
	logger log.Logger,
	metricsCollector metrics.Collector,
	defaultAuthResponse sshserver.AuthResponse,
) (sshserver.Handler, error)

New creates a new backend handler.

Types

This section is empty.

Jump to

Keyboard shortcuts

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