Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoRoute = errors.New("client: no route configured")
ErrNoRoute is returned by connect handlers to indicate that the request should fall back to the default configuration-based routing.
Functions ¶
This section is empty.
Types ¶
type BackendConfig ¶
type BackendConfig struct {
Name string `yaml:"name"`
Hostname string `yaml:"hostname"`
Hostnames []string `yaml:"hostnames"`
NexusAddresses []string `yaml:"nexusAddresses"`
AuthToken string `yaml:"authToken"`
PortMappings map[int]PortMapping `yaml:"portMappings"`
HealthChecks HealthCheckConfig `yaml:"healthChecks"`
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client manages the full lifecycle for one configured backend service.
func New ¶
func New(cfg ClientBackendConfig, opts ...Option) *Client
New creates a new Client instance for a specific backend configuration.
type ClientBackendConfig ¶
type ClientBackendConfig struct {
Name string
Hostnames []string
NexusAddress string
AuthToken string
PortMappings map[int]PortMapping
HealthChecks HealthCheckConfig
}
type ConnectHandler ¶
ConnectHandler is invoked whenever the proxy asks us to establish a new local connection. Returning ErrNoRoute will defer to the default port-mapping behaviour. Any other error is treated as fatal for that request.
type ConnectRequest ¶
type ConnectRequest struct {
BackendName string
ClientID uuid.UUID
Hostname string
OriginalHostname string
Port int
ClientIP string
}
ConnectRequest provides context about a client connection request coming from the Nexus proxy.
type HealthCheckConfig ¶
type Option ¶
type Option func(*Client)
Option mutates a Client during construction.
func WithConnectHandler ¶
func WithConnectHandler(handler ConnectHandler) Option
WithConnectHandler registers a custom connect handler. The handler is invoked before the default port-mapping logic. Returning ErrNoRoute (or a nil connection) will fall back to the default handler.