Documentation
¶
Overview ¶
Package session runs the local interactive Lingon terminal session.
Index ¶
- func DefaultSessionIdentity() (string, string)
- type Options
- type PublishStatus
- type PublishStatusKind
- type Runner
- func (r *Runner) HandleSessionCommand(ctx context.Context, sessionID string, kind protocolpb.CommandKind)
- func (r *Runner) HandleSessionInput(sessionID string, data []byte)
- func (r *Runner) ResizeActive(cols, rows int)
- func (r *Runner) ResizeActiveIfChanged(cols, rows int) bool
- func (r *Runner) Run(ctx context.Context) error
- func (r *Runner) SendCtrlDActive()
- func (r *Runner) SessionID() string
- func (r *Runner) SessionOffline(sessionID string) (bool, bool)
- func (r *Runner) StopSession(sessionID, reason string)
- type StatusKind
- type StatusUpdate
- type WallInactivityToggleResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultSessionIdentity ¶
DefaultSessionIdentity returns the standard default session id/name pair.
Types ¶
type Options ¶
type Options struct {
Endpoint string
Token string
AuthFile string
SessionID string
SessionName string
Cols int
Rows int
Shell string
Term string
Respawn bool
Offline bool
Theme string
Publish bool
PublishControl bool
HostnameOnly bool
ScrollbackLines int
MaxReplayScreens int
TLSDir string
Insecure bool
Stdin *os.File
Stdout *os.File
DisableRaw bool
Logger pslog.Logger
// Clock controls time-based behavior (reconnects, overlays).
Clock clock.Clock
OnPTYRead func([]byte)
OnPublishFrame func(*protocolpb.Frame)
OnPublishStatus func(PublishStatus)
OnPublishWall func(*protocolpb.Wall)
OnStatus func(StatusUpdate)
// DisableDesktopNotifications suppresses best-effort desktop notifications for inactivity walls.
DisableDesktopNotifications bool
DesktopNotifier desktopnotify.Notifier
// AllowRemoteResize permits relay- or attach-driven resize frames to resize
// the underlying local PTY. This must remain false for normal host sessions
// and only be enabled for headless Lingon-owned PTYs.
AllowRemoteResize bool
// ToggleWallInactivityFallback handles local-only wall inactivity cycling
// when relay-backed toggle is unavailable.
ToggleWallInactivityFallback func(context.Context, string) (WallInactivityToggleResult, error)
OnSnapshot func(terminal.Snapshot)
Trace *trace.Writer
ResizeEvents <-chan struct{}
// DisableSignalResize suppresses process-global SIGWINCH handling and relies
// only on explicit ResizeEvents.
DisableSignalResize bool
}
Options configures a local interactive session.
type PublishStatus ¶
type PublishStatus struct {
SessionID string
Kind PublishStatusKind
Message string
Endpoint string
Remaining time.Duration
}
PublishStatus describes a host publish connectivity state change.
type PublishStatusKind ¶
type PublishStatusKind string
PublishStatusKind identifies host publish connectivity transitions.
const ( // PublishStatusConnected indicates relay connectivity was restored. PublishStatusConnected PublishStatusKind = "connected" // PublishStatusConnectionLost indicates relay connectivity was lost. PublishStatusConnectionLost PublishStatusKind = "connection_lost" // PublishStatusConnectionBackoff indicates reconnect backoff countdown is active. PublishStatusConnectionBackoff PublishStatusKind = "connection_backoff" )
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner executes a local interactive session with optional relay publishing.
func (*Runner) HandleSessionCommand ¶
func (r *Runner) HandleSessionCommand(ctx context.Context, sessionID string, kind protocolpb.CommandKind)
HandleSessionCommand applies a protocol command to the target local session.
func (*Runner) HandleSessionInput ¶
HandleSessionInput writes raw input to the target local PTY session.
func (*Runner) ResizeActive ¶
ResizeActive applies a size update to the current active session.
func (*Runner) ResizeActiveIfChanged ¶
ResizeActiveIfChanged applies a size update only when the active session has not already observed the requested dimensions.
func (*Runner) SendCtrlDActive ¶
func (r *Runner) SendCtrlDActive()
SendCtrlDActive delivers an explicit EOF to the active local PTY session.
func (*Runner) SessionOffline ¶
SessionOffline reports the offline flag for a local session.
func (*Runner) StopSession ¶
StopSession force-stops the target local PTY session and publishes an explicit session-closed reason before shutting it down.
type StatusKind ¶
type StatusKind string
StatusKind identifies generic status banner kinds.
const ( // StatusKindInfo maps to a non-error status banner. StatusKindInfo StatusKind = "info" // StatusKindError maps to an error status banner. StatusKindError StatusKind = "error" )
type StatusUpdate ¶
type StatusUpdate struct {
SessionID string
Kind StatusKind
Message string
Duration time.Duration
}
StatusUpdate describes a transient status banner update.
type WallInactivityToggleResult ¶
WallInactivityToggleResult describes post-toggle wall inactivity state.