Documentation ¶
Index ¶
- Variables
- func ClearSignals(c chan<- os.Signal)
- func CopyBytes(b []byte) []byte
- func HandleSignals(f func(os.Signal), sigs ...os.Signal) chan<- os.Signal
- func IsSorted2DBytes(arr [][]byte) bool
- func IsSortedAndUnique(data sort.Interface) bool
- func IsSortedAndUniqueUint32(arr []uint32) bool
- func IsSortedAndUniqueUint64(u64 []uint64) bool
- func RandomBytes(n int) []byte
- func Sort2DBytes(arr [][]byte)
- func SortUint32(u32 []uint32)
- func SortUint64(u64 []uint64)
- type AtomicBool
- type AtomicInterface
- type DynamicIPDesc
- type IPCertDesc
- type IPDesc
- type IPDescContainer
Constants ¶
This section is empty.
Variables ¶
var ( MillisecondsBuckets = []float64{ 10, 100, 250, 500, 1000, 1500, 2000, 3000, 5000, 10000, } NanosecondsBuckets = []float64{ float64(100 * time.Nanosecond), float64(time.Microsecond), float64(10 * time.Microsecond), float64(100 * time.Microsecond), float64(time.Millisecond), float64(10 * time.Millisecond), float64(100 * time.Millisecond), float64(time.Second), } )
Useful latency buckets
var (
BytesBuckets = []float64{
1 << 8,
1 << 10,
1 << 12,
1 << 14,
1 << 16,
1 << 18,
1 << 20,
1 << 22,
}
)
Useful bytes buckets
Functions ¶
func ClearSignals ¶ added in v0.8.0
ClearSignals clears any signals that have been registered on the provided channel and closes the channel.
func CopyBytes ¶ added in v0.8.0
CopyBytes returns a copy of the provided byte slice. If nil is provided, nil will be returned.
func HandleSignals ¶ added in v0.8.0
HandleSignals calls f if the go runtime receives the any of the provided signals with the received signal.
If f is nil or there are no provided signals, then nil will be returned. Otherwise, a signal channel will be returned that can be used to clear the signals registered by this function by valling ClearSignals.
func IsSorted2DBytes ¶ added in v0.8.0
IsSorted2DBytes returns true iff [arr] is sorted
func IsSortedAndUnique ¶
IsSortedAndUnique returns true if the elements in the data are unique and sorted.
func IsSortedAndUniqueUint32 ¶
IsSortedAndUniqueUint32 returns true if the array of uint32s are sorted and unique
func IsSortedAndUniqueUint64 ¶ added in v0.8.0
IsSortedAndUniqueUint64 returns true if the array of uint64s are sorted and unique
func RandomBytes ¶ added in v1.3.2
RandomBytes returns a slice of n random bytes Intended for use in testing
func Sort2DBytes ¶ added in v0.8.0
func Sort2DBytes(arr [][]byte)
Sort2DBytes sorts a 2D byte array Each byte array is not sorted internally; the byte arrays are sorted relative to another.
Types ¶
type AtomicBool ¶ added in v1.0.3
type AtomicBool struct {
// contains filtered or unexported fields
}
func (*AtomicBool) GetValue ¶ added in v1.0.3
func (a *AtomicBool) GetValue() bool
func (*AtomicBool) SetValue ¶ added in v1.0.3
func (a *AtomicBool) SetValue(b bool)
type AtomicInterface ¶ added in v1.0.3
type AtomicInterface struct {
// contains filtered or unexported fields
}
func NewAtomicInterface ¶ added in v1.0.3
func NewAtomicInterface(v interface{}) *AtomicInterface
func (*AtomicInterface) GetValue ¶ added in v1.0.3
func (a *AtomicInterface) GetValue() interface{}
func (*AtomicInterface) SetValue ¶ added in v1.0.3
func (a *AtomicInterface) SetValue(v interface{})
type DynamicIPDesc ¶ added in v1.0.3
type DynamicIPDesc struct {
*IPDescContainer
}
func NewDynamicIPDesc ¶ added in v1.0.3
func NewDynamicIPDesc(ip net.IP, port uint16) DynamicIPDesc
func (*DynamicIPDesc) IP ¶ added in v1.0.3
func (i *DynamicIPDesc) IP() IPDesc
func (*DynamicIPDesc) Update ¶ added in v1.0.3
func (i *DynamicIPDesc) Update(ip IPDesc)
func (*DynamicIPDesc) UpdateIP ¶ added in v1.0.3
func (i *DynamicIPDesc) UpdateIP(ip net.IP)
func (*DynamicIPDesc) UpdatePort ¶ added in v1.0.3
func (i *DynamicIPDesc) UpdatePort(port uint16)
type IPCertDesc ¶ added in v1.4.0
type IPCertDesc struct { Cert *x509.Certificate IPDesc IPDesc Time uint64 Signature []byte }
type IPDesc ¶
IPDesc ...
func (IPDesc) IsPrivate ¶
IsPrivate attempts to decide if the ip address in this descriptor is a local ip address. This function was taken from: https://stackoverflow.com/a/50825191/3478466
type IPDescContainer ¶ added in v1.0.3
type IPDescContainer struct { *IPDesc // contains filtered or unexported fields }