Documentation ¶
Index ¶
- Constants
- Variables
- func HandleConnection(conn *network.ManagedConnection)
- func ReplayAutopeeringEvents(handlers *EventHandlers)
- func ShortNodeIDString(b []byte) string
- type AddNodeEvent
- type ConnectNodesEvent
- type DisconnectNodesEvent
- type EventHandlers
- type EventHandlersConsumer
- type EventsStruct
- type HeartbeatEvent
- type MetricHeartbeatEvent
- type NeighborMetric
- type NetworkMap
- type RemoveNodeEvent
Constants ¶
const ( // PluginName is the name of the analysis server plugin. PluginName = "AnalysisServer" // CfgAnalysisServerBindAddress defines the bind address of the analysis server. CfgAnalysisServerBindAddress = "analysis.server.bindAddress" // IdleTimeout defines the idle timeout of the read from the client's connection. IdleTimeout = 1 * time.Minute )
Variables ¶
var Networks = make(map[string]*NetworkMap)
Networks maps all available versions to network map
var ( // Plugin is the plugin instance of the analysis server plugin. Plugin *node.Plugin )
Functions ¶
func HandleConnection ¶
func HandleConnection(conn *network.ManagedConnection)
HandleConnection handles the given connection.
func ReplayAutopeeringEvents ¶
func ReplayAutopeeringEvents(handlers *EventHandlers)
ReplayAutopeeringEvents replays recorded events on the given event handler.
func ShortNodeIDString ¶
ShortNodeIDString returns the short nodeID as a string.
Types ¶
type AddNodeEvent ¶
AddNodeEvent is the payload type of an AddNode event.
type ConnectNodesEvent ¶
ConnectNodesEvent is the payload type of a ConnectNodesEvent.
type DisconnectNodesEvent ¶
DisconnectNodesEvent is the payload type f a DisconnectNodesEvent.
type EventHandlers ¶
type EventHandlers struct { // Addnode defines the handler called when adding a new node. AddNode func(event *AddNodeEvent) // RemoveNode defines the handler called when adding removing a node. RemoveNode func(event *RemoveNodeEvent) // ConnectNodes defines the handler called when connecting two nodes. ConnectNodes func(event *ConnectNodesEvent) // DisconnectNodes defines the handler called when connecting two nodes. DisconnectNodes func(event *DisconnectNodesEvent) }
EventHandlers holds the handler for each event of the record manager.
type EventHandlersConsumer ¶
type EventHandlersConsumer = func(handler *EventHandlers)
EventHandlersConsumer defines the consumer function of an *EventHandlers.
type EventsStruct ¶
type EventsStruct struct { // AddNode triggers when adding a new node. AddNode *event.Event[*AddNodeEvent] // RemoveNode triggers when removing a node. RemoveNode *event.Event[*RemoveNodeEvent] // ConnectNodes triggers when connecting two nodes. ConnectNodes *event.Event[*ConnectNodesEvent] // DisconnectNodes triggers when disconnecting two nodes. DisconnectNodes *event.Event[*DisconnectNodesEvent] // Error triggers when an error occurs. Error *event.Event[error] // Heartbeat triggers when an heartbeat has been received. Heartbeat *event.Event[*HeartbeatEvent] // MetricHeartbeat triggers when an MetricHeartbeat heartbeat has been received. MetricHeartbeat *event.Event[*MetricHeartbeatEvent] }
EventsStruct holds the events of the analysis server package.
var Events *EventsStruct
type HeartbeatEvent ¶
type MetricHeartbeatEvent ¶
type MetricHeartbeatEvent struct {
MetricHeartbeat *packet.MetricHeartbeat
}
type NeighborMetric ¶
NeighborMetric contains the number of inbound/outbound neighbors.
type NetworkMap ¶
type NetworkMap struct {
// contains filtered or unexported fields
}
NetworkMap contains information about the peer connections on a specific network.
func NewNetworkMap ¶
func NewNetworkMap(networkVersion string) *NetworkMap
NewNetworkMap creates a new network map with a given network version
func (*NetworkMap) NetworkGraph ¶
func (nm *NetworkMap) NetworkGraph() *graph.Graph
NetworkGraph returns the autopeering network graph for the current network.
func (*NetworkMap) NumOfNeighbors ¶
func (nm *NetworkMap) NumOfNeighbors() map[string]*NeighborMetric
NumOfNeighbors returns a map of nodeIDs to their neighbor count.
type RemoveNodeEvent ¶
RemoveNodeEvent is the payload type of a RemoveNode event.