drcom

package
v0.0.0-...-5910b1f Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2019 License: MIT, Apache-2.0 Imports: 13 Imported by: 0

README

Drcom

Code here is edited from go-jlu-drcom-client, which uses Apache License 2.0.

License

LICENSE

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMACAddrError  = errors.New("invalid mac address")
	ErrIdentifyError = errors.New("invalid username or password")
	ErrUnknown       = errors.New("login failed: unknown error")
)
View Source
var ErrChallengeHeadError = errors.New("challenge receive head is not correct")

Functions

func MACHex2Bytes

func MACHex2Bytes(mac string) (res []byte, err error)

MACHex2Bytes convert mac address to bytes, the input mac format should be 2a:1b:4c:fe:a9:e9.

Types

type Client

type Client struct {
	ChallengeTimes int
	Count          int
	FailCount      int
	// contains filtered or unexported fields
}

func New

func New(cfg *Config) *Client

func (*Client) Alive

func (c *Client) Alive() (err error)

func (*Client) Challenge

func (c *Client) Challenge() error

func (*Client) Close

func (c *Client) Close() error

Close close service.

func (*Client) Login

func (c *Client) Login() (err error)

func (*Client) Logout

func (c *Client) Logout()

func (*Client) ReadWithTimeout

func (c *Client) ReadWithTimeout(b []byte) (err error)

func (*Client) Start

func (c *Client) Start()

func (*Client) WriteWithTimeout

func (c *Client) WriteWithTimeout(b []byte) (err error)

type Config

type Config struct {
	MAC      string        `json:"mac"`
	Username string        `json:"username"`
	Password string        `json:"password"`
	Retry    int           `json:"retry"`
	Timeout  time.Duration `json:"timeout"`
	LogLevel string        `json:"log_level"`
	LogPath  string        `json:"log_path"`
}

Jump to

Keyboard shortcuts

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