Documentation
¶
Index ¶
- Constants
- type InfraStats
- type Manager
- func (m *Manager) CheckSecurityHealth() *SecurityHealthCheck
- func (m *Manager) ContainerName(name string) string
- func (m *Manager) EnsureBaseNginxConfig() error
- func (m *Manager) GetAgentPort() int
- func (m *Manager) GetDockerHostIP() string
- func (m *Manager) GetService(name string) (*models.InfraService, error)
- func (m *Manager) GetServiceLogs(name string, tail int) (string, error)
- func (m *Manager) GetStats() (*InfraStats, error)
- func (m *Manager) IsNginxRunning() bool
- func (m *Manager) ListServices() ([]models.InfraService, error)
- func (m *Manager) RefreshSecurityScripts() (*RefreshSecurityScriptsResult, error)
- func (m *Manager) RestartService(name string) error
- func (m *Manager) ServiceLogs(name string, tail int, stream string) (string, error)
- func (m *Manager) SetNginxRealtimeCapture(enabled bool) error
- func (m *Manager) SetNginxRealtimeCaptureWithStatus(enabled bool) (map[string]interface{}, error)
- func (m *Manager) StartService(name string) error
- func (m *Manager) StopService(name string) error
- func (m *Manager) StreamServiceLogs(ctx context.Context, name string, tail int, stream string, sink func(string)) error
- func (m *Manager) UpdateConfig(cfg *config.Config)
- type RefreshSecurityScriptsResult
- type SecurityHealthCheck
Constants ¶
const ( LogStreamAll = "all" LogStreamStdout = "stdout" LogStreamStderr = "stderr" )
A container writes two separate outputs and nginx uses both: the access log goes to stdout and the error log to stderr, so the two are readable apart without configuring a file.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InfraStats ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) CheckSecurityHealth ¶
func (m *Manager) CheckSecurityHealth() *SecurityHealthCheck
CheckSecurityHealth verifies the security setup is correctly configured
func (*Manager) ContainerName ¶
ContainerName is the container behind an infrastructure service, or "" if there is none.
func (*Manager) EnsureBaseNginxConfig ¶
EnsureBaseNginxConfig refreshes an already-managed base nginx.conf from the current template so an upgraded agent picks up template changes (such as the server_names_hash settings) without a security toggle. It preserves the on-disk variant (lua or plain) and is a no-op when no managed config exists or the content already matches.
func (*Manager) GetAgentPort ¶
GetAgentPort returns the port the agent API is listening on
func (*Manager) GetDockerHostIP ¶
GetDockerHostIP returns the IP address that containers can use to reach the host. It tries multiple methods and falls back to the default Docker bridge gateway.
func (*Manager) GetService ¶
func (m *Manager) GetService(name string) (*models.InfraService, error)
func (*Manager) GetServiceLogs ¶
func (*Manager) GetStats ¶
func (m *Manager) GetStats() (*InfraStats, error)
func (*Manager) IsNginxRunning ¶
IsNginxRunning checks if the nginx container is running
func (*Manager) ListServices ¶
func (m *Manager) ListServices() ([]models.InfraService, error)
func (*Manager) RefreshSecurityScripts ¶
func (m *Manager) RefreshSecurityScripts() (*RefreshSecurityScriptsResult, error)
RefreshSecurityScripts regenerates all security configs: nginx.conf, Lua scripts, and vhosts
func (*Manager) RestartService ¶
func (*Manager) ServiceLogs ¶
func (*Manager) SetNginxRealtimeCapture ¶
func (*Manager) SetNginxRealtimeCaptureWithStatus ¶
SetNginxRealtimeCaptureWithStatus enables/disables realtime capture and returns detailed status
func (*Manager) StartService ¶
func (*Manager) StopService ¶
func (*Manager) StreamServiceLogs ¶
func (m *Manager) StreamServiceLogs(ctx context.Context, name string, tail int, stream string, sink func(string)) error
StreamServiceLogs follows an infrastructure container's output until ctx is done, handing each line to sink as it is written.
func (*Manager) UpdateConfig ¶
type RefreshSecurityScriptsResult ¶
type RefreshSecurityScriptsResult struct {
Success bool `json:"success"`
AgentIP string `json:"agent_ip"`
AgentPort int `json:"agent_port"`
NginxConfWritten bool `json:"nginx_conf_written"`
LuaWritten bool `json:"lua_written"`
VolumesModified bool `json:"volumes_modified"`
ContainerRecreated bool `json:"container_recreated"`
NginxReloaded bool `json:"nginx_reloaded"`
VhostsUpdated []string `json:"vhosts_updated,omitempty"`
Errors []string `json:"errors,omitempty"`
}
RefreshSecurityScriptsResult contains the result of refreshing security scripts
type SecurityHealthCheck ¶
type SecurityHealthCheck struct {
Status string `json:"status"`
Checks map[string]bool `json:"checks"`
Issues []string `json:"issues"`
Recommendations []string `json:"recommendations"`
Details map[string]interface{} `json:"details,omitempty"`
}
SecurityHealthCheck represents the result of a security setup health check