util

package
v0.0.0-...-c8fc2fc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorCipherFailure = "Unable to initalize AES cipher"
	ErrorMacFailure    = "Unable to initalize Mac"
)

Variables

This section is empty.

Functions

func CalcPadding

func CalcPadding(length, blkSize int) int

CalcPadding returns the number of padding bytes needed to round length bytes to a multiple of blkSize

func Checksum

func Checksum(srcs ...common.RawBytes) uint16

Calculate RFC1071 checksum of supplied data chunks. If a chunk has an odd length, it is padded with a 0 during checksum computation.

func FillPadding

func FillPadding(b common.RawBytes, length, blkSize int) int

func InitMac

func InitMac(key common.RawBytes) (hash.Hash, error)

func Mac

func Mac(mac hash.Hash, msg common.RawBytes) (common.RawBytes, error)

func TimeToString

func TimeToString(t uint64) string

func UDPAddrEqual

func UDPAddrEqual(a, b *net.UDPAddr) bool

Types

type ASList

type ASList struct {
	Core    []*addr.ISD_AS
	NonCore []*addr.ISD_AS
}

func LoadASList

func LoadASList(fileName string) (*ASList, error)

LoadASList parses the yaml file fileName and returns a structure with non-core and core ASes.

type B64Bytes

type B64Bytes []byte

func (B64Bytes) MarshalYAML

func (b B64Bytes) MarshalYAML() (interface{}, error)

func (B64Bytes) String

func (b B64Bytes) String() string

func (*B64Bytes) UnmarshalYAML

func (b *B64Bytes) UnmarshalYAML(unmarshal func(interface{}) error) error

type Raw

type Raw struct {
	B      common.RawBytes
	Offset int
}

func (*Raw) Peek

func (r *Raw) Peek(p []byte) (int, error)

func (*Raw) Read

func (r *Raw) Read(p []byte) (int, error)

func (*Raw) Write

func (r *Raw) Write(p []byte) (int, error)

Directories

Path Synopsis
Package bufpool initializes an elastic pool of free buffers.
Package bufpool initializes an elastic pool of free buffers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL