types

package
v1.0.27 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CakeStats

type CakeStats struct {
	Interface    string `json:"interface"`
	Handle       string `json:"handle"`
	Direction    string `json:"direction"`
	Bandwidth    string `json:"bandwidth"`
	DiffservMode string `json:"diffserv_mode"`
	RTT          string `json:"rtt"`
	Overhead     string `json:"overhead"`
	DualMode     string `json:"dual_mode"`
	FwmarkMask   string `json:"fwmark_mask"`
	NATEnabled   bool   `json:"nat_enabled"`
	// ATMMode stores the framing-compensation mode string exactly as tc prints
	// it: "atm", "ptm", or "noatm" (also matched by the "raw" keyword).
	// Replaces the old ATMEnabled bool which collapsed atm and ptm into one.
	ATMMode string `json:"atm_mode"`
	// MPU stores the minimum packet unit value when configured (e.g. "84").
	// Empty string means the mpu parameter was absent or zero.
	MPU string `json:"mpu"`
	// WashEnabled is true when CAKE is configured with the "wash" keyword,
	// which re-marks DSCP on forwarded packets.  False means "nowash".
	WashEnabled bool   `json:"wash_enabled"`
	MemLimit    string `json:"memlimit"`
	RawHeader   string `json:"raw_header"`

	SentBytes  uint64 `json:"sent_bytes"`
	SentPkts   uint64 `json:"sent_pkts"`
	Dropped    uint64 `json:"dropped"`
	Overlimits uint64 `json:"overlimits"`
	Requeues   uint64 `json:"requeues"`

	BacklogBytes string `json:"backlog_bytes"`
	BacklogPkts  uint64 `json:"backlog_pkts"`

	MemoryUsed  string `json:"memory_used"`
	MemoryTotal string `json:"memory_total"`
	CapacityEst string `json:"capacity_estimate"`

	MinNetSize   string `json:"min_net_size"`
	MaxNetSize   string `json:"max_net_size"`
	MinAdjSize   string `json:"min_adj_size"`
	MaxAdjSize   string `json:"max_adj_size"`
	AvgHdrOffset string `json:"avg_hdr_offset"`

	Tiers     []CakeTier `json:"tiers"`
	UpdatedAt time.Time  `json:"updated_at"`

	// Computed per-poll by HistoryStore.Record — not parsed from tc output.
	// Zero on the first poll (no previous sample to diff against).
	TxBytesPerS  float64 `json:"tx_bytes_per_s"`
	DropsPerS    float64 `json:"drops_per_s"`
	MaxAvDelayMs float64 `json:"max_av_delay_ms"`
	MaxPkDelayMs float64 `json:"max_pk_delay_ms"`
}

CakeStats holds all parsed information for a single CAKE qdisc instance.

func (CakeStats) MarshalEasyJSON added in v1.0.13

func (v CakeStats) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CakeStats) MarshalJSON added in v1.0.13

func (v CakeStats) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CakeStats) UnmarshalEasyJSON added in v1.0.13

func (v *CakeStats) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CakeStats) UnmarshalJSON added in v1.0.13

func (v *CakeStats) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CakeTier

type CakeTier struct {
	Name     string `json:"name"`
	Thresh   string `json:"thresh"`
	Target   string `json:"target"`
	Interval string `json:"interval"`
	PkDelay  string `json:"pk_delay"`
	AvDelay  string `json:"av_delay"`
	SpDelay  string `json:"sp_delay"`
	Backlog  string `json:"backlog"`
	Pkts     uint64 `json:"pkts"`
	Bytes    uint64 `json:"bytes"`
	WayInds  uint64 `json:"way_inds"`
	WayMiss  uint64 `json:"way_miss"`
	WayCols  uint64 `json:"way_cols"`
	Drops    uint64 `json:"drops"`
	Marks    uint64 `json:"marks"`
	AckDrop  uint64 `json:"ack_drop"`
	SpFlows  uint64 `json:"sp_flows"`
	BkFlows  uint64 `json:"bk_flows"`
	UnFlows  uint64 `json:"un_flows"`
	MaxLen   uint64 `json:"max_len"`
	Quantum  uint64 `json:"quantum"`
}

CakeTier holds per-tier statistics from the CAKE table section. All counters use uint64 to handle arbitrarily large values without overflow. (Fields are identical to the original parser package.)

func (CakeTier) MarshalEasyJSON added in v1.0.13

func (v CakeTier) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CakeTier) MarshalJSON added in v1.0.13

func (v CakeTier) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CakeTier) UnmarshalEasyJSON added in v1.0.13

func (v *CakeTier) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CakeTier) UnmarshalJSON added in v1.0.13

func (v *CakeTier) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type HistoryResponse

type HistoryResponse map[string][]HistorySample

HistoryResponse is the serializable representation of the in-memory history store. It's a map from interface name to an ordered slice of samples.

type HistorySample

type HistorySample struct {
	T  int64   `json:"t"`  // unix timestamp (seconds)
	Tx float64 `json:"tx"` // bytes transmitted per second (TX throughput)
	Av float64 `json:"av"` // max av_delay across all tiers (milliseconds)
	Pk float64 `json:"pk"` // max pk_delay across all tiers (milliseconds)
	Dr float64 `json:"dr"` // packet drops per second
}

HistorySample is one time-series data point for a single CAKE interface. All numeric values are float64 so they can be directly consumed by charting libraries (uPlot, Chart.js, etc.).

func (HistorySample) MarshalEasyJSON added in v1.0.13

func (v HistorySample) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (HistorySample) MarshalJSON added in v1.0.13

func (v HistorySample) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*HistorySample) UnmarshalEasyJSON added in v1.0.13

func (v *HistorySample) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*HistorySample) UnmarshalJSON added in v1.0.13

func (v *HistorySample) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type StatsResponse

type StatsResponse struct {
	Interfaces []CakeStats `json:"interfaces"`
	UpdatedAt  string      `json:"updated_at"`
}

StatsResponse is the JSON message sent to clients containing the current interface statistics along with a timestamp.

func (StatsResponse) MarshalEasyJSON added in v1.0.13

func (v StatsResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (StatsResponse) MarshalJSON

func (v StatsResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*StatsResponse) UnmarshalEasyJSON added in v1.0.13

func (v *StatsResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*StatsResponse) UnmarshalJSON added in v1.0.13

func (v *StatsResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Jump to

Keyboard shortcuts

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