Documentation
¶
Index ¶
- Constants
- Variables
- func CrossTypeCompare(a interface{}, b interface{}) (int, error)
- func CrossTypeEqual(a interface{}, b interface{}) bool
- func DelField(obj map[string]interface{}, k string) interface{}
- func GetField(obj map[string]interface{}, k string) (interface{}, error)
- func IPToString(ip net.IP) string
- func IPv6Supported() bool
- func IsCaptureAllowed(nodeType string) bool
- func JSONDecode(r io.Reader, i interface{}) error
- func MaxInt64(a, b int64) int64
- func MinInt64(a, b int64) int64
- func Retry(fnc func() error, try int, delay time.Duration) error
- func SetField(obj map[string]interface{}, k string, v interface{}) bool
- func SetupTLSClientConfig(certPEM string, keyPEM string) *tls.Config
- func SetupTLSLoadCertificate(certPEM string) *x509.CertPool
- func SetupTLSServerConfig(certPEM string, keyPEM string) *tls.Config
- func ToFloat64(f interface{}) (float64, error)
- func ToInt64(i interface{}) (int64, error)
- func UnixMillis(t time.Time) int64
- type CaptureType
- type Iterator
- type Metric
- type NetNSContext
- type PortAllocator
- type RawSocket
- type ServiceAddress
- type ServiceType
- type SortOrder
- type TimeSlice
- type TimedMetric
Constants ¶
const ( // StoppedState service stopped StoppedState = iota + 1 // RunningState service running RunningState // StoppingState service stopping StoppingState )
Variables ¶
var ( // ErrInvalidPortRange invalid port range ErrInvalidPortRange = errors.New("Invalid port range") // ErrNoPortLeft no port left in the range ErrNoPortLeft = errors.New("No free port left") )
var ( // ErrCantCompareInterface error can't compare inteface ErrCantCompareInterface = errors.New("Can't compare interface") // ErrFieldNotFound error field not found ErrFieldNotFound = errors.New("Field not found") // ErrFieldWrongType error field has wrong type ErrFieldWrongType = errors.New("Field has wrong type") )
var ( // CaptureTypes contain all registred capture type and associated probes CaptureTypes = map[string]CaptureType{} )
Functions ¶
func CrossTypeCompare ¶
CrossTypeCompare compare 2 differents number types like Float64 vs Float32
func CrossTypeEqual ¶
func CrossTypeEqual(a interface{}, b interface{}) bool
CrossTypeEqual compare 2 differents number types
func DelField ¶ added in v0.12.0
DelField detete a value in a tree based on dot key
func GetField ¶ added in v0.12.0
GetField retrieve a value from a tree from the dot key like "a.b.c.d"
func IPToString ¶ added in v0.9.0
IPToString convert IPv4 or IPv6 to a string
func IPv6Supported ¶ added in v0.9.0
func IPv6Supported() bool
IPv6Supported returns true if the platform support IPv6
func IsCaptureAllowed ¶
IsCaptureAllowed returns true if the node capture type exist
func JSONDecode ¶ added in v0.12.0
JSONDecode wrapper to UseNumber during JSON decoding
func Retry ¶
Retry tries to execute the given function until a success applying a delay between each try
func SetField ¶ added in v0.12.0
SetField set a value in a tree based on dot key ("a.b.c.d" = "ok")
func SetupTLSClientConfig ¶ added in v0.12.0
SetupTLSClientConfig creates a client X509 certificate from public and private key
func SetupTLSLoadCertificate ¶ added in v0.12.0
SetupTLSLoadCertificate creates a X509 certificate from file
func SetupTLSServerConfig ¶ added in v0.12.0
SetupTLSServerConfig creates a server X509 certificate from public and private key
func ToFloat64 ¶ added in v0.9.0
ToFloat64 Convert all number like type to float64
func ToInt64 ¶ added in v0.9.0
ToInt64 Convert all number like type to int64
Types ¶
type CaptureType ¶ added in v0.9.0
CaptureType describes a list of allowed and default captures probes
type Iterator ¶ added in v0.9.0
type Iterator struct {
// contains filtered or unexported fields
}
Iterator describes a int64 iterator
func NewIterator ¶ added in v0.9.0
NewIterator creates a new iterator based on (at, from, to) parameters
func (*Iterator) Done ¶ added in v0.9.0
Done returns true when the Iterator is at the end or uninitialized properly
type Metric ¶ added in v0.12.0
Metric defines accessors
type NetNSContext ¶ added in v0.9.0
type NetNSContext struct {
// contains filtered or unexported fields
}
NetNSContext describes a NameSpace Context switch API
func NewNetNsContext ¶ added in v0.9.0
func NewNetNsContext(path string) (*NetNSContext, error)
NewNetNsContext creates a new NameSpace context base on path
func (*NetNSContext) Quit ¶ added in v0.9.0
func (n *NetNSContext) Quit() error
Quit the NameSpace and go back to the original one
type PortAllocator ¶ added in v0.12.0
PortAllocator describes a threads safe port list that can be allocated
func NewPortAllocator ¶ added in v0.12.0
func NewPortAllocator(min, max int) (*PortAllocator, error)
NewPortAllocator creates a new port allocator range
func (*PortAllocator) Allocate ¶ added in v0.12.0
func (p *PortAllocator) Allocate() (int, error)
Allocate returns a new unused port between min and max ports
func (*PortAllocator) Release ¶ added in v0.12.0
func (p *PortAllocator) Release(i int) error
Release a port
func (*PortAllocator) ReleaseAll ¶ added in v0.12.0
func (p *PortAllocator) ReleaseAll()
ReleaseAll ports
func (*PortAllocator) Set ¶ added in v0.12.0
func (p *PortAllocator) Set(i int, obj interface{}) error
Set associate an object to the port map
type RawSocket ¶ added in v0.12.0
type RawSocket struct {
// contains filtered or unexported fields
}
RawSocket describes a raw socket C implemenation
func NewRawSocket ¶ added in v0.12.0
NewRawSocket creates a raw socket for the network interface ifName
func NewRawSocketInNs ¶ added in v0.12.0
NewRawSocketInNs create/open a socket in the namespace nsPath for the network interface ifName
func (*RawSocket) Close ¶ added in v0.12.0
Close the file descriptor
type ServiceAddress ¶ added in v0.12.0
ServiceAddress describes the service listening address and port
func ServiceAddressFromString ¶ added in v0.12.0
func ServiceAddressFromString(addressPort string) (ServiceAddress, error)
ServiceAddressFromString returns a service address from a string, could be IPv4 or IPv6
type ServiceType ¶ added in v0.12.0
type ServiceType string
ServiceType describes the service type (analyzer or agent)
const ( // AnalyzerService analyzer AnalyzerService ServiceType = "analyzer" // AgentService agent AgentService ServiceType = "agent" )
func (ServiceType) String ¶ added in v0.12.0
func (st ServiceType) String() string
type SortOrder ¶ added in v0.12.0
type SortOrder string
SortOrder describes ascending or descending order
type TimeSlice ¶ added in v0.12.0
TimeSlice defines a time boudary values
type TimedMetric ¶ added in v0.12.0
TimedMetric defines Metric during a time slice
func (*TimedMetric) GetFieldInt64 ¶ added in v0.12.0
func (tm *TimedMetric) GetFieldInt64(field string) (int64, error)
GetFieldInt64 returns the field value
func (*TimedMetric) MarshalJSON ¶ added in v0.12.0
func (tm *TimedMetric) MarshalJSON() ([]byte, error)
MarshalJSON serialized a TimedMetric in JSON
Source Files
¶
- capture.go
- common.go
- iterator.go
- ns.go
- port_allocator.go
- service.go
- socket.go
- tls.go
- types.go