ui

package
v1.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package ui provides UI components and formatting utilities

This package provides UI components for displaying bandwidth statistics and various formatting utilities for human-readable display of bandwidth, bytes, and duration values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatBandwidth

func FormatBandwidth(bps uint64) string

FormatBandwidth formats bandwidth for UI display

func FormatBytes

func FormatBytes(bytes uint64) string

FormatBytes formats bytes in a human-readable way

func FormatDuration

func FormatDuration(d time.Duration) string

FormatDuration formats a duration in a human-readable way

Types

type Components

type Components struct {
	// contains filtered or unexported fields
}

Enhanced UI components

func NewComponents

func NewComponents() *Components

NewComponents creates new UI components

func (*Components) GetStats

func (c *Components) GetStats() *Stats

GetStats returns the current statistics

type KeyMap

type KeyMap struct {
	Reset       key.Binding
	Pause       key.Binding
	Stats       key.Binding
	DisplayMode key.Binding
	ScalingMode key.Binding
	TimeScale   key.Binding
	Quit        key.Binding
}

KeyMap defines the key bindings for the application

func DefaultKeyMap

func DefaultKeyMap() KeyMap

DefaultKeyMap returns the default key bindings

type Stats

type Stats struct {
	TotalUpload   uint64
	TotalDownload uint64
	PeakUpload    uint64
	PeakDownload  uint64
	StartTime     time.Time
	// contains filtered or unexported fields
}

Stats represents various statistics about the monitoring

func NewStats

func NewStats() *Stats

NewStats creates a new stats tracker

func (*Stats) GetUptime

func (s *Stats) GetUptime() time.Duration

GetUptime returns the uptime duration

func (*Stats) Reset

func (s *Stats) Reset()

Reset resets all statistics

func (*Stats) Update

func (s *Stats) Update(upload, download uint64)

Update updates the statistics

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL