Documentation ¶
Index ¶
- Constants
- func DumpRSAPEM(pubKey *rsa.PublicKey) (pubPEM []byte)
- func GenerateRSAKeys() (*rsa.PrivateKey, *rsa.PublicKey)
- func Pad(buf []byte, size int) ([]byte, error)
- func Unpad(padded []byte, size int) ([]byte, error)
- type Cipher
- type Device
- func (d *Device) CheckErrorCode(errorCode int) error
- func (d *Device) DoRequest(payload []byte) ([]byte, error)
- func (d *Device) GetDeviceInfo() (*Status, error)
- func (d *Device) GetURL() string
- func (d *Device) Handshake() (err error)
- func (d *Device) Login() (err error)
- func (d *Device) SetDeviceInfo(params map[string]interface{}) (err error)
- func (d *Device) Switch(status bool) (err error)
- type Status
Constants ¶
View Source
const RSABits = 1024
View Source
const Timeout = time.Second * 2
Variables ¶
This section is empty.
Functions ¶
func DumpRSAPEM ¶
func GenerateRSAKeys ¶
func GenerateRSAKeys() (*rsa.PrivateKey, *rsa.PublicKey)
Types ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
func (*Device) CheckErrorCode ¶
func (*Device) GetDeviceInfo ¶
func (*Device) SetDeviceInfo ¶
type Status ¶
type Status struct { ErrorCode int `json:"error_code"` Result struct { DeviceID string `json:"device_id"` FWVersion string `json:"fw_ver"` HWVersion string `json:"hw_ver"` Type string `json:"type"` Model string `json:"model"` MAC string `json:"mac"` HWID string `json:"hw_id"` FWID string `json:"fw_id"` OEMID string `json:"oem_id"` Specs string `json:"specs"` DeviceON bool `json:"device_on"` OnTime int `json:"on_time"` OverHeated bool `json:"overheated"` Nickname string `json:"nickname"` Location string `json:"location"` Avatar string `json:"avatar"` Longitude int `json:"longitude"` Latitude int `json:"latitude"` HasSetLocationInfo bool `json:"has_set_location_info"` IP string `json:"ip"` SSID string `json:"ssid"` SignalLevel int `json:"signal_level"` RSSI int `json:"rssi"` Region string `json:"Europe/Kiev"` TimeDiff int `json:"time_diff"` Lang string `json:"lang"` } `json:"result"` }
Click to show internal directories.
Click to hide internal directories.