Documentation
¶
Index ¶
- func CheckDNSResolution(ctx context.Context, host string) (time.Duration, error)
- func CheckTCPConnectivity(ctx context.Context, address string, timeout time.Duration) (time.Duration, error)
- func FormatBytes(b uint64) string
- func FormatDecimalBytes(b uint64) string
- func FormatDuration(d time.Duration) string
- func FormatRate(bytesPerSec float64) string
- func RenderProgressBar(pct float64, width int) string
- func TruncateString(s string, maxLen int) string
- type TableWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckDNSResolution ¶
CheckDNSResolution verifies if DNS resolution works and measures resolution latency.
func CheckTCPConnectivity ¶
func CheckTCPConnectivity(ctx context.Context, address string, timeout time.Duration) (time.Duration, error)
CheckTCPConnectivity verifies TCP connectivity to a host:port and measures latency.
func FormatBytes ¶
FormatBytes converts raw bytes into human readable binary units (B, KiB, MiB, GiB, TiB).
func FormatDecimalBytes ¶
FormatDecimalBytes converts raw bytes into decimal units (B, KB, MB, GB, TB).
func FormatDuration ¶
FormatDuration formats a duration concisely (e.g. "3d 4h 12m 5s").
func RenderProgressBar ¶
RenderProgressBar generates an ASCII progress meter like [████████░░░░░░░░] 50.0%
func TruncateString ¶
TruncateString truncates a string to maxLen with an ellipsis.
Types ¶
type TableWriter ¶
type TableWriter struct {
// contains filtered or unexported fields
}
TableWriter formats rows and columns into cleanly aligned CLI text.
func NewTableWriter ¶
func NewTableWriter(headers ...string) *TableWriter
NewTableWriter creates a new table writer.
func (*TableWriter) Append ¶
func (t *TableWriter) Append(cols ...string)
Append adds a row of values.
func (*TableWriter) Render ¶
func (t *TableWriter) Render(w io.Writer)
Render writes the formatted table to w.