models

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrLoginFailed is returned when the controller rejects the credentials
	// or reports a missing/expired session (controller code -30109).
	ErrLoginFailed = &RequestError{Code: -30109}
	// ErrLoginSessionClosed is returned when the session cookie is no longer
	// accepted, typically because the cookie jar dropped it.
	ErrLoginSessionClosed = errors.New("login session closed")
	// ErrUnsupportedControllerVersion is returned when the controller is older
	// than the minimum supported version.
	ErrUnsupportedControllerVersion = errors.New("unsupported Omada controller version")
	// ErrSiteNotFound is returned when a referenced site does not exist.
	ErrSiteNotFound = errors.New("site not found")
	// ErrConnectionFailed wraps network-level failures reaching the controller.
	ErrConnectionFailed = errors.New("connection to Omada controller failed")
	// ErrBadControllerURL wraps failures resolving the controller URL.
	ErrBadControllerURL = errors.New("controller URL could not be resolved")
	// ErrInvalidDevice is returned when a device lookup yields no usable device.
	ErrInvalidDevice = errors.New("invalid device")
)

Functions

func MapBool

func MapBool(m map[string]any, key string) bool

MapBool returns the bool value at key, or false when absent.

func MapInt

func MapInt(m map[string]any, key string) int

MapInt returns the numeric value at key as int, or 0 when absent. JSON numbers decode as float64; whole floats are converted safely.

func MapList

func MapList(m map[string]any, key string) []any

MapList returns the list at key as []any, or nil when absent.

func MapMap

func MapMap(m map[string]any, key string) (map[string]any, bool)

MapMap returns the nested object at key, ok=false when absent.

func MapPtrBool

func MapPtrBool(m map[string]any, key string) *bool

MapPtrBool returns a pointer to the bool at key, or nil when absent.

func MapPtrFloat

func MapPtrFloat(m map[string]any, key string) *float64

MapPtrFloat returns a pointer to the numeric value at key, or nil when absent.

func MapPtrInt

func MapPtrInt(m map[string]any, key string) *int

MapPtrInt returns a pointer to the numeric value at key, or nil when absent.

func MapPtrStr

func MapPtrStr(m map[string]any, key string) *string

MapPtrStr returns a pointer to the string at key, or nil when absent.

func MapStr

func MapStr(m map[string]any, key string) string

MapStr returns the string value at key, or "" when absent/not a string.

func MapStrList

func MapStrList(m map[string]any, key string) []string

MapStrList returns the list of strings at key, or nil when absent.

func ValidateVlanConflicts

func ValidateVlanConflicts(payload map[string]any, networks []LanNetwork, excludeID *string) error

ValidateVlanConflicts rejects collisions against a fresh inventory, including routed networks.

func ValidateVlanTarget

func ValidateVlanTarget(network LanNetwork) error

ValidateVlanTarget rejects protected, routed, incomplete, or unverified VLAN targets.

Types

type APLANPortSettings

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

APLANPortSettings is a LAN port on an access point.

func NewAPLANPortSettings

func NewAPLANPortSettings(data map[string]any) APLANPortSettings

NewAPLANPortSettings builds an APLANPortSettings from a raw API object.

func (APLANPortSettings) LocalVLANEnable

func (p APLANPortSettings) LocalVLANEnable() bool

LocalVLANEnable reports whether VLAN tagging is enabled for the port.

func (APLANPortSettings) LocalVLANID

func (p APLANPortSettings) LocalVLANID() int

LocalVLANID is the VLAN ID of the port.

func (APLANPortSettings) PoEEnable

func (p APLANPortSettings) PoEEnable() bool

PoEEnable is the PoE state of the port.

func (APLANPortSettings) PortName

func (p APLANPortSettings) PortName() string

PortName is the port name (not editable).

func (APLANPortSettings) SupportsPoE

func (p APLANPortSettings) SupportsPoE() bool

SupportsPoE reports whether the port supports PoE output.

func (APLANPortSettings) SupportsVLAN

func (p APLANPortSettings) SupportsVLAN() bool

SupportsVLAN reports whether the port supports VLAN tagging.

type APRadioSettings

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

APRadioSettings is the configured state of one radio on an access point.

func NewAPRadioSettings

func NewAPRadioSettings(data map[string]any) APRadioSettings

NewAPRadioSettings builds an APRadioSettings from a raw API object.

func (APRadioSettings) AutoChannel

func (s APRadioSettings) AutoChannel() bool

AutoChannel reports whether the AP chooses the channel itself.

func (APRadioSettings) ChannelIndex

func (s APRadioSettings) ChannelIndex() int

ChannelIndex is the configured channel as a 1-based index into the radio's channel list. 0 means the AP picks the channel automatically.

func (APRadioSettings) ChannelWidth

func (s APRadioSettings) ChannelWidth() ChannelWidth

ChannelWidth is the configured channel width.

func (APRadioSettings) Frequency

func (s APRadioSettings) Frequency() int

Frequency is the centre frequency of the configured channel in MHz.

func (APRadioSettings) RadioEnabled

func (s APRadioSettings) RadioEnabled() bool

RadioEnabled reports whether the radio is switched on.

func (APRadioSettings) Raw

func (s APRadioSettings) Raw() map[string]any

Raw is the underlying API object.

func (APRadioSettings) TxPower

func (s APRadioSettings) TxPower() int

TxPower is the transmit power in dBm.

func (APRadioSettings) TxPowerLevel

func (s APRadioSettings) TxPowerLevel() int

TxPowerLevel is the transmit power preset (0=Low, 1=Medium, 2=High, 3=Custom, 4=Auto).

func (APRadioSettings) WirelessMode

func (s APRadioSettings) WirelessMode() int

WirelessMode is the 802.11 mode of the radio. -2 means automatic.

type APRadioStatus

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

APRadioStatus is the live state of one radio on an access point.

func NewAPRadioStatus

func NewAPRadioStatus(data map[string]any) APRadioStatus

NewAPRadioStatus builds an APRadioStatus from a raw API object.

func (APRadioStatus) ActualChannel

func (s APRadioStatus) ActualChannel() string

ActualChannel is the channel currently in use, e.g. "36 / 5180MHz".

func (APRadioStatus) BandWidth

func (s APRadioStatus) BandWidth() string

BandWidth is the channel width currently in use, e.g. "40MHz".

func (APRadioStatus) InterUtil

func (s APRadioStatus) InterUtil() int

InterUtil is the percentage of airtime lost to interference.

func (APRadioStatus) MaxTxRate

func (s APRadioStatus) MaxTxRate() int

MaxTxRate is the maximum PHY rate at the current width in Mbps.

func (APRadioStatus) RXUtil

func (s APRadioStatus) RXUtil() int

RXUtil is the percentage of airtime spent receiving.

func (APRadioStatus) TXUtil

func (s APRadioStatus) TXUtil() int

TXUtil is the percentage of airtime spent transmitting.

func (APRadioStatus) TxPower

func (s APRadioStatus) TxPower() int

TxPower is the transmit power currently in use in dBm.

func (APRadioStatus) WirelessMode

func (s APRadioStatus) WirelessMode() string

WirelessMode is the 802.11 mode in use, e.g. "a/n/ac mixed".

type AccessPoint

type AccessPoint struct {
	Device
}

AccessPoint is the details of a managed access point.

func NewAccessPoint

func NewAccessPoint(data map[string]any) AccessPoint

NewAccessPoint builds an AccessPoint from a raw API object.

func (AccessPoint) LANPortSettings

func (a AccessPoint) LANPortSettings() []APLANPortSettings

LANPortSettings are the settings for the AP's LAN ports.

func (AccessPoint) RadioBands

func (a AccessPoint) RadioBands() []RadioId

RadioBands are the radios this AP actually has.

func (AccessPoint) RadioSettings

func (a AccessPoint) RadioSettings(band RadioId) *APRadioSettings

RadioSettings returns the configured state of one radio, or nil if the AP has no such radio.

func (AccessPoint) RadioStatus

func (a AccessPoint) RadioStatus(band RadioId) *APRadioStatus

RadioStatus returns the live state of one radio, or nil if the AP has no such radio.

func (AccessPoint) Supports5G

func (a AccessPoint) Supports5G() bool

Supports5G reports whether 5 GHz wifi is supported.

func (AccessPoint) Supports5G2

func (a AccessPoint) Supports5G2() bool

Supports5G2 reports whether 5G2 wifi is supported.

func (AccessPoint) Supports6G

func (a AccessPoint) Supports6G() bool

Supports6G reports whether Wi-Fi 6 is supported.

func (AccessPoint) Supports11AC

func (a AccessPoint) Supports11AC() bool

Supports11AC reports whether 802.11ac is supported.

func (AccessPoint) SupportsMesh

func (a AccessPoint) SupportsMesh() bool

SupportsMesh reports whether mesh networking is supported.

func (a AccessPoint) WiredUplink() *Link

WiredUplink is the AP's wired uplink device, nil when absent.

func (AccessPoint) WirelessLinked

func (a AccessPoint) WirelessLinked() bool

WirelessLinked reports whether the AP is connected wirelessly.

type AuthenticationStatus

type AuthenticationStatus int32
const (
	AuthenticationStatusUnknown    AuthenticationStatus = -1
	AuthenticationStatusConnected  AuthenticationStatus = 0
	AuthenticationStatusPending    AuthenticationStatus = 1
	AuthenticationStatusAuthorized AuthenticationStatus = 2
	AuthenticationStatusAuthFree   AuthenticationStatus = 3
)

func (AuthenticationStatus) String

func (s AuthenticationStatus) String() string

type BandwidthControl

type BandwidthControl int32
const (
	BandwidthControlUnknown      BandwidthControl = -1
	BandwidthControlOff          BandwidthControl = 0
	BandwidthControlRateLimit    BandwidthControl = 1
	BandwidthControlStormControl BandwidthControl = 2
)

func (BandwidthControl) String

func (s BandwidthControl) String() string

type ChannelWidth

type ChannelWidth int32
const (
	ChannelWidthUnknown       ChannelWidth = -1
	ChannelWidthWidth20       ChannelWidth = 2
	ChannelWidthWidth40       ChannelWidth = 3
	ChannelWidthAuto4020      ChannelWidth = 4
	ChannelWidthWidth80       ChannelWidth = 5
	ChannelWidthAuto804020    ChannelWidth = 6
	ChannelWidthWidth160      ChannelWidth = 7
	ChannelWidthAuto160804020 ChannelWidth = 8
	ChannelWidthWidth240      ChannelWidth = 9
	ChannelWidthWidth320      ChannelWidth = 10
)

func (ChannelWidth) String

func (s ChannelWidth) String() string

type Client

type Client struct {

	// Wired holds switch/gateway port details. Populated for wired clients.
	Wired *WiredDetails
	// Wireless holds AP radio details. Populated for wireless clients.
	Wireless *WirelessDetails
	// contains filtered or unexported fields
}

Client is a device connected to the Omada network.

func NewClient

func NewClient(data map[string]any) Client

NewClient builds a Client from a raw API object.

func (Client) Activity

func (c Client) Activity() int

Activity is the realtime downlink rate in bytes/s.

func (Client) AuthStatus

func (c Client) AuthStatus() AuthenticationStatus

AuthStatus is the authentication status.

func (Client) ConnectDevType

func (c Client) ConnectDevType() *string

ConnectDevType is the type of device the client is connected to.

func (Client) ConnectType

func (c Client) ConnectType() ConnectType

ConnectType is the connection type.

func (Client) ConnectionTime

func (c Client) ConnectionTime() *int

ConnectionTime is the client connection time in seconds.

func (Client) DeviceCategory

func (c Client) DeviceCategory() *string

DeviceCategory is the device category.

func (Client) DeviceType

func (c Client) DeviceType() string

DeviceType is the client device type (Android, iPhone, ...).

func (Client) DownPacket

func (c Client) DownPacket() int

DownPacket is the number of packets sent to the client.

func (Client) HostName

func (c Client) HostName() *string

HostName is the client's hostname.

func (Client) IP

func (c Client) IP() *string

IP is the client's IP address.

func (Client) IPSetting

func (c Client) IPSetting() IpSetting

IPSetting is the IP reservation setting of the client.

func (Client) IsActive

func (c Client) IsActive() bool

IsActive reports whether the client is active.

func (Client) IsBlocked

func (c Client) IsBlocked() bool

IsBlocked reports whether the client is blocked. Most API calls return "blocked"; the known_clients call returns "block".

func (Client) IsGuest

func (c Client) IsGuest() bool

IsGuest reports whether the client is a guest.

func (Client) IsWireless

func (c Client) IsWireless() *bool

IsWireless reports whether the client is wireless, nil when unreported.

func (Client) LastSeen

func (c Client) LastSeen() float64

LastSeen is the Unix timestamp (seconds) when the client was last connected.

func (Client) MAC

func (c Client) MAC() string

MAC is the MAC address of the client.

func (Client) Name

func (c Client) Name() string

Name is the name of the client.

func (Client) OSName

func (c Client) OSName() *string

OSName is the operating system name.

func (Client) RateLimit

func (c Client) RateLimit() RateLimit

RateLimit is the rate limit setting of the client.

func (Client) TrafficDown

func (c Client) TrafficDown() int

TrafficDown is the number of bytes sent to the client.

func (Client) TrafficUp

func (c Client) TrafficUp() int

TrafficUp is the number of bytes sent by the client.

func (Client) UpPacket

func (c Client) UpPacket() int

UpPacket is the number of packets received from the client.

func (Client) VLAN

func (c Client) VLAN() *int

VLAN is the VLAN ID of the client. Some access points do not report it.

func (Client) Vendor

func (c Client) Vendor() *string

Vendor is the vendor of the device.

type ConnectType

type ConnectType int32
const (
	ConnectTypeUnknown       ConnectType = -1
	ConnectTypeGuestWireless ConnectType = 0
	ConnectTypeWireless      ConnectType = 1
	ConnectTypeWired         ConnectType = 2
)

func (ConnectType) String

func (s ConnectType) String() string

type ControllerInfo

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

ControllerInfo wraps the /api/info response.

func NewControllerInfo

func NewControllerInfo(m map[string]any) ControllerInfo

func (ControllerInfo) APIVersion

func (c ControllerInfo) APIVersion() string

APIVersion is the controller API version, when reported.

func (ControllerInfo) Category

func (c ControllerInfo) Category() string

Category is the controller category, when reported.

func (ControllerInfo) CloudURL

func (c ControllerInfo) CloudURL() string

CloudURL is the Omada cloud URL, when reported.

func (ControllerInfo) Configured

func (c ControllerInfo) Configured() *bool

Configured reports whether the setup wizard has been completed.

func (ControllerInfo) ControllerVersion

func (c ControllerInfo) ControllerVersion() string

ControllerVersion is the controller software version.

func (ControllerInfo) ID

func (c ControllerInfo) ID() string

ID is the controller's unique ID (omadacId).

func (ControllerInfo) MspMode

func (c ControllerInfo) MspMode() *bool

MspMode reports whether the controller runs in MSP mode.

func (ControllerInfo) Raw

func (c ControllerInfo) Raw() map[string]any

Raw returns the original response map.

func (ControllerInfo) RegisteredRoot

func (c ControllerInfo) RegisteredRoot() *bool

RegisteredRoot reports whether the root account is registered.

func (ControllerInfo) SupportApp

func (c ControllerInfo) SupportApp() *bool

SupportApp reports whether the Omada app is supported.

func (ControllerInfo) Type

func (c ControllerInfo) Type() *int

Type is the controller type code as returned by the API.

type ControllerStatus

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

ControllerStatus wraps the maintenance/controllerStatus response.

func NewControllerStatus

func NewControllerStatus(m map[string]any) ControllerStatus

func (ControllerStatus) ControllerVersion

func (c ControllerStatus) ControllerVersion() string

ControllerVersion is the version reported by the status endpoint.

func (ControllerStatus) MAC

func (c ControllerStatus) MAC() string

MAC is the controller MAC address.

func (ControllerStatus) Model

func (c ControllerStatus) Model() string

Model is the hardware model, falling back to "Controller".

func (ControllerStatus) Name

func (c ControllerStatus) Name() *string

Name is the controller display name, stripped; nil when absent.

func (ControllerStatus) Raw

func (c ControllerStatus) Raw() map[string]any

func (ControllerStatus) Uptime

func (c ControllerStatus) Uptime() int64

Uptime is the controller uptime in seconds.

type ControllerTypeModel

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

ControllerTypeModel wraps the anon/controllerType response.

func NewControllerTypeModel

func NewControllerTypeModel(m map[string]any) ControllerTypeModel

func (ControllerTypeModel) CombinedGateway

func (c ControllerTypeModel) CombinedGateway() bool

CombinedGateway reports whether the controller runs on a combined gateway.

func (ControllerTypeModel) IsSoftController

func (c ControllerTypeModel) IsSoftController() bool

IsSoftController reports whether this is an Omada Software Controller.

func (ControllerTypeModel) Raw

func (c ControllerTypeModel) Raw() map[string]any

type ControllerUpdateInfo

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

ControllerUpdateInfo wraps a normalized controller update report.

func NewControllerUpdateInfo

func NewControllerUpdateInfo(m map[string]any) ControllerUpdateInfo

func (ControllerUpdateInfo) CurrentVersion

func (c ControllerUpdateInfo) CurrentVersion() *string

CurrentVersion is the current version of the relevant update section.

func (ControllerUpdateInfo) Hardware

Hardware is the hardware (firmware) update section, when present.

func (ControllerUpdateInfo) LatestVersion

func (c ControllerUpdateInfo) LatestVersion() *string

LatestVersion is the latest version of the relevant update section.

func (ControllerUpdateInfo) Raw

func (c ControllerUpdateInfo) Raw() map[string]any

func (ControllerUpdateInfo) ReleaseNotes

func (c ControllerUpdateInfo) ReleaseNotes() *string

ReleaseNotes are the notes of the relevant update section.

func (ControllerUpdateInfo) ReleaseURL

func (c ControllerUpdateInfo) ReleaseURL() *string

ReleaseURL is the release URL of the relevant update section.

func (ControllerUpdateInfo) Software

Software is the software update section, when present.

func (ControllerUpdateInfo) Update

func (c ControllerUpdateInfo) Update() *updateInfoSection

Update is the section matching the current controller type (hardware first).

func (ControllerUpdateInfo) Upgrade

func (c ControllerUpdateInfo) Upgrade() bool

Upgrade reports whether any update is available.

type Device

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

Device is a managed Omada device (gateway, switch, access point).

func NewDevice

func NewDevice(data map[string]any) Device

NewDevice builds a Device from a raw API object.

func (Device) CPUUsage

func (d Device) CPUUsage() int

CPUUsage is the current CPU usage percentage.

func (Device) DisplayUptime

func (d Device) DisplayUptime() *string

DisplayUptime is the uptime as a display string, nil when not connected.

func (Device) FWDownload

func (d Device) FWDownload() bool

FWDownload reports whether a firmware upgrade is being downloaded.

func (Device) FirmwareVersion

func (d Device) FirmwareVersion() string

FirmwareVersion is the running firmware version.

func (Device) IPAddress

func (d Device) IPAddress() string

IPAddress is the device IP address.

func (Device) LedSetting

func (d Device) LedSetting() LedSetting

LedSetting is the onboard LED setting.

func (Device) MAC

func (d Device) MAC() string

MAC is the device's MAC address.

func (Device) MemUsage

func (d Device) MemUsage() int

MemUsage is the current memory usage percentage.

func (Device) Model

func (d Device) Model() string

Model is the device model, such as EAP225.

func (Device) ModelDisplayName

func (d Device) ModelDisplayName() string

ModelDisplayName is the model description for front-end display.

func (Device) Name

func (d Device) Name() string

Name is the device name, falling back to the MAC.

func (Device) NeedUpgrade

func (d Device) NeedUpgrade() bool

NeedUpgrade reports whether a firmware upgrade is available.

func (Device) ResourcePath

func (d Device) ResourcePath() string

ResourcePath is the API path for querying detailed data about this device.

func (Device) Status

func (d Device) Status() DeviceStatus

Status is the device status.

func (Device) StatusCategory

func (d Device) StatusCategory() DeviceStatusCategory

StatusCategory is the high-level device status.

func (Device) Type

func (d Device) Type() string

Type returns "ap", "gateway", or "switch".

func (Device) Uptime

func (d Device) Uptime() int

Uptime is the uptime in seconds.

type DeviceStatus

type DeviceStatus int32
const (
	DeviceStatusUnknown                       DeviceStatus = -1
	DeviceStatusDisconnected                  DeviceStatus = 0
	DeviceStatusDisconnectedMigrating         DeviceStatus = 1
	DeviceStatusProvisioning                  DeviceStatus = 10
	DeviceStatusConfiguring                   DeviceStatus = 11
	DeviceStatusUpgrading                     DeviceStatus = 12
	DeviceStatusRebooting                     DeviceStatus = 13
	DeviceStatusConnected                     DeviceStatus = 14
	DeviceStatusConnectedWireless             DeviceStatus = 15
	DeviceStatusConnectedMigrating            DeviceStatus = 16
	DeviceStatusConnectedWirelessMigrating    DeviceStatus = 17
	DeviceStatusPending                       DeviceStatus = 20
	DeviceStatusPendingWireless               DeviceStatus = 21
	DeviceStatusAdopting                      DeviceStatus = 22
	DeviceStatusAdoptingWireless              DeviceStatus = 23
	DeviceStatusAdoptFailed                   DeviceStatus = 24
	DeviceStatusAdoptFailedWireless           DeviceStatus = 25
	DeviceStatusManagedExternally             DeviceStatus = 26
	DeviceStatusManagedExternallyWireless     DeviceStatus = 27
	DeviceStatusHeartbeatMissed               DeviceStatus = 30
	DeviceStatusHeartbeatMissedWireless       DeviceStatus = 31
	DeviceStatusHeartbeatMissedMigrating      DeviceStatus = 32
	DeviceStatusHeartbeatMissedWirelessMigrat DeviceStatus = 33
	DeviceStatusIsolated                      DeviceStatus = 40
	DeviceStatusIsolatedMigrating             DeviceStatus = 41
)

func (DeviceStatus) String

func (s DeviceStatus) String() string

type DeviceStatusCategory

type DeviceStatusCategory int32
const (
	DeviceStatusCategoryUnknown         DeviceStatusCategory = -1
	DeviceStatusCategoryDisconnected    DeviceStatusCategory = 0
	DeviceStatusCategoryConnected       DeviceStatusCategory = 1
	DeviceStatusCategoryPending         DeviceStatusCategory = 2
	DeviceStatusCategoryHeartbeatMissed DeviceStatusCategory = 3
	DeviceStatusCategoryIsolated        DeviceStatusCategory = 4
)

func (DeviceStatusCategory) String

func (s DeviceStatusCategory) String() string

type DhcpReservation

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

DhcpReservation is a DHCP reservation on an Omada controller.

func NewDhcpReservation

func NewDhcpReservation(data map[string]any) DhcpReservation

NewDhcpReservation builds a DhcpReservation from a raw API object.

func (DhcpReservation) ClientName

func (d DhcpReservation) ClientName() *string

ClientName is the name of the client associated with this reservation.

func (DhcpReservation) Description

func (d DhcpReservation) Description() *string

Description is the description/name for the reservation.

func (DhcpReservation) ExportToIpMacBinding

func (d DhcpReservation) ExportToIpMacBinding() *bool

ExportToIpMacBinding reports whether the reservation is exported to IP-MAC binding.

func (DhcpReservation) ID

func (d DhcpReservation) ID() string

ID is the reservation ID.

func (DhcpReservation) IP

func (d DhcpReservation) IP() string

IP is the reserved IP address.

func (DhcpReservation) MAC

func (d DhcpReservation) MAC() string

MAC is the device MAC address.

func (DhcpReservation) NetID

func (d DhcpReservation) NetID() *string

NetID is the ID of the network this reservation belongs to.

func (DhcpReservation) NetName

func (d DhcpReservation) NetName() *string

NetName is the name of the network this reservation belongs to.

func (DhcpReservation) Status

func (d DhcpReservation) Status() *bool

Status reports whether the reservation is active.

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

Downlink is a downlink device attached to a switch port.

func NewDownlink(data map[string]any) Downlink

NewDownlink builds a Downlink from a raw API object.

func (Downlink) MAC

func (d Downlink) MAC() string

MAC is the MAC of the linked device.

func (Downlink) Model

func (d Downlink) Model() string

Model is the model name of the linked device.

func (Downlink) Name

func (d Downlink) Name() string

Name is the name of the linked device.

func (Downlink) Port

func (d Downlink) Port() int

Port is the linked port number.

func (Downlink) Type

func (d Downlink) Type() string

Type is always "ap".

type Eth802Dot1X

type Eth802Dot1X int32
const (
	Eth802Dot1XUnknown           Eth802Dot1X = -1
	Eth802Dot1XForceUnauthorized Eth802Dot1X = 0
	Eth802Dot1XForceAuthorized   Eth802Dot1X = 1
	Eth802Dot1XAuto              Eth802Dot1X = 2
)

func (Eth802Dot1X) String

func (s Eth802Dot1X) String() string

type FirmwareUpdate

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

FirmwareUpdate wraps a device firmware update entry.

func NewFirmwareUpdate

func NewFirmwareUpdate(m map[string]any) FirmwareUpdate

func (FirmwareUpdate) CurrentVersion

func (c FirmwareUpdate) CurrentVersion() string

CurrentVersion is the device's current firmware version.

func (FirmwareUpdate) LatestVersion

func (c FirmwareUpdate) LatestVersion() string

LatestVersion is the latest available firmware version.

func (FirmwareUpdate) Raw

func (c FirmwareUpdate) Raw() map[string]any

func (FirmwareUpdate) ReleaseNotes

func (c FirmwareUpdate) ReleaseNotes() string

ReleaseNotes are the release notes for the new firmware.

type Gateway

type Gateway struct {
	Device
}

Gateway is the details of a managed gateway.

func NewGateway

func NewGateway(data map[string]any) Gateway

NewGateway builds a Gateway from a raw API object.

func (Gateway) EchoServer

func (g Gateway) EchoServer() *string

EchoServer is the address of the server pinged for online detection.

func (Gateway) IP

func (g Gateway) IP() string

IP is the gateway's LAN IP address.

func (Gateway) IsCombinedGateway

func (g Gateway) IsCombinedGateway() bool

IsCombinedGateway reports whether this is a combined gateway/switch.

func (Gateway) LLDPEnabled

func (g Gateway) LLDPEnabled() bool

LLDPEnabled reports whether LLDP is enabled on the gateway.

func (Gateway) NumberPorts

func (g Gateway) NumberPorts() int

NumberPorts is the number of ports on the gateway.

func (Gateway) PortConfigs

func (g Gateway) PortConfigs() []GatewayPortConfig

PortConfigs are the configurations of the gateway's ports, each including its status.

func (Gateway) PortStatuses

func (g Gateway) PortStatuses() []GatewayPortStatus

PortStatuses are the live statuses of the gateway's ports.

func (Gateway) SupportsPoE

func (g Gateway) SupportsPoE() bool

SupportsPoE reports whether the device supports PoE.

type GatewayPortConfig

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

GatewayPortConfig is the configuration of a gateway port, including its status.

func NewGatewayPortConfig

func NewGatewayPortConfig(data map[string]any, poeEnabled *bool) GatewayPortConfig

NewGatewayPortConfig builds a GatewayPortConfig from a raw API object. poeEnabled is the resolved PoE state for the port's number (nil when the gateway has no PoE settings for it).

func (GatewayPortConfig) Duplex

func (p GatewayPortConfig) Duplex() LinkDuplex

Duplex is the configured duplex mode of the port.

func (GatewayPortConfig) LinkSpeed

func (p GatewayPortConfig) LinkSpeed() LinkSpeed

LinkSpeed is the configured link speed of the port.

func (GatewayPortConfig) MirrorEnable

func (p GatewayPortConfig) MirrorEnable() bool

MirrorEnable reports whether port mirroring is enabled.

func (GatewayPortConfig) PoEMode

func (p GatewayPortConfig) PoEMode() PoEMode

PoEMode is the PoE mode of the port, resolved from the gateway's PoE settings.

func (GatewayPortConfig) PortNumber

func (p GatewayPortConfig) PortNumber() int

PortNumber is the port number.

func (GatewayPortConfig) PortStatus

func (p GatewayPortConfig) PortStatus() GatewayPortStatus

PortStatus is the full status of the port.

type GatewayPortMode

type GatewayPortMode int32
const (
	GatewayPortModeDisabled GatewayPortMode = -1
	GatewayPortModeWAN      GatewayPortMode = 0
	GatewayPortModeLAN      GatewayPortMode = 1
)

func (GatewayPortMode) String

func (s GatewayPortMode) String() string

type GatewayPortStatus

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

GatewayPortStatus is the live status of a gateway port.

func NewGatewayPortStatus

func NewGatewayPortStatus(data map[string]any) GatewayPortStatus

NewGatewayPortStatus builds a GatewayPortStatus from a raw API object.

func (GatewayPortStatus) BytesRX

func (p GatewayPortStatus) BytesRX() int

BytesRX is the number of bytes received by the port.

func (GatewayPortStatus) BytesTX

func (p GatewayPortStatus) BytesTX() int

BytesTX is the number of bytes transmitted by the port.

func (GatewayPortStatus) DisplayName

func (p GatewayPortStatus) DisplayName() string

DisplayName is the port display name, falling back to Name.

func (GatewayPortStatus) IPv6WANConnected

func (p GatewayPortStatus) IPv6WANConnected() bool

IPv6WANConnected reports whether the port is connected to the internet over IPv6.

func (GatewayPortStatus) LinkDuplex

func (p GatewayPortStatus) LinkDuplex() LinkDuplex

LinkDuplex is the actual duplex mode of the port.

func (GatewayPortStatus) LinkSpeed

func (p GatewayPortStatus) LinkSpeed() LinkSpeed

LinkSpeed is the established link speed of the port.

func (GatewayPortStatus) LinkStatus

func (p GatewayPortStatus) LinkStatus() LinkStatus

LinkStatus is the low-level connectivity status of the link.

func (GatewayPortStatus) Mode

Mode reports whether the port operates in WAN or LAN mode.

func (GatewayPortStatus) Name

func (p GatewayPortStatus) Name() string

Name is the port name.

func (GatewayPortStatus) OnlineDetection

func (p GatewayPortStatus) OnlineDetection() bool

OnlineDetection reports whether regular internet ping tests are working.

func (GatewayPortStatus) PoEActive

func (p GatewayPortStatus) PoEActive() bool

PoEActive reports whether the port is powering a PoE device.

func (GatewayPortStatus) PortNumber

func (p GatewayPortStatus) PortNumber() int

PortNumber is the port number.

func (GatewayPortStatus) Type

Type is the port type: SFP, WAN, WAN/LAN, or LAN.

func (GatewayPortStatus) WANConnected

func (p GatewayPortStatus) WANConnected() bool

WANConnected reports whether the port is connected to the internet.

func (GatewayPortStatus) WANIPAddress

func (p GatewayPortStatus) WANIPAddress() *string

WANIPAddress is the WAN IPv4 address of the port.

func (GatewayPortStatus) WANIPv6Address

func (p GatewayPortStatus) WANIPv6Address() *string

WANIPv6Address is the WAN IPv6 address of the port.

func (GatewayPortStatus) WANIPv6Enabled

func (p GatewayPortStatus) WANIPv6Enabled() bool

WANIPv6Enabled reports whether the WAN IPv6 address is enabled.

func (GatewayPortStatus) WANProtocol

func (p GatewayPortStatus) WANProtocol() *string

WANProtocol is the WAN protocol: static, dhcp, pppoe, l2tp, or pptp.

type GatewayPortType

type GatewayPortType int32
const (
	GatewayPortTypeUnknown GatewayPortType = -1
	GatewayPortTypeWAN     GatewayPortType = 0
	GatewayPortTypeWANLAN  GatewayPortType = 1
	GatewayPortTypeLAN     GatewayPortType = 2
	GatewayPortTypeSFPWAN  GatewayPortType = 3
)

func (GatewayPortType) String

func (s GatewayPortType) String() string

type HardwareUpdateInfo

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

func NewHardwareUpdateInfo

func NewHardwareUpdateInfo(m map[string]any) HardwareUpdateInfo

NewHardwareUpdateInfo wraps a controller hardware update section.

func (HardwareUpdateInfo) CurrentVersion

func (u HardwareUpdateInfo) CurrentVersion() *string

CurrentVersion is the currently installed version, when reported.

func (u HardwareUpdateInfo) DownloadLink() *string

DownloadLink is the update download link, stripped; nil when absent.

func (HardwareUpdateInfo) LatestVersion

func (u HardwareUpdateInfo) LatestVersion() *string

LatestVersion is the latest available version, falling back to the current one.

func (HardwareUpdateInfo) Raw

func (u HardwareUpdateInfo) Raw() map[string]any

func (HardwareUpdateInfo) ReleaseNotes

func (u HardwareUpdateInfo) ReleaseNotes() *string

ReleaseNotes is the release notes, checking both known keys.

func (HardwareUpdateInfo) ReleaseURL

func (u HardwareUpdateInfo) ReleaseURL() *string

ReleaseURL is the release information URL, stripped; nil when absent.

func (HardwareUpdateInfo) Upgrade

func (u HardwareUpdateInfo) Upgrade() bool

Upgrade reports whether an update is available.

type HardwareUpgradeStatus

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

HardwareUpgradeStatus wraps the maintenance/hardware/upgradeStatus response.

func NewHardwareUpgradeStatus

func NewHardwareUpgradeStatus(m map[string]any) HardwareUpgradeStatus

func (HardwareUpgradeStatus) DownloadProgress

func (c HardwareUpgradeStatus) DownloadProgress() int

DownloadProgress is the firmware download progress percentage.

func (HardwareUpgradeStatus) Raw

func (c HardwareUpgradeStatus) Raw() map[string]any

func (HardwareUpgradeStatus) RebootTime

func (c HardwareUpgradeStatus) RebootTime() int

RebootTime is the expected seconds before the controller is back online.

func (HardwareUpgradeStatus) UpgradeMsg

func (c HardwareUpgradeStatus) UpgradeMsg() string

UpgradeMsg is the message associated with the current status.

func (HardwareUpgradeStatus) UpgradeStatus

func (c HardwareUpgradeStatus) UpgradeStatus() int

UpgradeStatus is the current status of the firmware upgrade process.

func (HardwareUpgradeStatus) UpgradeTime

func (c HardwareUpgradeStatus) UpgradeTime() int

UpgradeTime is the suggested refresh interval for watching progress.

type InterfaceDetails

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

InterfaceDetails wraps maintenance/uiInterface.

func NewInterfaceDetails

func NewInterfaceDetails(m map[string]any) InterfaceDetails

func (InterfaceDetails) ControllerName

func (c InterfaceDetails) ControllerName() string

ControllerName is the display name of the controller.

func (InterfaceDetails) Raw

func (c InterfaceDetails) Raw() map[string]any

type IpSetting

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

IpSetting is the IP setting of a client.

func NewIpSetting

func NewIpSetting(data map[string]any) IpSetting

NewIpSetting builds an IpSetting from a raw API object.

func (IpSetting) Raw

func (s IpSetting) Raw() map[string]any

Raw is the underlying API object.

func (IpSetting) UsedFixedAddr

func (s IpSetting) UsedFixedAddr() bool

UsedFixedAddr reports whether a fixed IP address is reserved.

type LanNetwork

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

LanNetwork is a LAN network configuration.

func NewLanNetwork

func NewLanNetwork(data map[string]any) LanNetwork

NewLanNetwork builds a LanNetwork from a raw API object.

func ResolveVlanTarget

func ResolveVlanTarget(target string, networks []LanNetwork, byID bool) (LanNetwork, error)

ResolveVlanTarget resolves an exact ID/name, or strictly an ID after an earlier selection.

func (LanNetwork) DHCPEnabled

func (n LanNetwork) DHCPEnabled() *bool

DHCPEnabled reports whether DHCP is enabled for the network, nil when not reported.

func (LanNetwork) GatewaySubnet

func (n LanNetwork) GatewaySubnet() *string

GatewaySubnet is the gateway IPv4 subnet in CIDR notation.

func (LanNetwork) ID

func (n LanNetwork) ID() string

ID is the controller ID of the LAN network.

func (LanNetwork) Name

func (n LanNetwork) Name() string

Name is the LAN network name.

func (LanNetwork) Purpose

func (n LanNetwork) Purpose() string

Purpose is the controller network purpose.

func (LanNetwork) Raw

func (n LanNetwork) Raw() map[string]any

Raw returns the raw API object backing this network.

func (LanNetwork) VLANID

func (n LanNetwork) VLANID() *int

VLANID is the VLAN ID, when configured.

type LedSetting

type LedSetting int32
const (
	LedSettingUnknown      LedSetting = -1
	LedSettingOff          LedSetting = 0
	LedSettingOn           LedSetting = 1
	LedSettingSiteSettings LedSetting = 2
)

func (LedSetting) String

func (s LedSetting) String() string
type Link struct {
	// contains filtered or unexported fields
}

Link is an up/downlink connection from a switch or AP port.

func NewLink(data map[string]any) Link

NewLink builds a Link from a raw API object.

func (Link) MAC

func (l Link) MAC() string

MAC is the MAC of the linked device.

func (Link) Name

func (l Link) Name() string

Name is the name of the linked device.

func (Link) Port

func (l Link) Port() int

Port is the linked port number.

func (Link) Type

func (l Link) Type() string

Type is the type of the linked device.

type LinkDuplex

type LinkDuplex int32
const (
	LinkDuplexUnknown LinkDuplex = -1
	LinkDuplexAuto    LinkDuplex = 0
	LinkDuplexHalf    LinkDuplex = 1
	LinkDuplexFull    LinkDuplex = 2
)

func (LinkDuplex) String

func (s LinkDuplex) String() string

type LinkSpeed

type LinkSpeed int32
const (
	LinkSpeedUnknown   LinkSpeed = -1
	LinkSpeedSpeedAuto LinkSpeed = 0
	LinkSpeedSpeed10   LinkSpeed = 1
	LinkSpeedSpeed100  LinkSpeed = 2
	LinkSpeedSpeed1G   LinkSpeed = 3
	LinkSpeedSpeed2_5G LinkSpeed = 4
	LinkSpeedSpeed10G  LinkSpeed = 5
)

func (LinkSpeed) String

func (s LinkSpeed) String() string

type LinkStatus

type LinkStatus int32
const (
	LinkStatusUnknown  LinkStatus = -1
	LinkStatusLinkDown LinkStatus = 0
	LinkStatusLinkUp   LinkStatus = 1
)

func (LinkStatus) String

func (s LinkStatus) String() string

type NetworkTagsSetting

type NetworkTagsSetting int32
const (
	NetworkTagsSettingUnknown  NetworkTagsSetting = -1
	NetworkTagsSettingAllowAll NetworkTagsSetting = 0
	NetworkTagsSettingBlockAll NetworkTagsSetting = 1
	NetworkTagsSettingCustom   NetworkTagsSetting = 2
)

func (NetworkTagsSetting) String

func (s NetworkTagsSetting) String() string

type PoEMode

type PoEMode int32
const (
	PoEModeNone              PoEMode = -1
	PoEModeDisabled          PoEMode = 0
	PoEModeEnabled           PoEMode = 1
	PoEModeUseDeviceSettings PoEMode = 2
)

func (PoEMode) String

func (s PoEMode) String() string

type PortDetails

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

PortDetails is the full configuration of a switch port.

func NewPortDetails

func NewPortDetails(data map[string]any) PortDetails

NewPortDetails builds a PortDetails from a raw API object.

func (PortDetails) BandwidthLimitMode

func (p PortDetails) BandwidthLimitMode() BandwidthControl

BandwidthLimitMode is the type of bandwidth control applied.

func (PortDetails) Duplex

func (p PortDetails) Duplex() LinkDuplex

Duplex is the link duplex state of the port.

func (PortDetails) EEEEnabled

func (p PortDetails) EEEEnabled() bool

EEEEnabled reports whether energy-efficient Ethernet is enabled.

func (PortDetails) Eth8021xControl

func (p PortDetails) Eth8021xControl() Eth802Dot1X

Eth8021xControl is the 802.1x auth mode.

func (PortDetails) FlowControlEnabled

func (p PortDetails) FlowControlEnabled() bool

FlowControlEnabled reports whether flow control is enabled.

func (PortDetails) HasEEE

func (p PortDetails) HasEEE() bool

HasEEE reports whether EEE settings are available for this port.

func (PortDetails) HasFlowControl

func (p PortDetails) HasFlowControl() bool

HasFlowControl reports whether flow control settings are available for this port.

func (PortDetails) HasLoopbackDetectVlanBased

func (p PortDetails) HasLoopbackDetectVlanBased() bool

HasLoopbackDetectVlanBased reports whether VLAN-based loopback detection settings are available for this port.

func (PortDetails) HasProfileOverride

func (p PortDetails) HasProfileOverride() bool

HasProfileOverride reports whether the port's config profile is overridden.

func (PortDetails) HasVoiceNetwork

func (p PortDetails) HasVoiceNetwork() bool

HasVoiceNetwork reports whether voice network settings are available for this port.

func (PortDetails) LLDPMedEnabled

func (p PortDetails) LLDPMedEnabled() bool

LLDPMedEnabled reports whether LLDP-MED is enabled.

func (PortDetails) LinkSpeed

func (p PortDetails) LinkSpeed() LinkSpeed

LinkSpeed is the current link speed of the port.

func (PortDetails) LoopbackDetectEnabled

func (p PortDetails) LoopbackDetectEnabled() bool

LoopbackDetectEnabled reports whether loopback detection is enabled.

func (PortDetails) LoopbackDetectVlanBasedEnabled

func (p PortDetails) LoopbackDetectVlanBasedEnabled() bool

LoopbackDetectVlanBasedEnabled reports whether VLAN-based loopback detection is enabled.

func (PortDetails) MaxSpeed

func (p PortDetails) MaxSpeed() LinkSpeed

MaxSpeed is the maximum speed of the port.

func (PortDetails) NativeNetworkID

func (p PortDetails) NativeNetworkID() *string

NativeNetworkID is the ID of the port's native network.

func (PortDetails) NetworkTagsSetting

func (p PortDetails) NetworkTagsSetting() NetworkTagsSetting

NetworkTagsSetting is the network tags setting for the port.

func (PortDetails) PoEMode

func (p PortDetails) PoEMode() PoEMode

PoEMode is the PoE mode of the port. Omada may claim "enabled" on non-PoE ports (port profiles), so the mode is forced to NONE there.

func (PortDetails) PortID

func (p PortDetails) PortID() string

PortID is the ID of the port.

func (PortDetails) PortIsolationEnabled

func (p PortDetails) PortIsolationEnabled() bool

PortIsolationEnabled reports whether port isolation is enabled.

func (PortDetails) ProfileName

func (p PortDetails) ProfileName() string

ProfileName is the name of the port's config profile.

func (PortDetails) SpanningTreeEnabled

func (p PortDetails) SpanningTreeEnabled() bool

SpanningTreeEnabled reports whether spanning tree is enabled.

func (PortDetails) SupportsPoE

func (p PortDetails) SupportsPoE() bool

SupportsPoE reports whether the port supports PoE. Older controllers do not report the field, so it defaults to true (upstream behavior).

func (PortDetails) TagIDs

func (p PortDetails) TagIDs() []string

TagIDs are the IDs of the port's tagged networks.

func (PortDetails) TaggedNetworkIDs

func (p PortDetails) TaggedNetworkIDs() []string

TaggedNetworkIDs are the IDs of the port's tagged networks.

func (PortDetails) TopologyNotifyEnabled

func (p PortDetails) TopologyNotifyEnabled() bool

TopologyNotifyEnabled reports whether topology notify is enabled.

func (PortDetails) UntaggedNetworkIDs

func (p PortDetails) UntaggedNetworkIDs() []string

UntaggedNetworkIDs are the IDs of the port's untagged networks.

func (PortDetails) VoiceNetworkEnabled

func (p PortDetails) VoiceNetworkEnabled() bool

VoiceNetworkEnabled reports whether voice network is enabled for the port.

func (PortDetails) VoiceNetworkID

func (p PortDetails) VoiceNetworkID() *string

VoiceNetworkID is the ID of the port's voice network.

type PortProfile

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

PortProfile is a switch port configuration profile.

func NewPortProfile

func NewPortProfile(data map[string]any) PortProfile

NewPortProfile builds a PortProfile from a raw API object.

func (PortProfile) BandwidthLimitMode

func (p PortProfile) BandwidthLimitMode() BandwidthControl

BandwidthLimitMode is the type of bandwidth control applied.

func (PortProfile) EEEEnabled

func (p PortProfile) EEEEnabled() bool

EEEEnabled reports whether energy-efficient Ethernet is enabled.

func (PortProfile) Eth8021xControl

func (p PortProfile) Eth8021xControl() Eth802Dot1X

Eth8021xControl is the 802.1x auth mode.

func (PortProfile) FlowControlEnabled

func (p PortProfile) FlowControlEnabled() bool

FlowControlEnabled reports whether flow control is enabled.

func (PortProfile) HasEEE

func (p PortProfile) HasEEE() bool

HasEEE reports whether EEE settings are available for this profile.

func (PortProfile) HasFlowControl

func (p PortProfile) HasFlowControl() bool

HasFlowControl reports whether flow control settings are available for this profile.

func (PortProfile) HasLoopbackDetectVlanBased

func (p PortProfile) HasLoopbackDetectVlanBased() bool

HasLoopbackDetectVlanBased reports whether VLAN-based loopback detection settings are available for this profile.

func (PortProfile) LLDPMedEnabled

func (p PortProfile) LLDPMedEnabled() bool

LLDPMedEnabled reports whether LLDP-MED is enabled.

func (PortProfile) LoopbackDetectEnabled

func (p PortProfile) LoopbackDetectEnabled() bool

LoopbackDetectEnabled reports whether loopback detection is enabled.

func (PortProfile) LoopbackDetectVlanBasedEnabled

func (p PortProfile) LoopbackDetectVlanBasedEnabled() bool

LoopbackDetectVlanBasedEnabled reports whether VLAN-based loopback detection is enabled.

func (PortProfile) Name

func (p PortProfile) Name() string

Name is the name of the profile.

func (PortProfile) PoEMode

func (p PortProfile) PoEMode() PoEMode

PoEMode is the PoE mode.

func (PortProfile) PortIsolationEnabled

func (p PortProfile) PortIsolationEnabled() bool

PortIsolationEnabled reports whether port isolation is enabled.

func (PortProfile) ProfileID

func (p PortProfile) ProfileID() string

ProfileID is the ID of the profile.

func (PortProfile) Site

func (p PortProfile) Site() string

Site is the site the profile is valid for.

func (PortProfile) SpanningTreeEnabled

func (p PortProfile) SpanningTreeEnabled() bool

SpanningTreeEnabled reports whether spanning tree is enabled.

func (PortProfile) TopologyNotifyEnabled

func (p PortProfile) TopologyNotifyEnabled() bool

TopologyNotifyEnabled reports whether topology notify is enabled.

type PortType

type PortType int32
const (
	PortTypeUnknown PortType = -1
	PortTypeCopper  PortType = 1
	PortTypeCombo   PortType = 2
	PortTypeSFP     PortType = 3
)

func (PortType) String

func (s PortType) String() string

type RadioId

type RadioId int32
const (
	RadioIdUnknown RadioId = -1
	RadioIdFreq24  RadioId = 0
	RadioIdFreq51  RadioId = 1
	RadioIdFreq52  RadioId = 2
	RadioIdFreq6   RadioId = 3
)

func (RadioId) SettingsKey

func (r RadioId) SettingsKey() string

SettingsKey is the field name the controller uses for this radio's settings.

func (RadioId) StatusKey

func (r RadioId) StatusKey() string

StatusKey is the field name the controller uses for this radio's live status.

func (RadioId) String

func (r RadioId) String() string

type RateLimit

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

RateLimit is the rate limit setting of a client.

func NewRateLimit

func NewRateLimit(data map[string]any) RateLimit

NewRateLimit builds a RateLimit from a raw API object.

func (RateLimit) DownEnabled

func (r RateLimit) DownEnabled() bool

DownEnabled reports whether downstream rate limiting is enabled.

func (RateLimit) DownLimit

func (r RateLimit) DownLimit() int

DownLimit is the downstream rate limit.

func (RateLimit) DownUnit

func (r RateLimit) DownUnit() int

DownUnit is the downstream rate limit unit.

func (RateLimit) Enabled

func (r RateLimit) Enabled() bool

Enabled reports whether rate limiting is enabled.

func (RateLimit) UpEnabled

func (r RateLimit) UpEnabled() bool

UpEnabled reports whether upstream rate limiting is enabled.

func (RateLimit) UpLimit

func (r RateLimit) UpLimit() int

UpLimit is the upstream rate limit.

func (RateLimit) UpUnit

func (r RateLimit) UpUnit() int

UpUnit is the upstream rate limit unit.

type RequestError

type RequestError struct {
	Code int
	Msg  string
}

RequestError is returned when the Omada controller answers a request with a non-zero errorCode. Code holds the controller error code, Msg the message.

func (*RequestError) Error

func (e *RequestError) Error() string

func (*RequestError) Is

func (e *RequestError) Is(target error) bool

Is matches ErrLoginFailed for controller error code -30109 so callers can use errors.Is with the sentinel.

type Site

type Site struct {
	Name string
	ID   string
}

Site identifies a site controlled by the controller.

type SoftwareUpdateInfo

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

func NewSoftwareUpdateInfo

func NewSoftwareUpdateInfo(m map[string]any) SoftwareUpdateInfo

NewSoftwareUpdateInfo wraps a controller software update section.

func (SoftwareUpdateInfo) CurrentVersion

func (u SoftwareUpdateInfo) CurrentVersion() *string

CurrentVersion is the currently installed version, when reported.

func (u SoftwareUpdateInfo) DownloadLink() *string

DownloadLink is the update download link, stripped; nil when absent.

func (SoftwareUpdateInfo) LatestVersion

func (u SoftwareUpdateInfo) LatestVersion() *string

LatestVersion is the latest available version, falling back to the current one.

func (SoftwareUpdateInfo) Raw

func (u SoftwareUpdateInfo) Raw() map[string]any

func (SoftwareUpdateInfo) ReleaseNotes

func (u SoftwareUpdateInfo) ReleaseNotes() *string

ReleaseNotes is the release notes, checking both known keys.

func (SoftwareUpdateInfo) ReleaseURL

func (u SoftwareUpdateInfo) ReleaseURL() *string

ReleaseURL is the release information URL, stripped; nil when absent.

func (SoftwareUpdateInfo) Upgrade

func (u SoftwareUpdateInfo) Upgrade() bool

Upgrade reports whether an update is available.

type Switch

type Switch struct {
	Device
}

Switch is the details of a managed switch.

func NewSwitch

func NewSwitch(data map[string]any) Switch

NewSwitch builds a Switch from a raw API object.

func (Switch) DeviceCapabilities

func (s Switch) DeviceCapabilities() SwitchDeviceCaps

DeviceCapabilities are the switch capabilities.

func (s Switch) Downlinks() []Downlink

Downlinks are the devices attached downstream of the switch.

func (Switch) NumberPorts

func (s Switch) NumberPorts() int

NumberPorts is the number of ports on the switch.

func (Switch) Ports

func (s Switch) Ports() []SwitchPort

Ports are the ports on the switch.

func (s Switch) Uplink() *Link

Uplink is the switch's uplink device, nil when absent.

type SwitchDeviceCaps

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

SwitchDeviceCaps is the capabilities of a switch.

func NewSwitchDeviceCaps

func NewSwitchDeviceCaps(data map[string]any) SwitchDeviceCaps

NewSwitchDeviceCaps builds a SwitchDeviceCaps from a raw API object.

func (SwitchDeviceCaps) PoEPorts

func (c SwitchDeviceCaps) PoEPorts() int

PoEPorts is the number of PoE ports supported.

func (SwitchDeviceCaps) SupportsBT

func (c SwitchDeviceCaps) SupportsBT() bool

SupportsBT reports whether BT is supported.

func (SwitchDeviceCaps) SupportsPoE

func (c SwitchDeviceCaps) SupportsPoE() bool

SupportsPoE reports whether PoE is supported.

type SwitchPort

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

SwitchPort is a port on a switch.

func NewSwitchPort

func NewSwitchPort(data map[string]any) SwitchPort

NewSwitchPort builds a SwitchPort from a raw API object.

func (SwitchPort) IsDisabled

func (p SwitchPort) IsDisabled() bool

IsDisabled reports whether the port is disabled.

func (SwitchPort) Name

func (p SwitchPort) Name() string

Name is the port name.

func (SwitchPort) Operation

func (p SwitchPort) Operation() string

Operation is the port operation: switching, mirroring, or aggregating.

func (SwitchPort) Port

func (p SwitchPort) Port() int

Port is the port number.

func (SwitchPort) PortStatus

func (p SwitchPort) PortStatus() SwitchPortStatus

PortStatus is the live status of the port.

func (SwitchPort) ProfileID

func (p SwitchPort) ProfileID() string

ProfileID is the ID of the port's config profile.

func (SwitchPort) Type

func (p SwitchPort) Type() PortType

Type is the port type.

type SwitchPortStatus

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

SwitchPortStatus is the live status of a switch port.

func NewSwitchPortStatus

func NewSwitchPortStatus(data map[string]any) SwitchPortStatus

NewSwitchPortStatus builds a SwitchPortStatus from a raw API object.

func (SwitchPortStatus) BytesRX

func (s SwitchPortStatus) BytesRX() int

BytesRX is the number of bytes received by the port.

func (SwitchPortStatus) BytesTX

func (s SwitchPortStatus) BytesTX() int

BytesTX is the number of bytes transmitted by the port.

func (SwitchPortStatus) LinkSpeed

func (s SwitchPortStatus) LinkSpeed() LinkSpeed

LinkSpeed is the port link speed.

func (SwitchPortStatus) LinkStatus

func (s SwitchPortStatus) LinkStatus() LinkStatus

LinkStatus is the port link status.

func (SwitchPortStatus) PoEActive

func (s SwitchPortStatus) PoEActive() bool

PoEActive reports whether the port is powering a PoE device.

func (SwitchPortStatus) PoEPower

func (s SwitchPortStatus) PoEPower() *float64

PoEPower is the power (W) supplied over PoE, nil when unreported.

func (SwitchPortStatus) STPDiscarding

func (s SwitchPortStatus) STPDiscarding() bool

STPDiscarding reports the port's STP blocking state.

type Topology

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

Topology is the site's full physical network topology tree, rooted at its gateway(s).

func NewTopology

func NewTopology(data map[string]any) Topology

NewTopology builds a Topology from a raw API object.

func (Topology) Roots

func (t Topology) Roots() []TopologyNode

Roots are the root nodes of the topology tree (typically the site's gateway(s)).

type TopologyNode

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

TopologyNode is a single node (device, or a directly-identifiable client) in the topology tree.

func NewTopologyNode

func NewTopologyNode(data map[string]any) TopologyNode

NewTopologyNode builds a TopologyNode from a raw API object.

func (TopologyNode) ClientCount

func (n TopologyNode) ClientCount() int

ClientCount is the number of clients attached to this node.

func (TopologyNode) Disconnected

func (n TopologyNode) Disconnected() bool

Disconnected reports whether the node is currently disconnected.

func (TopologyNode) IPAddress

func (n TopologyNode) IPAddress() *string

IPAddress is the IP address of the node, if known.

func (TopologyNode) MAC

func (n TopologyNode) MAC() string

MAC is the MAC address of the node.

func (TopologyNode) Model

func (n TopologyNode) Model() *string

Model is the model of the node, if it's a managed Omada device.

func (TopologyNode) Name

func (n TopologyNode) Name() string

Name is the display name of the node, falling back to the MAC.

func (TopologyNode) OwnUplinkPort

func (n TopologyNode) OwnUplinkPort() *string

OwnUplinkPort is the port number, on this node's own hardware, used for its uplink (switches only).

func (TopologyNode) Status

func (n TopologyNode) Status() DeviceStatus

Status is the status of the node, if it's a managed Omada device.

func (TopologyNode) StatusCategory

func (n TopologyNode) StatusCategory() DeviceStatusCategory

StatusCategory is the high-level status of the node.

func (TopologyNode) Successors

func (n TopologyNode) Successors() []TopologyNode

Successors are the nodes plugged into this node.

func (TopologyNode) Type

func (n TopologyNode) Type() string

Type is the type of node. Known values include "gateway", "switch", "ap", and "omada controller".

func (TopologyNode) UpstreamDuplex

func (n TopologyNode) UpstreamDuplex() LinkDuplex

UpstreamDuplex is the negotiated duplex mode between this node and its parent.

func (TopologyNode) UpstreamLinkSpeed

func (n TopologyNode) UpstreamLinkSpeed() LinkSpeed

UpstreamLinkSpeed is the negotiated link speed between this node and its parent.

func (TopologyNode) UpstreamPort

func (n TopologyNode) UpstreamPort() *string

UpstreamPort is the port number, on the parent node, that this node is plugged into.

func (TopologyNode) WANPorts

func (n TopologyNode) WANPorts() []TopologyWanPort

WANPorts are the WAN port health summaries, for gateway nodes.

type TopologyWanPort

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

TopologyWanPort is a summary WAN port health entry, as reported on a gateway node in the topology tree.

func NewTopologyWanPort

func NewTopologyWanPort(data map[string]any) TopologyWanPort

NewTopologyWanPort builds a TopologyWanPort from a raw API object.

func (TopologyWanPort) Duplex

func (w TopologyWanPort) Duplex() LinkDuplex

Duplex is the actual duplex mode of the port.

func (TopologyWanPort) LinkSpeed

func (w TopologyWanPort) LinkSpeed() LinkSpeed

LinkSpeed is the established link speed of the port.

func (TopologyWanPort) LinkStatus

func (w TopologyWanPort) LinkStatus() LinkStatus

LinkStatus is the low-level connectivity status of the link.

func (TopologyWanPort) Name

func (w TopologyWanPort) Name() string

Name is the port name, falling back to the port number.

func (TopologyWanPort) OnlineDetection

func (w TopologyWanPort) OnlineDetection() bool

OnlineDetection reports whether regular internet ping tests are working.

func (TopologyWanPort) Port

func (w TopologyWanPort) Port() string

Port is the port number.

func (TopologyWanPort) WANConnected

func (w TopologyWanPort) WANConnected() bool

WANConnected reports whether the port is connected to the internet/WAN.

type UpdateSection

type UpdateSection string

UpdateSection identifies the hardware or software half of a firmware update.

const (
	// UpdateSectionHardware targets hardware (firmware) controller updates.
	UpdateSectionHardware UpdateSection = "hardware"
	// UpdateSectionSoftware targets software controller updates.
	UpdateSectionSoftware UpdateSection = "software"
)

type ValidationError

type ValidationError struct {
	Msg string
}

ValidationError is returned when a caller supplies invalid input to a method.

func (*ValidationError) Error

func (e *ValidationError) Error() string

type Version

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

Version is a dotted Omada software version, compared numerically per segment.

func ParseVersion

func ParseVersion(s string) (Version, error)

ParseVersion parses a dotted version string like "6.2.10.18". Each segment contributes its leading run of digits; a segment with no leading digits contributes 0. Empty input is an error.

func ParseVersionMust

func ParseVersionMust(s string) Version

ParseVersionMust is ParseVersion for tests and constants; it panics on bad input.

func (Version) Compare

func (v Version) Compare(o Version) int

Compare returns -1, 0 or 1 when v is less than, equal to or greater than o. Missing segments are treated as 0.

func (Version) String

func (v Version) String() string

String renders the version in dotted form.

type VlanCreate

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

VlanCreate creates a single VLAN-only network; it does not configure routing or DHCP.

func NewVlanCreate

func NewVlanCreate(name string, vlanID int) (VlanCreate, error)

NewVlanCreate builds a VlanCreate, validating name and VLAN ID.

func (VlanCreate) Payload

func (v VlanCreate) Payload() map[string]any

Payload is the range-string create payload used by the installed editor.

func (VlanCreate) VLANID

func (v VlanCreate) VLANID() int

VLANID is the validated VLAN ID.

type VlanUpdate

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

VlanUpdate changes the name and/or VLAN ID of a network while preserving its existing writable settings.

func NewVlanUpdate

func NewVlanUpdate(name *string, vlanID *int) (VlanUpdate, error)

NewVlanUpdate builds a VlanUpdate. At least one of name/vlanID is required.

func (VlanUpdate) Name

func (v VlanUpdate) Name() *string

Name is the validated name change, or nil when unchanged.

func (VlanUpdate) Payload

func (v VlanUpdate) Payload(network LanNetwork) (map[string]any, error)

Payload merges the verified writable settings of network into a defensive copy, applying the requested changes.

func (VlanUpdate) VLANID

func (v VlanUpdate) VLANID() *int

VLANID is the validated VLAN ID change, or nil when unchanged.

type VpnCategory

type VpnCategory string

VpnCategory is the VPN tab a policy belongs to.

const (
	VpnServer     VpnCategory = "server"
	VpnClient     VpnCategory = "client"
	VpnSiteToSite VpnCategory = "site_to_site"
)

func (VpnCategory) ListEndpoint

func (c VpnCategory) ListEndpoint() string

ListEndpoint is the OpenAPI list endpoint for this tab.

func (VpnCategory) String

func (c VpnCategory) String() string

type VpnPolicy

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

VpnPolicy is a single VPN entry that can be enabled/disabled via .../vpn/{id}/status.

func NewVpnPolicy

func NewVpnPolicy(category VpnCategory, data map[string]any) VpnPolicy

NewVpnPolicy builds a VpnPolicy from a raw API object and its tab.

func (VpnPolicy) Category

func (p VpnPolicy) Category() VpnCategory

Category is the VPN tab this policy belongs to.

func (VpnPolicy) Enabled

func (p VpnPolicy) Enabled() bool

Enabled is the current enabled state (the "status" flag).

func (VpnPolicy) Name

func (p VpnPolicy) Name() string

Name is the user-defined policy name, falling back to the id.

func (VpnPolicy) PolicyID

func (p VpnPolicy) PolicyID() string

PolicyID is the controller-side id, used as {id} in the status PATCH.

func (VpnPolicy) UniqueID

func (p VpnPolicy) UniqueID() string

UniqueID is the stable key: category + id.

func (VpnPolicy) VpnType

func (p VpnPolicy) VpnType() VpnType

VpnType is the VPN protocol type. Unrecognized codes map to Unknown, mirroring the upstream _missing_ behavior.

func (VpnPolicy) VpnTypeName

func (p VpnPolicy) VpnTypeName() string

VpnTypeName is the human-readable protocol.

type VpnType

type VpnType int32
const (
	VpnTypeUnknown   VpnType = -1
	VpnTypeL2TP      VpnType = 0
	VpnTypePPTP      VpnType = 1
	VpnTypeIPSec     VpnType = 2
	VpnTypeOpenVPN   VpnType = 3
	VpnTypeWireGuard VpnType = 4
	VpnTypeSSL       VpnType = 5
)

func (VpnType) String

func (t VpnType) String() string

func (VpnType) TypeName

func (t VpnType) TypeName() string

TypeName is the human-readable protocol, falling back to the member name.

type WifiMode

type WifiMode int32
const (
	WifiModeUnknown WifiMode = -1
	WifiModeA       WifiMode = 0
	WifiModeB       WifiMode = 1
	WifiModeG       WifiMode = 2
	WifiModeNA      WifiMode = 3
	WifiModeNG      WifiMode = 4
	WifiModeAC      WifiMode = 5
	WifiModeAXA     WifiMode = 6
	WifiModeAXG     WifiMode = 7
)

func (WifiMode) String

func (s WifiMode) String() string

type WiredDetails

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

WiredDetails are the wired-connection details of a client.

func NewWiredDetails

func NewWiredDetails(data map[string]any) WiredDetails

NewWiredDetails builds a WiredDetails from a raw API object.

func (WiredDetails) Dot1xVlan

func (w WiredDetails) Dot1xVlan() int

Dot1xVlan is the VLAN obtained by 802.1x D-VLAN.

func (WiredDetails) GatewayMAC

func (w WiredDetails) GatewayMAC() *string

GatewayMAC is the MAC of the gateway the client is connected to.

func (WiredDetails) GatewayName

func (w WiredDetails) GatewayName() *string

GatewayName is the name of the gateway the client is connected to.

func (WiredDetails) NetworkName

func (w WiredDetails) NetworkName() string

NetworkName is the network name.

func (WiredDetails) Port

func (w WiredDetails) Port() int

Port is the switch port the client is connected to.

func (WiredDetails) SwitchMAC

func (w WiredDetails) SwitchMAC() *string

SwitchMAC is the MAC of the switch the client is connected to.

func (WiredDetails) SwitchName

func (w WiredDetails) SwitchName() *string

SwitchName is the name of the switch the client is connected to.

type WirelessDetails

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

WirelessDetails are the wireless-connection details of a client.

func NewWirelessDetails

func NewWirelessDetails(data map[string]any) WirelessDetails

NewWirelessDetails builds a WirelessDetails from a raw API object.

func (WirelessDetails) APMAC

func (w WirelessDetails) APMAC() string

APMAC is the MAC address of the access point.

func (WirelessDetails) APName

func (w WirelessDetails) APName() string

APName is the name of the access point.

func (WirelessDetails) Channel

func (w WirelessDetails) Channel() int

Channel is the wifi channel number.

func (WirelessDetails) PowerSave

func (w WirelessDetails) PowerSave() bool

PowerSave reports whether power save mode is enabled.

func (WirelessDetails) RSSI

func (w WirelessDetails) RSSI() int

RSSI is the signal strength in dBm.

func (WirelessDetails) RadioID

func (w WirelessDetails) RadioID() RadioId

RadioID is the radio band the client is connected on.

func (WirelessDetails) RxRate

func (w WirelessDetails) RxRate() int

RxRate is the uplink negotiation rate in Kbit/s.

func (WirelessDetails) SSID

func (w WirelessDetails) SSID() string

SSID is the SSID name.

func (WirelessDetails) SignalLevel

func (w WirelessDetails) SignalLevel() int

SignalLevel is the signal strength percentage.

func (WirelessDetails) SignalRank

func (w WirelessDetails) SignalRank() int

SignalRank is the signal strength on a 0-5 scale.

func (WirelessDetails) TxRate

func (w WirelessDetails) TxRate() int

TxRate is the downlink negotiation rate in Kbit/s.

func (WirelessDetails) WifiMode

func (w WirelessDetails) WifiMode() WifiMode

WifiMode is the wifi mode.

Jump to

Keyboard shortcuts

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