types

package
v0.0.0-...-53467ae Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2019 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CBOR

type CBOR struct{}

CBOR is a type that allows for encoding and decoding of arbitrary types to and from CBOR

func (*CBOR) Decode

func (c *CBOR) Decode(pl []byte) interface{}

Decode decodes a CBOR byte array to a golang struct

func (*CBOR) Encode

func (c *CBOR) Encode(val interface{}) []byte

Encode encodes any golang struct into CBOR

type Compressor

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

Compressor implements go-coap.Compressor

func NewCompressor

func NewCompressor(mapsDir string, mapFiles []string, cborStruct *CBOR) (*Compressor, error)

NewCompressor returns a new instance of the Compressor struct with its dictionary initialised from the given files. Returns an error if the files couldn't be parsed or read.

func (*Compressor) CompressPayload

func (c *Compressor) CompressPayload(j []byte) ([]byte, error)

CompressPayload compresses a given byte array

func (*Compressor) CompressTransaction

func (c *Compressor) CompressTransaction(val interface{}) interface{}

CompressTransaction is a function that compresses PDU bodies and destination tables held inside a federation transaction.

func (*Compressor) DecompressPayload

func (c *Compressor) DecompressPayload(j []byte) ([]byte, error)

DecompressPayload decompresses a given byte array

func (*Compressor) DecompressTransaction

func (c *Compressor) DecompressTransaction(val interface{}) interface{}

DecompressTransaction is a function that compresses a transaction for federation traffic.

type InMemoryKeyStore

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

InMemoryKeyStore is a struct containing remote and local Diffie Hellman keys implemented by the noise protocol library.

func NewKeyStore

func NewKeyStore() *InMemoryKeyStore

NewKeyStore is a function that creates a new InMemoryKeyStore instance

func (*InMemoryKeyStore) GetLocalKey

func (ks *InMemoryKeyStore) GetLocalKey() (noise.DHKey, error)

GetLocalKey is a function that returns a static local key from the InMemoryKeyStore

func (*InMemoryKeyStore) GetRemoteKey

func (ks *InMemoryKeyStore) GetRemoteKey(addr net.Addr) ([]byte, error)

GetRemoteKey is a function that returns a remote key from the InMemoryKeyStore

func (*InMemoryKeyStore) SetLocalKey

func (ks *InMemoryKeyStore) SetLocalKey(key noise.DHKey) error

SetLocalKey is a function that takes in a DHKey and inserts it into the InMemoryKeyStore

func (*InMemoryKeyStore) SetRemoteKey

func (ks *InMemoryKeyStore) SetRemoteKey(addr net.Addr, key []byte) error

SetRemoteKey is a function that takes in a remote key and the address it is associated with and inserts/updates it in the InMemoryKeyStore

type JSON

type JSON struct{}

JSON is a struct that contains JSON encoding and decoding methods

func (*JSON) Decode

func (j *JSON) Decode(pl []byte) interface{}

Decode takes a JSON byte array and produces a golang object

func (*JSON) Encode

func (j *JSON) Encode(val interface{}) []byte

Encode takes an arbitrary golang object and encodes it to JSON

func (*JSON) ParseFile

func (j *JSON) ParseFile(filepath string, target interface{}) error

ParseFile takes in a filepath and a target struct and fills it with the contents of the JSON file

Jump to

Keyboard shortcuts

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