Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyConfigFile(filePath string, options ...interface{}) error
- func ApplyDefaultValues(strt interface{}) (err error)
- func ApplyFlags(flags []cli.Flag, fMap map[string]string, c *cli.Context, ...)
- func Exit(err error, code int)
- func GenerateFlags(options ...interface{}) ([]cli.Flag, map[string]string)
- func InitConfig()
- func InitLog()
- func InitLoggerLogrotate(logPath, logFileName, level, format string, maxAge time.Duration, ...)
- func NewLogger(logPath, fileName, level, typeof string) *logrus.Logger
- func Stack() []byte
- func WatchConfig()
- type Options
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 ¶
ApplyConfigFile apply configure flags
func ApplyDefaultValues ¶
func ApplyDefaultValues(strt interface{}) (err error)
ApplyDefaultValues set the default value if no parameters are passed
func ApplyFlags ¶
ApplyFlags apply command flags
func GenerateFlags ¶
GenerateFlags Generate command line flags
func InitLoggerLogrotate ¶
func InitLoggerLogrotate(logPath, logFileName, level, format string, maxAge time.Duration, rotationTime time.Duration)
InitLoggerLogrotate initialize the log file system
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
Click to show internal directories.
Click to hide internal directories.