freepsdo

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OutputModeFirstNonEmpty = iota
	OutputModeIgnore
)
View Source
const (
	ResponseTypeNone = iota
	ResponseTypePlainText
	ResponseTypeJSON
	ResponseTypeJPEG
)

Variables

View Source
var DefaultConfig = TemplateModConfig{}
View Source
var DefaultTelegramConfig = TelegramConfig{Token: ""}
View Source
var MuttModDefaultConfig = MuttModConfig{DefaultSubject: "default subject", DefaultBody: "default Body", DefaultRecv: ""}
View Source
var ScriptModDefaultConfig = ScriptModConfig{"/etc/freepsd/scripts"}

Functions

func CaptureRaspiStill

func CaptureRaspiStill(width, height int, cameraParams map[string]interface{}) (bytes []byte, err error)

Types

type CurlMod

type CurlMod struct {
}

func (*CurlMod) DoWithJSON

func (m *CurlMod) DoWithJSON(function string, jsonStr []byte, jrw *ResponseCollector)

func (*CurlMod) GetArgSuggestions added in v0.9.1

func (m *CurlMod) GetArgSuggestions(fn string, arg string, otherArgs map[string]interface{}) map[string]string

func (*CurlMod) GetFunctions added in v0.9.1

func (m *CurlMod) GetFunctions() []string

func (*CurlMod) GetPossibleArgs added in v0.9.1

func (m *CurlMod) GetPossibleArgs(fn string) []string

type DedupArgs added in v0.9.1

type DedupArgs struct {
	Retention string
}

type EchoMod

type EchoMod struct {
}

func (*EchoMod) DoWithJSON

func (m *EchoMod) DoWithJSON(fn string, jsonStr []byte, jrw *ResponseCollector)

func (*EchoMod) GetArgSuggestions added in v0.9.1

func (m *EchoMod) GetArgSuggestions(fn string, arg string, otherArgs map[string]interface{}) map[string]string

func (*EchoMod) GetFunctions added in v0.9.1

func (m *EchoMod) GetFunctions() []string

func (*EchoMod) GetPossibleArgs added in v0.9.1

func (m *EchoMod) GetPossibleArgs(fn string) []string

type EvalArgs added in v0.9.1

type EvalArgs struct {
	ValueName string
	ValueType string
	Operation string
	Operand   interface{}
}

type EvalMod added in v0.9.1

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

func (*EvalMod) DoWithJSON added in v0.9.1

func (m *EvalMod) DoWithJSON(fn string, jsonStr []byte, jrw *ResponseCollector)

func (*EvalMod) EvalAndRegexp added in v0.9.1

func (m *EvalMod) EvalAndRegexp(fn string, jsonStr []byte, jrw *ResponseCollector)

func (*EvalMod) EvalFloat added in v0.9.1

func (m *EvalMod) EvalFloat(vInterface interface{}, op string, v2Interface interface{}) (bool, error)

func (*EvalMod) EvalInt added in v0.9.1

func (m *EvalMod) EvalInt(vInterface interface{}, op string, v2Interface interface{}) (bool, error)

func (*EvalMod) EvalString added in v0.9.1

func (m *EvalMod) EvalString(vInterface interface{}, op string, v2Interface interface{}) (bool, error)

func (*EvalMod) GetArgSuggestions added in v0.9.1

func (m *EvalMod) GetArgSuggestions(fn string, arg string, otherArgs map[string]interface{}) map[string]string

func (*EvalMod) GetFunctions added in v0.9.1

func (m *EvalMod) GetFunctions() []string

func (*EvalMod) GetPossibleArgs added in v0.9.1

func (m *EvalMod) GetPossibleArgs(fn string) []string

func (*EvalMod) Regexp added in v0.9.1

func (m *EvalMod) Regexp(vInterface interface{}, op string, regexpInterface interface{}) (string, error)

type FieldWithType

type FieldWithType struct {
	FieldType  string
	FieldValue string
}

type FluxMod

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

func NewFluxMod

func NewFluxMod(cr *utils.ConfigReader) *FluxMod

func (*FluxMod) DoWithJSON

func (m *FluxMod) DoWithJSON(fn string, jsonStr []byte, jrw *ResponseCollector)

func (*FluxMod) GetArgSuggestions added in v0.9.1

func (m *FluxMod) GetArgSuggestions(fn string, arg string, otherArgs map[string]interface{}) map[string]string

func (*FluxMod) GetFunctions added in v0.9.1

func (m *FluxMod) GetFunctions() []string

func (*FluxMod) GetPossibleArgs added in v0.9.1

func (m *FluxMod) GetPossibleArgs(fn string) []string

type FritzMod

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

func NewFritzMod

func NewFritzMod(cr *utils.ConfigReader) *FritzMod

func (*FritzMod) DoWithJSON

func (m *FritzMod) DoWithJSON(fn string, jsonStr []byte, jrw *ResponseCollector)

func (*FritzMod) GetArgSuggestions added in v0.9.1

func (m *FritzMod) GetArgSuggestions(fn string, arg string, otherArgs map[string]interface{}) map[string]string

func (*FritzMod) GetDevices added in v0.9.1

func (m *FritzMod) GetDevices() map[string]string

func (*FritzMod) GetFunctions added in v0.9.1

func (m *FritzMod) GetFunctions() []string

func (*FritzMod) GetPossibleArgs added in v0.9.1

func (m *FritzMod) GetPossibleArgs(fn string) []string

type JsonArgs

type JsonArgs struct {
	Measurement    string
	Tags           map[string]string
	Fields         map[string]interface{}
	FieldsWithType map[string]FieldWithType
}

type MessageAndTime added in v0.9.1

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

type Mod

type Mod interface {
	DoWithJSON(fn string, jsonStr []byte, jrw *ResponseCollector)
	GetFunctions() []string
	GetPossibleArgs(fn string) []string
	GetArgSuggestions(fn string, arg string, otherArgs map[string]interface{}) map[string]string
}

type MuttMod added in v0.9.1

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

func NewMuttMod added in v0.9.1

func NewMuttMod(cr *utils.ConfigReader) *MuttMod

func (*MuttMod) DoWithJSON added in v0.9.1

func (m *MuttMod) DoWithJSON(function string, inputBytes []byte, jrw *ResponseCollector)

func (*MuttMod) GetArgSuggestions added in v0.9.1

func (m *MuttMod) GetArgSuggestions(fn string, arg string, otherArgs map[string]interface{}) map[string]string

func (*MuttMod) GetFunctions added in v0.9.1

func (m *MuttMod) GetFunctions() []string

func (*MuttMod) GetPossibleArgs added in v0.9.1

func (m *MuttMod) GetPossibleArgs(fn string) []string

type MuttModConfig added in v0.9.1

type MuttModConfig struct {
	DefaultSubject string
	DefaultBody    string
	DefaultRecv    string
}

type MuttParameters added in v0.9.1

type MuttParameters struct {
	Subject string
	Body    string
	Recv    string
}

type OutputModeT added in v0.9.1

type OutputModeT int

func (OutputModeT) MarshalJSON added in v0.9.1

func (g OutputModeT) MarshalJSON() ([]byte, error)

func (*OutputModeT) UnmarshalJSON added in v0.9.1

func (g *OutputModeT) UnmarshalJSON(b []byte) error

type RaspistillMod

type RaspistillMod struct {
}

func (*RaspistillMod) DoWithJSON

func (m *RaspistillMod) DoWithJSON(fn string, jsonStr []byte, jrw *ResponseCollector)

func (*RaspistillMod) GetArgSuggestions added in v0.9.1

func (m *RaspistillMod) GetArgSuggestions(fn string, arg string, otherArgs map[string]interface{}) map[string]string

func (*RaspistillMod) GetFunctions added in v0.9.1

func (m *RaspistillMod) GetFunctions() []string

func (*RaspistillMod) GetPossibleArgs added in v0.9.1

func (m *RaspistillMod) GetPossibleArgs(fn string) []string

type Response added in v0.9.1

type Response struct {
	StatusCode int          `json:",omitempty"`
	Output     interface{}  `json:",omitempty"`
	OutputType ResponseType `json:",omitempty"`
}

type ResponseCollector added in v0.9.1

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

func NewResponseCollector added in v0.9.1

func NewResponseCollector(creator string) *ResponseCollector

func (*ResponseCollector) Clone added in v0.9.1

func (*ResponseCollector) GetCreator added in v0.9.1

func (j *ResponseCollector) GetCreator() string

func (*ResponseCollector) GetFinalResponse added in v0.9.1

func (j *ResponseCollector) GetFinalResponse(pretty bool) (int, ResponseType, []byte)

func (*ResponseCollector) GetMarshalledOutput added in v0.9.1

func (j *ResponseCollector) GetMarshalledOutput() ([]byte, error)

GetMarshalledOutput runs GetOutput and returnes the json-encoded Output or an error if the operation failed

func (*ResponseCollector) GetOutput added in v0.9.1

func (j *ResponseCollector) GetOutput() (*Response, error)

GetOutput collects the output of the collector and all it's children

func (*ResponseCollector) GetResponseTree added in v0.9.1

func (j *ResponseCollector) GetResponseTree() []byte

func (*ResponseCollector) GetStatusCode added in v0.9.1

func (j *ResponseCollector) GetStatusCode() int

func (*ResponseCollector) IsRoot added in v0.9.1

func (j *ResponseCollector) IsRoot() bool

func (*ResponseCollector) IsStatusFailed added in v0.9.1

func (j *ResponseCollector) IsStatusFailed() bool

func (*ResponseCollector) SetContext added in v0.9.1

func (j *ResponseCollector) SetContext(ta *TemplateAction)

func (*ResponseCollector) SetOutputMode added in v0.9.1

func (j *ResponseCollector) SetOutputMode(outputMode OutputModeT)

func (*ResponseCollector) WriteError added in v0.9.1

func (j *ResponseCollector) WriteError(statusCode int, format string, a ...interface{})

func (*ResponseCollector) WriteMessageWithCode added in v0.9.1

func (j *ResponseCollector) WriteMessageWithCode(statusCode int, response interface{})

func (*ResponseCollector) WriteMessageWithCodef added in v0.9.1

func (j *ResponseCollector) WriteMessageWithCodef(statusCode int, format string, a ...interface{})

func (*ResponseCollector) WriteResponseWithCodeAndType added in v0.9.1

func (j *ResponseCollector) WriteResponseWithCodeAndType(statusCode int, outputType ResponseType, response interface{})

func (*ResponseCollector) WriteSuccess added in v0.9.1

func (j *ResponseCollector) WriteSuccess()

func (*ResponseCollector) WriteSuccessMessage added in v0.9.1

func (j *ResponseCollector) WriteSuccessMessage(response interface{})

func (*ResponseCollector) WriteSuccessf added in v0.9.1

func (j *ResponseCollector) WriteSuccessf(format string, a ...interface{})

type ResponseType added in v0.9.1

type ResponseType int

func (ResponseType) MarshalJSON added in v0.9.1

func (g ResponseType) MarshalJSON() ([]byte, error)

func (ResponseType) ToString added in v0.9.1

func (g ResponseType) ToString() (string, error)

func (*ResponseType) UnmarshalJSON added in v0.9.1

func (g *ResponseType) UnmarshalJSON(b []byte) error

type ScriptMod

type ScriptMod struct {
	ScriptDir string
}

func NewScriptMod added in v0.9.1

func NewScriptMod(cr *utils.ConfigReader) *ScriptMod

func (*ScriptMod) DoWithJSON

func (m *ScriptMod) DoWithJSON(function string, jsonStr []byte, jrw *ResponseCollector)

func (*ScriptMod) GetArgSuggestions added in v0.9.1

func (m *ScriptMod) GetArgSuggestions(fn string, arg string, otherArgs map[string]interface{}) map[string]string

func (*ScriptMod) GetFunctions added in v0.9.1

func (m *ScriptMod) GetFunctions() []string

func (*ScriptMod) GetPossibleArgs added in v0.9.1

func (m *ScriptMod) GetPossibleArgs(fn string) []string

type ScriptModConfig added in v0.9.1

type ScriptModConfig struct {
	ScriptDir string
}

type ScriptParameters

type ScriptParameters struct {
	Mode string
	Args []string
}

type SystemMod added in v0.9.1

type SystemMod struct {
	Modinator *TemplateMod
}

func NewSystemeMod added in v0.9.1

func NewSystemeMod(modintor *TemplateMod) *SystemMod

func (*SystemMod) DoWithJSON added in v0.9.1

func (m *SystemMod) DoWithJSON(fn string, jsonStr []byte, jrw *ResponseCollector)

func (*SystemMod) GetArgSuggestions added in v0.9.1

func (m *SystemMod) GetArgSuggestions(fn string, arg string, otherArgs map[string]interface{}) map[string]string

func (*SystemMod) GetFunctions added in v0.9.1

func (m *SystemMod) GetFunctions() []string

func (*SystemMod) GetPossibleArgs added in v0.9.1

func (m *SystemMod) GetPossibleArgs(fn string) []string

type TelegramConfig added in v0.9.1

type TelegramConfig struct {
	Token         string
	AllowedUsers  []string
	DebugMessages bool
}

type TelegramMod added in v0.9.1

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

func NewTelegramBot added in v0.9.1

func NewTelegramBot(cr *utils.ConfigReader) *TelegramMod

func (*TelegramMod) DoWithJSON added in v0.9.1

func (m *TelegramMod) DoWithJSON(function string, jsonStr []byte, jrw *ResponseCollector)

func (*TelegramMod) GetArgSuggestions added in v0.9.1

func (m *TelegramMod) GetArgSuggestions(fn string, arg string, otherArgs map[string]interface{}) map[string]string

func (*TelegramMod) GetFunctions added in v0.9.1

func (m *TelegramMod) GetFunctions() []string

func (*TelegramMod) GetPossibleArgs added in v0.9.1

func (m *TelegramMod) GetPossibleArgs(fn string) []string

type Template

type Template struct {
	Actions    []TemplateAction
	OutputMode OutputModeT `json:",omitempty"`
}

type TemplateAction

type TemplateAction struct {
	Mod             string                 `json:",omitempty"`
	Fn              string                 `json:",omitempty"`
	Args            map[string]interface{} `json:",omitempty"`
	FwdTemplateName string                 `json:",omitempty"`
	FwdTemplate     *Template              `json:",omitempty"`
}

type TemplateMod

type TemplateMod struct {
	Mods               map[string]Mod
	Config             TemplateModConfig
	TemporaryTemplates map[string]*Template
	ExternalTemplates  map[string]*Template
	Cache              map[string][]byte
	// contains filtered or unexported fields
}

func NewTemplateMod

func NewTemplateMod(cr *utils.ConfigReader) *TemplateMod

func (*TemplateMod) DoWithJSON

func (m *TemplateMod) DoWithJSON(templateName string, jsonStr []byte, jrw *ResponseCollector)

func (*TemplateMod) ExecuteModWithJson

func (m *TemplateMod) ExecuteModWithJson(mod string, fn string, jsonStr []byte, jrw *ResponseCollector)

func (*TemplateMod) ExecuteTemplateAction added in v0.9.1

func (m *TemplateMod) ExecuteTemplateAction(ta *TemplateAction, jrw *ResponseCollector)

func (*TemplateMod) ExecuteTemplateActionWithAdditionalArgs added in v0.9.1

func (m *TemplateMod) ExecuteTemplateActionWithAdditionalArgs(t *TemplateAction, moreJsonArgs []byte, jrw *ResponseCollector)

func (*TemplateMod) ExecuteTemplateWithAdditionalArgs

func (m *TemplateMod) ExecuteTemplateWithAdditionalArgs(template *Template, jsonStr []byte, jrw *ResponseCollector)

func (*TemplateMod) GetAllTemplates added in v0.9.1

func (m *TemplateMod) GetAllTemplates(includeTemp bool) map[string]*Template

func (*TemplateMod) GetArgSuggestions added in v0.9.1

func (m *TemplateMod) GetArgSuggestions(fn string, arg string, otherArgs map[string]interface{}) map[string]string

func (*TemplateMod) GetFunctions added in v0.9.1

func (m *TemplateMod) GetFunctions() []string

func (*TemplateMod) GetPossibleArgs added in v0.9.1

func (m *TemplateMod) GetPossibleArgs(fn string) []string

func (*TemplateMod) GetTemplate added in v0.9.1

func (m *TemplateMod) GetTemplate(templateName string) (*Template, bool)

func (*TemplateMod) GetTemporaryTemplateAction added in v0.9.1

func (m *TemplateMod) GetTemporaryTemplateAction(ID string) *TemplateAction

func (*TemplateMod) RemoveTemporaryTemplate added in v0.9.1

func (m *TemplateMod) RemoveTemporaryTemplate(ID string)

func (*TemplateMod) SaveTemplateAction added in v0.9.1

func (m *TemplateMod) SaveTemplateAction(templateName string, ta *TemplateAction) error

type TemplateModConfig

type TemplateModConfig struct {
	Templates        map[string]*Template
	TemplatesFromUrl string
	Verbose          bool
}

Jump to

Keyboard shortcuts

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