multiplier

package
v1.21.7 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package multiplier applies the node traffic multipliers an administrator sets for times of day.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	Periods []TimePeriod
}

Manager picks the multiplier in effect at a time from its periods.

func NewManager

func NewManager(periods []TimePeriod) *Manager

NewManager returns a manager over periods.

func (*Manager) GetMultiplier

func (m *Manager) GetMultiplier(current time.Time) float32

GetMultiplier returns the multiplier of the first period containing current's time of day, or 1 when none does.

type TimePeriod

type TimePeriod struct {
	StartTime  string  `json:"start_time"`
	EndTime    string  `json:"end_time"`
	Multiplier float32 `json:"multiplier"`
}

TimePeriod is a daily time range, which may cross midnight, and the multiplier that applies within it.

Jump to

Keyboard shortcuts

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