apufferi

package module
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const MaxRecursivePath = 256

Variables

This section is empty.

Functions

func Close

func Close(closer io.Closer)

func ContainsScope added in v3.0.3

func ContainsScope(arr []scope.Scope, value scope.Scope) bool

func ContainsString added in v3.0.3

func ContainsString(arr []string, value string) bool

func ContainsValue deprecated

func ContainsValue(arr []string, value string) bool

Deprecated: Use ContainsString instead

func Convert added in v3.0.7

func Convert(val interface{}, target interface{}) (interface{}, error)

Converts the val parameter to the same type as the target

func CopyFile

func CopyFile(src, dest string) error

func EnsureAccess

func EnsureAccess(source string, prefix string) bool

func GetBooleanOrDefault

func GetBooleanOrDefault(data map[string]interface{}, key string, def bool) bool

func GetMapOrNull

func GetMapOrNull(data map[string]interface{}, key string) map[string]interface{}

func GetObjectArrayOrNull

func GetObjectArrayOrNull(data map[string]interface{}, key string) []interface{}

func GetStringArrayOrNull

func GetStringArrayOrNull(data map[string]interface{}, key string) []string

func GetStringOrDefault

func GetStringOrDefault(data map[string]interface{}, key string, def string) string

func JoinPath

func JoinPath(paths ...string) string
func RemoveInvalidSymlinks(files []os.FileInfo, sourceFolder, prefix string) []os.FileInfo

func ReplaceTokens

func ReplaceTokens(msg string, mapping map[string]interface{}) string

func ReplaceTokensInArr

func ReplaceTokensInArr(msg []string, mapping map[string]interface{}) []string

func ReplaceTokensInMap

func ReplaceTokensInMap(msg map[string]string, mapping map[string]interface{}) map[string]string

func ToString added in v3.0.1

func ToString(v interface{}) string

func ToStringArray

func ToStringArray(element interface{}) []string

DEPRECATED: Use conversion library

Types

type Cache

type Cache interface {
	Read() (cache []string, epoch int64)

	ReadFrom(startTime int64) (cache []string, epoch int64)

	Write(b []byte) (n int, err error)
}

type Claim added in v3.0.2

type Claim struct {
	jwt.StandardClaims
	PanelClaims PanelClaims `json:"pufferpanel,omitempty"`
}

type Error

type Error interface {
	error

	GetMessage() string

	GetCode() string

	Is(Error) bool

	Metadata(metadata map[string]interface{}) Error
}

func CreateError

func CreateError(msg, code string) Error

func FromError

func FromError(err error) Error

type Execution

type Execution struct {
	Arguments               []string           `json:"arguments,omitempty"`
	ProgramName             string             `json:"program,omitempty"`
	StopCommand             string             `json:"stop,omitempty"`
	Disabled                bool               `json:"disabled,omitempty"`
	AutoStart               bool               `json:"autostart,omitempty"`
	AutoRestartFromCrash    bool               `json:"autorecover,omitempty"`
	AutoRestartFromGraceful bool               `json:"autorestart,omitempty"`
	PreExecution            []TypeWithMetadata `json:"pre,omitempty"`
	PostExecution           []TypeWithMetadata `json:"post,omitempty"`
	StopCode                int                `json:"stopCode,omitempty"`
	EnvironmentVariables    map[string]string  `json:"environmentVars,omitempty"`
}

type MemoryCache

type MemoryCache struct {
	Cache
	Buffer   []Message
	Capacity int
}

func (*MemoryCache) Read

func (c *MemoryCache) Read() (msg []string, lastTime int64)

func (*MemoryCache) ReadFrom

func (c *MemoryCache) ReadFrom(startTime int64) (msg []string, lastTime int64)

func (*MemoryCache) Write

func (c *MemoryCache) Write(b []byte) (n int, err error)

type Message

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

type PanelClaims added in v3.0.2

type PanelClaims struct {
	Scopes map[string][]scope.Scope `json:"scopes"`
}

type Server

type Server struct {
	Variables      map[string]Variable `json:"data,omitempty"`
	Display        string              `json:"display,omitempty"`
	Environment    TypeWithMetadata    `json:"environment,omitempty"`
	Installation   []TypeWithMetadata  `json:"install,omitempty"`
	Uninstallation []TypeWithMetadata  `json:"uninstall,omitempty"`
	Type           string              `json:"type,omitempty"`
	Identifier     string              `json:"id,omitempty"`
	Execution      Execution           `json:"run,omitempty"`
}

type Template

type Template struct {
	Server
	SupportedEnvironments []TypeWithMetadata `json:"supportedEnvironments,omitEmpty"`
}

type Token added in v3.0.2

type Token struct {
	*jwt.Token
	Claims *Claim
}

func ParseToken added in v3.0.2

func ParseToken(publicKey *ecdsa.PublicKey, token string) (*Token, error)

type TypeWithMetadata

type TypeWithMetadata struct {
	Type     string `json:"type,omitempty"`
	Metadata map[string]interface{}
}

designed to be overridden

func (*TypeWithMetadata) ParseMetadata added in v3.0.7

func (t *TypeWithMetadata) ParseMetadata(target interface{}) (err error)

Parses the metadata into the target interface

func (*TypeWithMetadata) UnmarshalJSON added in v3.0.7

func (t *TypeWithMetadata) UnmarshalJSON(bs []byte) (err error)

parses a type with this declaration, storing what it needs into metadata and type

type Variable

type Variable struct {
	Description  string           `json:"desc,omitempty"`
	Display      string           `json:"display,omitempty"`
	Internal     bool             `json:"internal,omitempty"`
	Required     bool             `json:"required,omitempty"`
	Value        interface{}      `json:"value,omitempty"`
	UserEditable bool             `json:"userEdit,omitempty"`
	Type         string           `json:"type,omitempty"`
	Options      []VariableOption `json:"options,omitempty"`
}

type VariableOption added in v3.0.7

type VariableOption struct {
	Value   string `json:"value"`
	Display string `json:"display"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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