connlist

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Connect(string) error
	Disconnect(context.Context) error
	BytesRead() int
	BytesWritten() int
}

type Collection

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

Collection represents a collection of items. Is used to easily pass events and update the UI state in one place (on{*} methods).

func New

func New() *Collection

func (*Collection) AddItem

func (l *Collection) AddItem(label, link string) error

func (*Collection) All

func (l *Collection) All() []*Item

func (*Collection) AllUntyped

func (l *Collection) AllUntyped() *[]any

func (*Collection) OnAdd

func (l *Collection) OnAdd(onAdd func(item *Item))

func (*Collection) OnChange

func (l *Collection) OnChange(onChange func())

func (*Collection) OnDelete

func (l *Collection) OnDelete(onDelete func(item *Item))

OnDelete note: provided method is called before the actual deletion of the item.

func (*Collection) OnSwap added in v0.0.2

func (l *Collection) OnSwap(onSwap func(*Item, *Item))

func (*Collection) RemoveItem

func (l *Collection) RemoveItem(del *Item)

func (*Collection) SwapItems added in v0.0.2

func (l *Collection) SwapItems(itm1 *Item, itm2 *Item) error

type Item

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

Item is a combine that is passed (via interface segregation) throughout the system to apply centralized changes to connections with the smallest overhead as possible.

func (*Item) Active

func (c *Item) Active() bool

func (*Item) BytesRead

func (c *Item) BytesRead() int

func (*Item) BytesWritten

func (c *Item) BytesWritten() int

func (*Item) Connect

func (c *Item) Connect() error

func (*Item) Disconnect

func (c *Item) Disconnect() error

func (*Item) Label

func (c *Item) Label() string
func (c *Item) Link() string

func (*Item) Read

func (c *Item) Read() []float64

func (*Item) RecordInterval

func (c *Item) RecordInterval() time.Duration

func (*Item) SetActive

func (c *Item) SetActive(active bool)

func (*Item) Update

func (c *Item) Update(link, label string) error

func (*Item) Written

func (c *Item) Written() []float64

func (*Item) XRayConfig

func (c *Item) XRayConfig() map[string]string

type NetworkRecorder

type NetworkRecorder interface {
	// Start should start recording data.
	Start()
	// Read should return values for uplink for each previous RecordInterval.
	// Number of values returned must match Written.
	Read() []float64
	// Written should return values for downlink for each previous RecordInterval.
	// Number of values returned must match Written.
	Written() []float64
	// BytesRead should return the total number of bytes for uplink.
	BytesRead() int
	// BytesWritten should return the total number of bytes for downlink.
	BytesWritten() int
	RecordInterval() time.Duration
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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