server

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

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

App encapsulates the core application logic for the SSH Agent Multiplexer.

func NewApp

func NewApp(
	initialConfigFlagValue string,
	agentCreator func(path string) (*pkg.Agent, error),
	version string,
	revision string,
) (*App, error)

NewApp creates and initializes a new App instance. initialConfigFlagValue: Path to config file from --config flag (can be empty). agentCreator: Function to create agent instances.

func (*App) AppConfigLock

func (app *App) AppConfigLock() *sync.RWMutex

AppConfigLock returns a pointer to the RWMutex that protects currentConfig. This allows tests to lock for more complex assertions if needed, though CurrentConfig() is preferred for simple reads.

func (*App) CurrentConfig

func (app *App) CurrentConfig() config.AppConfig

CurrentConfig returns a thread-safe copy of the current application configuration.

func (*App) Logger

func (app *App) Logger() zerolog.Logger

Logger returns the app's internal logger. Used for testing log capture.

func (*App) SetAgentCreatorForTest

func (app *App) SetAgentCreatorForTest(newCreator func(path string) (*pkg.Agent, error))

SetAgentCreatorForTest allows tests to replace the agent creator function. This method should ONLY be used in test contexts.

func (*App) SetLoggerForTest

func (app *App) SetLoggerForTest(logger zerolog.Logger)

SetLoggerForTest allows tests to replace the app's internal logger. This method should ONLY be used in test contexts.

func (*App) Start

func (app *App) Start() error

Start begins the core operations of the application: 1. Starts the network listener. 2. Starts the configuration file watcher (if a config file is used). 3. Enters the main loop to accept and handle incoming agent connections. It blocks until the application is stopped or a critical error occurs.

func (*App) Stop

func (app *App) Stop()

Stop signals the application to gracefully shut down all its services.

func (*App) TestReloadConfig

func (app *App) TestReloadConfig() error

TestReloadConfig is a test helper to expose reloadConfigAndApply for testing. It should only be used in tests.

Jump to

Keyboard shortcuts

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