Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // AvailableConnectionTypes - global preset list of types connections that can be made AvailableConnectionTypes = []string{"relay"} )
var ( // AvailableEventTypes - global preset list of directions that an individual node can give to another AvailableEventTypes = []string{"push", "fetch"} )
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct { DestinationNode *node.Node `json:"destination node"` // Node to contact InitializationNode *node.Node `json:"initializing node"` // Node initializing connection Data []byte `json:"data"` // Actual data being transmitted Port int `json:"port"` ConnectionType string `json:"type"` // Type of connection ConnectionStack []Event `json:"stack"` }
Connection - abstract container for Golang connection type, contains metadata, routing parameters
func FromBytes ¶
func FromBytes(b []byte) (*Connection, error)
FromBytes - attempt to convert specified byte array to connection
func NewConnection ¶
func NewConnection(sourceNode *node.Node, destinationNode *node.Node, port int, data []byte, connectionType string, connectionStack []Event) (*Connection, error)
NewConnection - creates new Connection{} instance with specified data, peers
func (*Connection) Attempt ¶
func (connection *Connection) Attempt() ([]byte, error)
Attempt - attempts to carry out connection, if event stack is provided, begins to iterate through list
func (*Connection) AttemptVariable ¶
func (connection *Connection) AttemptVariable() (*environment.Variable, error)
AttemptVariable - attempts to carry out connection, returning variable response
type Event ¶
type Event struct { EventType string `json:"type"` Resolution Resolution `json:"resolution"` // Data being transmitted Command *command.Command `json:"command"` // Action for destination node to carry out DestinationNode *node.Node `json:"destination"` // Node to contact Port int `json:"port"` }
Event - container holding metadata concerning a direction given from a peer to another
type Resolution ¶
type Resolution struct { ResolutionData []byte `json:"data"` // ResolutionData - data being passed via resolution (typically a struct) GuidingType interface{} `json:"guide"` // GuidingType - guiding struct to map resolution fields }
Resolution - abstract type defining how to handle and deal with a connection or event's data
func NewResolution ¶
func NewResolution(data []byte, guidingType interface{}) (*Resolution, error)
NewResolution - attempt to create new instance of the Resolution struct with specified initializers