gomini

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

README

gomini

Documentation

Overview

util.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CmdRunWithTimeout

func CmdRunWithTimeout(cmd *exec.Cmd, timeout time.Duration) (error, bool)

func DelFile

func DelFile(files []os.FileInfo, count int, fileDir string)

如果文件达到最上限,按时间删除

func Exec

func Exec(bin string, args ...string) (string, error)

func ExecWithTimeout

func ExecWithTimeout(bin string, timeout time.Duration, args ...string) (string, error)

func FileGetContent

func FileGetContent(file string) (string, error)

get string from text file

func FileMTime

func FileMTime(file string) (int64, error)

get file modified time

func FilePutContent

func FilePutContent(file string, content string) (int, error)

put string to file

func FileSize

func FileSize(file string) (int64, error)

get file size as how many bytes

func GetInt64Str

func GetInt64Str(d int64) string

func GetIntStr

func GetIntStr(d int) string

func GetIpMask

func GetIpMask(start, end string) string

func GetStrBool

func GetStrBool(strv string, def ...bool) (bool, error)

func GetStrFloat

func GetStrFloat(strv string, def ...float64) (float64, error)

func GetStrFloat64

func GetStrFloat64(strv string, def ...float64) (float64, error)

func GetStrInt

func GetStrInt(strv string, def ...int) (int, error)

func GetStrInt16

func GetStrInt16(strv string, def ...int16) (int16, error)

func GetStrInt32

func GetStrInt32(strv string, def ...int32) (int32, error)

func GetStrInt64

func GetStrInt64(strv string, def ...int64) (int64, error)

func GetStrInt8

func GetStrInt8(strv string, def ...int8) (int8, error)

func GetStrUint

func GetStrUint(strv string, def ...uint) (uint, error)

func GetStrUint16

func GetStrUint16(strv string, def ...uint16) (uint16, error)

func GetStrUint32

func GetStrUint32(strv string, def ...uint32) (uint32, error)

func GetStrUint64

func GetStrUint64(strv string, def ...uint64) (uint64, error)

func GetStrUint8

func GetStrUint8(strv string, def ...uint8) (uint8, error)

func GetTimeAgo

func GetTimeAgo(t int64) (s string)

func GetUint64Str

func GetUint64Str(d uint64) string

func GetUintStr

func GetUintStr(d uint) string

func Ip2long

func Ip2long(ipstr string) (ip uint32)

func IsExist

func IsExist(path string) bool

IsExist returns whether a file or directory exists.

func IsFile

func IsFile(file string) bool

it returns false when it's a directory or does not exist.

func IsPrivateIP

func IsPrivateIP(ip string) bool

判断IP地址是否为预留ip

func Long2ip

func Long2ip(ip uint32) string

func Mkdir

func Mkdir(src string) error

create dir

func Remove

func Remove(file string) error

delete file

func RemoveAll

func RemoveAll(path string) error

RemoveAll删除path指定的文件,或目录及它包含的任何下级对象。它会尝试删除所有东西,除非遇到错误并返回。 如果path指定的对象不存在,RemoveAll会返回nil而不返回错误。

func Rename

func Rename(file string, to string) error

rename file name

func Substr

func Substr(s string, start, length int) string

Types

type FileRepos

type FileRepos []Repository

func (FileRepos) Len

func (r FileRepos) Len() int

func (FileRepos) Less

func (r FileRepos) Less(i, j int) bool

func (FileRepos) Swap

func (r FileRepos) Swap(i, j int)

type IpNetmask

type IpNetmask struct {
	Ipaddr    string //IP地址
	Mask      string //IP掩码
	Subnet    string //网络地址
	Broadcast string //广播地址
	IpStart   string //起始IP
	IpEnd     string //结束IP
}

func GetIpAddrs

func GetIpAddrs(ipaddr, mask string, ok bool) (ipNetmask *IpNetmask, ipRangeAddrs []string)

type Repository

type Repository struct {
	Name     string
	FileTime int64
}

Directories

Path Synopsis
aes.go des.go md5.go padding.go rsa.go sha1.go
aes.go des.go md5.go padding.go rsa.go sha1.go

Jump to

Keyboard shortcuts

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