computil

package
v0.0.0-...-6065391 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Code generated for package computil by go-bindata DO NOT EDIT. (@generated) sources: compiler/templates/debugger.gs compiler/templates/entrypoint.go.tmpl compiler/templates/hard_reserved compiler/templates/obfstring.go.tmpl compiler/templates/preload.gs compiler/templates/soft_reserved compiler/templates/vm_file.go.tmpl

Index

Constants

View Source
const (
	// FullObfuscation tells the compiler to perform all available obfuscation techniques
	FullObfuscation = iota

	// NoPostObfuscation tells the compiler to only perform post compilation obfuscation techniques
	NoPostObfuscation

	// NoPreObfuscation tells the compiler to only perform pre compilation obfuscation techniques
	NoPreObfuscation

	// NoObfuscation tells the compiler not to perform any available obfuscation techniques
	NoObfuscation
)

Variables

View Source
var (
	// GOOS maintains a cache of valid go OS's
	GOOS = GOOSList()

	// GOARCH maintains a cache of valid go architectures
	GOARCH = GOARCHList()
)
View Source
var (

	// GenesisLibs is the name of the packages within the genesis standard library
	GenesisLibs = map[string]bool{
		"crypto":   true,
		"encoding": true,
		"exec":     true,
		"file":     true,
		"net":      true,
		"os":       true,
		"rand":     true,
		"requests": true,
		"time":     true,
	}

	// InstalledGoPackages holds a cache of all currently installed golang libraries
	InstalledGoPackages = GatherInstalledGoPackages()
)

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func ExecuteFuncsInParallel

func ExecuteFuncsInParallel(fns []func() error) error

ExecuteFuncsInParallel is a meta function that takes an array of function pointers (hopefully for each VM) and executes them in parallel to decrease compile times. This is setup to handle errors within each VM gracefully and not allow a goroutine to fail silently.

func GOARCHList

func GOARCHList() []string

GOARCHList returns a slice of all possible go architectures

func GOOSList

func GOOSList() []string

GOOSList returns a slice of all possible go architectures

func GatherInstalledGoPackages

func GatherInstalledGoPackages() map[string]Pkg

GatherInstalledGoPackages retrieves a list of all installed go packages in the context of current GOPATH and GOROOT

func IsBuildSpecificFile

func IsBuildSpecificFile(fn string) bool

IsBuildSpecificFile tests a file to see if it's got platform specific naming to it's convention

func IsValidArch

func IsValidArch(s string) bool

IsValidArch checks to see if the supplied string is a valid operating system target

func IsValidOS

func IsValidOS(s string) bool

IsValidOS checks to see if the supplied string is a valid operating system target

func List

func List(opts PkgOptions) (map[string]Pkg, error)

List packages on workDir. workDir is required for module mode. If the workDir is not under module, then it will fallback to GOPATH mode.

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RandAlphaNumericString

func RandAlphaNumericString(strlen int) string

RandAlphaNumericString creates a random lowercase alpha-numeric string of a given length

func RandLowerAlphaString

func RandLowerAlphaString(strlen int) string

RandLowerAlphaString creates a random lowercase alpha-only string of a given length

func RandMixedAlphaNumericString

func RandMixedAlphaNumericString(n int) string

RandMixedAlphaNumericString creates a random mixed-case alpha-numeric string of a given length

func RandUpperAlphaNumericString

func RandUpperAlphaNumericString(strlen int) string

RandUpperAlphaNumericString creates a random uppercase alpha-numeric string of a given length

func RandUpperAlphaString

func RandUpperAlphaString(strlen int) string

RandUpperAlphaString creates a random uppercase alpha-only string of a given length

func RandomInt

func RandomInt(min, max int) int

RandomInt returns a random integer between a min and max value

func ResolveEngineDir

func ResolveEngineDir() (targetDir string, err error)

ResolveEngineDir attempts to resolve the absolute path of the genesis engine directory

func ResolveGenesisPackageDir

func ResolveGenesisPackageDir() (targetDir string, err error)

ResolveGenesisPackageDir attempts to resolve the base directory for the genesis package

func ResolveGoPath

func ResolveGoPath() string

ResolveGoPath attempts to resolve the current user's GOPATH

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

func SourceFileIsTest

func SourceFileIsTest(src string) bool

SourceFileIsTest determines if the given source file is named after the test convention

func ValidArchList

func ValidArchList() []string

ValidArchList returns the list of valid architectures

func ValidOSList

func ValidOSList() []string

ValidOSList returns the list of valid target operating systems

Types

type Options

type Options struct {
	// Extra args that will be passed to 'go build'
	// DEFAULT: ""
	BuildArgs string `json:"build_args,omitempty"`

	// Compile as a GUI application for windows
	// DEFAULT: false
	WindowsGui bool `json:"windowsgui,omitempty"`

	// Target operating system
	// DEFAULT: current operating system
	OS string `json:"os,omitempty"`

	// Target architecture
	// DEFAULT: current operating system's architecture
	Arch string `json:"arch,omitempty"`

	// Location of final binary output
	// DEFAULT: a file located in your OS's temp directory
	OutputFile string `json:"output_file,omitempty"`

	// Location of build directory
	// DEFAULT: a folder within your OS's temp directory
	BuildDir string `json:"build_dir,omitempty"`

	// Do not delete your build directory after successful compilation
	// DEFAULT: false
	SaveBuildDir bool `json:"save_build_dir,omitempty"`

	// Compress the final binary with UPX to reduce file size
	// DEFAULT: false
	UPXEnabled bool `json:"upx_enabled,omitempty"`

	// Inject a genesis logger into the engine to show console output (good for testing/bad for production)
	// DEFAULT: false
	LoggingEnabled bool `json:"logging_enabled,omitempty"`

	// Inject an interactive debugger into the executable so DebugConsole() can be called.
	// DEFAULT: false
	DebuggerEnabled bool `json:"debugger_enabled,omitempty"`

	// Do not actually compile into a native binary for the target OS and Arch - stop after generating intermediate representation.
	// DEFAULT: false
	SkipCompilation bool `json:"skip_compilation,omitempty"`

	// Do not obfuscate the IDs of the various packages and gscript VM bundle IDs
	// DEFAULT: false
	UseHumanReadableNames bool `json:"use_human_readable_names,omitempty"`

	// Import all native functions into the virtual machine from native go packages, not just ones used in the script
	// DEFAULT: false
	ImportAllNativeFuncs bool `json:"import_all_native_funcs,omitempty"`

	// Expirimental: force enable the Modorifier post compilation obfuscator (warning: there be dragons)
	// DEFAULT: false
	ForceUseMordorifier bool `json:"force_use_mordorifier,omitempty"`

	// Determines the compilers level of obfuscation performed on the final binary
	// DEFAULT: 0 (look at compiler const for available options)
	ObfuscationLevel int `json:"obfuscation_level,omitempty"`

	// Used to attach the test harness into the genesis VM
	// DEFAULT: false
	EnableTestBuild bool `json:"enable_test_build,omitempty"`

	// Used to describe the genesis dir on this machine
	// DEFAULT: Discovered through GOPATH
	GenesisDir string `json:"genesis_dir"`

	// Tell the compiler to use garble instead of just go
	// DEFAULT: go
	EnableGarble bool `json:"enable_garble"`
}

Options defines a type to allow customization of a compiler at runtime

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns an Options object with all default options pre-filled

func (Options) AssetDir

func (o Options) AssetDir() string

AssetDir returns the file path to the asset build directory of the compiler

func (Options) CheckForConfigErrors

func (o Options) CheckForConfigErrors() error

CheckForConfigErrors examines the options to determine if there is any conflicting settings

type Pkg

type Pkg struct {
	Dir        string // directory containing package sources
	ImportPath string // import path of package in dir
	Name       string // package name
	Standard   bool   // is this package part of the standard Go library?
}

Pkg hold the information of the package.

func ResolveGlobalImport

func ResolveGlobalImport(pkg string) (*Pkg, error)

func ResolveStandardLibraryDir

func ResolveStandardLibraryDir(pkg string) (*Pkg, error)

ResolveStandardLibraryDir attempts to resolve the absolute path of the specified standard library package

type PkgOptions

type PkgOptions struct {
	WorkDir  string // Will return importable package under WorkDir. Any vendor dependencies outside the WorkDir will be ignored.
	NoVendor bool   // Will not retrieve vendor dependencies, except inside WorkDir (if specified)
}

Options for retrieve packages.

Jump to

Keyboard shortcuts

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