tplink

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeviceInfo

type DeviceInfo struct {
	DeviceName      string `json:"deviceName,omitempty"`
	DeviceModel     string `json:"deviceModel,omitempty"`
	FirmwareVersion string `json:"firmwareVersion,omitempty"`
	HardwareVersion string `json:"hardwareVersion,omitempty"`
	Mac             string `json:"mac,omitempty"`
	IP              string `json:"ip,omitempty"`
	SubnetMask      string `json:"subnetMask,omitempty"`
	LanPortList     []struct {
		Status string `json:"status,omitempty"`
		Name   string `json:"name,omitempty"`
	} `json:"lan_port_list,omitempty"`
	Time   string `json:"time,omitempty"`
	Uptime string `json:"uptime,omitempty"`
	CPU    int    `json:"cpu,omitempty"`
	Memory int    `json:"memory,omitempty"`
}

type LedInfo

type LedInfo struct {
	Enable string `json:"enable"`
}

type LedStatus

type LedStatus string
const (
	LedStatusOff LedStatus = "off"
	LedStatusOn  LedStatus = "on"
)

type RadioInfo

type RadioInfo struct {
	Status       string `json:"status,omitempty"`
	Wirelessmode int    `json:"wirelessmode,omitempty"`
	Chwidth      int    `json:"chwidth,omitempty"`
	Channel      int    `json:"channel,omitempty"`
	Txpower      int    `json:"txpower,omitempty"`
	RegionCode   int    `json:"regionCode,omitempty"`
	RadioID      int    `json:"radioID,omitempty"`
	MinPower     int    `json:"minPower,omitempty"`
}

type SSHInfo

type SSHInfo struct {
	// Whether the AP's SSH server is enabled
	SSHServerEnable bool `json:"sshServerEnable"`
	// Whether layer-3 accessibility is enabled
	RemoteEnable bool `json:"remoteEnable"`
	// What port the AP's SSH server is running on
	ServerPort int `json:"serverPort"`
}

type SSID

type SSID struct {
	Ssidname           string `json:"ssidname"`
	Vlanid             int    `json:"vlanid"`
	Ssidbcast          int    `json:"ssidbcast"`
	Guest              int    `json:"guest"`
	Portal             int    `json:"portal"`
	Key                int    `json:"key"`
	Limit              bool   `json:"limit"`
	LimitDownload      int    `json:"limit_download"`
	LimitDownloadUnit  int    `json:"limit_download_unit"`
	LimitUpload        int    `json:"limit_upload"`
	LimitUploadUnit    int    `json:"limit_upload_unit"`
	SecurityMode       int    `json:"securityMode"`
	PskVersion         int    `json:"psk_version"`
	PskCipher          int    `json:"psk_cipher"`
	PskKey             string `json:"psk_key"`
	PskKeyUpdate       int    `json:"psk_key_update"`
	WpaVersion         int    `json:"wpa_version"`
	WpaCipher          int    `json:"wpa_cipher"`
	Server             string `json:"server"`
	Port               int    `json:"port"`
	WpaKey             string `json:"wpa_key"`
	WpaKeyUpdate       int    `json:"wpa_key_update"`
	AcctEnable         int    `json:"acct_enable"`
	AcctServer         string `json:"acct_server"`
	AcctPort           int    `json:"acct_port"`
	AcctKey            string `json:"acct_key"`
	AcctUpdateEnable   int    `json:"acct_update_enable"`
	AcctUpdateInterval int    `json:"acct_update_interval"`
	WepMode            int    `json:"wep_mode"`
	WepSelect          int    `json:"wep_select"`
	WepFormat1         int    `json:"wep_format1"`
	WepKey1            string `json:"wep_key1"`
	WepType1           int    `json:"wep_type1"`
	WepFormat2         int    `json:"wep_format2"`
	WepKey2            string `json:"wep_key2"`
	WepType2           int    `json:"wep_type2"`
	WepFormat3         int    `json:"wep_format3"`
	WepKey3            string `json:"wep_key3"`
	WepType3           int    `json:"wep_type3"`
	WepFormat4         int    `json:"wep_format4"`
	WepKey4            string `json:"wep_key4"`
	WepType4           int    `json:"wep_type4"`
}

func (SSID) GetKey

func (s SSID) GetKey() int

func (SSID) MarshalJSON

func (s SSID) MarshalJSON() ([]byte, error)

type SSIDDiagnostic

type SSIDDiagnostic struct {
	Ssid     string `json:"SSID"`
	Key      int    `json:"key"`
	Vlan     int    `json:"vlan"`
	Clients  int    `json:"clients"`
	Guest    bool   `json:"guest"`
	Radio    int    `json:"Radio"`
	Portal   bool   `json:"portal"`
	Security int    `json:"security"`
	DownTh   int    `json:"downTh"`
	UpTh     int    `json:"upTh"`
}

func (SSIDDiagnostic) GetKey

func (s SSIDDiagnostic) GetKey() int

type TPLinkClient

type TPLinkClient struct {
	BaseAddr *url.URL
	Username string
	Password string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(baseAddr, username, password string) *TPLinkClient

func (*TPLinkClient) Authenticate

func (c *TPLinkClient) Authenticate() error

func (*TPLinkClient) Cookie

func (c *TPLinkClient) Cookie() string

func (*TPLinkClient) CreateSSIDD

func (c *TPLinkClient) CreateSSIDD(s SSID, radioID int) ([]SSID, error)

GetSSIDInfo createss a new SSID on the given band. On successful execution, it returns a list of all the currently configured SSIDs (including the newly created one).

func (*TPLinkClient) DeleteSSIDD

func (c *TPLinkClient) DeleteSSIDD(s ssidDeleter, radioID int) ([]SSID, error)

GetSSIDInfo deletes an existing SSID and returns the remaining SSIDs.

func (*TPLinkClient) GetDeviceInfo

func (c *TPLinkClient) GetDeviceInfo() (DeviceInfo, error)

GetDeviceInfo returns the client's device info from the `/data/status.device.json` endpoint.

func (*TPLinkClient) GetLedStatus

func (c *TPLinkClient) GetLedStatus() (LedInfo, error)

GetLedStatus returns the EAP's LED state.

func (*TPLinkClient) GetRadioInfo

func (c *TPLinkClient) GetRadioInfo(radioID int) (RadioInfo, error)

GetRadioInfo returns information for the provided radio ID.

func (*TPLinkClient) GetSSHStatus

func (c *TPLinkClient) GetSSHStatus() (SSHInfo, error)

GetLedStatus returns information of the EAP's SSH-Server.

func (*TPLinkClient) GetSSIDDiagnostics

func (c *TPLinkClient) GetSSIDDiagnostics() ([]SSIDDiagnostic, error)

GetSSIDInfo returns general diagnostics about the EAP's configured SSIDs.

func (*TPLinkClient) GetSSIDDs

func (c *TPLinkClient) GetSSIDDs(radioID int) ([]SSID, error)

GetSSIDInfo returns more detailed diagnostics of the EAP's configured SSIDs for a given radio.

func (*TPLinkClient) IsAuthenticated

func (c *TPLinkClient) IsAuthenticated() bool

func (*TPLinkClient) SetLedStatus

func (c *TPLinkClient) SetLedStatus(status LedStatus) (LedInfo, error)

GetLedStatus sets the EAP's LED state.

func (*TPLinkClient) SetSSHStatus

func (c *TPLinkClient) SetSSHStatus(info SSHInfo) (responseStatus, error)

GetLedStatus configures the EAP's SSH-Server.

Jump to

Keyboard shortcuts

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