Documentation ¶
Overview ¶
Package relay provides an external interface for a validating node. The relay opens a port for actions gateway, another port that listen to requests to receive block events and a third port for administrative purposes for the node.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WaitForOutgoingSyncRequest ¶
func WaitForOutgoingSyncRequest(conn *socket.SignedConnection, outgoing chan SyncRequest, drop chan crypto.Token, action chan []byte, topology chan *socket.SignedConnection)
WaitForOutgoingSyncRequest reads a sync request from a connection and sends it to the sync request channel. If it is not a valid request, if closes the conection and returns without sending anything to outgoing channel.
func WaitForProtocolActions ¶
func WaitForProtocolActions(conn *socket.SignedConnection, terminate chan crypto.Token, action chan []byte)
WaitForProtocolActions reads proposed actions from a connection and sends them to the action channel. If the connection is terminated, it sends the connection token to the terminate channel.
Types ¶
type Config ¶
type Config struct { GatewayPort int BlockListenerPort int Firewall *Firewall Credentials crypto.PrivateKey Hostname string }
Config defines the configuration for a relay node. The firewall defines the authorized connections for the gateway and the block listener. The credentials should be the private key of the validating node. Hostname is "localhost" or empty for internet connections. For test it can be any string.
type Firewall ¶
type Firewall struct { AcceptGateway *socket.AcceptValidConnections AcceptBlockListener *socket.AcceptValidConnections }
Firewall defines the authorized connections for the gateway and the block listener.
type Node ¶
type Node struct { ActionGateway chan []byte // Sends actions to swell engine BlockEvents chan []byte // receive block events from swell engine SyncRequest chan SyncRequest // sends sync requests to swell engine TopologyRequest chan *socket.SignedConnection // sends request for topology Statement chan []byte // contains filtered or unexported fields }
Node defines the external interface for a validating node. ActionGateway channel shoud be read by the validating node to receive proposed actions. BlockEvents channel should be write by the validating node to broadcast block events. SyncRequest channel should be read by the validating node to receive requests for state sync and recenet blocks sync.
type Shutdowner ¶
type Shutdowner interface {
Shutdown()
}
type SyncRequest ¶
type SyncRequest struct { Epoch uint64 State bool Conn *socket.CachedConnection }
SyncRequest defines a request for state sync and recent blocks sync. Epoch is the first epoch for which the requester needs a block. State is true if the requester needs a state sync.