Documentation
¶
Index ¶
- Constants
- Variables
- func AddedConnStyle() lipgloss.Style
- func BorderStyle() lipgloss.Style
- func ConnStyle() lipgloss.Style
- func DangerBorderColor() lipgloss.Color
- func DimmedStyle() lipgloss.Style
- func EmptyStyle() lipgloss.Style
- func ErrorStyle() lipgloss.Style
- func FooterDescStyle() lipgloss.Style
- func FooterGroupStyle() lipgloss.Style
- func FooterKeyStyle() lipgloss.Style
- func FooterStyle() lipgloss.Style
- func HeaderStyle() lipgloss.Style
- func LiveIndicatorStyle() lipgloss.Style
- func LoadingStyle() lipgloss.Style
- func RemovedConnStyle() lipgloss.Style
- func RenderDangerFrameWithTitle(content string, title string, width, height int) string
- func RenderFrameWithTitle(content string, title string, width, height int) string
- func SelectedConnStyle() lipgloss.Style
- func SortIndicatorStyle() lipgloss.Style
- func StatsStyle() lipgloss.Style
- func StatusStyle() lipgloss.Style
- func TableHeaderSelectedStyle() lipgloss.Style
- func TableHeaderStyle() lipgloss.Style
- func WarnStyle() lipgloss.Style
- type AnimationTickMsg
- type Change
- type ChangeType
- type ConnectionKey
- type DNSResolvedMsg
- type DataMsg
- type DockerResolvedMsg
- type Keybinding
- type Model
- func (m *Model) AtRootLevel() bool
- func (m *Model) CurrentView() *ViewState
- func (m Model) GetChange(c model.Connection) *Change
- func (m Model) Init() tea.Cmd
- func (m *Model) PopView() bool
- func (m *Model) PushView(state ViewState)
- func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m Model) View() string
- func (m Model) WithFilter(filter string) Model
- func (m Model) WithPID(pid int32) Model
- func (m Model) WithVersion(v string) Model
- type NetIOMsg
- type SortColumn
- type TickMsg
- type VersionCheckMsg
- type ViewLevel
- type ViewState
Constants ¶
const ( MinRefreshInterval = 500 * time.Millisecond MaxRefreshInterval = 10 * time.Second DefaultRefreshInterval = 2 * time.Second RefreshStep = 500 * time.Millisecond )
Refresh interval bounds.
Variables ¶
var ( KeyQuit = Keybinding{Key: "q", Desc: "Quit"} KeyQuitAlt = Keybinding{Key: "ctrl+c", Desc: "Quit"} KeyHelp = Keybinding{Key: "?", Desc: "Show help"} KeySettings = Keybinding{Key: "S", Desc: "Settings"} KeySearch = Keybinding{Key: "/", Desc: "Search/filter"} KeyToggleView = Keybinding{Key: "v", Desc: "Toggle grouped/flat view"} KeySortMode = Keybinding{Key: "s", Desc: "Enter sort mode"} KeyRefreshUp = Keybinding{Key: "+", Desc: "Increase refresh rate"} KeyRefreshDown = Keybinding{Key: "-", Desc: "Decrease refresh rate"} )
Global keybindings (always available)
var ( KeyUp = Keybinding{Key: "up", Desc: "Move up"} KeyUpAlt = Keybinding{Key: "k", Desc: "Move up"} KeyDown = Keybinding{Key: "down", Desc: "Move down"} KeyDownAlt = Keybinding{Key: "j", Desc: "Move down"} KeyPageUp = Keybinding{Key: "pgup", Desc: "Page up"} KeyPageDown = Keybinding{Key: "pgdown", Desc: "Page down"} KeyLeft = Keybinding{Key: "left", Desc: "Move left (sort mode)"} KeyLeftAlt = Keybinding{Key: "h", Desc: "Move left (sort mode)"} KeyRight = Keybinding{Key: "right", Desc: "Move right (sort mode)"} KeyRightAlt = Keybinding{Key: "l", Desc: "Move right (sort mode)"} KeyEnter = Keybinding{Key: "enter", Desc: "Select/drill-down"} KeySpace = Keybinding{Key: " ", Desc: "Select/drill-down"} KeyEsc = Keybinding{Key: "esc", Desc: "Back/cancel"} KeyBack = Keybinding{Key: "backspace", Desc: "Back/cancel"} )
Navigation keybindings
var ( KeyKillTerm = Keybinding{Key: "x", Desc: "Kill process (SIGTERM)"} KeyKillForce = Keybinding{Key: "X", Desc: "Force kill (SIGKILL)"} )
Kill keybindings
var ( KeyConfirmYes = Keybinding{Key: "y", Desc: "Confirm"} KeyConfirmNo = Keybinding{Key: "n", Desc: "Cancel"} )
Confirm/cancel keybindings
Functions ¶
func AddedConnStyle ¶
AddedConnStyle returns the style for newly added connections.
func DangerBorderColor ¶ added in v0.1.2
DangerBorderColor returns the red color for danger modals.
func DimmedStyle ¶
DimmedStyle returns a style for dimmed background content when modal is visible.
func EmptyStyle ¶
EmptyStyle returns the style for empty state messages.
func FooterDescStyle ¶
FooterDescStyle returns the style for key descriptions in footer.
func FooterGroupStyle ¶
FooterGroupStyle returns the style for footer group labels (NAV, ACTION).
func FooterKeyStyle ¶
FooterKeyStyle returns the style for keyboard shortcut keys in footer.
func HeaderStyle ¶
HeaderStyle returns the style for the main header title.
func LiveIndicatorStyle ¶
LiveIndicatorStyle returns the style for the LIVE indicator (green).
func LoadingStyle ¶
LoadingStyle returns the style for loading indicators.
func RemovedConnStyle ¶
RemovedConnStyle returns the style for removed connections.
func RenderDangerFrameWithTitle ¶ added in v0.1.2
RenderDangerFrameWithTitle renders content in a frame with danger/red styling. Used for destructive confirmations like kill process.
func RenderFrameWithTitle ¶
RenderFrameWithTitle renders content in a frame with a centered title on the top border. Uses heavy box drawing for modal prominence.
func SelectedConnStyle ¶
SelectedConnStyle returns the style for the selected row in table view.
func SortIndicatorStyle ¶
SortIndicatorStyle returns the style for sort direction indicators.
func StatsStyle ¶
StatsStyle returns the style for muted stats text.
func StatusStyle ¶
StatusStyle returns the style for status bar text.
func TableHeaderSelectedStyle ¶
TableHeaderSelectedStyle returns the style for the selected column header.
func TableHeaderStyle ¶
TableHeaderStyle returns the style for table column headers.
Types ¶
type AnimationTickMsg ¶
AnimationTickMsg is sent for UI animation updates (e.g., live indicator pulse).
type Change ¶
type Change struct {
Type ChangeType
Timestamp time.Time
}
Change represents a detected connection change.
type ChangeType ¶
type ChangeType int
ChangeType indicates whether a connection was added or removed.
const ( ChangeAdded ChangeType = iota ChangeRemoved )
type ConnectionKey ¶
ConnectionKey uniquely identifies a connection for diffing.
func KeyFromConnection ¶
func KeyFromConnection(c model.Connection) ConnectionKey
KeyFromConnection creates a ConnectionKey from a Connection.
type DNSResolvedMsg ¶
DNSResolvedMsg contains a DNS resolution result.
type DataMsg ¶
type DataMsg struct {
Snapshot *model.NetworkSnapshot
Err error
}
DataMsg contains updated network data.
type DockerResolvedMsg ¶ added in v0.1.11
type DockerResolvedMsg struct {
Containers map[int]*docker.ContainerPort // host port → container info
VirtualContainers []model.VirtualContainer // containers as virtual process rows
Err error
}
DockerResolvedMsg contains Docker container resolution results.
type Keybinding ¶
type Keybinding struct {
Key string // actual key(s) to match
Desc string // description for help display
}
Keybinding represents a keyboard shortcut with its display name.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the Bubble Tea model for the network monitor.
func (*Model) AtRootLevel ¶
AtRootLevel returns true if at the root navigation level.
func (*Model) CurrentView ¶
CurrentView returns the current view state (top of stack).
func (Model) GetChange ¶
func (m Model) GetChange(c model.Connection) *Change
GetChange returns a pointer to the Change for a connection, or nil if no change. Returns nil if highlight changes is disabled.
func (*Model) PopView ¶
PopView pops the current view state from the stack. Returns false if already at the root level.
func (Model) Update ¶
Update handles messages and ensures viewport content/scroll is synced after any state change.
func (Model) WithFilter ¶
WithFilter returns a copy of the model with an initial filter applied. CLI filters use exact port matching (port 80 only matches port 80, not 8080).
func (Model) WithPID ¶
WithPID returns a copy of the model that will drill into the given PID on first snapshot.
func (Model) WithVersion ¶
WithVersion returns a copy of the model with version string set.
type NetIOMsg ¶
type NetIOMsg struct {
Stats map[int32]*model.NetIOStats // Keyed by PID
Err error
}
NetIOMsg contains network I/O statistics from background collection.
type SortColumn ¶
type SortColumn int
SortColumn represents the column to sort by in table view.
const ( SortPID SortColumn = iota SortProcess SortProtocol SortLocal SortRemote SortState // Process list specific columns SortConns SortEstablished SortListen SortTX SortRX // Docker-specific columns SortContainer )
func (SortColumn) String ¶
func (s SortColumn) String() string
String returns a human-readable name for the SortColumn.
type VersionCheckMsg ¶
type VersionCheckMsg struct {
LatestVersion string // empty if up-to-date
Err error // nil on success (even if up-to-date)
}
VersionCheckMsg contains result of GitHub release check.
type ViewState ¶
type ViewState struct {
Level ViewLevel // Which view level (process list, connections)
ProcessName string // Selected process name (empty at Level 0)
Cursor int // Current cursor position in the list
SelectedID model.SelectionID // Stable selection identifier
SortColumn SortColumn // Current sort column
SortAscending bool // Sort direction
SelectedColumn SortColumn // Currently selected column for navigation
SortMode bool // Whether sort mode is active
}
ViewState captures the navigation state at a given level.