Documentation
¶
Index ¶
- Constants
- func AddLog(format string, args ...interface{})
- func SetGlobalProgram(p *tea.Program)
- func UpdateConnState(isClose bool)
- func UpdateConnections(addr string, port int, localAddr string, protocol string, isClose bool)
- func UpdateLatency(ms int64)
- func UpdateRemoteAddress(addr string)
- func UpdateStatus(status string)
- type AddressUpdateMsg
- type ConnStateUpdateMsg
- type ConnUpdateMsg
- type FocusChangeMsg
- type FormattedCLIWriteSyncer
- type LatencyUpdateMsg
- type LogMsg
- type LogsView
- func (v *LogsView) GetHeight() int
- func (v *LogsView) GetMaxHeight() int
- func (v *LogsView) GetMinHeight() int
- func (v *LogsView) GetTitle() string
- func (v *LogsView) HandleKeyMsg(msg tea.KeyMsg) bool
- func (v *LogsView) Init() tea.Cmd
- func (v *LogsView) SetHeight(height int)
- func (v *LogsView) Update(msg tea.Msg) (View, tea.Cmd)
- func (v *LogsView) View(width int) string
- type ResizeMsg
- type SetTotalHeightMsg
- type StatusUpdateMsg
- type SyncMap
- type TUIModel
- type TunnelCon
- type TunnelsView
- func (v *TunnelsView) GetHeight() int
- func (v *TunnelsView) GetMaxHeight() int
- func (v *TunnelsView) GetMinHeight() int
- func (v *TunnelsView) GetTitle() string
- func (v *TunnelsView) HandleKeyMsg(msg tea.KeyMsg) bool
- func (v *TunnelsView) Init() tea.Cmd
- func (v *TunnelsView) SetHeight(height int)
- func (v *TunnelsView) Update(msg tea.Msg) (View, tea.Cmd)
- func (v *TunnelsView) View(width int) string
- type View
- type WriteSyncer
Constants ¶
View Source
const ( MaxLogLines = 1000 MinLogHeight = 5 MaxLogHeight = 30 DefaultLogHeight = 12 MinTunnelsHeight = 8 MaxTunnelsHeight = 20 DefaultTunnelsHeight = 10 // ← 添加这个常量 DefaultTotalHeight = 40 MinTotalHeight = 24 MaxTotalHeight = 200 )
View Source
const ( BannerFixedHeight = 5 // 4行横幅 + 1空行 StatusFixedHeight = 8 // 状态面板实际高度 DividerFixedHeight = 2 // 分隔线 + 换行 HelpFixedHeight = 1 // 帮助栏 SectionHeaderFixedHeight = 2 // 每个区域标题(标题 + 换行) )
固定元素高度常量
Variables ¶
This section is empty.
Functions ¶
func SetGlobalProgram ¶
func UpdateConnState ¶
func UpdateConnState(isClose bool)
func UpdateConnections ¶
func UpdateLatency ¶
func UpdateLatency(ms int64)
func UpdateRemoteAddress ¶
func UpdateRemoteAddress(addr string)
func UpdateStatus ¶
func UpdateStatus(status string)
Types ¶
type AddressUpdateMsg ¶
type AddressUpdateMsg struct {
Address string
}
type ConnStateUpdateMsg ¶
type ConnStateUpdateMsg struct {
IsClose bool
}
type ConnUpdateMsg ¶
type FocusChangeMsg ¶
type FocusChangeMsg struct {
View string
}
type FormattedCLIWriteSyncer ¶
type FormattedCLIWriteSyncer struct {
// contains filtered or unexported fields
}
FormattedCLIWriteSyncer writes level-tagged, styled log lines to the TUI.
func NewFormattedCLIWriteSyncer ¶
func NewFormattedCLIWriteSyncer(level zapcore.Level, prefix string) *FormattedCLIWriteSyncer
func (*FormattedCLIWriteSyncer) Sync ¶
func (w *FormattedCLIWriteSyncer) Sync() error
type LatencyUpdateMsg ¶
type LatencyUpdateMsg struct {
Latency int64
}
type LogsView ¶
type LogsView struct {
Logs []string
Viewport viewport.Model
Width int
Height int
Ready bool
MaxLines int
// contains filtered or unexported fields
}
func NewLogsView ¶
func NewLogsView() *LogsView
func (*LogsView) GetMaxHeight ¶
func (*LogsView) GetMinHeight ¶
type SetTotalHeightMsg ¶
type SetTotalHeightMsg struct {
Height int
}
type StatusUpdateMsg ¶
type StatusUpdateMsg struct {
Status string
}
type SyncMap ¶
type SyncMap[K comparable, V any] struct { // contains filtered or unexported fields }
SyncMap is a simple thread-safe map
func NewSyncMap ¶
func NewSyncMap[K comparable, V any]() *SyncMap[K, V]
type TUIModel ¶
type TUIModel struct {
// State data
RemoteAddress string
Status string
Latency int64
// Views
TunnelsView *TunnelsView
LogsView *LogsView
ActiveView string
// Layout related
Width int
Height int
ContentHeight int
// Fixed heights
BannerHeight int
StatusHeight int
DividerHeight int
HelpHeight int
SectionHeaderHeight int
MainView tea.View
// contains filtered or unexported fields
}
func NewTUIModel ¶
NewTUIModel creates a new TUI model with default height
func (*TUIModel) SetTotalHeight ¶
SetTotalHeight sets the total height of the interface
type TunnelsView ¶
type TunnelsView struct {
ConnectionTable table.Model
Connections *SyncMap[string, *TunnelCon]
Width int
Height int
// contains filtered or unexported fields
}
func NewTunnelsView ¶
func NewTunnelsView() *TunnelsView
func (*TunnelsView) GetHeight ¶
func (v *TunnelsView) GetHeight() int
func (*TunnelsView) GetMaxHeight ¶
func (v *TunnelsView) GetMaxHeight() int
func (*TunnelsView) GetMinHeight ¶
func (v *TunnelsView) GetMinHeight() int
func (*TunnelsView) GetTitle ¶
func (v *TunnelsView) GetTitle() string
func (*TunnelsView) HandleKeyMsg ¶
func (v *TunnelsView) HandleKeyMsg(msg tea.KeyMsg) bool
func (*TunnelsView) Init ¶
func (v *TunnelsView) Init() tea.Cmd
func (*TunnelsView) SetHeight ¶
func (v *TunnelsView) SetHeight(height int)
func (*TunnelsView) View ¶
func (v *TunnelsView) View(width int) string
type WriteSyncer ¶
type WriteSyncer struct {
// contains filtered or unexported fields
}
WriteSyncer implements zapcore.WriteSyncer and routes output to the TUI log panel.
func NewCLIWriteSyncer ¶
func NewCLIWriteSyncer(level string) *WriteSyncer
NewCLIWriteSyncer creates a new CLI write syncer.
func (*WriteSyncer) Sync ¶
func (w *WriteSyncer) Sync() error
Click to show internal directories.
Click to hide internal directories.