Documentation
¶
Index ¶
- type App
- func (app *App) AppConfigLock() *sync.RWMutex
- func (app *App) CurrentConfig() config.AppConfig
- func (app *App) Logger() zerolog.Logger
- func (app *App) SetAgentCreatorForTest(newCreator func(path string) (*pkg.Agent, error))
- func (app *App) SetLoggerForTest(logger zerolog.Logger)
- func (app *App) Start() error
- func (app *App) Stop()
- func (app *App) TestReloadConfig() error
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 ¶
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 ¶
CurrentConfig returns a thread-safe copy of the current application configuration.
func (*App) SetAgentCreatorForTest ¶
SetAgentCreatorForTest allows tests to replace the agent creator function. This method should ONLY be used in test contexts.
func (*App) SetLoggerForTest ¶
SetLoggerForTest allows tests to replace the app's internal logger. This method should ONLY be used in test contexts.
func (*App) Start ¶
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 ¶
TestReloadConfig is a test helper to expose reloadConfigAndApply for testing. It should only be used in tests.