Documentation ¶
Index ¶
- func CalcPadding(length, blkSize int) int
- func Checksum(srcs ...common.RawBytes) uint16
- func FillPadding(b common.RawBytes, length, blkSize int) int
- func FmtDuration(dur time.Duration) string
- func ParseDuration(durationStr string) (time.Duration, error)
- func SecsToTime(t uint32) time.Time
- func TimeToSecs(t time.Time) uint32
- func TimeToString(t time.Time) string
- type ASList
- type B64Bytes
- type ChannelLock
- type DebugID
- type Raw
- type Trigger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalcPadding ¶
CalcPadding returns the number of padding bytes needed to round length bytes to a multiple of blkSize
func Checksum ¶
Calculate RFC1071 checksum of supplied data chunks. If a chunk has an odd length, it is padded with a 0 during checksum computation.
func FmtDuration ¶
func ParseDuration ¶
ParseDuration parses a string into a time.Duration, assuming that a year always has 365d, a week always has 7d, and a day always has 24h.
It is similar to time.ParseDuration, but differs in the following ways: - It adds support for the following units: "y", "w", "d" - It requires a unit suffix - It does not support mixed unit durations (e.g. `1h10m10s` is not supported). - It does not support negative durations.
func TimeToSecs ¶ added in v0.2.0
TimeToSecs returns seconds stored as uint32.
func TimeToString ¶
Types ¶
type ASList ¶
func LoadASList ¶
LoadASList parses the yaml file fileName and returns a structure with non-core and core ASes.
type ChannelLock ¶
type ChannelLock struct {
// contains filtered or unexported fields
}
ChannelLock implements a sync.Mutex-like API that uses a 1-value channel behind the scenes. This makes it usable in selects that also need to meet context deadlines.
func NewChannelLock ¶
func NewChannelLock() *ChannelLock
func (*ChannelLock) Lock ¶
func (l *ChannelLock) Lock() <-chan struct{}
Lock returns a channel that can be drained to acquire the lock.
func (*ChannelLock) Unlock ¶
func (l *ChannelLock) Unlock()
type DebugID ¶ added in v0.2.0
type DebugID uint32
DebugID is used to correlate behavior in logs. A DebugID is allocated for each outgoing request/response or notify message exchange, and for each handler executed during ListenAndServe.
func GetDebugID ¶ added in v0.2.0
func GetDebugID() DebugID
type Trigger ¶
type Trigger struct {
// contains filtered or unexported fields
}
Trigger represents a timer with delayed arming. Once Arm is called, the channel return by Done() will be closed after d time. If d is 0, the channel is never closed.