Documentation ¶
Index ¶
- func CheckDirExisted(dir string) bool
- func CheckError(str string, err error)
- func CheckFileExisted(filename string) bool
- func Connect(user, password, host, port, key string) (*ssh.Client, error)
- func CreateDirectory(dir string) bool
- func Datetime2EpochCompact(ts string) int64
- func Datetime2EpochFull(ts string) int64
- func Datetime2EpochNoYear(year, str string) int64
- func Datetime2EpochPlain(ts string) int64
- func Datetime2EpochShort(lastEpoch int64, ts string) int64
- func GetFileModTime(filename string) time.Time
- func GetMyIpMap() map[string]int
- func Interface2Str(inter interface{}) string
- func LocalRun(cmd string) string
- func LocalRunIgnoreError(cmd string) (string, error)
- func MatchAnyRegex(line string, regexArray []*regexp.Regexp) bool
- func RemoveContents(dir string) error
- func RunCmds(client *ssh.Client, cmds string) (string, string)
- func RunCmdsIgnoreError(client *ssh.Client, cmds string) (string, string)
- func RunCmds_async(client *ssh.Client, cmds string, c chan int)
- func Scp(user, password, host, port, key, src, dest string) error
- type DateTimeType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckDirExisted ¶
func CheckError ¶
func CheckFileExisted ¶
func CreateDirectory ¶
func Datetime2EpochCompact ¶
Convert the following DateTime format to epoch: 20190507-221634.23248
func Datetime2EpochFull ¶
Convert the following DateTime format to epoch: 2019-05-07 22:47:09
func Datetime2EpochNoYear ¶
Convert the following DateTime format to epoch: I0507 22:47:09.501549
func Datetime2EpochPlain ¶
Convert the following DateTime format to epoch: %3|1557778930.317
func Datetime2EpochShort ¶
Convert the following DateTime format to epoch: 22:47:09.824235
func GetMyIpMap ¶
Get local ip addresses return a map for better search performance
func Interface2Str ¶
func Interface2Str(inter interface{}) string
func LocalRunIgnoreError ¶
func MatchAnyRegex ¶
Return true when match anyone of the regexArray
func RemoveContents ¶
func RunCmdsIgnoreError ¶
Run commands that might fail
func RunCmds_async ¶
run several commands asynchronously
Types ¶
type DateTimeType ¶
type DateTimeType int
const ( Full DateTimeType = iota // e.g., 2019-05-07 22:47:09 Compact // e.g., 20190507-221634.23248 NoYear // e.g., I/W/E0507 22:16:49.801210 Short // 22:47:09.824235 Epoch // e.g., %3|1557778930.317 Unknown )
func CheckDateTimeType ¶
func CheckDateTimeType(str string) DateTimeType
Determin DateTimeType of a certain timestamp Instead of using regex match (which is too time-consuming), just check some chars in the string