router

package
v1.1.1-0...-40efbf4 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: GPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRouterFromMap

func NewRouterFromMap(r map[string]interface{}) api.Router

NewRouterFromMap : Makes a new instance of this module from a map of arguments (for deserialization support)

Types

type DefaultRouter

type DefaultRouter struct {
	// Internal
	RecentBuffer

	Patches []api.Patch

	// CheckContent - Check if incoming messages are for the contentKey
	CheckContent bool
	// CheckChannels - Check if incoming messages are for any of the channel keys
	CheckChannels bool
	// CheckProfiles - Check if incoming messages are for any of the profile keys
	CheckProfiles bool

	// ForwardConsumedContent - Should node forward consumed messages that matched contentKey
	ForwardConsumedContent bool
	// ForwardConsumedContent - Should node forward consumed messages that matched a channel key
	ForwardConsumedChannels bool
	// ForwardConsumedProfile - Should node forward consumed messages that matched a profile key
	ForwardConsumedProfiles bool

	// ForwardUnknownContent - Should node forward non-consumed messages that matched contentKey
	ForwardUnknownContent bool
	// ForwardUnknownContent - Should node forward non-consumed messages that matched a channel key
	ForwardUnknownChannels bool
	// ForwardUnknownProfile - Should node forward non-consumed messages that matched a profile key
	ForwardUnknownProfiles bool
}

DefaultRouter - The Default router makes no changes at all,

every message is sent out on the same channel it came in on,
and non-channel messages are consumed but not forwarded

func NewDefaultRouter

func NewDefaultRouter() *DefaultRouter

NewDefaultRouter - returns a new instance of DefaultRouter

func (*DefaultRouter) GetPatches

func (r *DefaultRouter) GetPatches() []api.Patch

GetPatches : Returns an array with the mappings of incoming channels to destination channels

func (*DefaultRouter) MarshalJSON

func (r *DefaultRouter) MarshalJSON() (b []byte, e error)

MarshalJSON : Create a serialized JSON blob out of the config of this router

func (*DefaultRouter) Patch

func (r *DefaultRouter) Patch(patch api.Patch)

Patch : Redirect messages from one input to different outputs

func (*DefaultRouter) Route

func (r *DefaultRouter) Route(node api.Node, message []byte) error

Route - Router that does default behavior

type RecentBuffer

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

RecentBuffer - Used for tracking recently seen messages

func (*RecentBuffer) SeenRecently

func (r *RecentBuffer) SeenRecently(nonce []byte) bool

SeenRecently : Returns whether this message should be filtered out by loop detection

Jump to

Keyboard shortcuts

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