ch7465lg

package module
v0.0.0-...-2448ce1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2020 License: MIT Imports: 12 Imported by: 0

README

CH7465LG

GoDoc Go Report Card

Go library and Prometheus exporter for the Compal CH7465LG cable modem (Ziggo ConnectBox).

Features

  • Metrics for bonded downstream channels

TODO

  • Expose metrics for bonded upstream channels

Installation

Build from source
Prerequisites
$ GO111MODULE=on go get github.com/dstotijn/ch7465lg/cmd/ch7465lg

Usage


$ ch7465lg -h
Usage of ./ch7465lg:
-gw string
Modem gateway IP address. (default "192.168.178.1")
-prom string
Prometheus exporter bind address. (default ":9810")

The password for the modem admin user is read from a (required) MODEM_PASSWORD environment variable.

Acknowledgements

License

MIT


© 2020 David Stotijn — Twitter, Email

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLoginFailed = errors.New("login failed")

ErrLoginFailed is returned when login failed, e.g. invalid credentials.

Functions

This section is empty.

Types

type Client

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

Client represents a client for a CH7465LG modem.

func NewClient

func NewClient(addr, password string, httpClient *http.Client) (*Client, error)

NewClient returns a new Client.

func (*Client) Downstreams

func (c *Client) Downstreams() ([]Downstream, error)

Downstreams fetches statistics for bonded downstream channels.

func (*Client) Get

func (c *Client) Get(funcNum int) (*http.Response, error)

Get retrieves settings.

func (*Client) Login

func (c *Client) Login() error

Login performs a login attempt.

func (*Client) Logout

func (c *Client) Logout() error

Logout ends the current session.

func (*Client) Set

func (c *Client) Set(funcNum int, formValues FormValues) (*http.Response, error)

Set sends a mutation request.

type Downstream

type Downstream struct {
	Frequency    int64   `xml:"freq"`
	Power        int     `xml:"pow"`
	SNR          int     `xml:"snr"`
	Modulation   string  `xml:"mod"`
	ChannelID    int     `xml:"chid"`
	RxMER        float64 `xml:"RxMER"`
	PreRSErrs    int64   `xml:"PreRs"`
	PostRSErrs   int64   `xml:"PostRs"`
	IsQamLocked  int     `xml:"IsQamLocked"`
	IsFECLocked  int     `xml:"IsFECLocked"`
	IsMpegLocked int     `xml:"IsMpegLocked"`
}

Downstream represents a bonded downstream channel.

type FormValue

type FormValue struct {
	Key   string
	Value string
}

FormValue is used for submitting form values.

type FormValues

type FormValues []FormValue

FormValues is used for submitting forms. Order matters, thus we cannot use a map (e.g. url.Values).

func (*FormValues) Add

func (v *FormValues) Add(key, value string)

Add adds a form value.

func (FormValues) Encode

func (v FormValues) Encode() string

Encode encodes the form values into “URL encoded” form ("bar=baz&foo=quux").

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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