objects

package
v2.0.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2016 License: GPL-3.0 Imports: 15 Imported by: 10

Documentation

Overview

This file is autogenerated from https://github.com/immesys/bw2_pid/blob/master/allocations.yaml

Index

Constants

View Source
const (
	ROAccessDChainHash     = 0x01
	ROPermissionDChainHash = 0x11
	ROAccessDChain         = 0x02
	ROPermissionDChain     = 0x12
	ROAccessDOT            = 0x20
	ROPermissionDOT        = 0x21
	ROEntity               = 0x30
	ROEntityWKey           = 0x32
	ROOriginVK             = 0x31
	ROExpiry               = 0x40
	RORevocation           = 0x50
)
View Source
const (
	CmdHello        = "helo"
	CmdPublish      = "publ"
	CmdSubscribe    = "subs"
	CmdPersist      = "pers"
	CmdList         = "list"
	CmdQuery        = "quer"
	CmdTapSubscribe = "tsub"
	CmdTapQuery     = "tque"
	CmdPutDot       = "putd"
	CmdPutEntity    = "pute"
	CmdPutChain     = "putc"
	CmdMakeDot      = "makd"
	CmdMakeEntity   = "make"
	CmdMakeChain    = "makc"
	CmdBuildChain   = "bldc"
	CmdAddPrefDot   = "adpd"
	CmdAddPrefChain = "adpc"
	CmdDelPrefDot   = "dlpd"
	CmdDelPrefChain = "dlpc"
	CmdSetEntity    = "sete"

	CmdResponse = "resp"
	CmdResult   = "rslt"
)
View Source
const PODFBWRoutingObject = `0.0.0.0`
View Source
const PODFBinary = `0.0.0.0`
View Source
const PODFBinaryActuation = `1.0.1.0`
View Source
const PODFBlob = `1.0.0.0`
View Source
const PODFCapnP = `3.0.0.0`
View Source
const PODFDouble = `1.0.2.0`
View Source
const PODFFMDIntentString = `64.0.1.1`
View Source
const PODFHamiltonBase = `2.0.4.0`
View Source
const PODFHamiltonTelemetry = `2.0.4.64`
View Source
const PODFJSON = `65.0.0.0`
View Source
const PODFMaskBWRoutingObject = `0.0.0.0/8`
View Source
const PODFMaskBinary = `0.0.0.0/4`
View Source
const PODFMaskBinaryActuation = `1.0.1.0/32`
View Source
const PODFMaskBlob = `1.0.0.0/8`
View Source
const PODFMaskCapnP = `3.0.0.0/8`
View Source
const PODFMaskDouble = `1.0.2.0/32`
View Source
const PODFMaskFMDIntentString = `64.0.1.1/32`
View Source
const PODFMaskHamiltonBase = `2.0.4.0/24`
View Source
const PODFMaskHamiltonTelemetry = `2.0.4.64/26`
View Source
const PODFMaskJSON = `65.0.0.0/8`
View Source
const PODFMaskMsgPack = `2.0.0.0/8`
View Source
const PODFMaskSMetadata = `2.0.3.1/32`
View Source
const PODFMaskSpawnpointConfig = `67.0.2.0/32`
View Source
const PODFMaskSpawnpointHeartbeat = `67.0.2.1/32`
View Source
const PODFMaskSpawnpointLog = `2.0.2.0/32`
View Source
const PODFMaskString = `64.0.1.0/32`
View Source
const PODFMaskText = `64.0.0.0/4`
View Source
const PODFMaskXML = `66.0.0.0/8`
View Source
const PODFMaskYAML = `67.0.0.0/8`
View Source
const PODFMsgPack = `2.0.0.0`
View Source
const PODFSMetadata = `2.0.3.1`
View Source
const PODFSpawnpointConfig = `67.0.2.0`
View Source
const PODFSpawnpointHeartbeat = `67.0.2.1`
View Source
const PODFSpawnpointLog = `2.0.2.0`
View Source
const PODFString = `64.0.1.0`
View Source
const PODFText = `64.0.0.0`
View Source
const PODFXML = `66.0.0.0`
View Source
const PODFYAML = `67.0.0.0`
View Source
const POMaskBWRoutingObject = 8
View Source
const POMaskBinary = 4
View Source
const POMaskBinaryActuation = 32
View Source
const POMaskBlob = 8
View Source
const POMaskCapnP = 8
View Source
const POMaskDouble = 32
View Source
const POMaskFMDIntentString = 32
View Source
const POMaskHamiltonBase = 24
View Source
const POMaskHamiltonTelemetry = 26
View Source
const POMaskJSON = 8
View Source
const POMaskMsgPack = 8
View Source
const POMaskSMetadata = 32
View Source
const POMaskSpawnpointConfig = 32
View Source
const POMaskSpawnpointHeartbeat = 32
View Source
const POMaskSpawnpointLog = 32
View Source
const POMaskString = 32
View Source
const POMaskText = 4
View Source
const POMaskXML = 8
View Source
const POMaskYAML = 8
View Source
const PONumBWRoutingObject = 0

BWRoutingObject (0.0.0.0/8): Bosswave Routing Object This class and schema block is reserved for bosswave routing objects represented using the full PID.

View Source
const PONumBinary = 0

Binary (0.0.0.0/4): Binary protocols This is a superclass for classes that are generally unreadable in their plain form and require translation.

View Source
const PONumBinaryActuation = 16777472

BinaryActuation (1.0.1.0/32): Binary actuation This payload object is one byte long, 0x00 for off, 0x01 for on.

View Source
const PONumBlob = 16777216

Blob (1.0.0.0/8): Blob This is a class for schemas that do not use a public encoding format. In general it should be avoided. Schemas below this should include the key "readme" with a url to a description of the schema that is sufficiently detailed to allow for a developer to reverse engineer the protocol if required.

View Source
const PONumCapnP = 50331648

CapnP (3.0.0.0/8): Captain Proto This class is for captain proto interfaces. Schemas below this should include the key "schema" with a url to their .capnp file

View Source
const PONumDouble = 16777728

Double (1.0.2.0/32): Double This payload is an 8 byte long IEEE 754 double floating point value encoded in little endian. This should only be used if the semantic meaning is obvious in the context, otherwise a PID with a more specific semantic meaning should be used.

View Source
const PONumFMDIntentString = 1073742081

FMDIntentString (64.0.1.1/32): FMD Intent String A plain string used as an intent for the follow-me display service.

View Source
const PONumHamiltonBase = 33555456

HamiltonBase (2.0.4.0/24): Hamilton Messages This is the base class for messages used with the Hamilton motes. The only key guaranteed is "#" that contains a uint16 representation of the serial of the mote the message is destined for or originated from.

View Source
const PONumHamiltonTelemetry = 33555520

HamiltonTelemetry (2.0.4.64/26): Hamilton Telemetry This object contains a "#" field for the serial number, as well as possibly containing an "A" field with a list of X, Y, and Z accelerometer values. A "T" field containing the temperature as an integer in degrees C multiplied by 10000, and an "L" field containing the illumination in Lux.

View Source
const PONumJSON = 1090519040

JSON (65.0.0.0/8): JSON This class is for schemas that are represented in JSON

View Source
const PONumMsgPack = 33554432

MsgPack (2.0.0.0/8): MsgPack This class is for schemas that are represented in MsgPack

View Source
const PONumSMetadata = 33555201

SMetadata (2.0.3.1/32): Simple Metadata entry This contains a simple "val" string and "ts" int64 metadata entry. The key is determined by the URI. Other information MAY be present in the msgpacked object. The timestamp is used for merging metadata entries.

View Source
const PONumSpawnpointConfig = 1124073984

SpawnpointConfig (67.0.2.0/32): SpawnPoint config A configuration file for SpawnPoint (github.com/immesys/spawnpoint)

View Source
const PONumSpawnpointHeartbeat = 1124073985

SpawnpointHeartbeat (67.0.2.1/32): SpawnPoint heartbeat A heartbeat message from spawnpoint

View Source
const PONumSpawnpointLog = 33554944

SpawnpointLog (2.0.2.0/32): Spawnpoint stdout This contains stdout data from a spawnpoint container. It is a msgpacked dictionary that contains a "service" key, a "time" key (unix nano timestamp) and a "contents" key and a "spalias" key.

View Source
const PONumString = 1073742080

String (64.0.1.0/32): String A plain string with no rigid semantic meaning. This can be thought of as a print statement. Anything that has semantic meaning like a process log should use a different schema.

View Source
const PONumText = 1073741824

Text (64.0.0.0/4): Human readable text This is a superclass for classes that are moderately understandable if they are read directly in their binary form. Generally these are protocols that were designed specifically to be human readable.

View Source
const PONumXML = 1107296256

XML (66.0.0.0/8): XML This class is for schemas that are represented in XML

View Source
const PONumYAML = 1124073472

YAML (67.0.0.0/8): YAML This class is for schemas that are represented in YAML

View Source
const SaneObjectSize = 16 * 1024 * 1024

We allocate buffers for objects. Lets not get too exciteable about how big an object we are willing to accept

Variables

View Source
var RoutingObjectConstructor = map[int]func(ronum int, content []byte) (RoutingObject, error){
	ROAccessDChain:         NewDChain,
	ROAccessDChainHash:     NewDChain,
	ROPermissionDChain:     NewDChain,
	ROPermissionDChainHash: NewDChain,
	ROAccessDOT:            NewDOT,
	ROPermissionDOT:        NewDOT,
	ROEntity:               NewEntity,
	ROOriginVK:             NewOriginVK,
	ROExpiry:               NewExpiry,
	RORevocation:           NewRevocation,
}

RoutingObjectConstruct allows you to map a ROnum into a constructor that takes a binary representation and returns a Routing Object

Functions

func IsEveryoneVK

func IsEveryoneVK(vk []byte) bool

Check is vk is all zeroes

func NewObjectError

func NewObjectError(oid int, msg string) error

NewObjectError constructs an ObjectError

func PONumDotForm

func PONumDotForm(ponum int) string

func PONumFromDotForm

func PONumFromDotForm(dotform string) (int, error)

func ReadExactly

func ReadExactly(s *bufio.Reader, to []byte) error

Types

type AccessDOTPermissionSet

type AccessDOTPermissionSet struct {
	CanPublish     bool
	CanConsume     bool
	CanConsumePlus bool
	CanConsumeStar bool
	CanTap         bool
	CanTapPlus     bool
	CanTapStar     bool
	CanList        bool
}

func DecodeADPS

func DecodeADPS(raw []byte) *AccessDOTPermissionSet

func GetADPSFromPermString

func GetADPSFromPermString(v string) *AccessDOTPermissionSet

func (*AccessDOTPermissionSet) Encode

func (ps *AccessDOTPermissionSet) Encode() []byte

This is not the encoding used on the wire, but it is used on the BC

func (*AccessDOTPermissionSet) GetPermString

func (ps *AccessDOTPermissionSet) GetPermString() string

func (*AccessDOTPermissionSet) IsSubsetOf

func (ps *AccessDOTPermissionSet) IsSubsetOf(rhs *AccessDOTPermissionSet) bool

func (*AccessDOTPermissionSet) ReduceBy

type BossWaveObject

type BossWaveObject interface {
	IsPayloadObject() bool
}

func LoadBosswaveObject

func LoadBosswaveObject(s io.Reader) (BossWaveObject, error)

LoadBosswaveObject loads an object from a reader. all objects will need to have the full length header

type DChain

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

DChain is a list of DOT hashes

func CreateDChain

func CreateDChain(access bool, dots ...*DOT) (*DChain, error)

CreateDChain creates a dot chain from the given DOTs. The DOTs must have the hash field populated

func (*DChain) AugmentBy

func (ro *DChain) AugmentBy(d *DOT)

AugmentBy fills the given dot into the right position in the chain assuming it is referred to at all

func (*DChain) CheckAccessGrants

func (ro *DChain) CheckAccessGrants(curTime *time.Time,
	ADPS *AccessDOTPermissionSet, mvk []byte, suffix string,
	getDOT func([]byte) *DOT, getEntity func([]byte) *Entity,
	getRevocations func([]byte) []*Revocation) int

CheckAccessGrants is supposed to verify absolutely everything it can. As a quirk, it is written to use external state so it can be used for BC and statedb work. It fails if absoulutely ANYTHING is out of order. it checks

  • all DOT sigs,
  • Revocations on srcvk, dstvk, dothash
  • all dots are access
  • dots are tail-to-tail
  • dot expiry against curTimeNs
  • TTL
  • all dots grant on MVK
  • final chain gives superset of ADPS and Suffix
  • all entity sigs
  • entity expiry against curTimeNs
  • given URI suffix is well formed
  • the origin of the dchain is the mvk - this might be contentious

it is my hope that if this method gives the okay, there is nothing (save for unknown revocations) that could be wrong if curTimeNs is nil, the current system time will be used if any of the state functions cannot find, it should return nil if status is BWStatusOkay, everything is A-OK, if it is BWStatusOkayAsResolved it MIGHT be ok it is up to the caller to determine if they need to know that the entities are unexpired. Otherwise any entity that fails to resolve is not an error but may have been expired and we don't know. DOTs must be resolvable so we know they are not expired.

func (*DChain) CheckAllSigs

func (ro *DChain) CheckAllSigs() bool

func (*DChain) ConvertToDChainHash

func (ro *DChain) ConvertToDChainHash() (*DChain, error)

ConvertToDChainHash creates a hash RO from a dchain RO that may or may not be fully elaborated. Note that there are shared resources in the result

func (*DChain) GetAccessURIPermString

func (ro *DChain) GetAccessURIPermString() string

func (*DChain) GetAccessURISuffix

func (ro *DChain) GetAccessURISuffix() (string, error)

func (*DChain) GetChainHash

func (ro *DChain) GetChainHash() []byte

GetChainHash returns the hash of the chain

func (*DChain) GetContent

func (ro *DChain) GetContent() []byte

GetContent returns the serialised content for this object

func (*DChain) GetDOT

func (ro *DChain) GetDOT(num int) *DOT

GetDOT returns the DOT at the given index if it has been stored in the chain, otherwise nil

func (*DChain) GetDotHash

func (ro *DChain) GetDotHash(num int) []byte

GetDotHash returns the dot hash at the specific index

func (*DChain) GetGiverVK

func (ro *DChain) GetGiverVK() []byte

func (*DChain) GetMVK

func (ro *DChain) GetMVK() []byte

func (*DChain) GetRONum

func (ro *DChain) GetRONum() int

GetRONum returns the RONum for this object

func (*DChain) GetReceiverVK

func (ro *DChain) GetReceiverVK() []byte

func (*DChain) GetTTL

func (ro *DChain) GetTTL() int

func (*DChain) IsAccess

func (ro *DChain) IsAccess() bool

func (*DChain) IsElaborated

func (ro *DChain) IsElaborated() bool

IsElaborated returns true if the dot hashes are populated

func (*DChain) IsPayloadObject

func (ro *DChain) IsPayloadObject() bool

func (*DChain) NumHashes

func (ro *DChain) NumHashes() int

NumHashes returns the length of the chain

func (*DChain) SetDOT

func (ro *DChain) SetDOT(num int, d *DOT)

SetDOT sets the specific DOT

func (*DChain) UnElaborate

func (ro *DChain) UnElaborate()

func (*DChain) WriteToStream

func (ro *DChain) WriteToStream(s io.Writer, fullObjNum bool) error

type DOT

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

DOT is a declaration of trust. This is a shared object that implements both an access dot and a permission dot

func CreateDOT

func CreateDOT(isAccess bool, giverVK []byte, receiverVK []byte) *DOT

CreateDOT is used to create a DOT from scratch. The DOT is incomplete until Encode() is called later.

func (*DOT) AddRevoker

func (ro *DOT) AddRevoker(rvk []byte)

func (*DOT) Encode

func (ro *DOT) Encode(sk []byte)

Encode will work out the content of the DOT based on the fields that have been set, and sign it with the given sk (must match the vk)

func (*DOT) GetAccessURIMVK

func (ro *DOT) GetAccessURIMVK() []byte

GetAccessURIMVK gets the mvk if this is an access DOT

func (*DOT) GetAccessURISuffix

func (ro *DOT) GetAccessURISuffix() string

GetAccessURISuffix returns the suffix if this is an access DOT

func (*DOT) GetComment

func (ro *DOT) GetComment() string

func (*DOT) GetContact

func (ro *DOT) GetContact() string

func (*DOT) GetContent

func (ro *DOT) GetContent() []byte

GetContent returns the binary representation of the DOT if Encode has been called

func (*DOT) GetCreated

func (ro *DOT) GetCreated() *time.Time

func (*DOT) GetExpiry

func (ro *DOT) GetExpiry() *time.Time

func (*DOT) GetGiverVK

func (ro *DOT) GetGiverVK() []byte

GetGiverVK returns the verifying key of the entity that created this DOT

func (*DOT) GetHash

func (ro *DOT) GetHash() []byte

GetHash returns the dot hash or panics if it has not been set by encoding/reading from stream etc.

func (*DOT) GetPermString

func (ro *DOT) GetPermString() string

GetPermString gets the human readable permission string for an access dot

func (*DOT) GetPermissionSet

func (ro *DOT) GetPermissionSet() *AccessDOTPermissionSet

func (*DOT) GetRONum

func (ro *DOT) GetRONum() int

GetRONum returns the ronum of the dot

func (*DOT) GetReceiverVK

func (ro *DOT) GetReceiverVK() []byte

GetReceiverVK gets the verifying key of the entity that is the recipient of trust in this DOT

func (*DOT) GetRevokers

func (ro *DOT) GetRevokers() [][]byte

func (*DOT) GetTTL

func (ro *DOT) GetTTL() int

GetTTL gets the TTL of a DOT

func (*DOT) IsAccess

func (ro *DOT) IsAccess() bool

func (*DOT) IsPayloadObject

func (ro *DOT) IsPayloadObject() bool

func (*DOT) OverrideSetSignatureValid

func (ro *DOT) OverrideSetSignatureValid()

OverrideSetSigValid sets this dots signature as valid without checking it this is used if the DOT is known good (say from the store)

func (*DOT) SetAccessURI

func (ro *DOT) SetAccessURI(mvk []byte, suffix string)

SetAccessURI sets the URI of an Access DOT

func (*DOT) SetCanConsume

func (ro *DOT) SetCanConsume(normal bool, plus bool, star bool)

SetCanConsume sets the consume privileges on an access dot

func (*DOT) SetCanList

func (ro *DOT) SetCanList(value bool)

SetCanList sets the list capability on an access DOT

func (*DOT) SetCanPublish

func (ro *DOT) SetCanPublish(value bool)

SetCanPublish sets the publish capability on an access DOT

func (*DOT) SetCanTap

func (ro *DOT) SetCanTap(normal bool, plus bool, star bool)

SetCanTap sets the tap capability on an access dot

func (*DOT) SetComment

func (ro *DOT) SetComment(v string)

func (*DOT) SetContact

func (ro *DOT) SetContact(v string)

func (*DOT) SetCreation

func (ro *DOT) SetCreation(time time.Time)

SetCreation sets the creation timestamp on the DOT

func (*DOT) SetCreationToNow

func (ro *DOT) SetCreationToNow()

SetCreationToNow sets the creation timestamp to the current time

func (*DOT) SetExpireFromNow

func (ro *DOT) SetExpireFromNow(delta time.Duration)

SetExpireFromNow is a convenience function that sets the creation time to now, and sets the expiry to the given delta from the creation time

func (*DOT) SetExpiry

func (ro *DOT) SetExpiry(time time.Time)

SetExpiry sets the expiry time to the given time

func (*DOT) SetPermString

func (ro *DOT) SetPermString(v string) bool

SetPermString sets the permissions of this (access) dot. it returns true on success, false if the string is bad or this was not an access dot

func (*DOT) SetPermission

func (ro *DOT) SetPermission(key string, value string)

SetPermission sets the given key in a Permission DOT's table

func (*DOT) SetTTL

func (ro *DOT) SetTTL(v int)

SetTTL sets the TTL of a dot

func (*DOT) SigValid

func (ro *DOT) SigValid() bool

SigValid returns if the DOT's signature is valid. This only checks the signature on the first call, so the content must not change after encoding for this to be valid. As a plus it also verifies that the topic is sane

func (*DOT) String

func (ro *DOT) String() string

String returns a string representation of the DOT

func (*DOT) WriteToStream

func (ro *DOT) WriteToStream(s io.Writer, fullObjNum bool) error

type Entity

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

func CreateLightEntity

func CreateLightEntity(vk, sk []byte) *Entity

func CreateNewEntity

func CreateNewEntity(contact, comment string, revokers [][]byte) *Entity

func (*Entity) AddRevoker

func (ro *Entity) AddRevoker(rvk []byte)

func (*Entity) Encode

func (ro *Entity) Encode()

func (*Entity) FullString

func (ro *Entity) FullString() string

func (*Entity) GetComment

func (ro *Entity) GetComment() string

func (*Entity) GetContact

func (ro *Entity) GetContact() string

func (*Entity) GetContent

func (ro *Entity) GetContent() []byte

func (*Entity) GetCreated

func (ro *Entity) GetCreated() *time.Time

func (*Entity) GetExpiry

func (ro *Entity) GetExpiry() *time.Time

func (*Entity) GetRONum

func (ro *Entity) GetRONum() int

func (*Entity) GetRevokers

func (ro *Entity) GetRevokers() [][]byte

func (*Entity) GetSK

func (ro *Entity) GetSK() []byte

func (*Entity) GetSigningBlob

func (ro *Entity) GetSigningBlob() []byte

GetSigningBlob returns the full entity, including the private key

func (*Entity) GetVK

func (ro *Entity) GetVK() []byte

func (*Entity) IsPayloadObject

func (ro *Entity) IsPayloadObject() bool

func (*Entity) OverrideSetSignatureValid

func (ro *Entity) OverrideSetSignatureValid()

func (*Entity) SetCreationToNow

func (ro *Entity) SetCreationToNow()

func (*Entity) SetExpiry

func (ro *Entity) SetExpiry(t time.Time)

func (*Entity) SetSK

func (ro *Entity) SetSK(sk []byte)

func (*Entity) SetVK

func (ro *Entity) SetVK(vk []byte)

func (*Entity) SigValid

func (ro *Entity) SigValid() bool

SigValid returns if the Entity's signature is valid. This only checks the signature on the first call, so the content must not change after encoding for this to be valid

func (*Entity) StringKey

func (ro *Entity) StringKey() string

func (*Entity) WriteToStream

func (ro *Entity) WriteToStream(s io.Writer, fullObjNum bool) error

type Expiry

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

func CreateNewExpiry

func CreateNewExpiry(expiry time.Time) *Expiry

func CreateNewExpiryFromNow

func CreateNewExpiryFromNow(expiry time.Duration) *Expiry

func (*Expiry) GetContent

func (ro *Expiry) GetContent() []byte

func (*Expiry) GetExpiry

func (ro *Expiry) GetExpiry() time.Time

func (*Expiry) GetRONum

func (ro *Expiry) GetRONum() int

func (*Expiry) IsPayloadObject

func (ro *Expiry) IsPayloadObject() bool

func (*Expiry) WriteToStream

func (ro *Expiry) WriteToStream(s io.Writer, fullObjNum bool) error

type Frame

type Frame struct {
	SeqNo   int
	Headers []Header
	Cmd     string
	ROs     []ROEntry
	POs     []POEntry
	Length  int
}

func CreateFrame

func CreateFrame(cmd string, seqno int) *Frame

func LoadFrameFromStream

func LoadFrameFromStream(s *bufio.Reader) (f *Frame, e error)

func (*Frame) AddHeader

func (f *Frame) AddHeader(k string, v string)

func (*Frame) AddHeaderB

func (f *Frame) AddHeaderB(k string, v []byte)

func (*Frame) AddPayloadObject

func (f *Frame) AddPayloadObject(po PayloadObject)

func (*Frame) AddRoutingObject

func (f *Frame) AddRoutingObject(ro RoutingObject)

func (*Frame) GetAllHeaders

func (f *Frame) GetAllHeaders(k string) []string

func (*Frame) GetAllHeadersB

func (f *Frame) GetAllHeadersB(k string) [][]byte

func (*Frame) GetAllPOs

func (f *Frame) GetAllPOs() []PayloadObject

func (*Frame) GetAllROs

func (f *Frame) GetAllROs() []RoutingObject

func (*Frame) GetFirstHeader

func (f *Frame) GetFirstHeader(k string) (string, bool)

func (*Frame) GetFirstHeaderB

func (f *Frame) GetFirstHeaderB(k string) ([]byte, bool)

func (*Frame) ParseFirstHeaderAsBool

func (f *Frame) ParseFirstHeaderAsBool(k string, def bool) (bool, bool, *string)

func (*Frame) ParseFirstHeaderAsInt

func (f *Frame) ParseFirstHeaderAsInt(k string, def int) (int, bool, *string)

func (*Frame) WriteToStream

func (f *Frame) WriteToStream(s *bufio.Writer)

type GenericPO

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

func (*GenericPO) GetContent

func (po *GenericPO) GetContent() []byte

func (*GenericPO) GetPONum

func (po *GenericPO) GetPONum() int
type Header struct {
	Content []byte
	Key     string
	Length  string
	ILength int
}

type ObjectError

type ObjectError struct {
	ObjectID int
	Message  string
}

ObjectError is thrown by object parsing function

func (ObjectError) Error

func (oe ObjectError) Error() string

type OriginVK

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

func CreateOriginVK

func CreateOriginVK(vk []byte) *OriginVK

func (*OriginVK) GetContent

func (ro *OriginVK) GetContent() []byte

func (*OriginVK) GetRONum

func (ro *OriginVK) GetRONum() int

func (*OriginVK) GetVK

func (ro *OriginVK) GetVK() []byte

func (*OriginVK) IsPayloadObject

func (ro *OriginVK) IsPayloadObject() bool

func (*OriginVK) WriteToStream

func (ro *OriginVK) WriteToStream(s io.Writer, fullObjNum bool) error

type POEntry

type POEntry struct {
	PO     PayloadObject
	IntNum string
	DotNum string
	Length string
}

type PayloadObject

type PayloadObject interface {
	GetPONum() int
	GetContent() []byte
}

PayloadObject is the interface that is common among all objects that appear in the payload block

func CreateOpaquePayloadObject

func CreateOpaquePayloadObject(ponum int, content []byte) (PayloadObject, error)

func CreateOpaquePayloadObjectDF

func CreateOpaquePayloadObjectDF(dotform string, content []byte) (PayloadObject, error)

func LoadPayloadObject

func LoadPayloadObject(ponum int, content []byte) (PayloadObject, error)

type PublishLimits

type PublishLimits struct {
	TxLimit    int64
	StoreLimit int64
	Retain     int
}

PublishLimits is an option found in an AccessDOT that governs the resources that may be used by messages authorised via the DOT

type ROEntry

type ROEntry struct {
	RO     RoutingObject
	RONum  string
	Length string
}

type Revocation

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

func (*Revocation) Encode

func (ro *Revocation) Encode(sk []byte)

func (*Revocation) GetContent

func (ro *Revocation) GetContent() []byte

func (*Revocation) GetHash

func (ro *Revocation) GetHash() []byte

func (*Revocation) GetRONum

func (ro *Revocation) GetRONum() int

func (*Revocation) GetTarget

func (ro *Revocation) GetTarget() []byte

func (*Revocation) GetVK

func (ro *Revocation) GetVK() []byte

func (*Revocation) IsPayloadObject

func (ro *Revocation) IsPayloadObject() bool

func (*Revocation) IsValidFor

func (ro *Revocation) IsValidFor(obj RoutingObject) bool

This does not recurse. E.g. for a dot this would return false even if valid for src/dstvk... this is because you have to check the entities seperately anyway to fully factor in the entities DRVKs

func (*Revocation) SigValid

func (ro *Revocation) SigValid() bool

func (*Revocation) WriteToStream

func (ro *Revocation) WriteToStream(s io.Writer, fullObjNum bool) error

type RoutingObject

type RoutingObject interface {
	GetRONum() int
	GetContent() []byte
	WriteToStream(w io.Writer, fullObjNum bool) error
	IsPayloadObject() bool
}

RoutingObject is the interface that is common among all objects that appear in the routing object block

func LoadRoutingObject

func LoadRoutingObject(ronum int, content []byte) (RoutingObject, error)

LoadRoutingObject takes the ronum and the content and returns the object

func NewDChain

func NewDChain(ronum int, content []byte) (rv RoutingObject, err error)

NewDChain deserialises a DChain from a byte array

func NewDOT

func NewDOT(ronum int, content []byte) (rv RoutingObject, err error)

NewDOT constructs a DOT from its packed form

func NewEntity

func NewEntity(ronum int, content []byte) (rv RoutingObject, err error)

func NewExpiry

func NewExpiry(ronum int, content []byte) (rv RoutingObject, err error)

func NewOriginVK

func NewOriginVK(ronum int, content []byte) (RoutingObject, error)

func NewRevocation

func NewRevocation(ronum int, content []byte) (rv RoutingObject, err error)

Jump to

Keyboard shortcuts

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