Documentation ¶
Overview ¶
This file is autogenerated from https://github.com/immesys/bw2_pid/blob/master/allocations.yaml
Index ¶
- Constants
- Variables
- func IsEveryoneVK(vk []byte) bool
- func NewObjectError(oid int, msg string) error
- func PONumDotForm(ponum int) string
- func PONumFromDotForm(dotform string) (int, error)
- func ReadExactly(s *bufio.Reader, to []byte) error
- type AccessDOTPermissionSet
- type BossWaveObject
- type DChain
- func (ro *DChain) AugmentBy(d *DOT)
- func (ro *DChain) CheckAllSigs() bool
- func (ro *DChain) ConvertToDChainHash() (*DChain, error)
- func (ro *DChain) GetAccessURIPermString() string
- func (ro *DChain) GetAccessURISuffix() (string, error)
- func (ro *DChain) GetChainHash() []byte
- func (ro *DChain) GetContent() []byte
- func (ro *DChain) GetDOT(num int) *DOT
- func (ro *DChain) GetDotHash(num int) []byte
- func (ro *DChain) GetGiverVK() []byte
- func (ro *DChain) GetMVK() []byte
- func (ro *DChain) GetRONum() int
- func (ro *DChain) GetReceiverVK() []byte
- func (ro *DChain) GetTTL() int
- func (ro *DChain) IsAccess() bool
- func (ro *DChain) IsElaborated() bool
- func (ro *DChain) IsPayloadObject() bool
- func (ro *DChain) NumHashes() int
- func (ro *DChain) SetDOT(num int, d *DOT)
- func (ro *DChain) UnElaborate()
- func (ro *DChain) WriteToStream(s io.Writer, fullObjNum bool) error
- type DOT
- func (ro *DOT) AddRevoker(rvk []byte)
- func (ro *DOT) Encode(sk []byte)
- func (ro *DOT) GetAccessURIMVK() []byte
- func (ro *DOT) GetAccessURISuffix() string
- func (ro *DOT) GetComment() string
- func (ro *DOT) GetContact() string
- func (ro *DOT) GetContent() []byte
- func (ro *DOT) GetCreated() *time.Time
- func (ro *DOT) GetExpiry() *time.Time
- func (ro *DOT) GetGiverVK() []byte
- func (ro *DOT) GetHash() []byte
- func (ro *DOT) GetPermString() string
- func (ro *DOT) GetPermissionSet() *AccessDOTPermissionSet
- func (ro *DOT) GetRONum() int
- func (ro *DOT) GetReceiverVK() []byte
- func (ro *DOT) GetRevokers() [][]byte
- func (ro *DOT) GetTTL() int
- func (ro *DOT) IsAccess() bool
- func (ro *DOT) IsPayloadObject() bool
- func (ro *DOT) OverrideSetSignatureValid()
- func (ro *DOT) SetAccessURI(mvk []byte, suffix string)
- func (ro *DOT) SetCanConsume(normal bool, plus bool, star bool)
- func (ro *DOT) SetCanList(value bool)
- func (ro *DOT) SetCanPublish(value bool)
- func (ro *DOT) SetCanTap(normal bool, plus bool, star bool)
- func (ro *DOT) SetComment(v string)
- func (ro *DOT) SetContact(v string)
- func (ro *DOT) SetCreation(time time.Time)
- func (ro *DOT) SetCreationToNow()
- func (ro *DOT) SetExpireFromNow(delta time.Duration)
- func (ro *DOT) SetExpiry(time time.Time)
- func (ro *DOT) SetPermString(v string) bool
- func (ro *DOT) SetPermission(key string, value string)
- func (ro *DOT) SetTTL(v int)
- func (ro *DOT) SigValid() bool
- func (ro *DOT) String() string
- func (ro *DOT) WriteToStream(s io.Writer, fullObjNum bool) error
- type Entity
- func (ro *Entity) AddRevoker(rvk []byte)
- func (ro *Entity) Encode()
- func (ro *Entity) FullString() string
- func (ro *Entity) GetComment() string
- func (ro *Entity) GetContact() string
- func (ro *Entity) GetContent() []byte
- func (ro *Entity) GetCreated() *time.Time
- func (ro *Entity) GetExpiry() *time.Time
- func (ro *Entity) GetRONum() int
- func (ro *Entity) GetRevokers() [][]byte
- func (ro *Entity) GetSK() []byte
- func (ro *Entity) GetSigningBlob() []byte
- func (ro *Entity) GetVK() []byte
- func (ro *Entity) IsPayloadObject() bool
- func (ro *Entity) OverrideSetSignatureValid()
- func (ro *Entity) SetCreationToNow()
- func (ro *Entity) SetExpiry(t time.Time)
- func (ro *Entity) SetSK(sk []byte)
- func (ro *Entity) SetVK(vk []byte)
- func (ro *Entity) SigValid() bool
- func (ro *Entity) StringKey() string
- func (ro *Entity) WriteToStream(s io.Writer, fullObjNum bool) error
- type Expiry
- type Frame
- func (f *Frame) AddHeader(k string, v string)
- func (f *Frame) AddHeaderB(k string, v []byte)
- func (f *Frame) AddPayloadObject(po PayloadObject)
- func (f *Frame) AddRoutingObject(ro RoutingObject)
- func (f *Frame) GetAllHeaders(k string) []string
- func (f *Frame) GetAllHeadersB(k string) [][]byte
- func (f *Frame) GetAllPOs() []PayloadObject
- func (f *Frame) GetAllROs() []RoutingObject
- func (f *Frame) GetFirstHeader(k string) (string, bool)
- func (f *Frame) GetFirstHeaderB(k string) ([]byte, bool)
- func (f *Frame) ParseFirstHeaderAsBool(k string, def bool) (bool, bool, *string)
- func (f *Frame) ParseFirstHeaderAsInt(k string, def int) (int, bool, *string)
- func (f *Frame) WriteToStream(s *bufio.Writer)
- type GenericPO
- type Header
- type ObjectError
- type OriginVK
- type POEntry
- type PayloadObject
- type PublishLimits
- type ROEntry
- type RoutingObject
- func LoadRoutingObject(ronum int, content []byte) (RoutingObject, error)
- func NewDChain(ronum int, content []byte) (rv RoutingObject, err error)
- func NewDOT(ronum int, content []byte) (rv RoutingObject, err error)
- func NewEntity(ronum int, content []byte) (RoutingObject, error)
- func NewExpiry(ronum int, content []byte) (RoutingObject, error)
- func NewOriginVK(ronum int, content []byte) (RoutingObject, error)
Constants ¶
const ( ROAccessDChainHash = 0x01 ROPermissionDChainHash = 0x11 ROAccessDChain = 0x02 ROPermissionDChain = 0x12 ROAccessDOT = 0x20 ROPermissionDOT = 0x21 ROEntity = 0x30 ROEntityWKey = 0x32 ROOriginVK = 0x31 ROExpiry = 0x40 )
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" )
const PODFBWRoutingObject = `0.0.0.0`
const PODFBinary = `0.0.0.0`
const PODFBlob = `1.0.0.0`
const PODFCapnP = `3.0.0.0`
const PODFJSON = `65.0.0.0`
const PODFMaskBWRoutingObject = `0.0.0.0/8`
const PODFMaskBinary = `0.0.0.0/4`
const PODFMaskBlob = `1.0.0.0/8`
const PODFMaskCapnP = `3.0.0.0/8`
const PODFMaskJSON = `65.0.0.0/8`
const PODFMaskMsgPack = `2.0.0.0/8`
const PODFMaskSpawnpointConfig = `67.0.2.0/32`
const PODFMaskSpawnpointHeartbeat = `67.0.2.1/32`
const PODFMaskSpawnpointLog = `2.0.2.0/32`
const PODFMaskString = `64.0.1.0/32`
const PODFMaskText = `64.0.0.0/4`
const PODFMaskXML = `66.0.0.0/8`
const PODFMaskYAML = `67.0.0.0/8`
const PODFMsgPack = `2.0.0.0`
const PODFSpawnpointConfig = `67.0.2.0`
const PODFSpawnpointHeartbeat = `67.0.2.1`
const PODFSpawnpointLog = `2.0.2.0`
const PODFString = `64.0.1.0`
const PODFText = `64.0.0.0`
const PODFXML = `66.0.0.0`
const PODFYAML = `67.0.0.0`
const POMaskBWRoutingObject = 8
const POMaskBinary = 4
const POMaskBlob = 8
const POMaskCapnP = 8
const POMaskJSON = 8
const POMaskMsgPack = 8
const POMaskSpawnpointConfig = 32
const POMaskSpawnpointHeartbeat = 32
const POMaskSpawnpointLog = 32
const POMaskString = 32
const POMaskText = 4
const POMaskXML = 8
const POMaskYAML = 8
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.
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.
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.
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
const PONumJSON = 1090519040
JSON (65.0.0.0/8): JSON This class is for schemas that are represented in JSON
const PONumMsgPack = 33554432
MsgPack (2.0.0.0/8): MsgPack This class is for schemas that are represented in MsgPack
const PONumSpawnpointConfig = 1124073984
SpawnpointConfig (67.0.2.0/32): SpawnPoint config A configuration file for SpawnPoint (github.com/immesys/spawnpoint)
const PONumSpawnpointHeartbeat = 1124073985
SpawnpointHeartbeat (67.0.2.1/32): SpawnPoint heartbeat A heartbeat message from spawnpoint
const PONumSpawnpointLog = 33554944
SpawnpointLog (2.0.2.0/32): Spawnpoint stdout This contains stdout data from a spawnpoint container
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.
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.
const PONumXML = 1107296256
XML (66.0.0.0/8): XML This class is for schemas that are represented in XML
const PONumYAML = 1124073472
YAML (67.0.0.0/8): YAML This class is for schemas that are represented in YAML
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 ¶
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, }
RoutingObjectConstruct allows you to map a ROnum into a constructor that takes a binary representation and returns a Routing Object
Functions ¶
func NewObjectError ¶
NewObjectError constructs an ObjectError
func PONumDotForm ¶
func PONumFromDotForm ¶
Types ¶
type AccessDOTPermissionSet ¶
type AccessDOTPermissionSet struct { CanPublish bool CanConsume bool CanConsumePlus bool CanConsumeStar bool CanTap bool CanTapPlus bool CanTapStar bool CanList bool }
func GetADPSFromPermString ¶
func GetADPSFromPermString(v string) *AccessDOTPermissionSet
func (*AccessDOTPermissionSet) GetPermString ¶
func (ps *AccessDOTPermissionSet) GetPermString() string
func (*AccessDOTPermissionSet) IsSubsetOf ¶
func (ps *AccessDOTPermissionSet) IsSubsetOf(rhs *AccessDOTPermissionSet) bool
func (*AccessDOTPermissionSet) ReduceBy ¶
func (ps *AccessDOTPermissionSet) ReduceBy(rhs *AccessDOTPermissionSet)
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 ¶
CreateDChain creates a dot chain from the given DOTs. The DOTs must have the hash field populated
func (*DChain) AugmentBy ¶
AugmentBy fills the given dot into the right position in the chain assuming it is referred to at all
func (*DChain) CheckAllSigs ¶
func (*DChain) ConvertToDChainHash ¶
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 (*DChain) GetAccessURISuffix ¶
func (*DChain) GetChainHash ¶
GetChainHash returns the hash of the chain
func (*DChain) GetContent ¶
GetContent returns the serialised content for this object
func (*DChain) GetDOT ¶
GetDOT returns the DOT at the given index if it has been stored in the chain, otherwise nil
func (*DChain) GetDotHash ¶
GetDotHash returns the dot hash at the specific index
func (*DChain) GetGiverVK ¶
func (*DChain) GetReceiverVK ¶
func (*DChain) IsElaborated ¶
IsElaborated returns true if the dot hashes are populated
func (*DChain) IsPayloadObject ¶
func (*DChain) UnElaborate ¶
func (ro *DChain) UnElaborate()
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 ¶
CreateDOT is used to create a DOT from scratch. The DOT is incomplete until Encode() is called later.
func (*DOT) AddRevoker ¶
func (*DOT) Encode ¶
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 ¶
GetAccessURIMVK gets the mvk if this is an access DOT
func (*DOT) GetAccessURISuffix ¶
GetAccessURISuffix returns the suffix if this is an access DOT
func (*DOT) GetComment ¶
func (*DOT) GetContact ¶
func (*DOT) GetContent ¶
GetContent returns the binary representation of the DOT if Encode has been called
func (*DOT) GetCreated ¶
func (*DOT) GetGiverVK ¶
GetGiverVK returns the verifying key of the entity that created this DOT
func (*DOT) GetHash ¶
GetHash returns the dot hash or panics if it has not been set by encoding/reading from stream etc.
func (*DOT) GetPermString ¶
GetPermString gets the human readable permission string for an access dot
func (*DOT) GetPermissionSet ¶
func (ro *DOT) GetPermissionSet() *AccessDOTPermissionSet
func (*DOT) GetReceiverVK ¶
GetReceiverVK gets the verifying key of the entity that is the recipient of trust in this DOT
func (*DOT) GetRevokers ¶
func (*DOT) IsPayloadObject ¶
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 ¶
SetAccessURI sets the URI of an Access DOT
func (*DOT) SetCanConsume ¶
SetCanConsume sets the consume privileges on an access dot
func (*DOT) SetCanList ¶
SetCanList sets the list capability on an access DOT
func (*DOT) SetCanPublish ¶
SetCanPublish sets the publish capability on an access DOT
func (*DOT) SetComment ¶
func (*DOT) SetContact ¶
func (*DOT) SetCreation ¶
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 ¶
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) SetPermString ¶
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 ¶
SetPermission sets the given key in a Permission DOT's table
func (*DOT) SigValid ¶
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
type Entity ¶
type Entity struct {
// contains filtered or unexported fields
}
func CreateLightEntity ¶
func CreateNewEntity ¶
func (*Entity) AddRevoker ¶
func (*Entity) FullString ¶
func (*Entity) GetComment ¶
func (*Entity) GetContact ¶
func (*Entity) GetContent ¶
func (*Entity) GetCreated ¶
func (*Entity) GetRevokers ¶
func (*Entity) GetSigningBlob ¶
GetSigningBlob returns the full entity, including the private key
func (*Entity) IsPayloadObject ¶
func (*Entity) OverrideSetSignatureValid ¶
func (ro *Entity) OverrideSetSignatureValid()
func (*Entity) SetCreationToNow ¶
func (ro *Entity) SetCreationToNow()
type Expiry ¶
type Expiry struct {
// contains filtered or unexported fields
}
func CreateNewExpiry ¶
func CreateNewExpiryFromNow ¶
func (*Expiry) GetContent ¶
func (*Expiry) IsPayloadObject ¶
type Frame ¶
func CreateFrame ¶
func (*Frame) AddHeaderB ¶
func (*Frame) AddPayloadObject ¶
func (f *Frame) AddPayloadObject(po PayloadObject)
func (*Frame) AddRoutingObject ¶
func (f *Frame) AddRoutingObject(ro RoutingObject)
func (*Frame) GetAllHeaders ¶
func (*Frame) GetAllHeadersB ¶
func (*Frame) GetAllPOs ¶
func (f *Frame) GetAllPOs() []PayloadObject
func (*Frame) GetAllROs ¶
func (f *Frame) GetAllROs() []RoutingObject
func (*Frame) ParseFirstHeaderAsBool ¶
func (*Frame) ParseFirstHeaderAsInt ¶
func (*Frame) WriteToStream ¶
type GenericPO ¶
type GenericPO struct {
// contains filtered or unexported fields
}
func (*GenericPO) GetContent ¶
type ObjectError ¶
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 (*OriginVK) GetContent ¶
func (*OriginVK) IsPayloadObject ¶
type PayloadObject ¶
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 ¶
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 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 NewOriginVK ¶
func NewOriginVK(ronum int, content []byte) (RoutingObject, error)