xiaomirouterapi

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

README

xiaomi-router-api

Клиент для API роутера Xiaomi Mi Router 4

Пример использования:
package main

import (
    "fmt"
    xiaomirouterapi "github.com/art-sitedesign/xiaomi-router-api"
)

func main() {
    api := xiaomirouterapi.NewMiWifiApi("192.168.31.1")
    
    err := api.Auth("admin", "12345678")
    if err != nil {
        fmt.Println(err)
        return
    }
    
    defer func() {
        _ = api.Logout()
    }()
    
    status, err := api.Status()
    if err != nil {
        fmt.Println(err)
        return
    }
    
    fmt.Println(status)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BandWidthTest added in v1.1.0

type BandWidthTest struct {
	Code       int     `json:"code"`
	Download   float64 `json:"download"`
	Upload     float64 `json:"upload"`
	BandWidth  float64 `json:"bandwidth"`
	BandWidth2 float64 `json:"bandwidth2"`
}

type CountryCodeResp added in v1.1.0

type CountryCodeResp struct {
	Code    int           `json:"code"`
	Current string        `json:"current"`
	List    []countryCode `json:"list"`
}

type DeviceListResp added in v1.1.0

type DeviceListResp struct {
	Code int    `json:"code"`
	List []list `json:"list"`
	Mac  string `json:"mac"`
}

type MiWifiApi

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

func NewMiWifiApi

func NewMiWifiApi(routerIP string) *MiWifiApi

func (*MiWifiApi) Auth

func (api *MiWifiApi) Auth(user string, pass string) error

func (*MiWifiApi) BandWidthTest

func (api *MiWifiApi) BandWidthTest(history int) (*BandWidthTest, error)

func (*MiWifiApi) CountryCode

func (api *MiWifiApi) CountryCode() (*CountryCodeResp, error)

func (*MiWifiApi) DeviceList

func (api *MiWifiApi) DeviceList() (*DeviceListResp, error)

func (*MiWifiApi) Logout

func (api *MiWifiApi) Logout() error

func (*MiWifiApi) PPOEStatus

func (api *MiWifiApi) PPOEStatus() (*PpoeStatus, error)

func (*MiWifiApi) Status

func (api *MiWifiApi) Status() (*StatusResp, error)

func (*MiWifiApi) WifiDetailAll

func (api *MiWifiApi) WifiDetailAll() (*WifiDetailAllResp, error)

type PpoeStatus added in v1.1.0

type PpoeStatus struct {
	Code   int          `json:"code"`
	Status int          `json:"status"`
	Proto  string       `json:"proto"`
	Dns    []string     `json:"dns"`
	Gw     string       `json:"gw"`
	Ip     ppoeStatusIp `json:"ip"`
}

type StatusResp added in v1.1.0

type StatusResp struct {
	Code        int      `json:"code"`
	Count       count    `json:"count"`
	Cpu         cpu      `json:"cpu"`
	Dev         []dev    `json:"dev"`
	Hardware    hardware `json:"hardware"`
	Mem         mem      `json:"mem"`
	Temperature float64  `json:"temperature"`
	UpTime      float64  `json:"uptime,string"`
	Wan         wan      `json:"wan"`
}

type WifiDetailAllResp added in v1.1.0

type WifiDetailAllResp struct {
	Code int                 `json:"code"`
	Bsd  int                 `json:"bsd"`
	Info []wifiDetailAllInfo `json:"info"`
}

Jump to

Keyboard shortcuts

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