Documentation ¶
Index ¶
- Constants
- Variables
- func BenchStatusToStr(r share.BenchStatus) string
- func CompareSliceWithoutOrder(a, b interface{}) bool
- func Decrypt(encryptionKey, text []byte) ([]byte, error)
- func DecryptForURL(key []byte, b64 string) (string, error)
- func DecryptFromBase64(encryptionKey []byte, b64 string) (string, error)
- func DecryptPassword(encrypted string) string
- func DecryptPasswordForURL(encrypted string) string
- func DecryptSensitiveForURL(encrypted string, key []byte) string
- func DoesGroupHavePolicyMode(name string) bool
- func Encrypt(encryptionKey, text []byte) ([]byte, error)
- func EncryptForURL(key, text []byte) (string, error)
- func EncryptPassword(password string) string
- func EncryptPasswordForURL(password string) string
- func EncryptSensitiveForURL(data string, key []byte) string
- func EncryptToBase64(encryptionKey, text []byte) (string, error)
- func EnsureBaseDir(fpath string) error
- func EvaluateApiCfgType(name string, bCrdType bool) string
- func EvaluateGroupType(name string) share.TCfgType
- func Exec(dir string, bin string, args ...string) ([]byte, error)
- func ExtractAllArchive(dst string, r io.Reader, maxFileSize int64) (int64, error)
- func ExtractAllArchiveToFiles(path string, r io.Reader, maxFileSize int64, encryptKey []byte) error
- func FileHashCrc32(path string, size int64) uint32
- func FilterIndexKey(path, regex string) string
- func GetAppIDByName(name string) uint32
- func GetCVEDBEncryptKey() []byte
- func GetCaller(skip int, excludes []string) string
- func GetFileContentType(buffer []byte) string
- func GetFunctionName(f interface{}) string
- func GetGID() uint64
- func GetGuid() (string, error)
- func GetIPEnclosure(ips []net.IP) *net.IPNet
- func GetLicenseInfo(license string) (string, error)
- func GetLicenseSymKey() []byte
- func GetMd5(s string) string
- func GetPortLink(ipproto uint8, port uint16) string
- func GetPortRangeLink(ipproto uint8, port uint16, portR uint16) string
- func GetRandomID(length int, prefix string) string
- func GetStringUUID(s string) string
- func GetSupportedTLSCipherSuites() []uint16
- func GetTimeUUID(t time.Time) string
- func GunzipBytes(buf []byte) []byte
- func GzipBytes(buf []byte) []byte
- func HasGroupProfiles(name string) bool
- func HashPassword(password string) string
- func HashStringToInt32(s string, slots int) int
- func Htonl(v uint32) uint32
- func IPNet2Subnet(ipnet *net.IPNet) *net.IPNet
- func IPNet2SubnetLoose(ipnet *net.IPNet, scope string) *net.IPNet
- func IPv42Int(ip net.IP) uint32
- func Int2IPv4(addr uint32) net.IP
- func InterpretIP(ip, ipR net.IP) string
- func IsCustomProfileGroup(group string) bool
- func IsExecutable(info os.FileInfo, path string) bool
- func IsExecutableLinkableFile(path string) bool
- func IsGroupLearned(name string) bool
- func IsGroupNodes(name string) bool
- func IsIPv4(ip net.IP) bool
- func IsIPv6(ip net.IP) bool
- func IsMountPoint(path string) bool
- func IsNativeLittleEndian() bool
- func JoinCommand(cmds []string) string
- func MakeServiceName(namespace, name string) string
- func MakeTar(files []TarFileInfo) (*bytes.Buffer, error)
- func MakeUserFullname(server, username string) string
- func MergeSpecialSubnet(subnets map[string]share.CLUSSpecSubnet, snet share.CLUSSubnet, iptype string) bool
- func MergeSubnet(subnets map[string]share.CLUSSubnet, snet share.CLUSSubnet) bool
- func NormalizeForURL(name string) string
- func ParseIPRange(value string) (net.IP, net.IP)
- func ParsePortRangeLink(name string) (uint8, uint16, uint16, error)
- func PerfProfile(req *share.CLUSProfilingRequest, prefix string)
- func Proto2Name(ipproto uint8) string
- func ResolveAddrList(addr string, skipLoopback bool) ([]string, bool)
- func ResolveIP(name string) ([]net.IP, error)
- func ReverseBytesInPlace(a []byte) []byte
- func SelectivelyExtractArchive(r io.Reader, selected func(string) bool, maxFileSize int64) (map[string][]byte, error)
- func SelectivelyExtractModules(r io.Reader, lastfix string, maxFileSize int64) (map[string][]byte, error)
- func SelectivelyExtractToFile(r io.Reader, selected func(string) bool, dir string) (map[string]string, error)
- func SelectivelyExtractToFiles(r io.Reader, dir string, selected func(string) bool, maxFileSize int64) (map[string]string, error)
- func SetReady(value string) error
- func SubnetContains(n1, n2 *net.IPNet) (bool, int)
- func TCPStateString(state uint8) string
- func UnsetReady() error
- func Unzip(src string, dest string) error
- func UnzipDataIfValid(value []byte) ([]byte, bool)
- type EnvironParser
- func (p EnvironParser) GetKVPairs() map[string]string
- func (p EnvironParser) GetPlatformEnv() map[string][]string
- func (p EnvironParser) GetPlatformIntf(port string) []string
- func (p EnvironParser) GetPlatformName() (string, string)
- func (p EnvironParser) GetSystemGroups() []*regexp.Regexp
- func (p EnvironParser) Value(key string) (string, bool)
- type Iterator
- type LogFormatter
- type Set
- type TarFileInfo
- type TarReadCloser
- type TimerTask
- type TimerWheel
- type WheelTimeOut
- type XzReader
Constants ¶
const ( OS_READ = 04 OS_WRITE = 02 OS_EX = 01 OS_USER_SHIFT = 6 OS_GROUP_SHIFT = 3 OS_OTH_SHIFT = 0 OS_USER_X = OS_EX << OS_USER_SHIFT OS_GROUP_X = OS_EX << OS_GROUP_SHIFT OS_OTH_X = OS_EX << OS_OTH_SHIFT OS_ALL_X = OS_USER_X | OS_GROUP_X | OS_OTH_X )
Variables ¶
var ( // ErrCouldNotExtract occurs when an extraction fails. ErrCouldNotExtract = errors.New("could not extract the archive") ErrRequestCanceled = errors.New("request conceled") // ErrExtractedFileTooBig occurs when a file to extract is too big. ErrExtractedFileTooBig = errors.New("could not extract one or more files from the archive: file too big") ErrCouldNotWriteToDisk = errors.New("could not write to disk") )
var AppNameMap map[uint32]string = map[uint32]string{ C.DPI_APP_HTTP: "HTTP", C.DPI_APP_SSL: "SSL", C.DPI_APP_SSH: "SSH", C.DPI_APP_DNS: "DNS", C.DPI_APP_DHCP: "DHCP", C.DPI_APP_NTP: "NTP", C.DPI_APP_TFTP: "TFTP", C.DPI_APP_ECHO: "Echo", C.DPI_APP_RTSP: "RTSP", C.DPI_APP_SIP: "SIP", C.DPI_APP_MYSQL: "MySQL", C.DPI_APP_REDIS: "Redis", C.DPI_APP_ZOOKEEPER: "ZooKeeper", C.DPI_APP_CASSANDRA: "Cassandra", C.DPI_APP_MONGODB: "MongoDB", C.DPI_APP_POSTGRESQL: "PostgreSQL", C.DPI_APP_KAFKA: "Kafka", C.DPI_APP_COUCHBASE: "Couchbase", C.DPI_APP_WORDPRESS: "Wordpress", C.DPI_APP_ACTIVEMQ: "ActiveMQ", C.DPI_APP_COUCHDB: "CouchDB", C.DPI_APP_ELASTICSEARCH: "ElasticSearch", C.DPI_APP_MEMCACHED: "Memcached", C.DPI_APP_RABBITMQ: "RabbitMQ", C.DPI_APP_RADIUS: "Radius", C.DPI_APP_VOLTDB: "VoltDB", C.DPI_APP_CONSUL: "Consul", C.DPI_APP_SYSLOG: "Syslog", C.DPI_APP_ETCD: "etcd", C.DPI_APP_SPARK: "Spark", C.DPI_APP_APACHE: "Apache", C.DPI_APP_NGINX: "nginx", C.DPI_APP_JETTY: "Jetty", C.DPI_APP_TNS: "Oracle", C.DPI_APP_TDS: "MSSQL", C.DPI_APP_GRPC: "GRPC", }
var CfgTypeToApiMapping = map[share.TCfgType]string{ share.Learned: api.CfgTypeLearned, share.UserCreated: api.CfgTypeUserCreated, share.GroundCfg: api.CfgTypeGround, share.FederalCfg: api.CfgTypeFederal, }
Utilities: find group attribute from the grou's name definitions, based on controller/api/apis.go
var IPv4Loopback = net.IPv4(127, 0, 0, 1)
Functions ¶
func BenchStatusToStr ¶
func BenchStatusToStr(r share.BenchStatus) string
func CompareSliceWithoutOrder ¶
func CompareSliceWithoutOrder(a, b interface{}) bool
func DecryptPassword ¶
func DecryptPasswordForURL ¶
func DecryptSensitiveForURL ¶
func DoesGroupHavePolicyMode ¶
func EncryptForURL ¶
func EncryptPassword ¶
func EncryptPasswordForURL ¶
func EncryptSensitiveForURL ¶
func EncryptToBase64 ¶
func EnsureBaseDir ¶
func EvaluateApiCfgType ¶
func EvaluateGroupType ¶
func ExtractAllArchive ¶
func FileHashCrc32 ¶
func FilterIndexKey ¶
func GetAppIDByName ¶
func GetCVEDBEncryptKey ¶
func GetCVEDBEncryptKey() []byte
func GetFileContentType ¶
GetFileContentType: explore the content type, only work content at least 512 bytes
func GetFunctionName ¶
func GetFunctionName(f interface{}) string
func GetLicenseInfo ¶
func GetLicenseSymKey ¶
func GetLicenseSymKey() []byte
func GetPortLink ¶
func GetRandomID ¶
func GetStringUUID ¶
func GetSupportedTLSCipherSuites ¶
func GetSupportedTLSCipherSuites() []uint16
func GetTimeUUID ¶
func GunzipBytes ¶
func HasGroupProfiles ¶
func HashPassword ¶
func HashStringToInt32 ¶
func InterpretIP ¶
func IsCustomProfileGroup ¶
func IsExecutableLinkableFile ¶
IsExecutableLinkableFile: explore ELF header
func IsGroupLearned ¶
func IsGroupNodes ¶
func IsMountPoint ¶
Determine if a directory is a mountpoint, by comparing the device for the directory with the device for it's parent. If they are the same, it's not a mountpoint, if they're different, it is.
func IsNativeLittleEndian ¶
func IsNativeLittleEndian() bool
func JoinCommand ¶
func MakeServiceName ¶
func MakeUserFullname ¶
func MergeSpecialSubnet ¶
func MergeSpecialSubnet(subnets map[string]share.CLUSSpecSubnet, snet share.CLUSSubnet, iptype string) bool
func MergeSubnet ¶
func MergeSubnet(subnets map[string]share.CLUSSubnet, snet share.CLUSSubnet) bool
func NormalizeForURL ¶
func PerfProfile ¶
func PerfProfile(req *share.CLUSProfilingRequest, prefix string)
func Proto2Name ¶
func ReverseBytesInPlace ¶
func SelectivelyExtractArchive ¶
func SelectivelyExtractArchive(r io.Reader, selected func(string) bool, maxFileSize int64) (map[string][]byte, error)
SelectivelyExtractArchive extracts the specified files and folders from targz data read from the given reader and store them in a map indexed by file paths
func SelectivelyExtractToFile ¶
func SelectivelyExtractToFile(r io.Reader, selected func(string) bool, dir string) (map[string]string, error)
func SelectivelyExtractToFile(r io.Reader, prefix string, toExtract []string, dir string) (map[string]string, error) {
func SubnetContains ¶
The first value indicate if two subnets contains one or another, if true then, the second value returns 1 if n1 contains n2, -1 if n2 contains n1, 0 if equal.
func TCPStateString ¶
func UnsetReady ¶
func UnsetReady() error
func Unzip ¶
Unzip will decompress a zip archive, moving all files and folders within the zip file (parameter 1) to an output directory (parameter 2).
func UnzipDataIfValid ¶
Types ¶
type EnvironParser ¶
type EnvironParser struct {
// contains filtered or unexported fields
}
func NewEnvironParser ¶
func NewEnvironParser(envs []string) *EnvironParser
func (EnvironParser) GetKVPairs ¶
func (p EnvironParser) GetKVPairs() map[string]string
func (EnvironParser) GetPlatformEnv ¶
func (p EnvironParser) GetPlatformEnv() map[string][]string
func (EnvironParser) GetPlatformIntf ¶
func (p EnvironParser) GetPlatformIntf(port string) []string
func (EnvironParser) GetPlatformName ¶
func (p EnvironParser) GetPlatformName() (string, string)
func (EnvironParser) GetSystemGroups ¶
func (p EnvironParser) GetSystemGroups() []*regexp.Regexp
type LogFormatter ¶
type LogFormatter struct {
Module string
}
type Set ¶
type Set interface { // Adds an element to the set. Returns whether // the item was added. Add(i interface{}) bool // Returns the number of elements in the set. Cardinality() int // Removes all elements from the set, leaving // the emtpy set. Clear() // Returns a clone of the set using the same // implementation, duplicating all keys. Clone() Set // Returns whether the given items // are all in the set. Contains(i ...interface{}) bool // Returns the difference between this set // and other. The returned set will contain // all elements of this set that are not also // elements of other. // // Note that the argument to Difference // must be of the same type as the receiver // of the method. Otherwise, Difference will // panic. Difference(other Set) Set // Determines if two sets are equal to each // other. If they have the same cardinality // and contain the same elements, they are // considered equal. The order in which // the elements were added is irrelevant. // // Note that the argument to Equal must be // of the same type as the receiver of the // method. Otherwise, Equal will panic. Equal(other Set) bool // Returns a new set containing only the elements // that exist only in both sets. // // Note that the argument to Intersect // must be of the same type as the receiver // of the method. Otherwise, Intersect will // panic. Intersect(other Set) Set // Determines if every element in the other set // is in this set. // // Note that the argument to IsSubset // must be of the same type as the receiver // of the method. Otherwise, IsSubset will // panic. IsSubset(other Set) bool // Determines if every element in this set is in // the other set. // // Note that the argument to IsSuperset // must be of the same type as the receiver // of the method. Otherwise, IsSuperset will // panic. IsSuperset(other Set) bool // Returns a channel of elements that you can // range over. Iter() threadUnsafeSet // Remove a single element from the set. Remove(i interface{}) // Provides a convenient string representation // of the current state of the set. String() string // Returns a new set with all elements which are // in either this set or the other set but not in both. // // Note that the argument to SymmetricDifference // must be of the same type as the receiver // of the method. Otherwise, SymmetricDifference // will panic. SymmetricDifference(other Set) Set // Returns a new set with all elements in both sets. // // Note that the argument to Union must be of the // same type as the receiver of the method. // Otherwise, IsSuperset will panic. Union(other Set) Set // Returns the members of the set as a slice. ToSlice() []interface{} ToInt32Slice() []int32 ToStringSlice() []string // Returns one member of the set. Any() interface{} }
func NewSetFromSlice ¶
func NewSetFromSlice(s []interface{}) Set
func NewSetFromSliceKind ¶
func NewSetFromSliceKind(slice interface{}) Set
type TarFileInfo ¶
type TarReadCloser ¶
TarReadCloser embeds a *tar.Reader and the related io.Closer It is the caller's responsibility to call Close on TarReadCloser when done.
func (*TarReadCloser) Close ¶
func (r *TarReadCloser) Close() error
type TimerWheel ¶
type TimerWheel struct {
// contains filtered or unexported fields
}
func NewTimerWheel ¶
func NewTimerWheel() *TimerWheel
func NewTimerWheelWithTick ¶
func NewTimerWheelWithTick(tick time.Duration) *TimerWheel
func (*TimerWheel) RemoveTask ¶
func (t *TimerWheel) RemoveTask(taskId string) error
func (*TimerWheel) Start ¶
func (t *TimerWheel) Start()
func (*TimerWheel) Stop ¶
func (t *TimerWheel) Stop()
type WheelTimeOut ¶
type WheelTimeOut struct {
// contains filtered or unexported fields
}
type XzReader ¶
type XzReader struct { io.ReadCloser // contains filtered or unexported fields }
XzReader is an io.ReadCloser which decompresses xz compressed data.
func NewXzReader ¶
NewXzReader shells out to a command line xz executable (if available) to decompress the given io.Reader using the xz compression format and returns an *XzReader. It is the caller's responsibility to call Close on the XzReader when done.