Documentation ¶
Index ¶
- Constants
- Variables
- func CopyGopath(ctx build.Context, packageName string, newGopath string, keepTests bool) bool
- func Gobfuscate(config gogo.GoConfig, encKey string, pkgName string, outPath string, ...) (string, error)
- func MovePackage(ctxt *build.Context, from, to, moveTmpl string) error
- func ObfuscatePackageNames(ctx build.Context, gopath string, enc *Encrypter) error
- func ObfuscateStrings(gopath string) error
- func ObfuscateSymbols(ctx build.Context, gopath string, enc *Encrypter) error
- func Rename(ctxt *build.Context, offsetFlag, fromFlag, to string) error
- type Encrypter
Constants ¶
const GoExtension = ".go"
GoExtension - Go src code file extension
Variables ¶
var ( // Force enables patching of the source files even if conflicts were reported. // The resulting program may be ill-formed. // It may even cause gorename to crash. TODO(adonovan): fix that. Force = true // This ensure we ignore any "DO NOT EDIT"s // Diff causes the tool to display diffs instead of rewriting files. Diff bool // DiffCmd specifies the diff command used by the -d feature. // (The command must accept a -u flag and two filename arguments.) DiffCmd = "diff" // ConflictError is returned by Main when it aborts the renaming due to conflicts. // (It is distinguished because the interesting errors are the conflicts themselves.) ConflictError = errors.New("renaming aborted due to conflicts") // Verbose enables extra logging. Verbose bool )
IgnoreMethods - Methods to skip when obfuscating
var SkipRenames = map[string]bool{ "_": true, "int32ptr": true, "atomicLock": true, "grow": true, }
SkipRenames - Skip renaming these symbols
Functions ¶
func CopyGopath ¶
CopyGopath - Creates a new Gopath with a copy of a package and all of its dependencies.
func Gobfuscate ¶
func Gobfuscate(config gogo.GoConfig, encKey string, pkgName string, outPath string, symbols bool) (string, error)
Gobfuscate - Obfuscate Go code
func MovePackage ¶
Move, given a package path and a destination package path, will try to move the given package to the new path. The Move function will first check for any conflicts preventing the move, such as a package already existing at the destination package path. If the move can proceed, it builds an import graph to find all imports of the packages whose paths need to be renamed. This includes uses of the subpackages of the package to be moved as those packages will also need to be moved. It then renames all imports to point to the new paths, and then moves the packages to their new paths.
func ObfuscatePackageNames ¶
ObfuscatePackageNames - Obfuscate package names
func ObfuscateStrings ¶
ObfuscateStrings - Obfuscate strings in a given gopath, skips canaries
func ObfuscateSymbols ¶
ObfuscateSymbols - Obfuscate binary symbols