buf

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2018 License: Unlicense, Unlicense Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Byte

type Byte struct {
	// contains filtered or unexported fields
}

Byte is a buffer that represents a byte

func NewByte

func NewByte(b byte) *Byte

NewByte makes a new Byte

func (*Byte) Array

func (r *Byte) Array() def.Array

Array is not implemented for Byte

func (*Byte) Buf

func (r *Byte) Buf() interface{}

Buf returns the byte

func (*Byte) Coding

func (r *Byte) Coding() def.Coding

Coding returns the string coding type handler

func (*Byte) Copy

func (r *Byte) Copy(b interface{}) def.Buffer

Copy copies a Byte or byte

func (*Byte) Free

func (r *Byte) Free() def.Buffer

Free is no-op as the buffer part of the struct

func (*Byte) Len

func (r *Byte) Len() int

Len always returns 1 because this is a byte

func (r *Byte) Link(b def.Buffer) def.Buffer

Link does nothing because bytes are stored in the struct

func (*Byte) Null

func (r *Byte) Null() def.Buffer

Null zeroes out the buffer

func (*Byte) OfLen

func (r *Byte) OfLen(int) def.Buffer

OfLen does nothing because this type only provides 1 byte

func (*Byte) Rand

func (r *Byte) Rand(...int) def.Buffer

Rand gets a random byte and loads it into the buffer

func (*Byte) Status

func (r *Byte) Status() def.Status

Status returns the status object

func (*Byte) String

func (r *Byte) String() (S string)

type Fenced

type Fenced struct {
	// contains filtered or unexported fields
}

Fenced is a struct that stores and manages memguard.LockedBuffer, ensuring that buffers are destroyed when no longer in use.

func NewFenced

func NewFenced() (R *Fenced)

NewFenced creates a new secure buffer

func (*Fenced) Array

func (r *Fenced) Array() def.Array

Array returns the array module of the Fenced buffer

func (*Fenced) Buf

func (r *Fenced) Buf() interface{}

Buf returns a pointer to the byte slice in the Fenced.

func (*Fenced) Coding

func (r *Fenced) Coding() def.Coding

Coding returns the coding module of the Fenced buffer

func (*Fenced) Copy

func (r *Fenced) Copy(b interface{}) def.Buffer

Copy duplicates the buffer from another Fenced.

func (*Fenced) Elem

func (r *Fenced) Elem(i int) interface{}

Elem returns the byte at a given index of the buffer

func (*Fenced) Free

func (r *Fenced) Free() def.Buffer

Free destroys the Fenced and dereferences it

func (*Fenced) Len

func (r *Fenced) Len() (i int)

Len returns the length of the Fenced if it has been loaded, or -1 if not. Note that this method satisfies two interfaces, Buffer and Array

func (r *Fenced) Link(buf def.Buffer) def.Buffer

Link copies the pointer from another Fenced's content, meaning what is written to one will also be visible in the other

func (*Fenced) MarshalJSON

func (r *Fenced) MarshalJSON() ([]byte, error)

MarshalJSON marshals the data of this object into JSON

func (*Fenced) Null

func (r *Fenced) Null() def.Buffer

Null zeroes out a Fenced buffer

func (*Fenced) OfLen

func (r *Fenced) OfLen(size int) def.Buffer

OfLen allocates a new buffer of a specified size and nulls and frees the existing, if any

func (*Fenced) Print

func (r *Fenced) Print()

func (*Fenced) Rand

func (r *Fenced) Rand(size ...int) def.Buffer

Rand loads the Fenced with cryptographically random bytes to a specified length, destroying existing buffer if it was set

func (*Fenced) SetElem

func (r *Fenced) SetElem(i int, b interface{}) interface{}

SetElem sets an element in the buffer

func (*Fenced) Status

func (r *Fenced) Status() def.Status

Status returns the status module of the Fenced buffer

func (*Fenced) String

func (r *Fenced) String() (S string)

String returns the JSON representing the data in a Fenced

type Unsafe

type Unsafe struct {
	// contains filtered or unexported fields
}

Unsafe is a struct that stores and manages byte slices for security purposes, automatically wipes old data when new data is loaded.

func NewUnsafe

func NewUnsafe() *Unsafe

NewUnsafe makes a new Unsafe

func (*Unsafe) Array

func (r *Unsafe) Array() def.Array

Array returns the array module of the Fenced buffer

func (*Unsafe) Buf

func (r *Unsafe) Buf() (R interface{})

Buf returns a variable pointing to the value stored in a Unsafe.

func (*Unsafe) Coding

func (r *Unsafe) Coding() def.Coding

Coding returns the string coding type handler

func (*Unsafe) Copy

func (r *Unsafe) Copy(b interface{}) def.Buffer

Copy duplicates the data from the buffer provided and zeroes and replaces its contents, clearing the error value.

func (*Unsafe) Elem

func (r *Unsafe) Elem(i int) (R interface{})

Elem returns the byte at a given index of the buffer

func (*Unsafe) Free

func (r *Unsafe) Free() def.Buffer

Free dereferences the buffer

func (*Unsafe) Len

func (r *Unsafe) Len() int

Len returns the length of the *[]byte if it has a value assigned, or -1

func (r *Unsafe) Link(b def.Buffer) (R def.Buffer)

Link copies the link from a buffer after purging its contents, if any

func (*Unsafe) MarshalJSON

func (r *Unsafe) MarshalJSON() ([]byte, error)

MarshalJSON renders the data as JSON

func (*Unsafe) Null

func (r *Unsafe) Null() (R def.Buffer)

Null wipes the value stored

func (*Unsafe) OfLen

func (r *Unsafe) OfLen(size int) (R def.Buffer)

OfLen nulls the Unsafe and assigns an empty *[]byte with a specified size

func (*Unsafe) Rand

func (r *Unsafe) Rand(size ...int) (R def.Buffer)

Rand loads a cryptographically random string of []byte of a specified size.

func (*Unsafe) SetElem

func (r *Unsafe) SetElem(i int, b interface{}) (R interface{})

SetElem sets an element in the buffer

func (*Unsafe) Status

func (r *Unsafe) Status() def.Status

Status returns the status object

func (*Unsafe) String

func (r *Unsafe) String() (S string)

String returns the Unsafe in the currently set coding format

Jump to

Keyboard shortcuts

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