fritz

package
v0.0.0-...-0e7d6d3 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	XPATH_SENT_DATA_YESTERDAY_DE     string = "//tr[td[text() = 'Gestern']]/td[@datalabel='Datenvolumen gesendet(MB)']/text()"
	XPATH_RECEIVED_DATA_YESTERDAY_DE string = "//tr[td[text() = 'Gestern']]/td[@datalabel='Datenvolumen empfangen(MB)']/text()"
)

FritzOS <= 7.21 Needed for parsing values from HTML table

Variables

This section is empty.

Functions

This section is empty.

Types

type CounterData

type CounterData struct {
	Yesterday struct {
		Bytessenthigh     string `json:"BytesSentHigh"`
		Bytessentlow      string `json:"BytesSentLow"`
		Bytesreceivedhigh string `json:"BytesReceivedHigh"`
		Bytesreceivedlow  string `json:"BytesReceivedLow"`
	} `json:"Yesterday"`
	Today struct {
		Bytessenthigh     string `json:"BytesSentHigh"`
		Bytessentlow      string `json:"BytesSentLow"`
		Bytesreceivedhigh string `json:"BytesReceivedHigh"`
		Bytesreceivedlow  string `json:"BytesReceivedLow"`
	} `json:"Today"`
}

FritzOS >= 7.25 Needed for parsing the JSON part taken from HTML source code

type FritzBox

type FritzBox struct {
	Host     string
	User     string
	Passw    string
	Insecure bool // If host is https allow insecure/invalid TLS certificates
	// contains filtered or unexported fields
}

Stores general information about the FritzBox

func (*FritzBox) PerformLogin

func (fb *FritzBox) PerformLogin() error

PerformLogin performs a login and returns SessionInfo including the session id (SID) on success

func (*FritzBox) ReadOnlineCounter

func (fb *FritzBox) ReadOnlineCounter() (OnlineCounter, error)

type OnlineCounter

type OnlineCounter struct {
	DataSent     int
	DataReceived int
	DayOfData    time.Time
}

type SessionInfo

type SessionInfo struct {
	SID       string `xml:"SID"`
	Challenge string `xml:"Challenge"`
	Users     []User `xml:"Users"`
}

Stores the current FritzBox session

type User

type User struct {
	// TODO does not work
	//LastUsed int    `xml:"last,attr,default=0"`
	User string `xml:"User"`
}

Jump to

Keyboard shortcuts

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