cocoon

package module
v0.0.0-...-a8ac621 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2019 License: MIT Imports: 25 Imported by: 0

README

cocoon

Runtime container

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttachConsole

func AttachConsole() (ok bool)

AttachConsole call win32 AttachConsole

func CloseLog

func CloseLog()

CloseLog close log.

func DefaultMessageBox

func DefaultMessageBox(caption, text string) (result int)

DefaultMessageBox is win32 MessageBox in information mode

func ErrorMessageBox

func ErrorMessageBox(text string) (result int)

ErrorMessageBox is win32 MessageBox in error mode

func FreeConsole

func FreeConsole() (ok bool)

FreeConsole call win32 FreeConsole

func GetAbsolutePath

func GetAbsolutePath(somepath string) string

GetAbsolutePath transforms given path to the absolute path in myself dir if relative. Returns as is if path is absolute.

func GetCocoonAssetName

func GetCocoonAssetName(extension string) string

GetCocoonAssetName returns filename, produced by cocoon exe file name without extension + given extension

func GetConfigFileName

func GetConfigFileName() string

GetConfigFileName returns config file name

func GetMyselfDir

func GetMyselfDir() string

GetMyselfDir returns folder where executable file is.

func GetMyselfName

func GetMyselfName() (string, error)

GetMyselfName returns abs filepath to executable file

func GetNpipeName

func GetNpipeName() string

GetNpipeName constructs npipe name by pid

func GetOutputs

func GetOutputs(folder string, filenamePrefix string) (stdout *os.File, stderr *os.File, err error)

GetOutputs creates stdout and stderr files in specific folder and returns file handlers

func HasConfig

func HasConfig() bool

HasConfig checks is config file is available

func InitCocoon

func InitCocoon()

InitCocoon initialize cocoon

func Initlog

func Initlog(title string, exeFileName string)

Initlog log initialization

func Is64bitOS

func Is64bitOS() bool

Is64bitOS try to call win32 IsWow64Process. Our application must be 32bit to have correct result.

func ListenNpipe

func ListenNpipe() *npipe.PipeListener

ListenNpipe starts npipe listener

func LoadConfig

func LoadConfig() (*initfile.File, error)

LoadConfig if config file is not exists then creates default and load config file

func LogError

func LogError(v ...interface{})

LogError log as error

func LogFatal

func LogFatal(v ...interface{})

LogFatal panic

func LogInfo

func LogInfo(v ...interface{})

LogInfo log as information

func LogWarning

func LogWarning(v ...interface{})

LogWarning log as warinig

func MetamorphoseChrysalisDir

func MetamorphoseChrysalisDir(value string, cfg *initfile.File) bool

MetamorphoseChrysalisDir sets new values in [chrystalis] config section

func MetamorphoseCocoonLoglevel

func MetamorphoseCocoonLoglevel(value string, cfg *initfile.File) bool

MetamorphoseCocoonLoglevel sets new cocoon.log.level config value

func MetamorphoseCocoonLogname

func MetamorphoseCocoonLogname(value string, cfg *initfile.File) bool

MetamorphoseCocoonLogname sets new cocoon.log.file config value

func MetamorphoseCocoonStartup

func MetamorphoseCocoonStartup(value string, cfg *initfile.File) bool

MetamorphoseCocoonStartup sets new cocoon.startup config value

func MetamorphoseCocoonUsepipe

func MetamorphoseCocoonUsepipe(value string, cfg *initfile.File) bool

MetamorphoseCocoonUsepipe sets new cocoon.usepipe value

func MetamorphoseDate

func MetamorphoseDate(cfg *initfile.File)

MetamorphoseDate write new metamorphose date into config

func MetamorphoseInjectChrysalis

func MetamorphoseInjectChrysalis(injectName, injectZip, dropRuntimes string, cfg *initfile.File) bool

MetamorphoseInjectChrysalis extract zip into [chrysalis].dir.base and updates config

func MetamorphoseLarvaStartup

func MetamorphoseLarvaStartup(value string, cfg *initfile.File) bool

MetamorphoseLarvaStartup sets new [larva].startup config value

func SetLogLevel

func SetLogLevel(level Severity)

SetLogLevel sets log level

func ShouldMetamorph

func ShouldMetamorph(params []string) bool

ShouldMetamorph returns true if params contain "metamorphose" keyword

func Start

func Start(startupCmdFile, logFileName string, cocoon *Cocoon)

Start cocoon container

func StartCmdScript

func StartCmdScript(scriptName string, attr *os.ProcAttr) *os.Process

StartCmdScript starts %COMSPEC% (cmd.exe expected) with scriptName as /C argument value.

func StartCmdScripts

func StartCmdScripts(scriptNames []string, attr *os.ProcAttr) *os.Process

StartCmdScripts creates sequence '"script1" && "script2" && ...' and call %COMSPEC% (cmd.exe) with this sequence as /C value

func Stop

func Stop()

Types

type Cocoon

type Cocoon struct {
	ArchStr           string
	Path              string `validate:"fileExists"`
	Startup           string
	ChrystalisPath    string `validate:"fileExists"`
	ChrystalisStartup string
	LarvaPath         string `validate:"fileExists"`
	LarvaStartup      string `validate:"fileExists"`
	UsePipe           bool
	LogPath           string
}

Cocoon configuration structure

func DefaultCocoon

func DefaultCocoon(startupCmdFile string, is64bit bool) Cocoon

DefaultCocoon creates new Cocoon object with default values.

func NewCocoon

func NewCocoon(cfg *initfile.File, is64bit bool) Cocoon

NewCocoon creates new Coocon object, based on config file content.

func (Cocoon) String

func (cocoon Cocoon) String() string

type Severity

type Severity int

Severity is log severity level.

func GetLogLevel

func GetLogLevel() Severity

GetLogLevel returns current log level

func ParseLogLevel

func ParseLogLevel(levelString string) Severity

ParseLogLevel convert string to Severity

Jump to

Keyboard shortcuts

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