tool

package
v0.0.0-...-f9d70ec Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ENOEXEC Exec format error
	ENOEXEC = 8

	// EINVAL Invalid argument
	EINVAL = 22

	// CannotExecCode command invoked cannot execute
	CannotExecCode = 0x7E

	// InvalidArgsCode invalid argument to exit
	InvalidArgsCode = 0x80
)
View Source
const (
	// ProcessName process name
	ProcessName string = "caracal-pty"

	// Usage usage infomation.
	Usage = "Caracal pty."

	// ForceExitTime force exit time
	ForceExitTime = 15 // second
)

Process manager

Variables

View Source
var (
	// ConfPath Configuration file path
	ConfPath string = "./conf/hcl/conf.hcl"

	// ConfName Configuration file name
	ConfName string = "config"

	// ConfUsage Configuration file usage
	ConfUsage string = "Config file path"

	// ConfEnvVars Configuration Environment variable
	ConfEnvVars []string = []string{"CARACAL_PTY_CONFIG"}

	// ConfDir configuration path
	ConfDir string = "./conf/yaml/"
)

Configure file

View Source
var (
	// Config returns an initialized Viper instance
	Config = viper.New()
)
View Source
var Log = &logrus.Entry{
	Logger: logger,
}

Log export outside

Functions

func ApplyConfigFile

func ApplyConfigFile(filePath string, options ...interface{}) error

ApplyConfigFile apply configure flags

func ApplyDefaultValues

func ApplyDefaultValues(strt interface{}) (err error)

ApplyDefaultValues set the default value if no parameters are passed

func ApplyFlags

func ApplyFlags(flags []cli.Flag, fMap map[string]string, c *cli.Context, options ...interface{})

ApplyFlags apply command flags

func Exit

func Exit(err error, code int)

Exit exit process

func GenerateFlags

func GenerateFlags(options ...interface{}) ([]cli.Flag, map[string]string)

GenerateFlags Generate command line flags

func InitConfig

func InitConfig()

InitConfig initialize the configuration file

func InitLog

func InitLog()

InitLog initialize the log

func InitLoggerLogrotate

func InitLoggerLogrotate(logPath, logFileName, level, format string, maxAge time.Duration, rotationTime time.Duration)

InitLoggerLogrotate initialize the log file system

func NewLogger

func NewLogger(logPath, fileName, level, typeof string) *logrus.Logger

NewLogger need linux logrotate process split log

func Stack

func Stack() []byte

Stack pid stack buf

func WatchConfig

func WatchConfig()

WatchConfig automatic discovery configuration

Types

type Options

type Options struct {
	Address       string `hcl:"address" flagName:"address" flagSName:"a" flagDescribe:"IP address to listen" default:"0.0.0.0"`
	Port          string `hcl:"port" flagName:"port" flagSName:"p" flagDescribe:"Port number to liten" default:"8080"`
	Term          string `` /* 131-byte string literal not displayed */
	TitleFormat   string `` /* 142-byte string literal not displayed */
	Maxconnection int    `hcl:"max_connection" flagName:"max-connection" flagDescribe:"Maximum connection to gotty" default:"0"`
	Timeout       int    `hcl:"timeout" flagName:"timeout" flagSName:"" flagDescribe:"Timeout seconds for waiting a client(0 to disable)" default:"0"`
	Width         int    `` /* 132-byte string literal not displayed */
	Height        int    `` /* 135-byte string literal not displayed */
	PermitWrite   bool   `` /* 135-byte string literal not displayed */

	TitleVariable map[string]interface{}
}

Options command line options

Jump to

Keyboard shortcuts

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