limits

package
v2.0.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DefaultQueryTimeout = 30 * time.Second

DefaultQueryTimeout bounds each of the limits agent's influx queries.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountAction

type AccountAction interface {
	HandleAccount(a *store.Account, rxBytes, txBytes int64, bwc store.BandwidthClass, ul *userLimits, trx *sqlx.Tx) error
}

type Agent

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

func NewAgent

func NewAgent(cfg *Config, ifxCfg *metrics.InfluxConfig, zCfg *automation.Config, emailCfg *emailUi.Config, str *store.Store) (*Agent, error)

func (*Agent) CanAccessShare

func (a *Agent) CanAccessShare(shrId int, trx *sqlx.Tx) (bool, error)

func (*Agent) CanCreateEnvironment

func (a *Agent) CanCreateEnvironment(acctId int, trx *sqlx.Tx) (bool, error)

func (*Agent) CanCreateShare

func (a *Agent) CanCreateShare(acctId, envId int, reserved, uniqueName bool, _ sdk.ShareMode, backendMode sdk.BackendMode, trx *sqlx.Tx) (bool, error)

func (*Agent) CanReserveName

func (a *Agent) CanReserveName(acctId int, trx *sqlx.Tx) (bool, error)

func (*Agent) DroppedEvents added in v2.0.5

func (a *Agent) DroppedEvents() uint64

func (*Agent) Handle

func (a *Agent) Handle(u *metrics.Usage) error

func (*Agent) HandleContext added in v2.0.5

func (a *Agent) HandleContext(ctx context.Context, u *metrics.Usage) error

func (*Agent) Start

func (a *Agent) Start()

func (*Agent) Stop

func (a *Agent) Stop()

Stop cancels the agent's context first, so an influx query in flight returns and the run loop can see the close.

type Bandwidth

type Bandwidth struct {
	Rx    int64
	Tx    int64
	Total int64
}

type BandwidthPerPeriod

type BandwidthPerPeriod struct {
	Period  time.Duration
	Warning *Bandwidth
	Limit   *Bandwidth
}

func DefaultBandwidthPerPeriod

func DefaultBandwidthPerPeriod() *BandwidthPerPeriod

type Config

type Config struct {
	Environments   int
	Shares         int
	ReservedShares int
	UniqueNames    int
	ShareFrontends int
	Bandwidth      *BandwidthPerPeriod
	Cycle          time.Duration
	Enforcing      bool
	HandoffTimeout time.Duration
	QueryTimeout   time.Duration
}

func DefaultConfig

func DefaultConfig() *Config

type FailedShare added in v2.0.7

type FailedShare struct {
	Account          string
	ShareToken       string
	SelectedFrontend string
}

FailedShare is a v1-created share whose frontend selection names no live frontend.

type MissingDialPolicy added in v2.0.7

type MissingDialPolicy struct {
	Account    string
	ShareToken string
	Name       string
	// contains filtered or unexported fields
}

MissingDialPolicy is a desired dial policy that was not found by name.

type RepairReport added in v2.0.7

type RepairReport struct {
	Apply           bool
	Checked         int
	Missing         []*MissingDialPolicy
	Created         int
	Failed          int
	SkippedAccounts []string
	SkippedShares   []string
	FailedShares    []*FailedShare
}

RepairReport is the outcome of a RepairDialPolicies run. Checked and Missing count dial policies; Failed counts failed policies and the FailedShares whose desired policies could not be derived.

func RepairDialPolicies added in v2.0.7

func RepairDialPolicies(str *store.Store, ziti *automation.ZitiAutomation, apply bool, out io.Writer) (*RepairReport, error)

RepairDialPolicies finds the live shares whose dial policies are missing although their account is not limited, and with apply creates them. it honours the bandwidth limit journal: an account limited as a whole is skipped, and so are the shares of a backend mode limited by a scoped limit class; restoring those would lift a limit the journal still records. it never deletes anything.

Jump to

Keyboard shortcuts

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