service

package
v0.0.0-...-d102195 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const RETRYTIMES = 5

Variables

View Source
var (
	ErrChallengeHeadError = errors.New("challenge receive head is not correct")
	ErrMACAddrError       = errors.New("invalid mac address")
	ErrIdentifyError      = errors.New("invalid username or password")
	ErrUnknown            = errors.New("login failed: unknown error")
)
View Source
var (
	ErrMACAddrLenError = errors.New("length of mac address 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 Error

type Error struct {
	Err error
	Msg string
}

Error exit message

type Logger

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

func (*Logger) Error

func (l *Logger) Error(msg string)

func (*Logger) Info

func (l *Logger) Info(msg string)

type LoggerInterface

type LoggerInterface interface {
	Info(string)
	Error(string)
}

type Service

type Service struct {
	ChallengeTimes int
	Count          int
	LogoutCh       chan struct{}

	Restart chan int
	// contains filtered or unexported fields
}

func New

func New(c *conf.Config) (s *Service)

New create service instance and return.

func (*Service) Alive

func (s *Service) Alive() (err error)

func (*Service) Challenge

func (s *Service) Challenge(tryTimes int) (err error)

func (*Service) Close

func (s *Service) Close() error

Close close service.

func (*Service) Login

func (s *Service) Login() (err error)

func (*Service) Logout

func (s *Service) Logout() (err error)

func (*Service) ReStart

func (s *Service) ReStart() error

func (*Service) Start

func (s *Service) Start() error

Start start drcom client.

Jump to

Keyboard shortcuts

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