Help us shape the future of Go! Take the 2026 Go Developer Survey

mockmaps

package
v1.18.16 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CtMockMap

type CtMockMap struct {
	Entries []ctmap.CtMapRecord
}

CtMockMap implements the CtMap interface and can be used for unit tests.

func NewCtMockMap

func NewCtMockMap(records []ctmap.CtMapRecord) *CtMockMap

NewCtMockMap is a constructor for a CtMockMap.

func (*CtMockMap) Close

func (m *CtMockMap) Close() error

Close does nothing, mock maps need not be closed either.

func (*CtMockMap) Count added in v1.16.0

func (m *CtMockMap) Count(_ context.Context) (int, error)

Count returns the length of the map entries.

func (*CtMockMap) DumpEntries

func (m *CtMockMap) DumpEntries() (string, error)

DumpEntries iterates through Map m and writes the values of the ct entries in m to a string.

func (*CtMockMap) DumpWithCallback

func (m *CtMockMap) DumpWithCallback(cb bpf.DumpCallback) error

DumpWithCallback runs the callback on each entry of the mock map.

func (*CtMockMap) Open

func (m *CtMockMap) Open() error

Open does nothing, mock maps need not be opened.

func (*CtMockMap) Path

func (m *CtMockMap) Path() (string, error)

Path returns a mock path for the mock map.

func (*CtMockMap) Update added in v1.16.0

func (m *CtMockMap) Update(key bpf.MapKey, value bpf.MapValue) error

type MetricsMockMap

type MetricsMockMap struct {
	Entries []MetricsRecord
}

MetricsMockMap implements the MetricsMap interface and can be used for unit tests.

func NewMetricsMockMap

func NewMetricsMockMap(records []MetricsRecord) *MetricsMockMap

NewMetricsMockMap is a constructor for a MetricsMockMap.

func NewRatelimitMetricsMockMap added in v1.17.0

func NewRatelimitMetricsMockMap(records []MetricsRecord) *MetricsMockMap

NewRatelimitMetricsMockMap is a constructor for a MetricsMockMap.

func (*MetricsMockMap) IterateWithCallback

func (m *MetricsMockMap) IterateWithCallback(cb metricsmap.IterateCallback) error

DumpWithCallback runs the callback on each entry of the mock map.

type MetricsRecord

type MetricsRecord struct {
	Key    metricsmap.Key
	Values metricsmap.Values
}

MetricsRecord designates a map entry (key + value). This type is used for mock maps.

type NatMockMap

type NatMockMap struct {
	Entries []nat.NatMapRecord
}

NatMockMap implements the NatMap interface and can be used for unit tests.

func NewNatMockMap

func NewNatMockMap(records []nat.NatMapRecord) *NatMockMap

NewNatMockMap is a constructor for a NatMockMap.

func (*NatMockMap) Close

func (m *NatMockMap) Close() error

Close does nothing, mock maps need not be closed either.

func (*NatMockMap) DumpEntries

func (m *NatMockMap) DumpEntries() (string, error)

DumpEntries iterates through Map m and writes the values of the ct entries in m to a string.

func (*NatMockMap) DumpWithCallback

func (m *NatMockMap) DumpWithCallback(cb bpf.DumpCallback) error

DumpWithCallback runs the callback on each entry of the mock map.

func (*NatMockMap) Open

func (m *NatMockMap) Open() error

Open does nothing, mock maps need not be opened.

func (*NatMockMap) Path

func (m *NatMockMap) Path() (string, error)

Path returns a mock path for the mock map.

type RatelimitMetricsMockMap added in v1.17.0

type RatelimitMetricsMockMap struct {
	Entries []RatelimitMetricsRecord
}

RatelimitMetricsMockMap implements the ratelimitmap interface and can be used for unit tests.

func (*RatelimitMetricsMockMap) DumpWithCallback added in v1.17.0

func (m *RatelimitMetricsMockMap) DumpWithCallback(cb ratelimitmap.DumpCallback) error

DumpWithCallback runs the callback on each entry of the mock map.

type RatelimitMetricsRecord added in v1.17.0

type RatelimitMetricsRecord struct {
	Key   ratelimitmap.MetricsKey
	Value ratelimitmap.MetricsValue
}

RatelimitMetricsRecord designates a map entry (key + value). This type is used for mock maps.

Jump to

Keyboard shortcuts

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