darkstat

package
v1.0.4 Latest Latest
Warning

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

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

Documentation

Overview

Package darkstat provides a library to read information from darkstat web server. Darkstat: Captures network traffic, calculates statistics about usage, and serves reports over HTTP. http://unix4lyfe.org/darkstat/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

A Conn represents a connection to Darkstat.

func New

func New(serverURL string) (*Conn, error)

New prepares a Darkstat connection by returning a *Conn.

func (*Conn) Bandwidth

func (c *Conn) Bandwidth() (in, out int, err error)

Bandwidth returns the average bandwidth in bytes observed in the last minute.

func (*Conn) Graphs

func (c *Conn) Graphs() (*GraphsXML, error)

Graphs gets and parses darkstat's graphs.xml page.

type DataPoint

type DataPoint struct {
	Pos int `xml:"p,attr"`
	In  int `xml:"i,attr"`
	Out int `xml:"o,attr"`
}

An DataPoint represents a data point of bytes in/out at a given instant.

type GraphsXML

type GraphsXML struct {
	Packets    int         `xml:"tp,attr"`
	Bytes      int         `xml:"tb,attr"`
	Captured   int         `xml:"pc,attr"`
	Dropped    int         `xml:"pd,attr"`
	RunningFor string      `xml:"rf,attr"`
	Seconds    []DataPoint `xml:"seconds>e"`
	Minutes    []DataPoint `xml:"minutes>e"`
	Hours      []DataPoint `xml:"hours>e"`
	Days       []DataPoint `xml:"days>e"`
}

A GraphsXML represents darkstat's graphs.xml.

func (*GraphsXML) Bandwidth

func (g *GraphsXML) Bandwidth() (in, out int)

Bandwidth returns the average bandwidth in bytes observed in the last minute.

Jump to

Keyboard shortcuts

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