Documentation
¶
Overview ¶
Package socketbridge provides host-side socket forwarding via docker exec. It connects to a container running socket-forwarder and multiplexes socket connections between the container and host agents (GPG, SSH).
This implements a muxrpc-like protocol over stdin/stdout, avoiding the need for network access from container to host.
Package socketbridge provides socket forwarding between host and container via muxrpc-style protocol over docker exec stdin/stdout.
Index ¶
Constants ¶
const ( MsgData byte = 1 // Socket data MsgOpen byte = 2 // New connection (payload = socket type) MsgClose byte = 3 // Connection closed MsgPubkey byte = 4 // GPG public key data MsgReady byte = 5 // Forwarder ready MsgError byte = 6 // Error message )
Message types (must match socket-forwarder)
const ProtocolVersion = 1
ProtocolVersion is the muxrpc wire protocol version. Bump when the message format or semantics change incompatibly.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bridge ¶
type Bridge struct {
// Warnings receives user-visible warning messages (typically stderr).
// If nil, warnings are suppressed.
Warnings io.Writer
// contains filtered or unexported fields
}
Bridge manages socket forwarding to a container.
func NewBridge ¶
NewBridge creates a new socket bridge for the given container. gpgEnabled indicates whether GPG agent forwarding is configured.
func (*Bridge) SetGPGPubkey ¶
SetGPGPubkey sets the GPG public key to send to the container. Must be called before Start if GPG forwarding is enabled.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager tracks per-container bridge daemon processes. It spawns detached "clawker bridge serve" subprocesses that forward GPG and SSH agent sockets into running containers.
Manager implements SocketBridgeManager.
func NewManager ¶
NewManager creates a new socket bridge Manager.
func (*Manager) EnsureBridge ¶
EnsureBridge ensures a bridge daemon is running for the given container. It is idempotent — if a bridge is already running, it returns immediately.
func (*Manager) IsRunning ¶
IsRunning returns true if a bridge daemon is running for the given container.
func (*Manager) StopBridge ¶
StopBridge stops the bridge daemon for the given container.
type SocketBridgeManager ¶
type SocketBridgeManager interface {
// EnsureBridge ensures a bridge daemon is running for the given container.
// It is idempotent — if a bridge is already running, it returns immediately.
EnsureBridge(containerID string, gpgEnabled bool) error
// StopBridge stops the bridge daemon for the given container.
StopBridge(containerID string) error
// StopAll stops all known bridge daemons.
StopAll() error
// IsRunning returns true if a bridge daemon is running for the given container.
IsRunning(containerID string) bool
}
SocketBridgeManager is the interface for managing socket bridge daemons. Commands interact with this interface (not the concrete Manager) to enable test mocking via sockebridgemocks.SocketBridgeManagerMock.
type SocketConfig ¶
type SocketConfig struct {
Path string `json:"path"` // Unix socket path in container
Type string `json:"type"` // "gpg-agent" or "ssh-agent"
}
SocketConfig defines a socket to forward.