js

package
v0.0.0-...-0dfd57a Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Service js provides JavaScript scripting for the sarif network.

Index

Constants

This section is empty.

Variables

View Source
var Module = &services.Module{
	Name:        "js",
	Version:     "1.0",
	NewInstance: NewService,
}

Functions

This section is empty.

Types

type Config

type Config struct {
	ScriptDir string `json:"script_dir"`
}

type ContentPayload

type ContentPayload struct {
	Content schema.Content `json:"content"`
}

func (ContentPayload) Text

func (p ContentPayload) Text() string

type Dependencies

type Dependencies struct {
	Config        services.Config
	Client        sarif.Client
	ClientFactory sarif.ClientFactory
}

type Machine

type Machine struct {
	sarif.Client
	Modules *motto.Motto
	VM      *otto.Otto

	StateLock    sync.Mutex
	OutputBuffer string
	Listeners    []string
}

func NewMachine

func NewMachine(c sarif.Client) *Machine

func (*Machine) Attach

func (m *Machine) Attach(listener string)

func (*Machine) Disable

func (m *Machine) Disable() error

func (*Machine) Do

func (m *Machine) Do(code string) (string, error, interface{})

func (*Machine) Enable

func (m *Machine) Enable() error

func (*Machine) FlushOut

func (m *Machine) FlushOut() string

func (*Machine) InformListeners

func (m *Machine) InformListeners(action, message string)

func (*Machine) RegisterModule

func (m *Machine) RegisterModule(name string, module map[string]interface{})

type MsgMachineAllStatus

type MsgMachineAllStatus struct {
	Up     int               `json:"up"`
	Status map[string]string `json:"status"`
}

func (MsgMachineAllStatus) Text

func (s MsgMachineAllStatus) Text() string

type MsgMachineStatus

type MsgMachineStatus struct {
	Machine string `json:"machine,omitempty"`
	Status  string `json:"status,omitempty"`
	Out     string `json:"out,omitempty"`
}

func (MsgMachineStatus) String

func (p MsgMachineStatus) String() string

type Service

type Service struct {
	ClientFactory sarif.ClientFactory
	sarif.Client

	Scripts   map[string]string
	Machines  map[string]*Machine
	Listeners map[string][]string
	// contains filtered or unexported fields
}

func NewService

func NewService(deps *Dependencies) *Service

func (*Service) Enable

func (s *Service) Enable() error

Jump to

Keyboard shortcuts

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