ax50

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: GPL-3.0 Imports: 22 Imported by: 0

README

archer-ax50

golang client library for accessing TP-Link Archer AX50 WiFi router

Based on https://github.com/Electry/TPLink-C2300-APIClient python lib

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrExceededMaxAttempts = errors.New("Login failed, maximum login attempts exceeded. Please wait for 60-120 minutes")
View Source
var ErrLoginError = errors.New("Login error")
View Source
var ErrLoginFailed = errors.New("Login failed, wrong password")
View Source
var ErrUserConflict = errors.New("Login conflict. Someone else is logged in.")

Functions

func MarshalForm

func MarshalForm(obj interface{}) ([]byte, error)

func Operation

func Operation(op string) map[string]string

func Pad

func Pad(data []byte, size int) []byte

func ReadResponse

func ReadResponse[T any](data []byte) (*T, error)

func Unpad

func Unpad(data []byte) []byte

Types

type AESCipher

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

func GenAESCipher

func GenAESCipher() (*AESCipher, error)

func NewAESCipher

func NewAESCipher(key, iv string) (*AESCipher, error)

func (*AESCipher) Decrypt

func (c *AESCipher) Decrypt(data []byte) ([]byte, error)

func (*AESCipher) DecryptBase64

func (c *AESCipher) DecryptBase64(data string) ([]byte, error)

func (*AESCipher) DecryptHex

func (c *AESCipher) DecryptHex(data string) ([]byte, error)

func (*AESCipher) Encrypt

func (c *AESCipher) Encrypt(data []byte) ([]byte, error)

func (*AESCipher) EncryptBase64

func (c *AESCipher) EncryptBase64(data []byte) (string, error)

func (*AESCipher) EncryptHex

func (c *AESCipher) EncryptHex(data []byte) (string, error)

func (*AESCipher) IV

func (c *AESCipher) IV() string

func (*AESCipher) Key

func (c *AESCipher) Key() string

type AccessDevice

type AccessDevice struct {
	Hostname string `json:"hostname"`
	IPv4     string `json:"ipaddr"`
	MAC      string `json:"macaddr"`
	WireType string `json:"wire_type"`
}

type Client

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

func NewClient

func NewClient(host string) (*Client, error)

func (*Client) GetClientList

func (client *Client) GetClientList() (*ClientList, error)

func (*Client) Login

func (client *Client) Login(password string) error

func (*Client) Logout

func (client *Client) Logout() error

func (*Client) MakeFormURL

func (client *Client) MakeFormURL(endpoint, form string) *url.URL

func (*Client) MakeURL

func (client *Client) MakeURL(endpoint string, query url.Values) *url.URL

type ClientList

type ClientList struct {
	Wireless []*AccessDevice `json:"access_devices_wireless_host"`
	Wired    []*AccessDevice `json:"access_devices_wired"`
}

type EncryptedFormData

type EncryptedFormData struct {
	Sign string `json:"sign"`
	Data string `json:"data"`
}

type EncryptedResponse

type EncryptedResponse struct {
	Data string `json:"data"`
}

type FormMarshaler

type FormMarshaler interface {
	MarshalForm() ([]byte, error)
}

type RSACipher

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

func ParseRSAKey

func ParseRSAKey(key []string) (*RSACipher, error)

func (*RSACipher) Encrypt

func (c *RSACipher) Encrypt(data []byte) ([]byte, error)

func (*RSACipher) EncryptBase64

func (c *RSACipher) EncryptBase64(data []byte) (string, error)

func (*RSACipher) EncryptHex

func (c *RSACipher) EncryptHex(data []byte) (string, error)

type RSASigner

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

func NewRSASigner

func NewRSASigner(password string, key []string, seq int, aesKey *AESCipher) (*RSASigner, error)

func (*RSASigner) DecryptResponse

func (signer *RSASigner) DecryptResponse(body []byte) ([]byte, error)

func (*RSASigner) Sign

func (signer *RSASigner) Sign(data interface{}, isLogin bool) (*EncryptedFormData, error)

type ResponseWrapper

type ResponseWrapper[T any] struct {
	Success   bool    `json:"success"`
	ErrorCode *string `json:"errorcode"`
	Data      *T      `json:"data"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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