cppm

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: GPL-2.0, GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Policers map[Protocol]PolicerConfig
}

func DefaultConfig

func DefaultConfig() Config

type Manager

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

func NewManager

func NewManager(cfg Config) *Manager

func (*Manager) Allow

func (m *Manager) Allow(proto Protocol) bool

func (*Manager) Configure

func (m *Manager) Configure(proto Protocol, rate float64, burst int)

func (*Manager) Get

func (m *Manager) Get(proto Protocol) *Policer

func (*Manager) GetStats

func (m *Manager) GetStats() []Stats

type Policer

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

func NewPolicer

func NewPolicer(rate float64, burst int) *Policer

func (*Policer) Allow

func (p *Policer) Allow() bool

func (*Policer) Burst

func (p *Policer) Burst() int

func (*Policer) Rate

func (p *Policer) Rate() float64

type PolicerConfig

type PolicerConfig struct {
	Rate  float64
	Burst int
}

type Protocol

type Protocol string
const (
	ProtocolDHCPv4 Protocol = "dhcpv4"
	ProtocolDHCPv6 Protocol = "dhcpv6"
	ProtocolARP    Protocol = "arp"
	ProtocolPPPoE  Protocol = "pppoe"
	ProtocolIPv6ND Protocol = "ipv6-nd"
	ProtocolL2TP   Protocol = "l2tp"
)

type Stats

type Stats struct {
	Protocol string  `json:"protocol"`
	Rate     float64 `json:"rate"`
	Burst    int     `json:"burst"`
	Allowed  uint64  `json:"allowed"`
	Policed  uint64  `json:"policed"`
}

Jump to

Keyboard shortcuts

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