v0.0.0-...-e4e4297 Latest Latest

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

Go to latest
Published: Jun 5, 2024 License: MIT Imports: 15 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Client

type Client struct {
	// contains filtered or unexported fields

Client connects to an Omada Controller.

func NewClient

func NewClient(logger *zap.Logger, config *Config) (*Client, error)

NewClient returns a client that talks an Omada Controller.

func (*Client) BaseURL

func (c *Client) BaseURL() string

BaseURL returns the path to the Omada controller. When authenticated, this will include the Controller ID as of Omada 5.x

func (*Client) ConnectedClients

func (c *Client) ConnectedClients(site string) ([]*ConnectedClient, error)

ConnectedClients returns statistics for active wireless clients across all known Access Points.

func (*Client) SetBaseURL

func (c *Client) SetBaseURL(path string) error

SetBaseURL updates the path to the Omada controller.

func (*Client) SetToken

func (c *Client) SetToken(token string)

func (*Client) Sites

func (c *Client) Sites() ([]*Site, error)

Sites returns information about each "site" known to the controller.

func (*Client) Token

func (c *Client) Token() string

Token returns the auth token for the controller. Some URLs may need it.

type ClientsResult

type ClientsResult struct {
	ErrorCode int64 `json:"errorCode"`
	Msg       string
	Result    struct {
		CurrentPage int64              `json:"currentPage"`
		CurrentSize int64              `json:"currentSize"`
		TotalRows   int64              `json:"totalRows"`
		Data        []*ConnectedClient `json:"data"`
	} `json:"result"`

ClientsResult was autogenerated with `gojson`.

type Config

type Config struct {
	Path     string `yaml:"path"`
	Username string `yaml:"user"`
	Password string `yaml:"pass"`
	Secure   bool   `yaml:"secure"` // control tls.Config InsecureSkipVerify

func ParseConfig

func ParseConfig(configFile string) (*Config, error)

ParseConfig reads a config file, if available, and then uses values from these environment variables:

OMADA_PATH - base URL to Omada controller, like ""
OMADA_USER - controller admin username
OMADA_PASS - controller admin password
OMADA_SECURE - require verifiable TLS connection to OMADA_PATH when 1 or true

Note that "secure" is false by default, the default controller does not have a verifiable TLS certificate.

type ConnectedClient

type ConnectedClient struct {
	Active         bool   `json:"active"`
	Activity       int64  `json:"activity"`
	ApMAC          string `json:"apMac"`
	ApName         string `json:"apName"`
	AuthStatus     int64  `json:"authStatus"`
	Channel        int64  `json:"channel"`
	ConnectDevType string `json:"connectDevType"`
	ConnectType    int64  `json:"connectType"`
	DeviceType     string `json:"deviceType"`
	DownPacket     int64  `json:"downPacket"`
	Guest          bool   `json:"guest"`
	HostName       string `json:"hostName"`
	IP             string `json:"ip"`
	LastSeen       int64  `json:"lastSeen"`
	MAC            string `json:"mac"`
	Manager        bool   `json:"manager"`
	Name           string `json:"name"`
	PowerSave      bool   `json:"powerSave"`
	RadioID        int64  `json:"radioId"`
	RSSI           int64  `json:"rssi"`
	RxRate         int64  `json:"rxRate"`
	SignalLevel    int64  `json:"signalLevel"`
	SignalRank     int64  `json:"signalRank"`
	SSID           string `json:"ssid"`
	TrafficDown    int64  `json:"trafficDown"`
	TrafficUp      int64  `json:"trafficUp"`
	TxRate         int64  `json:"txRate"`
	UpPacket       int64  `json:"upPacket"`
	Uptime         int64  `json:"uptime"`
	WifiMode       int64  `json:"wifiMode"`
	Wireless       bool   `json:"wireless"`

ConnectedClient was autogenerated with `gojson`.

type Site

type Site struct {
	AlertNum                  int64  `json:"alertNum"`
	Key                       string `json:"key"`
	Lan                       bool   `json:"lan"`
	LanDeviceConnectedNum     int64  `json:"lanDeviceConnectedNum"`
	LanDeviceDisconnectedNum  int64  `json:"lanDeviceDisconnectedNum"`
	LanGuestNum               int64  `json:"lanGuestNum"`
	LanUserNum                int64  `json:"lanUserNum"`
	Name                      string `json:"name"`
	Primary                   bool   `json:"primary"`
	Region                    string `json:"region"`
	Wan                       bool   `json:"wan"`
	Wlan                      bool   `json:"wlan"`
	WlanDeviceConnectedNum    int64  `json:"wlanDeviceConnectedNum"`
	WlanDeviceDisconnectedNum int64  `json:"wlanDeviceDisconnectedNum"`
	WlanDeviceIsolatedNum     int64  `json:"wlanDeviceIsolatedNum"`
	WlanGuestNum              int64  `json:"wlanGuestNum"`
	WlanUserNum               int64  `json:"wlanUserNum"`

Site was autogenerated with `gojson`.

type SitesResult

type SitesResult struct {
	ErrorCode int64 `json:"errorCode"`
	Msg       string
	Result    struct {
		CurrentPage int64   `json:"currentPage"`
		CurrentSize int64   `json:"currentSize"`
		TotalRows   int64   `json:"totalRows"`
		Data        []*Site `json:"data"`
	} `json:"result"`

SitesResult was autogenerated with `gojson`.

Jump to

Keyboard shortcuts

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