glinet

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnauthorized = errors.New("unauthorized")
View Source
var ErrUnexpected = errors.New("unexpected")

Functions

This section is empty.

Types

type Client

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

func New

func New(addr, token string) (*Client, error)

func NewFromPassword

func NewFromPassword(ctx context.Context, addr, password string) (*Client, error)

NewFromPassword will do auth and build a new regular Client.

func (*Client) GetClientList

func (c *Client) GetClientList(ctx context.Context) (*GetClientListResp, error)

func (*Client) GetModemInfo

func (c *Client) GetModemInfo(ctx context.Context) (*GetModemInfoResp, error)

func (*Client) GetNetworkStatus

func (c *Client) GetNetworkStatus(ctx context.Context) (*GetNetworkStatusResp, error)

func (*Client) GetPublicIP

func (c *Client) GetPublicIP(ctx context.Context) (string, error)

func (*Client) ModemTurnOff

func (c *Client) ModemTurnOff(ctx context.Context) error

func (*Client) ModemTurnOn

func (c *Client) ModemTurnOn(ctx context.Context) error

func (*Client) ModemTurnOnAuto

func (c *Client) ModemTurnOnAuto(ctx context.Context) error

func (*Client) Token

func (c *Client) Token() string

type Code

type Code int
const (
	CodeBadToken Code = -1
)

type GetClientListResp

type GetClientListResp struct {
	Clients []RouterClient `json:"clients"`
}

type GetModemInfoResp

type GetModemInfoResp struct {
	Passthrough           bool    `json:"passthrough"`
	HintModifyWifiChannel int     `json:"hint_modify_wifi_channel"`
	Modems                []Modem `json:"modems"`
}

type GetNetworkStatusResp

type GetNetworkStatusResp struct {
	Reachable  bool `json:"reachable"`
	RebootFlag bool `json:"reboot_flag"`
}

type Modem

type Modem struct {
	Ports       []string `json:"ports"`
	ModemID     int      `json:"modem_id"`
	DataPort    string   `json:"data_port"`
	ControlPort string   `json:"control_port"`
	QmiPort     string   `json:"qmi_port"`
	Name        string   `json:"name"`
	Imei        string   `json:"IMEI"`
	Bus         string   `json:"bus"`
	HwVersion   string   `json:"hw_version"`
	SimNum      string   `json:"sim_num"`
	Mnc         string   `json:"mnc"`
	Mcc         string   `json:"mcc"`
	Carrier     string   `json:"carrier"`
	Up          string   `json:"up"`
	SIMStatus   int      `json:"SIM_status"`
	Operators   []string `json:"operators"`
}

type RouterClient

type RouterClient struct {
	Remote     bool   `json:"remote"`
	Mac        string `json:"mac"`
	Favorite   bool   `json:"favorite"`
	IP         string `json:"ip"`
	Up         string `json:"up"`
	Down       string `json:"down"`
	TotalUp    string `json:"total_up"`
	TotalDown  string `json:"total_down"`
	QosUp      string `json:"qos_up"`
	QosDown    string `json:"qos_down"`
	Blocked    bool   `json:"blocked"`
	Iface      string `json:"iface"`
	Name       string `json:"name"`
	OnlineTime string `json:"online_time"`
	Alive      string `json:"alive"`
	NewOnline  bool   `json:"new_online"`
	Online     bool   `json:"online"`
	Vendor     string `json:"vendor"`
	Node       string `json:"node"`
}

Jump to

Keyboard shortcuts

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