Documentation ¶
Index ¶
- Constants
- Variables
- func Bool(v bool) *bool
- func BoolMap(src map[string]bool) map[string]*bool
- func BoolSlice(src []bool) []*bool
- func BoolValue(v *bool) bool
- func BoolValueMap(src map[string]*bool) map[string]bool
- func BoolValueSlice(src []*bool) []bool
- func BytesSliceEqual(a, b []byte) bool
- func CheckAndCreateDir(path string) error
- func CheckAndCreateDirByMode(path string, mode os.FileMode) error
- func CheckIP(ip string) bool
- func CmdExec(args string) (string, error)
- func CmdRunWithTimeout(cmd *exec.Cmd, timeout time.Duration) (bool, error)
- func CopyFile(source, target string) error
- func CreateFileHash(sourceFile, hashfile string) error
- func CreateHashString(source string) (hashstr string, err error)
- func CreateHostID() (string, error)
- func CreateVersionByTime() string
- func DecimailFromFloat64(f float64) float64
- func DecimalFromFloat32(f float32) float32
- func Deweight(data *[]string)
- func DirIsEmpty(dir string) bool
- func Elapsed(what string) func()
- func Exec(ctx context.Context, f func() error, wait time.Duration) error
- func FileExists(filename string) (bool, error)
- func FileExistsWithSuffix(pathDir, suffix string) bool
- func Float32(v float32) *float32
- func Float32Map(src map[string]float32) map[string]*float32
- func Float32Slice(src []float32) []*float32
- func Float32Value(v *float32) float32
- func Float32ValueMap(src map[string]*float32) map[string]float32
- func Float32ValueSlice(src []*float32) []float32
- func Float64(v float64) *float64
- func Float64Map(src map[string]float64) map[string]*float64
- func Float64Slice(src []float64) []*float64
- func Float64Value(v *float64) float64
- func Float64ValueMap(src map[string]*float64) map[string]float64
- func Float64ValueSlice(src []*float64) []float64
- func GenOpenSSHKeyPair() ([]byte, []byte, error)
- func GenerateMACAddress() string
- func GetCurrentDir() string
- func GetDirList(dirpath string, level int) ([]string, error)
- func GetDirNameList(dirpath string, level int) ([]string, error)
- func GetDirSize(path string) float64
- func GetDirSizeByCmd(path string) float64
- func GetFileList(dirpath string, level int) ([]string, error)
- func GetFileSize(path string) int64
- func GetIDFromKey(key string) string
- func GetParentDirectory(dirctory string) string
- func Getenv(key, def string) string
- func If[T any](condition bool, trueVal, falseVal T) T
- func Int(v int) *int
- func Int16(v int16) *int16
- func Int16Map(src map[string]int16) map[string]*int16
- func Int16Slice(src []int16) []*int16
- func Int16Value(v *int16) int16
- func Int16ValueMap(src map[string]*int16) map[string]int16
- func Int16ValueSlice(src []*int16) []int16
- func Int32(v int32) *int32
- func Int32Map(src map[string]int32) map[string]*int32
- func Int32Slice(src []int32) []*int32
- func Int32Value(v *int32) int32
- func Int32ValueMap(src map[string]*int32) map[string]int32
- func Int32ValueSlice(src []*int32) []int32
- func Int64(v int64) *int64
- func Int64Map(src map[string]int64) map[string]*int64
- func Int64Slice(src []int64) []*int64
- func Int64Value(v *int64) int64
- func Int64ValueMap(src map[string]*int64) map[string]int64
- func Int64ValueSlice(src []*int64) []int64
- func Int8(v int8) *int8
- func Int8Map(src map[string]int8) map[string]*int8
- func Int8Slice(src []int8) []*int8
- func Int8Value(v *int8) int8
- func Int8ValueMap(src map[string]*int8) map[string]int8
- func Int8ValueSlice(src []*int8) []int8
- func IntMap(src map[string]int) map[string]*int
- func IntSlice(src []int) []*int
- func IntValue(v *int) int
- func IntValueMap(src map[string]*int) map[string]int
- func IntValueSlice(src []*int) []int
- func IntermittentExec(ctx context.Context, f func(), t time.Duration)
- func IsDir(path string) (bool, error)
- func IsEndWithNumber(dir string) (isEndWithNumber bool, suffix string)
- func IsHaveFile(path string) bool
- func LocalIP() (net.IP, error)
- func MergeDir(fromdir, todir string) error
- func MillisecondsTimeValue(v *int64) time.Time
- func NewUUID() string
- func OpenOrCreateFile(filename string) (*os.File, error)
- func ParseVariable(source string, configs map[string]string) string
- func ProfilerSetup(r ServeMux)
- func Ptr[T any](v T) *T
- func ReadHostID(filePath string) (string, error)
- func RemoveSpaces(sources []string) (re []string)
- func Rename(old, new string) error
- func Reverse(source []string) []string
- func SearchFile(pathDir, name string, level int) bool
- func SearchFileBody(filename, searchStr string) bool
- func SecondsTimeValue(v *int64) time.Time
- func SendNoBlocking(m []byte, ch chan []byte)
- func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, err error)
- func String(v string) *string
- func StringArrayContains(list []string, source string) bool
- func StringMap(src map[string]string) map[string]*string
- func StringSlice(src []string) []*string
- func StringValue(v *string) string
- func StringValueMap(src map[string]*string) map[string]string
- func StringValueSlice(src []*string) []string
- func Time(v time.Time) *time.Time
- func TimeMap(src map[string]time.Time) map[string]*time.Time
- func TimeSlice(src []time.Time) []*time.Time
- func TimeUnixMilli(t time.Time) int64
- func TimeValue(v *time.Time) time.Time
- func TimeValueMap(src map[string]*time.Time) map[string]time.Time
- func TimeValueSlice(src []*time.Time) []time.Time
- func ToByte(v string) []byte
- func ToString(b []byte) string
- func Translation(english string) string
- func Uint(v uint) *uint
- func Uint16(v uint16) *uint16
- func Uint16Map(src map[string]uint16) map[string]*uint16
- func Uint16Slice(src []uint16) []*uint16
- func Uint16Value(v *uint16) uint16
- func Uint16ValueMap(src map[string]*uint16) map[string]uint16
- func Uint16ValueSlice(src []*uint16) []uint16
- func Uint32(v uint32) *uint32
- func Uint32Map(src map[string]uint32) map[string]*uint32
- func Uint32Slice(src []uint32) []*uint32
- func Uint32Value(v *uint32) uint32
- func Uint32ValueMap(src map[string]*uint32) map[string]uint32
- func Uint32ValueSlice(src []*uint32) []uint32
- func Uint64(v uint64) *uint64
- func Uint64Map(src map[string]uint64) map[string]*uint64
- func Uint64Slice(src []uint64) []*uint64
- func Uint64Value(v *uint64) uint64
- func Uint64ValueMap(src map[string]*uint64) map[string]uint64
- func Uint64ValueSlice(src []*uint64) []uint64
- func Uint8(v uint8) *uint8
- func Uint8Map(src map[string]uint8) map[string]*uint8
- func Uint8Slice(src []uint8) []*uint8
- func Uint8Value(v *uint8) uint8
- func Uint8ValueMap(src map[string]*uint8) map[string]uint8
- func Uint8ValueSlice(src []*uint8) []uint8
- func UintMap(src map[string]uint) map[string]*uint
- func UintSlice(src []uint) []*uint
- func UintValue(v *uint) uint
- func UintValueMap(src map[string]*uint) map[string]uint
- func UintValueSlice(src []*uint) []uint
- func UnTar(archive, target string, zip bool) error
- func Unzip(archive, target string) error
- func Value[T any](p *T) T
- func Zip(source, target string) error
- type Hosts
- type HostsLine
- type IPEVENT
- type IPEVENTTYPE
- type IPPool
- type PipeCommand
- type SSHClient
- type ServeMux
- type StdType
- type TimeVersion
Constants ¶
const ( //StartOfSection writ hosts start StartOfSection = "# Generate by Wutong. DO NOT EDIT" //EndOfSection writ hosts end EndOfSection = "# End of Section" )
Variables ¶
var StatefulServiceType = "StatefulServiceType"
StatefulServiceType 有状态应用
var StatelessServiceType = "StatelessServiceType"
StatelessServiceType 无状态应用
Functions ¶
func BoolValue ¶
BoolValue returns the value of the bool pointer passed in or false if the pointer is nil.
func BoolValueMap ¶
BoolValueMap converts a string map of bool pointers into a string map of bool values
func BoolValueSlice ¶
BoolValueSlice converts a slice of bool pointers into a slice of bool values
func CheckAndCreateDir ¶
CheckAndCreateDir check and create dir
func CheckAndCreateDirByMode ¶
CheckAndCreateDirByMode check and create dir
func CmdRunWithTimeout ¶
CmdRunWithTimeout exec cmd with timeout
func CopyFile ¶
CopyFile copy source file to target direct io read and write file Keep the permissions user and group
func CreateFileHash ¶
CreateFileHash compute sourcefile hash and write hashfile
func CreateHashString ¶
CreateHashString create hash string
func CreateVersionByTime ¶
func CreateVersionByTime() string
CreateVersionByTime create version number
func DecimailFromFloat64 ¶ added in v1.11.0
DecimailFromFloat64 Keep 2 bit after decimal point
func DecimalFromFloat32 ¶ added in v1.11.0
DecimalFromFloat32 Keep 2 bit after decimal point
func FileExistsWithSuffix ¶
FileExistsWithSuffix 指定目录是否含有指定后缀的文件
func Float32Map ¶
Float32Map converts a string map of float32 values into a string map of float32 pointers
func Float32Slice ¶
Float32Slice converts a slice of float32 values into a slice of float32 pointers
func Float32Value ¶
Float32Value returns the value of the float32 pointer passed in or 0 if the pointer is nil.
func Float32ValueMap ¶
Float32ValueMap converts a string map of float32 pointers into a string map of float32 values
func Float32ValueSlice ¶
Float32ValueSlice converts a slice of float32 pointers into a slice of float32 values
func Float64Map ¶
Float64Map converts a string map of float64 values into a string map of float64 pointers
func Float64Slice ¶
Float64Slice converts a slice of float64 values into a slice of float64 pointers
func Float64Value ¶
Float64Value returns the value of the float64 pointer passed in or 0 if the pointer is nil.
func Float64ValueMap ¶
Float64ValueMap converts a string map of float64 pointers into a string map of float64 values
func Float64ValueSlice ¶
Float64ValueSlice converts a slice of float64 pointers into a slice of float64 values
func GenOpenSSHKeyPair ¶ added in v1.7.0
GenOpenSSHKeyPair make a pair of private and public keys for SSH access. Private Key generated is PEM encoded Public key is encoded in the format for inclusion in an OpenSSH authorized_keys file.
func GenerateMACAddress ¶ added in v1.12.0
func GenerateMACAddress() string
func GetDirList ¶
GetDirList get all lower level dir
func GetDirNameList ¶
GetDirNameList get all lower level dir
func GetDirSizeByCmd ¶
GetDirSizeByCmd get dir sizes by du command return kb
func GetParentDirectory ¶
GetParentDirectory GetParentDirectory
func Int16Slice ¶
Int16Slice converts a slice of int16 values into a slice of int16 pointers
func Int16Value ¶
Int16Value returns the value of the int16 pointer passed in or 0 if the pointer is nil.
func Int16ValueMap ¶
Int16ValueMap converts a string map of int16 pointers into a string map of int16 values
func Int16ValueSlice ¶
Int16ValueSlice converts a slice of int16 pointers into a slice of int16 values
func Int32Slice ¶
Int32Slice converts a slice of int32 values into a slice of int32 pointers
func Int32Value ¶
Int32Value returns the value of the int32 pointer passed in or 0 if the pointer is nil.
func Int32ValueMap ¶
Int32ValueMap converts a string map of int32 pointers into a string map of int32 values
func Int32ValueSlice ¶
Int32ValueSlice converts a slice of int32 pointers into a slice of int32 values
func Int64Slice ¶
Int64Slice converts a slice of int64 values into a slice of int64 pointers
func Int64Value ¶
Int64Value returns the value of the int64 pointer passed in or 0 if the pointer is nil.
func Int64ValueMap ¶
Int64ValueMap converts a string map of int64 pointers into a string map of int64 values
func Int64ValueSlice ¶
Int64ValueSlice converts a slice of int64 pointers into a slice of int64 values
func Int8Value ¶
Int8Value returns the value of the int8 pointer passed in or 0 if the pointer is nil.
func Int8ValueMap ¶
Int8ValueMap converts a string map of int8 pointers into a string map of int8 values
func Int8ValueSlice ¶
Int8ValueSlice converts a slice of int8 pointers into a slice of int8 values
func IntValueMap ¶
IntValueMap converts a string map of int pointers into a string map of int values
func IntValueSlice ¶
IntValueSlice converts a slice of int pointers into a slice of int values
func IntermittentExec ¶
IntermittentExec 间歇性执行
func IsEndWithNumber ¶
IsEndWithNumber Determine whether the stateful component directory name is satisfied, that is, it ends with a number
func MillisecondsTimeValue ¶
MillisecondsTimeValue converts an int64 pointer to a time.Time value representing milliseconds sinch Epoch or time.Time{} if the pointer is nil.
func OpenOrCreateFile ¶
OpenOrCreateFile open or create file
func ParseVariable ¶
ParseVariable parse and replace variable in source str
func ReadHostID ¶
ReadHostID 读取当前机器ID ID是节点的唯一标识,acp_node将把ID与机器信息的绑定关系维护于etcd中
func SearchFile ¶
SearchFile 搜索指定目录是否有指定文件,指定搜索目录层数,-1为全目录搜索
func SearchFileBody ¶
SearchFileBody 搜索文件中是否含有指定字符串
func SecondsTimeValue ¶
SecondsTimeValue converts an int64 pointer to a time.Time value representing seconds since Epoch or time.Time{} if the pointer is nil.
func StdCopy ¶
StdCopy is a modified version of io.Copy.
StdCopy will demultiplex `src`, assuming that it contains two streams, previously multiplexed together using a StdWriter instance. As it reads from `src`, StdCopy will write to `dstout` and `dsterr`.
StdCopy will read until it hits EOF on `src`. It will then return a nil error. In other words: if `err` is non nil, it indicates a real underlying error.
`written` will hold the total number of bytes written to `dstout` and `dsterr`.
func StringArrayContains ¶
StringArrayContains string array contains
func StringMap ¶
StringMap converts a string map of string values into a string map of string pointers
func StringSlice ¶
StringSlice converts a slice of string values into a slice of string pointers
func StringValue ¶
StringValue returns the value of the string pointer passed in or "" if the pointer is nil.
func StringValueMap ¶
StringValueMap converts a string map of string pointers into a string map of string values
func StringValueSlice ¶
StringValueSlice converts a slice of string pointers into a slice of string values
func TimeMap ¶
TimeMap converts a string map of time.Time values into a string map of time.Time pointers
func TimeUnixMilli ¶
TimeUnixMilli returns a Unix timestamp in milliseconds from "January 1, 1970 UTC". The result is undefined if the Unix time cannot be represented by an int64. Which includes calling TimeUnixMilli on a zero Time is undefined.
This utility is useful for service API's such as CloudWatch Logs which require their unix time values to be in milliseconds.
See Go stdlib https://golang.org/pkg/time/#Time.UnixNano for more information.
func TimeValue ¶
TimeValue returns the value of the time.Time pointer passed in or time.Time{} if the pointer is nil.
func TimeValueMap ¶
TimeValueMap converts a string map of time.Time pointers into a string map of time.Time values
func TimeValueSlice ¶
TimeValueSlice converts a slice of time.Time pointers into a slice of time.Time values
func Translation ¶
Translation Translation English to Chinese
func Uint16Map ¶
Uint16Map converts a string map of uint16 values into a string map of uint16 pointers
func Uint16Slice ¶
Uint16Slice converts a slice of uint16 values into a slice of uint16 pointers
func Uint16Value ¶
Uint16Value returns the value of the uint16 pointer passed in or 0 if the pointer is nil.
func Uint16ValueMap ¶
Uint16ValueMap converts a string map of uint16 pointers into a string map of uint16 values
func Uint16ValueSlice ¶
Uint16ValueSlice converts a slice of uint16 pointers into a slice of uint16 values
func Uint32Map ¶
Uint32Map converts a string map of uint32 values into a string map of uint32 pointers
func Uint32Slice ¶
Uint32Slice converts a slice of uint32 values into a slice of uint32 pointers
func Uint32Value ¶
Uint32Value returns the value of the uint32 pointer passed in or 0 if the pointer is nil.
func Uint32ValueMap ¶
Uint32ValueMap converts a string map of uint32 pointers into a string map of uint32 values
func Uint32ValueSlice ¶
Uint32ValueSlice converts a slice of uint32 pointers into a slice of uint32 values
func Uint64Map ¶
Uint64Map converts a string map of uint64 values into a string map of uint64 pointers
func Uint64Slice ¶
Uint64Slice converts a slice of uint64 values into a slice of uint64 pointers
func Uint64Value ¶
Uint64Value returns the value of the uint64 pointer passed in or 0 if the pointer is nil.
func Uint64ValueMap ¶
Uint64ValueMap converts a string map of uint64 pointers into a string map of uint64 values
func Uint64ValueSlice ¶
Uint64ValueSlice converts a slice of uint64 pointers into a slice of uint64 values
func Uint8Slice ¶
Uint8Slice converts a slice of uint8 values into a slice of uint8 pointers
func Uint8Value ¶
Uint8Value returns the value of the uint8 pointer passed in or 0 if the pointer is nil.
func Uint8ValueMap ¶
Uint8ValueMap converts a string map of uint8 pointers into a string map of uint8 values
func Uint8ValueSlice ¶
Uint8ValueSlice converts a slice of uint8 pointers into a slice of uint8 values
func UintValue ¶
UintValue returns the value of the uint pointer passed in or 0 if the pointer is nil.
func UintValueMap ¶
UintValueMap converts a string map of uint pointers uinto a string map of uint values
func UintValueSlice ¶
UintValueSlice converts a slice of uint pointers uinto a slice of uint values
Types ¶
type Hosts ¶
Hosts represents a hosts file.
type HostsLine ¶
HostsLine represents a single line in the hosts file.
func NewHostsLine ¶
NewHostsLine returns a new instance of ```HostsLine```.
type IPEVENTTYPE ¶
type IPEVENTTYPE int
IPEVENTTYPE ip change event type
const ( //ADD add event ADD IPEVENTTYPE = iota //DEL del event DEL //UPDATE update event UPDATE )
type IPPool ¶
type IPPool struct { HostIPs map[string]net.IP EventCh chan IPEVENT StopCh chan struct{} // contains filtered or unexported fields }
IPPool ip pool
func (*IPPool) GetWatchIPChan ¶
GetWatchIPChan watch ip change
type PipeCommand ¶
type PipeCommand struct {
// contains filtered or unexported fields
}
PipeCommand PipeCommand
func NewPipeCommand ¶
func NewPipeCommand(stack ...*exec.Cmd) (*PipeCommand, error)
NewPipeCommand new pipe commands
func (*PipeCommand) GetFinalStderr ¶
func (p *PipeCommand) GetFinalStderr() io.Reader
GetFinalStderr get final command stderr reader
func (*PipeCommand) GetFinalStdout ¶
func (p *PipeCommand) GetFinalStdout() io.Reader
GetFinalStdout get final command stdout reader
type SSHClient ¶
type SSHClient struct { IP string Port int User string Password string Method string Key string Stdout, Stderr io.Writer Cmd string }
SSHClient ssh client
func NewSSHClient ¶
NewSSHClient new ssh client
type ServeMux ¶
type ServeMux interface {
HandleFunc(pattern string, funC http.HandlerFunc)
}
ServeMux -
type StdType ¶
type StdType byte
StdType is the type of standard stream a writer can multiplex to.
const ( // Stdin represents standard input stream type. Stdin StdType = iota // Stdout represents standard output stream type. Stdout // Stderr represents standard error steam type. Stderr // Systemerr represents errors originating from the system that make it // into the the multiplexed stream. Systemerr )
type TimeVersion ¶
type TimeVersion string
TimeVersion time version
func NewTimeVersion ¶
func NewTimeVersion() TimeVersion
NewTimeVersion return version string by time
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
dockerfile
|
|
command
Package command contains the set of Dockerfile commands.
|
Package command contains the set of Dockerfile commands. |
parser
Package parser implements a parser and parse tree dumper for Dockerfiles.
|
Package parser implements a parser and parse tree dumper for Dockerfiles. |
etcdlock
Package etcdlock Master election using etcd.
|
Package etcdlock Master election using etcd. |
Fuzzy searching allows for flexibly matching a string with partial input, useful for filtering data very quickly based on lightweight user input.
|
Fuzzy searching allows for flexibly matching a string with partial input, useful for filtering data very quickly based on lightweight user input. |
ingress-nginx
|
|