core

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: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypePublish   = 0x01
	TypePersist   = 0x02
	TypeSubscribe = 0x03
	TypeTap       = 0x04
	TypeQuery     = 0x05
	TypeTapQuery  = 0x06
	TypeLS        = 0x07
)

Variables

View Source
var Forever = time.Date(2050, time.January, 1, 1, 1, 1, 1, time.UTC)

Functions

func AnalyzeAccessDOTChain

func AnalyzeAccessDOTChain(mtype int, targetURI string, dc *objects.DChain) (code int,
	mvk []byte, mergeduri *string, star, plus bool,
	ps *objects.AccessDOTPermissionSet, originVK []byte)

AnalyzeAccessDotChain does what it says.

func DistributeRO

func DistributeRO(routerEntity *objects.Entity,
	ro objects.RoutingObject,
	cl *Client,
)

DistributeRO will store an RO in the various correct places, as well as publish it on the router's uri. NOTE: will need to make terminus treat this uri specially

func ElaborateDChain

func ElaborateDChain(dc *objects.DChain) *objects.DChain

func NewSnode

func NewSnode() *snode

func ResolveDotsInDChain

func ResolveDotsInDChain(dc *objects.DChain, cache []objects.RoutingObject) bool

Types

type BWConfig

type BWConfig struct {
	Router struct {
		VK      string
		SK      string
		DB      string
		LogPath string
	}
	Affinity struct {
		MVK []string
	}
	Native struct {
		ListenOn string
	}
	OOB struct {
		ListenOn string
	}
	DNSOverride struct {
		Set []string
	}
}

BWConfig is the configuration for a router

func LoadConfig

func LoadConfig(filename string) *BWConfig

LoadConfig will load and return a configuration. If "" is specified for the filename, it will default to "bw2.ini" in the current directory

func (*BWConfig) GetDRVKcache

func (c *BWConfig) GetDRVKcache() map[string][]byte

func (*BWConfig) GetNamecache

func (c *BWConfig) GetNamecache() map[string][]byte

DNS override should allow name : mvk mvk : dr dr : host

func (*BWConfig) GetTargetcache

func (c *BWConfig) GetTargetcache() map[string]string

type Client

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

A handle to a queue that gets messages dispatched to it

func (*Client) Destroy

func (cl *Client) Destroy()

func (*Client) List

func (cl *Client) List(m *Message, cb func(s string, ok bool))

func (*Client) Persist

func (cl *Client) Persist(m *Message)

func (*Client) Publish

func (cl *Client) Publish(m *Message)

func (*Client) Query

func (cl *Client) Query(m *Message, cb func(m *Message))

func (*Client) Subscribe

func (cl *Client) Subscribe(m *Message, cb func(m *Message, id UniqueMessageID)) UniqueMessageID

Subscribe should bind the given handler with the given topic returns the identifier used for Unsubscribe func (cl *Client) Subscribe(topic string, tap bool, meta interface{}) (uint32, bool) {

func (*Client) Unsubscribe

func (cl *Client) Unsubscribe(subid UniqueMessageID)

Unsubscribe does what it says. For now the topic system is crude so this doesn't seem necessary to have the subid instead of topic but it will make sense when we are doing wildcards later.

type Message

type Message struct {

	//Packed
	Encoded []byte

	//Primary data
	Type           uint8
	MessageID      uint64
	Consumers      int
	MVK            []byte
	TopicSuffix    string
	Signature      []byte
	RoutingObjects []objects.RoutingObject
	PayloadObjects []objects.PayloadObject

	//Derived data, not needed for TX message
	SigCoverEnd        int
	OriginVK           *[]byte
	Valid              bool
	Topic              string
	RXTime             time.Time
	ExpireTime         time.Time
	PrimaryAccessChain *objects.DChain

	MergedTopic *string
	UMid        UniqueMessageID
	// contains filtered or unexported fields
}

Message is the primary Bosswave message type that is passed all the way through

func LoadMessage

func LoadMessage(b []byte) (m *Message, err error)

func (*Message) Encode

func (m *Message) Encode(sk []byte, vk []byte)

Encode generates the encoded array with signature. it assumes that everything is properly set up by the message factory that created this message object.

func (*Message) Verify

func (m *Message) Verify() *StatusMessage

TODO remove the damn status message thing and just use an int A piece of critical documentation: There are a few "exceptions" to the obvious rules. a) A DOT granting a VK of all zeroes applies to anyone b) Any message concerning a topic of mvk/*/$/* is allowed as read only

without a DChain. This is used so that clients can discover "free"
DOTs or means of acquiring DOTs.

c) A router exposes its DOTs and entities as

		  00..00/$/dot/to/<vk>/<hashes>
     00..00/$/dot/from/<vk>/<hash>
			00..00/$/dot/from/to/<vk>/<hash>
		  00..00/$/dot/<hash>
     00..00/$/entity/<hash>
   these can be queried or subscribed to.

type ObjectResponse

type ObjectResponse struct {
	UMid    UniqueMessageID
	Objects []objects.PayloadObject
}

type StatusMessage

type StatusMessage struct {
	UMid UniqueMessageID
	Code int
}

func (*StatusMessage) Ok

func (s *StatusMessage) Ok() bool

type Terminus

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

func CreateTerminus

func CreateTerminus() *Terminus

func (*Terminus) AddSub

func (tm *Terminus) AddSub(topic string, s subscription) UniqueMessageID

AddSub adds a subscription to terminus. It returns the unique message ID of the actual subscription in the tree. If it is not the same as the one in the given subscription, then the add was a noop. Note that means that the new callback in the added subscription WILL NOT BE CALLED upon new messages. i.e subscriptions must be unique within a client

func (*Terminus) CreateClient

func (tm *Terminus) CreateClient(name string) *Client

func (*Terminus) RMatchSubs

func (tm *Terminus) RMatchSubs(topic string, visitor func(s subscription))

type UniqueMessageID

type UniqueMessageID struct {
	Mid uint64
	Sig uint64
}

func UniqueMessageIDFromString

func UniqueMessageIDFromString(s string) *UniqueMessageID

func (*UniqueMessageID) ToString

func (umid *UniqueMessageID) ToString() string

type VerifyState

type VerifyState struct {
	Code   uint8
	Reason []byte
}

Jump to

Keyboard shortcuts

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