Documentation
¶
Index ¶
- func RegisterLauncherAuthRoutes(mux *http.ServeMux, opts LauncherAuthRouteOpts)
- type Handler
- func (h *Handler) EnsurePicoChannel(callerOrigin string) (bool, error)
- func (h *Handler) RegisterRoutes(mux *http.ServeMux)
- func (h *Handler) RestartGateway() (int, error)
- func (h *Handler) SetDebug(debug bool)
- func (h *Handler) SetServerOptions(port int, public bool, publicExplicit bool, allowedCIDRs []string)
- func (h *Handler) Shutdown()
- func (h *Handler) StopGateway()
- func (h *Handler) TryAutoStartGateway()
- type LauncherAuthRouteOpts
- type LauncherAuthTokenHelp
- type LogBuffer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterLauncherAuthRoutes ¶ added in v0.2.5
func RegisterLauncherAuthRoutes(mux *http.ServeMux, opts LauncherAuthRouteOpts)
RegisterLauncherAuthRoutes registers /api/auth/login|logout|status.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler serves HTTP API requests.
func NewHandler ¶
NewHandler creates an instance of the API handler.
func (*Handler) EnsurePicoChannel ¶ added in v0.2.4
EnsurePicoChannel enables the Pico channel with sane defaults if it isn't already configured. Returns true when the config was modified.
callerOrigin is the Origin header from the setup request. If non-empty and no origins are configured yet, it's written as the allowed origin so the WebSocket handshake works for whatever host the caller is on (LAN, custom port, etc.). Pass "" when there's no request context.
func (*Handler) RegisterRoutes ¶
RegisterRoutes binds all API endpoint handlers to the ServeMux.
func (*Handler) RestartGateway ¶ added in v0.2.4
RestartGateway restarts the gateway process. This is a non-blocking operation that stops the current gateway (if running) and starts a new one. Returns the PID of the new gateway process or an error.
func (*Handler) SetServerOptions ¶
func (h *Handler) SetServerOptions(port int, public bool, publicExplicit bool, allowedCIDRs []string)
SetServerOptions stores current backend listen options for fallback behavior.
func (*Handler) Shutdown ¶ added in v0.2.4
func (h *Handler) Shutdown()
Shutdown gracefully shuts down the handler, stopping the gateway if it was started by this handler.
func (*Handler) StopGateway ¶ added in v0.2.4
func (h *Handler) StopGateway()
StopGateway stops the gateway process if it was started by this handler. This method is called during application shutdown to ensure the gateway subprocess is properly terminated. It only stops processes that were started by this handler, not processes that were attached to from existing instances.
func (*Handler) TryAutoStartGateway ¶
func (h *Handler) TryAutoStartGateway()
TryAutoStartGateway checks whether gateway start preconditions are met and starts it when possible. Intended to be called by the backend at startup.
type LauncherAuthRouteOpts ¶ added in v0.2.5
type LauncherAuthRouteOpts struct {
DashboardToken string
SessionCookie string
SecureCookie func(*http.Request) bool
// TokenHelp is returned on unauthenticated /api/auth/status responses (no secrets).
TokenHelp LauncherAuthTokenHelp
}
LauncherAuthRouteOpts configures dashboard token login handlers.
type LauncherAuthTokenHelp ¶ added in v0.2.5
type LauncherAuthTokenHelp struct {
EnvVarName string `json:"env_var_name"`
LogFileAbs string `json:"log_file,omitempty"`
ConfigFileAbs string `json:"config_file,omitempty"`
TrayCopyMenu bool `json:"tray_copy_menu"`
ConsoleStdout bool `json:"console_stdout"`
}
LauncherAuthTokenHelp tells the login UI where users can find the dashboard token.
type LogBuffer ¶
type LogBuffer struct {
// contains filtered or unexported fields
}
LogBuffer is a thread-safe ring buffer that stores the most recent N log lines. It supports incremental reads via LinesSince and tracks a runID that increments whenever the buffer is reset or cleared so clients can detect log history resets.
func NewLogBuffer ¶
NewLogBuffer creates a LogBuffer with the given capacity.
func (*LogBuffer) Append ¶
Append adds a line to the buffer. If the buffer is full, the oldest line is evicted.
func (*LogBuffer) Clear ¶ added in v0.2.2
func (b *LogBuffer) Clear()
Clear removes all buffered lines and increments the runID so clients treat subsequent reads as a new log stream.
func (*LogBuffer) LinesSince ¶
LinesSince returns lines appended after the given offset, the current total count, and the runID. If offset >= total, no lines are returned. If offset is too old (evicted), all buffered lines are returned.