detect

package
v0.0.0-...-e6e1b3f Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaskPing    = "ping"
	TaskTCP80   = "tcp_80"
	TaskTCP502  = "tcp_502"
	TaskSunspec = "sunspec"
)

public task ids

Variables

This section is empty.

Functions

This section is empty.

Types

type Criteria

type Criteria map[string]interface{}

type HttpHandler

type HttpHandler struct {
	Port int

	Schema, Method, Path string
	Codes                []int
	Header               map[string]string
	Jq                   string
	Timeout              time.Duration
	// contains filtered or unexported fields
}

func (*HttpHandler) Test

func (h *HttpHandler) Test(log *util.Logger, ip string) []interface{}

type HttpResult

type HttpResult struct {
	Jq interface{}
}

type KEBAHandler

type KEBAHandler struct {
	Timeout time.Duration
	// contains filtered or unexported fields
}

func (*KEBAHandler) Test

func (h *KEBAHandler) Test(log *util.Logger, ip string) []interface{}

type KebaResult

type KebaResult struct {
	Addr, Serial string
}

type ModbusHandler

type ModbusHandler struct {
	Port     int
	IDs      []uint8
	Models   []int
	Point    string
	Register modbus.Register `mapstructure:",squash"`
	Values   []int
	Invalid  []int

	Timeout time.Duration
	// contains filtered or unexported fields
}

func (*ModbusHandler) Test

func (h *ModbusHandler) Test(log *util.Logger, ip string) (res []interface{})

type ModbusResult

type ModbusResult struct {
	SlaveID uint8
	Model   int
	Point   string
	Value   interface{}
}

func (*ModbusResult) Configuration

func (r *ModbusResult) Configuration(handler TaskHandler, res Result) map[string]interface{}

type MqttHandler

type MqttHandler struct {
	Port    int
	Topic   string
	Timeout time.Duration
}

func (*MqttHandler) Test

func (h *MqttHandler) Test(log *util.Logger, ip string) []interface{}

type PingHandler

type PingHandler struct {
	Count   int
	Timeout time.Duration
}

func (*PingHandler) Test

func (h *PingHandler) Test(log *util.Logger, ip string) (res []interface{})

type Result

type Result struct {
	Task
	Host       string
	Details    interface{}
	Attributes map[string]interface{}
}

func Work

func Work(log *util.Logger, num int, hosts []string) []Result

type SMAHandler

type SMAHandler struct {
	Timeout time.Duration
	// contains filtered or unexported fields
}

func (*SMAHandler) Test

func (h *SMAHandler) Test(log *util.Logger, ip string) (res []interface{})

type SmaResult

type SmaResult struct {
	Addr, Serial string
	Http         bool
}

type Summary

type Summary struct {
	Charger, Grid, PV, Charge, Battery, Meter TypeSummary
}

func Consolidate

func Consolidate(res []Result) Summary

type Task

type Task struct {
	ID, Type string
	Depends  string
	Config   map[string]interface{}
}

type TaskHandler

type TaskHandler interface {
	Test(log *util.Logger, ip string) []interface{}
}

func HttpHandlerFactory

func HttpHandlerFactory(conf map[string]interface{}) (TaskHandler, error)

func KEBAHandlerFactory

func KEBAHandlerFactory(conf map[string]interface{}) (TaskHandler, error)

func ModbusHandlerFactory

func ModbusHandlerFactory(conf map[string]interface{}) (TaskHandler, error)

func MqttHandlerFactory

func MqttHandlerFactory(conf map[string]interface{}) (TaskHandler, error)

func PingHandlerFactory

func PingHandlerFactory(conf map[string]interface{}) (TaskHandler, error)

func SMAHandlerFactory

func SMAHandlerFactory(conf map[string]interface{}) (TaskHandler, error)

func TcpHandlerFactory

func TcpHandlerFactory(conf map[string]interface{}) (TaskHandler, error)

type TaskHandlerRegistry

type TaskHandlerRegistry map[string]func(map[string]interface{}) (TaskHandler, error)

func (TaskHandlerRegistry) Add

func (r TaskHandlerRegistry) Add(name string, factory func(map[string]interface{}) (TaskHandler, error))

func (TaskHandlerRegistry) Get

func (r TaskHandlerRegistry) Get(name string) (func(map[string]interface{}) (TaskHandler, error), error)

type TaskList

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

func (*TaskList) Add

func (l *TaskList) Add(task Task)

func (*TaskList) Count

func (l *TaskList) Count() int

func (*TaskList) Test

func (l *TaskList) Test(log *util.Logger, ip string) (res []Result)

type TcpHandler

type TcpHandler struct {
	Port    int
	Timeout time.Duration
	// contains filtered or unexported fields
}

func (*TcpHandler) Test

func (h *TcpHandler) Test(log *util.Logger, ip string) []interface{}

type TypeSummary

type TypeSummary struct {
	Results       []Result
	Found, Unique bool
}

Jump to

Keyboard shortcuts

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