Documentation
¶
Index ¶
- Constants
- Variables
- func CellStyle(width int) lipgloss.Style
- type ConnectionStatus
- type HeaderPanel
- type HelpPanel
- type ProtocolFilter
- type TrafficPanel
- func (p *TrafficPanel) AddPacket(info connection.PacketInfo)
- func (p *TrafficPanel) Clear()
- func (p *TrafficPanel) FilterName() string
- func (p *TrafficPanel) HideBFD() bool
- func (p *TrafficPanel) IsPaused() bool
- func (p *TrafficPanel) ScrollDown()
- func (p *TrafficPanel) ScrollToBottom()
- func (p *TrafficPanel) ScrollToTop()
- func (p *TrafficPanel) ScrollUp()
- func (p *TrafficPanel) SetFilter(f ProtocolFilter)
- func (p *TrafficPanel) SetPacketRate(pps int64)
- func (p *TrafficPanel) SetPaused(paused bool, auto bool)
- func (p *TrafficPanel) SetSize(width, height int)
- func (p *TrafficPanel) ToggleBFD()
- func (p TrafficPanel) View() string
- type TunnelInfo
Constants ¶
const ( // LeftMargin is the left margin for content inside panels LeftMargin = " " // CONNECTIONS table column widths ConnIDWidth = 38 // full UUID (36 chars) + 2 padding ConnStatusWidth = 12 ConnUptimeWidth = 10 ConnAddrsWidth = 40 // TRAFFIC table column widths TimeWidth = 10 ProtoWidth = 6 SrcWidth = 42 // full IPv6 ULA + port DstWidth = 42 SizeWidth = 7 FlagsWidth = 6 DirWidth = 4 )
Variables ¶
var ( // Panel styles HeaderStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("87")) // cyan BorderStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(lipgloss.Color("240")). MarginTop(1) TrafficBorderStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder(), true, true, false, true). BorderForeground(lipgloss.Color("240")) // Text styles LabelStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("250")) ValueStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("255")) DimStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("243")) // Status styles HealthyStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("82")) // green UnhealthyStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("196")) // red // Protocol styles TCPStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("39")) // blue UDPStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("208")) // orange ICMPStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("141")) // purple UnknownProtoStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("243")) // gray // Direction styles InboundStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("82")) // green OutboundStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("226")) // yellow // Help style HelpStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("243")) // Column header style ColumnHeaderStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("250")). Bold(true) // Paused indicator style PausedStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("226")). Background(lipgloss.Color("52")) // dark red )
Functions ¶
Types ¶
type ConnectionStatus ¶
ConnectionStatus contains status information about a single connection.
type HeaderPanel ¶
type HeaderPanel struct {
// contains filtered or unexported fields
}
HeaderPanel displays tunnel info and connection status.
func (HeaderPanel) Height ¶
func (p HeaderPanel) Height() int
Height returns the height of the header panel.
func (*HeaderPanel) SetConnections ¶
func (p *HeaderPanel) SetConnections(conns []ConnectionStatus)
SetConnections updates the connection status list.
func (*HeaderPanel) SetTunnelInfo ¶
func (p *HeaderPanel) SetTunnelInfo(info TunnelInfo)
SetTunnelInfo updates the tunnel info.
func (*HeaderPanel) SetWidth ¶
func (p *HeaderPanel) SetWidth(width int)
SetWidth sets the panel width.
type HelpPanel ¶
type HelpPanel struct {
// contains filtered or unexported fields
}
HelpPanel displays the help information at the bottom.
type ProtocolFilter ¶
type ProtocolFilter int
ProtocolFilter defines which protocols to show.
const ( FilterAll ProtocolFilter = iota FilterTCP FilterUDP FilterICMP )
type TrafficPanel ¶
type TrafficPanel struct {
// contains filtered or unexported fields
}
TrafficPanel displays live packet traffic.
func NewTrafficPanel ¶
func NewTrafficPanel() TrafficPanel
NewTrafficPanel creates a new traffic panel.
func (*TrafficPanel) AddPacket ¶
func (p *TrafficPanel) AddPacket(info connection.PacketInfo)
AddPacket adds a packet to the display.
func (*TrafficPanel) FilterName ¶
func (p *TrafficPanel) FilterName() string
FilterName returns the name of the current filter.
func (*TrafficPanel) HideBFD ¶
func (p *TrafficPanel) HideBFD() bool
HideBFD returns whether BFD packets are currently hidden.
func (*TrafficPanel) IsPaused ¶
func (p *TrafficPanel) IsPaused() bool
IsPaused returns whether traffic observation is paused.
func (*TrafficPanel) ScrollDown ¶
func (p *TrafficPanel) ScrollDown()
ScrollDown scrolls down by one line.
func (*TrafficPanel) ScrollToBottom ¶
func (p *TrafficPanel) ScrollToBottom()
ScrollToBottom scrolls to the bottom.
func (*TrafficPanel) ScrollToTop ¶
func (p *TrafficPanel) ScrollToTop()
ScrollToTop scrolls to the top.
func (*TrafficPanel) SetFilter ¶
func (p *TrafficPanel) SetFilter(f ProtocolFilter)
SetFilter sets the protocol filter.
func (*TrafficPanel) SetPacketRate ¶
func (p *TrafficPanel) SetPacketRate(pps int64)
SetPacketRate sets the current raw packet rate for display.
func (*TrafficPanel) SetPaused ¶
func (p *TrafficPanel) SetPaused(paused bool, auto bool)
SetPaused sets the paused state and whether it was auto-triggered.
func (*TrafficPanel) SetSize ¶
func (p *TrafficPanel) SetSize(width, height int)
SetSize sets the panel dimensions.
func (*TrafficPanel) ToggleBFD ¶
func (p *TrafficPanel) ToggleBFD()
ToggleBFD toggles visibility of BFD control packets.