helpers

package module
v0.0.0-...-958e258 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	VersionStr     string = "24.10.0"
	ApplicationStr string = "Go-pktgen Traffic Generator"
	CopyrightStr   string = "Copyright © 2023-2025 Intel Corporation"
	BuildDateStr   string = ""
)

Functions

func AcceptFloat

func AcceptFloat(textToCheck string, lastChar rune) bool

func AcceptHex

func AcceptHex(textToCheck string, lastChar rune) bool

func AcceptIPv4

func AcceptIPv4(textToCheck string, lastChar rune) bool

func AcceptIPv4CiDR

func AcceptIPv4CiDR(textToCheck string, lastChar rune) bool

func AcceptMac

func AcceptMac(textToCheck string, lastChar rune) bool

func AcceptNumber

func AcceptNumber(textToCheck string, lastChar rune) bool

func AddModalPage

func AddModalPage(title string, modal interface{})

func Application

func Application() string

Command string

func BitRate

func BitRate(ioPkts, ioBytes uint64) float64

BitRate - return the network bit rate

func BuildDate

func BuildDate() string

Build Date string

func Center

func Center(width, height int, p kview.Primitive) *kview.Flex

Center returns a new primitive which shows the provided primitive in its center, given the provided primitive's size.

func CommandInfo

func CommandInfo(color bool) string

CommandInfo returning the basic information string

func Copyright() string

Copyright string

func CreateForm

func CreateForm(flex *kview.Flex, msg TextInfo, fixedSize, proportion int, focus bool) *kview.Form

CreateForm window

func CreateList

func CreateList(flex *kview.Flex, msg TextInfo, fixedSize, proportion int, focus bool) *kview.List

CreateList window

func CreateModal

func CreateModal(p kview.Primitive, width, height int) kview.Primitive

func CreateTabOrder

func CreateTabOrder(app *kview.Application, panelName string, data []tab.TabData) (*tab.Tab, error)

func CreateTableView

func CreateTableView(flex *kview.Flex, msg TextInfo, fixedSize, proportion int, focus bool) *kview.Table

CreateTableView - Helper to create a Table

func CreateTextView

func CreateTextView(flex *kview.Flex, msg TextInfo, fixedSize, proportion int, focus bool) *kview.TextView

CreateTextView - helper routine to create a TextView

func Format

func Format(units []string, v uint64, w ...interface{}) string

Format the bytes into human readable format

func FormatBytes

func FormatBytes(v uint64, w ...interface{}) string

FormatBytes into KB, MB, GB, ...

func FormatUnits

func FormatUnits(v uint64, w ...interface{}) string

FormatUnits into KB, MB, GB, ...

func NumCPUs

func NumCPUs() int

NumCPUs is the number of CPUs in the system (logical cores)

func ParseNumberFloat64

func ParseNumberFloat64(text string, val *float64) error

func ParseNumberUint16

func ParseNumberUint16(text string, val *uint16) error

func ParseNumberUint64

func ParseNumberUint64(text string, val *uint64) error

func SetCell

func SetCell(table *kview.Table, row, col int, msg TextInfo, selectable bool) *kview.TableCell

SetCell content given the information row, col of the cell to create and fill msg is the string content to insert in the cell a is an interface{} object list

object a is int then alignment kview.AlignLeft/Right/Center
object a is bool then set the cell as selectable or not

func SetupSignals

func SetupSignals(signals ...os.Signal)

func TableCellSelect

func TableCellSelect(table *kview.Table, row, col int, v TextInfo) int

func TableCellSet

func TableCellSet(table *kview.Table, row, col int, v TextInfo) int

func TableSetHeaders

func TableSetHeaders(table *kview.Table, row, col int, titles []TextInfo) int

func TableSetRows

func TableSetRows(table *kview.Table, row, col int, titles []TextInfo) int

func TitleBox

func TitleBox(flex *kview.Flex, text string) *kview.TextView

TitleBox to return the top title window

func TitleColor

func TitleColor(msg string) string

TitleColor - Set the title color to the windows

func Version

func Version() string

Version string

Types

type ModalPage

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

func GetModalPages

func GetModalPages() []*ModalPage

type TextInfo

type TextInfo struct {
	Text  string // Text can include colorized text
	Align int    // Alignment cview.AlignLeft, cview.AlignCenter, cview.AlignRight
}

func NewText

func NewText(text string, align int) TextInfo

Jump to

Keyboard shortcuts

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