Documentation
¶
Overview ¶
Package cliutils host all public-used golang utils/tools/libs for Guance Cloud.
Index ¶
- Variables
- func CreateRandomString(n int) string
- func Decrypt(endata, phrase []byte) ([]byte, error)
- func Encrypt(data, phrase []byte) ([]byte, error)
- func FloatEquals(a, b float64) bool
- func GZip(data []byte) ([]byte, error)
- func GZipStr(str string) ([]byte, error)
- func LeftStringTrim(s string, n int) string
- func Md5Hash(data []byte) string
- func MustGZip(data []byte) []byte
- func PromTextToMetrics(data io.Reader, measurementPrefix, defaultMeasurement string, t time.Time) ([]*ifxcli.Point, error)
- func SizeFmt(n int64) string
- func StringTrim(s string, n int) string
- func ToUnsafeBytes(s string) (b []byte)
- func ToUnsafeString(b []byte) string
- func WgWait(wg *sync.WaitGroup, timeout int)
- func WhiteListMatched(val string, arr []*WhiteListItem) bool
- func XID(p string) string
- type OssCli
- func (oc *OssCli) Download(obj, to string) error
- func (oc *OssCli) GetMeta(obj string) (map[string][]string, error)
- func (oc *OssCli) Init() error
- func (oc *OssCli) ListObjects(prefix, marker string, maxKeys int) (oss.ListObjectsResult, error)
- func (oc *OssCli) Move(from, to string) error
- func (oc *OssCli) Reconnect() error
- func (oc *OssCli) SetMeta(obj string, meta map[string]string) error
- func (oc *OssCli) Stat() string
- func (oc *OssCli) Upload(from, to string) error
- type Sem
- type WhiteListItem
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrOssFileTooLarge = errors.New(`oss file too large`) DefaultPartSize = int64(32 * 1024 * 1024) //nolint:gomnd // 32MB DefaultTimeout = uint(30) //nolint:gomnd // seconds DefaultWorkers = 8 )
Functions ¶
func CreateRandomString ¶
func FloatEquals ¶
FloatEquals checks if two float64 numbers are "close enough".
func LeftStringTrim ¶
func PromTextToMetrics ¶
func StringTrim ¶
func ToUnsafeBytes ¶
ToUnsafeBytes converts s to a byte slice without memory allocations. The returned byte slice is valid only until s is reachable and unmodified.
func ToUnsafeString ¶
ToUnsafeString converts b to string without memory allocations. The returned string is valid only until b is reachable and unmodified.
func WhiteListMatched ¶
func WhiteListMatched(val string, arr []*WhiteListItem) bool
Types ¶
type OssCli ¶
type OssCli struct {
Host, AccessKey, SecretKey, BucketName, WorkDir string
Timeout uint
PartSize int64
Workers int
ReconnectCnt int
FailedCnt int
UploadedFiles int
UploadedBytes int64
// contains filtered or unexported fields
}
func (*OssCli) ListObjects ¶
type WhiteListItem ¶
type WhiteListItem struct {
// contains filtered or unexported fields
}
WhiteListItem 白名单条目,支持普通字符串和正则表达式.
func NewWhiteListItem ¶
func NewWhiteListItem(pattern string) *WhiteListItem
NewWhiteListItem 从字符串创建白名单条目,支持普通字符串和正则表达式.
func (*WhiteListItem) IsRegex ¶
func (item *WhiteListItem) IsRegex() bool
func (*WhiteListItem) Match ¶
func (item *WhiteListItem) Match(val string) bool
Match 检查给定路径是否与白名单条目匹配.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package aggregate provides point aggregation and tail-sampling helpers.
|
Package aggregate provides point aggregation and tail-sampling helpers. |
|
cmd
|
|
|
diskcache
command
|
|
|
Package dialtesting defined dialtesting tasks and task implements.
|
Package dialtesting defined dialtesting tasks and task implements. |
|
Package diskcache is a simple local-disk cache implements.
|
Package diskcache is a simple local-disk cache implements. |
|
Code generated by goyacc -l -o gram_y.go gram.y.
|
Code generated by goyacc -l -o gram_y.go gram.y. |
|
Package lineproto wraps influxdb lineprotocol.
|
Package lineproto wraps influxdb lineprotocol. |
|
Package logger wrapped zap as a basic logging implement.
|
Package logger wrapped zap as a basic logging implement. |
|
Package metrics implements datakit's Prometheus metrics
|
Package metrics implements datakit's Prometheus metrics |
|
Package network wraps basic network related implements.
|
Package network wraps basic network related implements. |
|
http
Package http wraps all HTTP releated common-used utils.
|
Package http wraps all HTTP releated common-used utils. |
|
ws
Package ws wraps websocket implements among UNIX-like(Linux & macOS) platform
|
Package ws wraps websocket implements among UNIX-like(Linux & macOS) platform |
|
Package otlp provides shared helpers for decoding OTLP payloads and converting common OTLP values into cliutils point primitives.
|
Package otlp provides shared helpers for decoding OTLP payloads and converting common OTLP values into cliutils point primitives. |
|
pkg
|
|
|
hash
Package hash used to calculate hash
|
Package hash used to calculate hash |
|
Package point implements datakits basic data structure.
|
Package point implements datakits basic data structure. |
|
test
command
Package main used for GC escape:
|
Package main used for GC escape: |
|
pprofparser
|
|
|
cfg
Package cfg is used to control the behavior of this package.
|
Package cfg is used to control the behavior of this package. |
|
domain/events
Package events define the pprof event types.
|
Package events define the pprof event types. |
|
domain/languages
Package languages define the supported languages.
|
Package languages define the supported languages. |
|
domain/parameter
Package parameter defines the parsing parameters.
|
Package parameter defines the parsing parameters. |
|
domain/pprof
Package pprof declares the pprof util methods.
|
Package pprof declares the pprof util methods. |
|
domain/quantity
Package quantity defines the unit and quantity kinds.
|
Package quantity defines the unit and quantity kinds. |
|
domain/tracing
Package tracing defines the trace and span entities.
|
Package tracing defines the trace and span entities. |
|
service/parsing
Package parsing is the core pprof parsing package.
|
Package parsing is the core pprof parsing package. |
|
service/storage
Package storage implements a series of storage kinds.
|
Package storage implements a series of storage kinds. |
|
tools/filepathtoolkit
Package filepathtoolkit is a collection of filepath utils.
|
Package filepathtoolkit is a collection of filepath utils. |
|
tools/jsontoolkit
Package jsontoolkit is a collection of json utils.
|
Package jsontoolkit is a collection of json utils. |
|
tools/logtoolkit
Package logtoolkit is a collection of log utils.
|
Package logtoolkit is a collection of log utils. |
|
tools/mathtoolkit
Package mathtoolkit is a collection of math utils.
|
Package mathtoolkit is a collection of math utils. |
|
tools/parsetoolkit
Package parsetoolkit is a collection of parsing utils.
|
Package parsetoolkit is a collection of parsing utils. |
|
Package system used to wrap basic system related settings.
|
Package system used to wrap basic system related settings. |
|
rtpanic
Package rtpanic wraps panic handling during golang app panic.
|
Package rtpanic wraps panic handling during golang app panic. |
|
Package testutil wraps basic tools when building goalng test cases.
|
Package testutil wraps basic tools when building goalng test cases. |
|
Package tracer defined basic trace wraps.
|
Package tracer defined basic trace wraps. |
Click to show internal directories.
Click to hide internal directories.