plugin

package module
v1.10.6 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: GPL-3.0 Imports: 6 Imported by: 0

README

Release Software License Go Report Card Docs

islazy is a Go library containing a set of opinionated packages, objects, helpers and functions implemented with the KISS principle in mind that I often use in my projects.

go get -u github.com/evilsocket/islazy

Examples for each package can be found in the examples folder.

Who's using islazy?

If your project is using this library add it to this README and send a PR!

License

This library was made with ♥ by Simone Margaritelli and it's released under the GPL 3 license.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Defines = map[string]interface{}{}

Defines is a map containing the predefined objects and functions for each vm of each plugin.

Functions

This section is empty.

Types

type Plugin

type Plugin struct {
	sync.Mutex
	// The basename of the plugin.
	Name string
	// The actual javascript code.
	Code string
	// The full path of the plugin.
	Path string
	// contains filtered or unexported fields
}

Plugin is an object representing a javascript file exporting functions and variables that your project can use to extend its functionalities.

func Load

func Load(path string) (plug *Plugin, err error)

Load loads and compiles a plugin given its path.

func Parse

func Parse(code string) (*Plugin, error)

Parse parsesand compiles a plugin given its source code.

func (*Plugin) Call

func (p *Plugin) Call(name string, args ...interface{}) (interface{}, error)

Call executes one of the declared callbacks of the plugin by its name.

func (*Plugin) Clone

func (p *Plugin) Clone() (clone *Plugin)

Clone returns a new instance identical to the plugin.

func (*Plugin) GetObject

func (p *Plugin) GetObject(name string) (interface{}, error)

GetObject returns an interface containing the value of the object by its name

func (*Plugin) GetTypeObject

func (p *Plugin) GetTypeObject(name string) string

GetTypeObject returns the type of the object by its name

func (*Plugin) HasFunc

func (p *Plugin) HasFunc(name string) bool

HasFunc returns true if the function with `name` has been declared in the plugin code.

func (*Plugin) IsArrayObject

func (p *Plugin) IsArrayObject(name string) bool

IsArrayObject returns true if the object with a given name is a javascript array object, false otherwise

func (*Plugin) IsBooleanObject

func (p *Plugin) IsBooleanObject(name string) bool

IsBooleanObject returns true if the object with a given name is a javascript boolean object, false otherwise

func (*Plugin) IsBooleanPrimitive

func (p *Plugin) IsBooleanPrimitive(name string) bool

IsBooleanPrimitive returns true if the object with a given name is a javascript primitive boolean, false otherwise

func (*Plugin) IsDateObject

func (p *Plugin) IsDateObject(name string) bool

IsDateObject returns true if the object with a given name is a javascript Date object, false otherwise

func (*Plugin) IsErrorObject

func (p *Plugin) IsErrorObject(name string) bool

IsErrorObject returns true if the object with a given name is a javascript error object, false otherwise

func (*Plugin) IsNumberObject

func (p *Plugin) IsNumberObject(name string) bool

IsNumberObject returns true if the object with a given name is a javascript Number object, false otherwise

func (*Plugin) IsNumberPrimitive

func (p *Plugin) IsNumberPrimitive(name string) bool

IsNumberPrimitive returns true if the object with a given name is a javascript primitive number, false otherwise

func (*Plugin) IsRegExpObject

func (p *Plugin) IsRegExpObject(name string) bool

IsRegExpObject returns true if the object with a given name is a javascript RegExp object, false otherwise

func (*Plugin) IsStringObject

func (p *Plugin) IsStringObject(name string) bool

IsStringObject returns true if the object with a given name is a javascript string object, false otherwise

func (*Plugin) IsStringPrimitive

func (p *Plugin) IsStringPrimitive(name string) bool

IsStringPrimitive returns true if the object with a given name is a javascript primitive string

func (*Plugin) Methods

func (p *Plugin) Methods() []string

Methods returns a list of methods exported from the javascript

func (*Plugin) Objects

func (p *Plugin) Objects() []string

Objects returns a list of object exported by the javascript

func (*Plugin) Set

func (p *Plugin) Set(name string, v interface{}) error

Set sets a variable into the VM of this plugin instance.

Directories

Path Synopsis
Package async contains a set of helper objects for async tasks and job queues.
Package async contains a set of helper objects for async tasks and job queues.
Package data contains basic threadsafe data structures with filesystem persistance and configurable flushing policies.
Package data contains basic threadsafe data structures with filesystem persistance and configurable flushing policies.
Package fs contains helper functions for file system access and enumeration.
Package fs contains helper functions for file system access and enumeration.
Package log provides access to log functions.
Package log provides access to log functions.
Package ops contains helper operators.
Package ops contains helper operators.
Package plugin contains objects and functions to load and use javascript plugins in order to extend the functionalities of your projects.
Package plugin contains objects and functions to load and use javascript plugins in order to extend the functionalities of your projects.
Package str contains utilities for string manipulation.
Package str contains utilities for string manipulation.
Package tui contains a set of helper objects and functions for terminal based user interfaces.
Package tui contains a set of helper objects and functions for terminal based user interfaces.
Package version contains information about the library version.
Package version contains information about the library version.
Package zip contains zip and unzip utilities.
Package zip contains zip and unzip utilities.

Jump to

Keyboard shortcuts

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