Documentation
¶
Index ¶
- func FormatRow(result *speedtester.Result, mode speedtester.SpeedMode, index int) []string
- func GetHeaders(mode speedtester.SpeedMode) []string
- func IsTerminalFile(file *os.File) bool
- func SortResults(results []*speedtester.Result, mode speedtester.SpeedMode) []*speedtester.Result
- type IsTerminal
- type OutputMode
- type TSVWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatRow ¶
func FormatRow(result *speedtester.Result, mode speedtester.SpeedMode, index int) []string
FormatRow formats a single result row without ANSI colors. Returns plain text strings using speedtester.Result's Format* methods.
func GetHeaders ¶
func GetHeaders(mode speedtester.SpeedMode) []string
GetHeaders returns table headers based on speed mode. fast: ID, Name, Type, Latency download: ID, Name, Type, Latency, Jitter, Packet Loss, Download Speed full: ID, Name, Type, Latency, Jitter, Packet Loss, Download Speed, Upload Speed
func IsTerminalFile ¶
IsTerminalFile checks if the given file is a terminal This is the default implementation used in production
func SortResults ¶
func SortResults(results []*speedtester.Result, mode speedtester.SpeedMode) []*speedtester.Result
SortResults sorts results based on speed mode. fast: latency ascending (lower is better) download/full: download speed descending (higher is better)
Types ¶
type IsTerminal ¶
IsTerminal is a function type for terminal detection to enable testability
type OutputMode ¶
type OutputMode int
OutputMode represents the output format mode
const ( // OutputModeTSV outputs tab-separated values without ANSI colors OutputModeTSV OutputMode = iota // OutputModeInteractive outputs interactive UI (currently tablewriter, future TUI) OutputModeInteractive )
func DetermineOutputMode ¶
func DetermineOutputMode(isTerminal IsTerminal) OutputMode
DetermineOutputMode determines the output mode based on terminal detection. Returns TSV mode when stdout is not a terminal (for example, piped output). Otherwise returns Interactive mode. File output is handled separately by the caller.
type TSVWriter ¶
type TSVWriter struct {
// contains filtered or unexported fields
}
TSVWriter writes tab-separated values output without ANSI colors It outputs the header immediately on creation, then streams rows as they complete
func NewTSVWriter ¶
NewTSVWriter creates a new TSV writer and writes the header immediately