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
- Variables
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func ExecuteFuncsInParallel(fns []func() error) error
- func GOARCHList() []string
- func GOOSList() []string
- func GatherInstalledGoPackages() map[string]Pkg
- func IsBuildSpecificFile(fn string) bool
- func IsValidArch(s string) bool
- func IsValidOS(s string) bool
- func List(opts PkgOptions) (map[string]Pkg, error)
- func MustAsset(name string) []byte
- func RandAlphaNumericString(strlen int) string
- func RandLowerAlphaString(strlen int) string
- func RandMixedAlphaNumericString(n int) string
- func RandUpperAlphaNumericString(strlen int) string
- func RandUpperAlphaString(strlen int) string
- func RandomInt(min, max int) int
- func ResolveEngineDir() (targetDir string, err error)
- func ResolveGenesisPackageDir() (targetDir string, err error)
- func ResolveGoPath() string
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- func SourceFileIsTest(src string) bool
- func ValidArchList() []string
- func ValidOSList() []string
- type Options
- type Pkg
- type PkgOptions
Constants ¶
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 ¶
var ( // GOOS maintains a cache of valid go OS's GOOS = GOOSList() // GOARCH maintains a cache of valid go architectures GOARCH = GOARCHList() )
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() )
var Logger logger.Logger
Functions ¶
func Asset ¶
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 ¶
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 ¶
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 ExecuteFuncsInParallel ¶
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 GatherInstalledGoPackages ¶
GatherInstalledGoPackages retrieves a list of all installed go packages in the context of current GOPATH and GOROOT
func IsBuildSpecificFile ¶
IsBuildSpecificFile tests a file to see if it's got platform specific naming to it's convention
func IsValidArch ¶
IsValidArch 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 ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RandAlphaNumericString ¶
RandAlphaNumericString creates a random lowercase alpha-numeric string of a given length
func RandLowerAlphaString ¶
RandLowerAlphaString creates a random lowercase alpha-only string of a given length
func RandMixedAlphaNumericString ¶
RandMixedAlphaNumericString creates a random mixed-case alpha-numeric string of a given length
func RandUpperAlphaNumericString ¶
RandUpperAlphaNumericString creates a random uppercase alpha-numeric string of a given length
func RandUpperAlphaString ¶
RandUpperAlphaString creates a random uppercase alpha-only string of a given length
func ResolveEngineDir ¶
ResolveEngineDir attempts to resolve the absolute path of the genesis engine directory
func ResolveGenesisPackageDir ¶
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 ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
func SourceFileIsTest ¶
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 ¶
AssetDir returns the file path to the asset build directory of the compiler
func (Options) CheckForConfigErrors ¶
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 ResolveStandardLibraryDir ¶
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.