Documentation
¶
Index ¶
- Variables
- func Run(ctx context.Context, packetsCh <-chan connection.PacketInfo, ...) error
- type ConnectionStatus
- type ConnectionStatusMsg
- type Model
- type PacketMsg
- type StatusProvider
- type TUIPacketObserver
- func (o *TUIPacketObserver) CheckAutoSuspend(window time.Duration) (pps int64, didAutoSuspend bool)
- func (o *TUIPacketObserver) CountPacket()
- func (o *TUIPacketObserver) IsAutoSuspended() bool
- func (o *TUIPacketObserver) IsSuspended() bool
- func (o *TUIPacketObserver) OnPacket(info connection.PacketInfo)
- func (o *TUIPacketObserver) Resume()
- func (o *TUIPacketObserver) Suspend()
- type TickMsg
- type TunnelInfo
- type TunnelInfoMsg
Constants ¶
This section is empty.
Variables ¶
var DefaultKeyMap = keyMap{ Quit: key.NewBinding(key.WithKeys("q", "ctrl+c"), key.WithHelp("q", "quit")), ScrollUp: key.NewBinding(key.WithKeys("k", "up"), key.WithHelp("k/↑", "up")), ScrollDown: key.NewBinding(key.WithKeys("j", "down"), key.WithHelp("j/↓", "down")), Top: key.NewBinding(key.WithKeys("g"), key.WithHelp("g", "top")), Bottom: key.NewBinding(key.WithKeys("G"), key.WithHelp("G", "bottom")), FilterTCP: key.NewBinding(key.WithKeys("t"), key.WithHelp("t", "TCP")), FilterUDP: key.NewBinding(key.WithKeys("u"), key.WithHelp("u", "UDP")), FilterICMP: key.NewBinding(key.WithKeys("i"), key.WithHelp("i", "ICMP")), FilterAll: key.NewBinding(key.WithKeys("a"), key.WithHelp("a", "all")), ToggleBFD: key.NewBinding(key.WithKeys("p"), key.WithHelp("p", "toggle pings")), Suspend: key.NewBinding(key.WithKeys("s"), key.WithHelp("s", "pause")), Clear: key.NewBinding(key.WithKeys("c"), key.WithHelp("c", "clear")), }
Functions ¶
func Run ¶
func Run(ctx context.Context, packetsCh <-chan connection.PacketInfo, observer *TUIPacketObserver, statusProvider StatusProvider) error
Run starts the TUI with the given packet channel and status provider. It blocks until the TUI is closed (user presses 'q' or Ctrl+C).
Types ¶
type ConnectionStatus ¶
type ConnectionStatus = panels.ConnectionStatus
type ConnectionStatusMsg ¶
type ConnectionStatusMsg struct {
Connections []ConnectionStatus
}
ConnectionStatusMsg is sent when connection status is updated.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the main Bubble Tea model for the TUI.
func NewModel ¶
func NewModel(packetsCh <-chan connection.PacketInfo, observer *TUIPacketObserver, statusProvider StatusProvider) Model
NewModel creates a new TUI model.
type PacketMsg ¶
type PacketMsg struct {
Info connection.PacketInfo
}
PacketMsg is sent when a new packet is observed.
type StatusProvider ¶
type StatusProvider interface {
GetTunnelInfo() TunnelInfo
GetConnections() []ConnectionStatus
}
StatusProvider provides tunnel and connection status.
type TUIPacketObserver ¶
type TUIPacketObserver struct {
// contains filtered or unexported fields
}
TUIPacketObserver implements connection.PacketObserver and sends packets to a channel.
func NewPacketObserver ¶
func NewPacketObserver(ch chan<- connection.PacketInfo) *TUIPacketObserver
NewPacketObserver creates a new TUI packet observer with rate limiting.
func (*TUIPacketObserver) CheckAutoSuspend ¶
func (o *TUIPacketObserver) CheckAutoSuspend(window time.Duration) (pps int64, didAutoSuspend bool)
CheckAutoSuspend reads and resets the packet counter, computes rate, and auto-suspends if the rate exceeds the threshold. Should be called periodically (e.g. every 500ms from the TUI tick).
func (*TUIPacketObserver) CountPacket ¶
func (o *TUIPacketObserver) CountPacket()
CountPacket increments the packet counter without processing. Called by splice.go when suspended, to track rate.
func (*TUIPacketObserver) IsAutoSuspended ¶
func (o *TUIPacketObserver) IsAutoSuspended() bool
IsAutoSuspended returns whether suspension was triggered automatically.
func (*TUIPacketObserver) IsSuspended ¶
func (o *TUIPacketObserver) IsSuspended() bool
IsSuspended returns whether the observer is suspended.
func (*TUIPacketObserver) OnPacket ¶
func (o *TUIPacketObserver) OnPacket(info connection.PacketInfo)
OnPacket is called when a packet is observed.
func (*TUIPacketObserver) Resume ¶
func (o *TUIPacketObserver) Resume()
Resume resumes packet observation.
func (*TUIPacketObserver) Suspend ¶
func (o *TUIPacketObserver) Suspend()
Suspend stops packet observation.
type TunnelInfoMsg ¶
type TunnelInfoMsg struct {
Info TunnelInfo
}
TunnelInfoMsg is sent when tunnel info is updated.