network

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 16 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(ctx context.Context, opts WinOpts) error

func CleanupQosPolicies

func CleanupQosPolicies()

func Revert

func Revert(ctx context.Context, opts WinOpts) error

Types

type BlackholeOpts

type BlackholeOpts struct {
	Filter
	Duration   time.Duration
	FilterFile string
}

func (*BlackholeOpts) QoSCommands

func (o *BlackholeOpts) QoSCommands(_ Mode) ([]string, error)

func (*BlackholeOpts) String

func (o *BlackholeOpts) String() string

func (*BlackholeOpts) WinDivertCommands

func (o *BlackholeOpts) WinDivertCommands(mode Mode) ([]string, error)

type CorruptPackagesOpts

type CorruptPackagesOpts struct {
	Filter
	Corruption uint
	Duration   time.Duration
	FilterFile string
}

func (*CorruptPackagesOpts) QoSCommands

func (o *CorruptPackagesOpts) QoSCommands(_ Mode) ([]string, error)

func (*CorruptPackagesOpts) String

func (o *CorruptPackagesOpts) String() string

func (*CorruptPackagesOpts) WinDivertCommands

func (o *CorruptPackagesOpts) WinDivertCommands(mode Mode) ([]string, error)

type DelayOpts

type DelayOpts struct {
	Filter
	Delay      time.Duration
	Duration   time.Duration
	Jitter     bool
	FilterFile string
}

func (*DelayOpts) QoSCommands

func (o *DelayOpts) QoSCommands(_ Mode) ([]string, error)

func (*DelayOpts) String

func (o *DelayOpts) String() string

func (*DelayOpts) WinDivertCommands

func (o *DelayOpts) WinDivertCommands(mode Mode) ([]string, error)

type Direction

type Direction string
var (
	DirectionIncoming Direction = "Incoming"
	DirectionOutgoing Direction = "Outgoing"
	DirectionAll      Direction = "All"
)

type Family

type Family string
const (
	FamilyV4 Family = "inet"
	FamilyV6 Family = "inet6"
)

type Filter

type Filter struct {
	Include          []akn.NetWithPortRange
	Exclude          []akn.NetWithPortRange
	InterfaceIndexes []int
	Direction        Direction
	// ExcludeLoopback leaves loopback traffic (127.0.0.0/8, ::1) untouched.
	// WinDivert captures loopback packets, so they are affected unless excluded.
	ExcludeLoopback bool
}

type LimitBandwidthOpts

type LimitBandwidthOpts struct {
	Bandwidth    string
	IncludeCidrs []net.IPNet
	PortRange    network.PortRange
}

func (*LimitBandwidthOpts) QoSCommands

func (o *LimitBandwidthOpts) QoSCommands(mode Mode) ([]string, error)

func (*LimitBandwidthOpts) String

func (o *LimitBandwidthOpts) String() string

func (*LimitBandwidthOpts) WinDivertCommands

func (o *LimitBandwidthOpts) WinDivertCommands(_ Mode) ([]string, error)

type Mode

type Mode string
const (
	ModeAdd    Mode = "add"
	ModeDelete Mode = "del"
)

type PackageLossOpts

type PackageLossOpts struct {
	Filter
	Loss     uint
	Duration time.Duration
	// contains filtered or unexported fields
}

func (*PackageLossOpts) QoSCommands

func (o *PackageLossOpts) QoSCommands(_ Mode) ([]string, error)

func (*PackageLossOpts) String

func (o *PackageLossOpts) String() string

func (*PackageLossOpts) WinDivertCommands

func (o *PackageLossOpts) WinDivertCommands(mode Mode) ([]string, error)

type WinOpts

type WinOpts interface {
	QoSCommands(mode Mode) ([]string, error)
	WinDivertCommands(mode Mode) ([]string, error)
	String() string
}

Jump to

Keyboard shortcuts

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