bandwidth

package
v0.0.0-...-8b1022e Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

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 `json:"asOf"`
}

Quota encapsulates information about the user's bandwidth quota.

func GetQuota

func GetQuota() *Quota

GetQuota gets the most up to date bandwidth quota information.

Jump to

Keyboard shortcuts

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