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

bandwidth

package
v7.6.218 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: GPL-3.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Updates is a channel on which one can receive updates to the Quota
	Updates = make(chan *Quota, 100)
)

Functions

func Track

func Track(resp *http.Response)

Track updates the bandwith quota information based on the XBQ header in the given response. The header is expected to follow this format:

<used>/<allowed>/<asof>

<used> is the string representation of a 64-bit unsigned integer <allowed> is the string representation of a 64-bit unsigned integer <asof> is the 64-bit signed integer representing seconds since a custom epoch (00:00:00 01/01/2016 UTC).

Types

type Quota

type Quota struct {
	MiBAllowed uint64 `json:"mibAllowed"`
	MiBUsed    uint64 `json:"mibUsed"`
	AsOf       time.Time
	TTLSeconds uint64
}

Quota encapsulates information about the user's bandwidth quota.

func GetQuota

func GetQuota() (*Quota, bool)

GetQuota gets the most up to date bandwidth quota information and a bool indicating whether or not we've had a chance to learn the quota yet.

Jump to

Keyboard shortcuts

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