site

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 8 Imported by: ? modules, 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

This section is empty.

Functions

This section is empty.

Types

type DhcpReservationUpdate

type DhcpReservationUpdate struct {
	IP   string
	Host *string
	MAC  *string
}

DhcpReservationUpdate describes the changes to apply to a DHCP reservation. At least one field must be set.

type GatewayPortSettings

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

GatewayPortSettings is the effective configuration of a gateway port.

func NewGatewayPortSettings

func NewGatewayPortSettings(data map[string]any) GatewayPortSettings

NewGatewayPortSettings builds a GatewayPortSettings from a raw API object.

func (GatewayPortSettings) Enabled

func (p GatewayPortSettings) Enabled() bool

Enabled reports whether the port is enabled.

func (GatewayPortSettings) Index

func (p GatewayPortSettings) Index() int

Index is the port number.

func (GatewayPortSettings) PoE

PoE is the PoE mode of the port.

func (GatewayPortSettings) Speed

func (p GatewayPortSettings) Speed() string

Speed is the port speed.

func (GatewayPortSettings) Type

Type is the port type.

type LanNetworkCreate

type LanNetworkCreate struct {
	Name        string
	VLAN        int
	Subnet      string
	Mask        string
	Gateway     string
	DHCPEnabled *bool
	StartIP     string
	EndIP       string
	DNSServers  []string
}

LanNetworkCreate is the create request for a LAN network.

func NewLanNetworkCreate

func NewLanNetworkCreate(name string, vlan int) (LanNetworkCreate, error)

NewLanNetworkCreate builds a validated LAN network create request.

type LanNetworkUpdate

type LanNetworkUpdate struct {
	NetworkID   string
	Name        *string
	VLAN        *int
	Subnet      *string
	Mask        *string
	Gateway     *string
	DHCPEnabled *bool
	StartIP     *string
	EndIP       *string
	DNSServers  []string
}

LanNetworkUpdate changes a LAN network partially; only the set fields apply.

func (LanNetworkUpdate) ID

func (u LanNetworkUpdate) ID() string

ID returns the updated LAN network identity.

type PortProfileOverrides

type PortProfileOverrides struct {
	Name        string
	Description string
	Ports       []int
	PVID        int
	VLANs       []int
}

PortProfileOverrides is the create request for a port profile.

type SiteClient

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

SiteClient is the site-scoped API handle. Connection lifecycle belongs to the Controller.

func NewSiteClient

func NewSiteClient(c conn.Connection, site string) *SiteClient

NewSiteClient builds a site-scoped handle on the given connection. Callers are expected to validate the site ID first (Controller.SiteClient does).

func (*SiteClient) AccessPoint

func (s *SiteClient) AccessPoint(ctx context.Context, deviceID string) (models.AccessPoint, error)

models.AccessPoint returns the access point at the given device ID.

func (*SiteClient) AccessPoints

func (s *SiteClient) AccessPoints(ctx context.Context) ([]models.AccessPoint, error)

AccessPoints lists the access points visible to the site.

func (*SiteClient) AccessPointsByMAC

func (s *SiteClient) AccessPointsByMAC(ctx context.Context, macs []string) ([]models.AccessPoint, error)

AccessPointsByMAC returns the access points matching the given MACs.

func (*SiteClient) ApAvailableChannels

func (s *SiteClient) ApAvailableChannels(ctx context.Context, deviceID string, radioID int) ([]int, error)

ApAvailableChannels returns the channels available on the access point radio.

func (*SiteClient) ApPorts

func (s *SiteClient) ApPorts(ctx context.Context, deviceID string) ([]models.APLANPortSettings, error)

ApPorts returns the LAN port settings of the access point.

func (*SiteClient) ApRadioSettings

func (s *SiteClient) ApRadioSettings(ctx context.Context, deviceID string, radioID int) (models.APRadioSettings, error)

ApRadioSettings returns the configured state of an access point radio.

func (*SiteClient) ApplyPortProfile

func (s *SiteClient) ApplyPortProfile(ctx context.Context, id string, ports []int) error

ApplyPortProfile applies a port profile to the given ports.

func (*SiteClient) BlockClient

func (s *SiteClient) BlockClient(ctx context.Context, mac string) error

BlockClient blocks the client with the given MAC.

func (*SiteClient) Client

func (s *SiteClient) Client(ctx context.Context, mac string) (models.Client, error)

models.Client returns the client details for the given MAC.

func (*SiteClient) ClientByID

func (s *SiteClient) ClientByID(ctx context.Context, deviceIndex string) (models.Client, error)

ClientByID returns the client at the given device index.

func (*SiteClient) Clients

func (s *SiteClient) Clients(ctx context.Context) ([]models.Client, error)

Clients lists the clients visible to the site.

func (*SiteClient) ConnectedClients

func (s *SiteClient) ConnectedClients(ctx context.Context) ([]models.Client, error)

ConnectedClients lists the clients currently connected to the site.

func (*SiteClient) CreateDhcpReservation

func (s *SiteClient) CreateDhcpReservation(ctx context.Context, host, ip, mac string) (models.DhcpReservation, error)

CreateDhcpReservation creates a DHCP reservation for the host, IP, and MAC. The host, IP, and MAC must not be empty.

func (*SiteClient) CreateLanNetwork

func (s *SiteClient) CreateLanNetwork(ctx context.Context, create LanNetworkCreate) (models.LanNetwork, error)

CreateLanNetwork creates a LAN network.

func (*SiteClient) CreatePortProfile

func (s *SiteClient) CreatePortProfile(ctx context.Context, profile PortProfileOverrides) (models.PortProfile, error)

CreatePortProfile creates a port profile.

func (*SiteClient) CreateVLAN

func (s *SiteClient) CreateVLAN(ctx context.Context, name string, vlanID int) (models.LanNetwork, error)

CreateVLAN creates a VLAN-only network with the given name and VLAN ID. It rejects names and IDs that conflict with the site's existing networks.

func (*SiteClient) DeleteDhcpReservation

func (s *SiteClient) DeleteDhcpReservation(ctx context.Context, ip string) error

DeleteDhcpReservation deletes the DHCP reservation for the given IP.

func (*SiteClient) DeletePortProfile

func (s *SiteClient) DeletePortProfile(ctx context.Context, id string) error

DeletePortProfile deletes a port profile.

func (*SiteClient) Device

func (s *SiteClient) Device(ctx context.Context, deviceID string) (models.Device, error)

models.Device returns the device at the given device ID.

func (*SiteClient) DeviceByMAC

func (s *SiteClient) DeviceByMAC(ctx context.Context, mac string) (models.Device, error)

DeviceByMAC returns the device with the given MAC.

func (*SiteClient) Devices

func (s *SiteClient) Devices(ctx context.Context) ([]models.Device, error)

Devices lists the devices visible to the site.

func (*SiteClient) DhcpReservation

func (s *SiteClient) DhcpReservation(ctx context.Context, ip string) (models.DhcpReservation, error)

models.DhcpReservation returns the DHCP reservation for the given IP, if any.

func (*SiteClient) DhcpReservations

func (s *SiteClient) DhcpReservations(ctx context.Context) ([]models.DhcpReservation, error)

DhcpReservations lists the DHCP reservations of the site.

func (*SiteClient) FactoryResetDevice

func (s *SiteClient) FactoryResetDevice(ctx context.Context, deviceID string) error

FactoryResetDevice resets the device to factory defaults.

func (*SiteClient) Gateway

func (s *SiteClient) Gateway(ctx context.Context, deviceID string) (models.Gateway, error)

models.Gateway returns the gateway at the given device ID.

func (*SiteClient) GatewayPorts

func (s *SiteClient) GatewayPorts(ctx context.Context, deviceID string) ([]GatewayPortSettings, error)

GatewayPorts returns the port settings of the gateway.

func (*SiteClient) Gateways

func (s *SiteClient) Gateways(ctx context.Context) ([]models.Gateway, error)

Gateways lists the gateways visible to the site.

func (*SiteClient) GetFirmwareDetails

func (s *SiteClient) GetFirmwareDetails(ctx context.Context, deviceID string) (models.FirmwareUpdate, error)

GetFirmwareDetails returns the firmware details of a single device.

func (*SiteClient) GetFirmwareUpdates

func (s *SiteClient) GetFirmwareUpdates(ctx context.Context) ([]models.FirmwareUpdate, error)

GetFirmwareUpdates lists the firmware updates for the site's devices.

func (*SiteClient) GetGatewayPort

func (s *SiteClient) GetGatewayPort(ctx context.Context, deviceID string, portIndex int) (*models.GatewayPortConfig, error)

GetGatewayPort returns the configuration of a single gateway port.

func (*SiteClient) GetSwitchPort

func (s *SiteClient) GetSwitchPort(ctx context.Context, deviceID string, portIndex int) (models.PortDetails, error)

GetSwitchPort returns the details of a single switch port.

func (*SiteClient) KnownClients

func (s *SiteClient) KnownClients(ctx context.Context) ([]models.Client, error)

KnownClients lists the clients known to the site.

func (*SiteClient) LanNetwork

func (s *SiteClient) LanNetwork(ctx context.Context, id string) (models.LanNetwork, error)

LanNetwork returns the LAN network with the given ID.

func (*SiteClient) LanNetworks

func (s *SiteClient) LanNetworks(ctx context.Context) ([]models.LanNetwork, error)

LanNetworks lists the LAN networks of the site.

func (*SiteClient) Networks

func (s *SiteClient) Networks(ctx context.Context) ([]models.LanNetwork, error)

Networks lists the LAN networks of the site.

func (*SiteClient) PortProfile

func (s *SiteClient) PortProfile(ctx context.Context, id string) (models.PortProfile, error)

models.PortProfile returns the port profile with the given ID.

func (*SiteClient) PortProfiles

func (s *SiteClient) PortProfiles(ctx context.Context) ([]models.PortProfile, error)

PortProfiles lists the port profiles visible to the site.

func (*SiteClient) PreviewVlanCreate

func (s *SiteClient) PreviewVlanCreate(ctx context.Context, create models.VlanCreate) (map[string]any, error)

PreviewVlanCreate previews a VLAN-only network creation.

func (*SiteClient) PreviewVlanDelete

func (s *SiteClient) PreviewVlanDelete(ctx context.Context, del VlanDelete) (map[string]any, error)

PreviewVlanDelete previews a VLAN-only network deletion.

func (*SiteClient) PreviewVlanUpdate

func (s *SiteClient) PreviewVlanUpdate(ctx context.Context, update models.VlanUpdate) (map[string]any, error)

PreviewVlanUpdate previews a VLAN-only network update.

func (*SiteClient) RebootDevice

func (s *SiteClient) RebootDevice(ctx context.Context, deviceID string) error

RebootDevice reboots the device.

func (*SiteClient) ReconnectClient

func (s *SiteClient) ReconnectClient(ctx context.Context, mac string) error

ReconnectClient reconnects the client with the given MAC.

func (*SiteClient) RestoreDevice

func (s *SiteClient) RestoreDevice(ctx context.Context, deviceID string) error

RestoreDevice restores the device.

func (*SiteClient) SetApPortEnabled

func (s *SiteClient) SetApPortEnabled(ctx context.Context, deviceID string, portIndex int, enabled bool, poe bool) error

SetApPortEnabled enables or disables an access point port.

func (*SiteClient) SetApRadioChannel

func (s *SiteClient) SetApRadioChannel(ctx context.Context, deviceID string, radioID int, channel int, channelWidth models.ChannelWidth) error

SetApRadioChannel sets the channel and channel width of an access point radio.

func (*SiteClient) SetApRadioEnabled

func (s *SiteClient) SetApRadioEnabled(ctx context.Context, deviceID string, radioID int, enabled bool) error

SetApRadioEnabled enables or disables an access point radio.

func (*SiteClient) SetDeviceLED

func (s *SiteClient) SetDeviceLED(ctx context.Context, deviceID string, state models.LedSetting, duration time.Duration) error

SetDeviceLED sets the onboard LED state of the device.

func (*SiteClient) SetGatewayPoE

func (s *SiteClient) SetGatewayPoE(ctx context.Context, deviceID string, portIndex int, state models.PoEMode) error

SetGatewayPoE sets the PoE state of a gateway port.

func (*SiteClient) SetGatewayPortSettings

func (s *SiteClient) SetGatewayPortSettings(ctx context.Context, deviceID string, portIndex int, poe models.PoEMode, speed string, enabled *bool) error

SetGatewayPortSettings changes the configuration of a gateway port, merging the requested settings into the current port configuration.

func (*SiteClient) SetGatewayWanPortConnectState

func (s *SiteClient) SetGatewayWanPortConnectState(ctx context.Context, deviceID string, portIndex int, connect bool) (models.GatewayPortStatus, error)

SetGatewayWanPortConnectState connects or disconnects a gateway WAN port and returns the resulting port status.

func (*SiteClient) SetSwitchPortSettings

func (s *SiteClient) SetSwitchPortSettings(ctx context.Context, deviceID string, portIndex int, mode models.PortType, pvid int, tagged []int, untagged *int, poe *bool) error

SetSwitchPortSettings changes the configuration of a switch port, merging the requested settings into the current port configuration.

func (*SiteClient) SetVpnPolicyEnabled

func (s *SiteClient) SetVpnPolicyEnabled(ctx context.Context, id string, enabled bool) (models.VpnPolicy, error)

SetVpnPolicyEnabled enables or disables a VPN policy by controller ID and returns the updated policy.

func (*SiteClient) SiteVersion

func (s *SiteClient) SiteVersion(ctx context.Context) (models.Version, error)

SiteVersion returns the Omada version reported for the site.

func (*SiteClient) Switch

func (s *SiteClient) Switch(ctx context.Context, deviceID string) (models.Switch, error)

models.Switch returns the switch at the given device ID.

func (*SiteClient) SwitchPorts

func (s *SiteClient) SwitchPorts(ctx context.Context, deviceID string) ([]SwitchPortSettings, error)

SwitchPorts returns the port settings of the switch.

func (*SiteClient) Switches

func (s *SiteClient) Switches(ctx context.Context) ([]models.Switch, error)

Switches lists the switches visible to the site.

func (*SiteClient) SwitchesByMAC

func (s *SiteClient) SwitchesByMAC(ctx context.Context, macs []string) ([]models.Switch, error)

SwitchesByMAC returns the switches matching the given MACs.

func (*SiteClient) Topology

func (s *SiteClient) Topology(ctx context.Context) (models.Topology, error)

models.Topology fetches the site's physical topology tree.

func (*SiteClient) TopologyNode

func (s *SiteClient) TopologyNode(ctx context.Context, networkID string) (models.TopologyNode, error)

models.TopologyNode returns the topology node for the given network ID.

func (*SiteClient) UnblockClient

func (s *SiteClient) UnblockClient(ctx context.Context, mac string) error

UnblockClient unblocks the client with the given MAC.

func (*SiteClient) UpdateClientSettings

func (s *SiteClient) UpdateClientSettings(ctx context.Context, mac string, name string, ipSetting *models.IpSetting, rateLimit *models.RateLimit) error

UpdateClientSettings updates the settings of a client. An empty name with nil IP setting and rate limit is a validation error.

func (*SiteClient) UpdateDhcpReservation

func (s *SiteClient) UpdateDhcpReservation(ctx context.Context, update DhcpReservationUpdate) (models.DhcpReservation, error)

UpdateDhcpReservation updates a DHCP reservation partially; only the set fields apply. An empty update is a validation error.

func (*SiteClient) UpdateFirmwareChannel

func (s *SiteClient) UpdateFirmwareChannel(ctx context.Context, section models.UpdateSection, channel string) error

UpdateFirmwareChannel selects the firmware release channel to check.

func (*SiteClient) UpdateLanNetwork

func (s *SiteClient) UpdateLanNetwork(ctx context.Context, update LanNetworkUpdate) (models.LanNetwork, error)

UpdateLanNetwork updates a LAN network partially.

func (*SiteClient) UpdatePortProfile

func (s *SiteClient) UpdatePortProfile(ctx context.Context, id string, profile PortProfileOverrides) (models.PortProfile, error)

UpdatePortProfile updates a port profile.

func (*SiteClient) UpdateVLAN

func (s *SiteClient) UpdateVLAN(ctx context.Context, network models.LanNetwork, update models.VlanUpdate) (models.LanNetwork, error)

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

func (*SiteClient) UpgradeDeviceFirmware

func (s *SiteClient) UpgradeDeviceFirmware(ctx context.Context, deviceIDs []string) error

UpgradeDeviceFirmware upgrades the firmware of the given devices.

func (*SiteClient) VLANs

func (s *SiteClient) VLANs(ctx context.Context) ([]models.LanNetwork, error)

VLANs lists the VLAN-only networks of the site.

func (*SiteClient) VlanCreate

func (s *SiteClient) VlanCreate(ctx context.Context, create models.VlanCreate) (map[string]any, error)

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

func (*SiteClient) VlanDelete

func (s *SiteClient) VlanDelete(ctx context.Context, del VlanDelete) (map[string]any, error)

VlanDelete deletes a VLAN-only network.

func (*SiteClient) VlanUpdate

func (s *SiteClient) VlanUpdate(ctx context.Context, update models.VlanUpdate) (map[string]any, error)

VlanUpdate changes a VLAN-only network; it preserves writable settings.

func (*SiteClient) VpnPolicies

func (s *SiteClient) VpnPolicies(ctx context.Context) ([]models.VpnPolicy, error)

VpnPolicies lists all VPN policies of the site across its tabs. Tabs whose list endpoint is unavailable are skipped.

func (*SiteClient) VpnPolicy

func (s *SiteClient) VpnPolicy(ctx context.Context, id string) (models.VpnPolicy, error)

models.VpnPolicy returns the VPN policy with the given controller ID.

type SwitchPortSettings

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

SwitchPortSettings is the effective configuration of a switch port.

func NewSwitchPortSettings

func NewSwitchPortSettings(data map[string]any) SwitchPortSettings

NewSwitchPortSettings builds a SwitchPortSettings from a raw API object.

func (SwitchPortSettings) Index

func (p SwitchPortSettings) Index() int

Index is the port number.

func (SwitchPortSettings) Mode

Mode is the port mode.

func (SwitchPortSettings) Name

func (p SwitchPortSettings) Name() string

Name is the port name.

func (SwitchPortSettings) PVID

func (p SwitchPortSettings) PVID() int

PVID is the port PVID.

type VlanDelete

type VlanDelete struct {
	VLAN int
}

VlanDelete identifies a VLAN-only network to delete.

Jump to

Keyboard shortcuts

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