utils

package
v0.0.0-...-20155fc Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2018 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// sub director
	SUB_DIR_CONF    = "conf"
	SUB_DIR_LUALIBS = "lualibs"
	SUB_DIR_PLUGINS = "plugins"
	SUB_DIR_MODULES = "modules"
	SUB_DIR_TEMP    = "tmp"
)
View Source
const (
	DEFAULT_TERM_NAME   = "vt100"
	DEFAULT_TERM_HEIGHT = 80
	DEFAULT_TERM_WIDTH  = 40
)
View Source
const (
	DEFAULT_TERM_ECHO     = 0     // disable echoing
	DEFAULT_TERM_ISIG     = 1     // Enable signals INTR, QUIT, [D]SUSP.
	DEFAULT_TTY_OP_ISPEED = 14400 // input speed = 14.4kbaud
	DEFAULT_TTY_OP_OSPEED = 14400 // output speed = 14.4kbaud
)

Variables

This section is empty.

Functions

func Boolean

func Boolean(value interface{}, strict bool) (bool, error)

func CheckBecomeErrorString

func CheckBecomeErrorString(buffer []byte, method, username string) error

func CheckBecomeMethod

func CheckBecomeMethod(method string) bool

find become method return true if found else false

func CheckBecomeUnknownExec

func CheckBecomeUnknownExec(buffer []byte, method, becomeExe string) error

func CheckBecomeUnknownExecutable

func CheckBecomeUnknownExecutable(buffer []byte, method, executable string) error

func CheckBecomeUnknownUser

func CheckBecomeUnknownUser(buffer []byte, method, username string) error

check unknown user for become

func DefaultTerminalModels

func DefaultTerminalModels() ssh.TerminalModes

func EnsurePath

func EnsurePath(path string, dir bool) error

EnsurePath is used to make sure a path exists

func FindUsername

func FindUsername(username string) string

find username return curren login name or root as username if username is empty

func GenHashCode

func GenHashCode(str string) uint

func GenHashDir

func GenHashDir(name string, ismd5 bool) []string

func GenMd5

func GenMd5(name string) string

genrate md5

func GenName

func GenName(name string) string

use goid as name if name is empty

func GoId

func GoId() (int, error)

func IndexOf

func IndexOf(array, val interface{}) int

func InitHomeDir

func InitHomeDir(programName string) error

initialize working directory structure

func IsIPV4

func IsIPV4(ip string) bool

func IsIPV6

func IsIPV6(ip string) bool

func ProgramHomeDir

func ProgramHomeDir(programName string, disableCache bool) (string, error)

func RandBytes

func RandBytes(n int) []byte

func RandKey

func RandKey() string

func ShlexJoin

func ShlexJoin(args ...string) string

func ShlexQuote

func ShlexQuote(s string) string

func ShlexSplit

func ShlexSplit(s string) ([]string, error)

func TerminalHeight

func TerminalHeight(h int) int

func TerminalName

func TerminalName(name string) string

func TerminalSize

func TerminalSize(h, w int) (int, int)

func TerminalWidth

func TerminalWidth(w int) int

Types

This section is empty.

Jump to

Keyboard shortcuts

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