Documentation ¶
Index ¶
- Constants
- 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 InitMac(key common.RawBytes) (hash.Hash, error)
- func Mac(mac hash.Hash, msg common.RawBytes) (common.RawBytes, error)
- func ParseDuration(durationStr string) (time.Duration, error)
- func SecsToTime(t int64) time.Time
- func TimeToString(t time.Time) string
- func UDPAddrEqual(a, b *net.UDPAddr) bool
- func USecsToTime(t uint32) time.Time
- type ASList
- type B64Bytes
- type ChannelLock
- type Raw
- type Trigger
Constants ¶
const ( ErrorCipherFailure = "Unable to initalize AES cipher" ErrorMacFailure = "Unable to initalize Mac" )
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 TimeToString ¶
func UDPAddrEqual ¶
func USecsToTime ¶
USecsToTime takes seconds stored in a uint32.
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 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.