C# Класс Brunet.Relay.RelayEdgeListener

Relays provide the ability for disconnected peers to form via existing overlay connections. For example, two nodes behind asymmetric NATs can form a tunnel over a common peer forming a virtual direct link between each other. Relays provide a mechanism for forming a complete ring.
Наследование: EdgeListener, IEdgeSendHandler, IDataHandler, IRpcHandler
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
_connections ConnectionList
_iasf IForwarderSelectorFactory
_ito IRelayOverlap
_local_tas IList
_node Brunet.Node
_oco OverlapConnectionOverlord
_oco_trim_timeout int
_oco_trim_timer FuzzyEvent
_running int
_started int

Private Properties

Свойство Тип Описание

Открытые методы

Метод Описание
CreateEdgeTo ( TransportAddress ta, EdgeCreationCallback ecb ) : void

Does not immediately create an edge to a remote node, instead, it tells a timer to wait 5 seconds prior to attempting an edge.

GetNearest ( Brunet.Address addr, ConnectionList cons ) : List

Returns our nearest neighbors to the specified address, which is in turn used to help communicate with tunnel peer.

HandleData ( MemBlock data, ISender return_path, object state ) : void

Where data packets prepended with a tunnel come. Here we receive data as well as create new RelayEdges.

HandleEdgeSend ( Edge from, ICopyable data ) : void

Used to send data over the tunnel via forwarding senders using a randomly selected peer from our overlap list.

HandleRpc ( ISender caller, string method, IList args, object rs ) : void
RelayEdgeListener ( Node node ) : Brunet
RelayEdgeListener ( Node node, IRelayOverlap ito ) : Brunet
RelayEdgeListener ( Node node, IRelayOverlap ito, IForwarderSelectorFactory iasf ) : Brunet
Start ( ) : void
Stop ( ) : void

Защищенные методы

Метод Описание
AttemptToCreateOverlap ( RelayEdgeCallbackAction teca ) : void

First we try to find a third party we can connect with for overlap, if that is successful, we attempt to connect to him, if that is successful, we create a new tunnel edge.

CloseHandler ( object o, EventArgs ea ) : void

When a RelayEdge closes, we must remove it from our hashtable.

ConnectionHandler ( object o, EventArgs ea ) : void

We need to keep track of a current ConnectionList, so we listen to incoming connections. We also use this opportunity to rebuild our LocalTA.

CreateEdge ( RelayEdgeCallbackAction teca, List overlap ) : void

Common code to Create an outgoing edge.

CreateEdgeTo ( RelayEdgeCallbackAction teca ) : void

The delayed callback for CreateEdgeTo, we create an edge if there is a potential non-tunnel overlap and allow the Linker to do the rest.

DisconnectionHandler ( object o, EventArgs ea ) : void

When a disconnection occurs, we must make sure that none of our tunnels use that faulty edge / connection any more.

FailedEdgeCreate ( RelayEdgeCallbackAction teca ) : void

Common code to signify the failure of edge creation.

OcoTrim ( System.DateTime now ) : void

A callback to trim Overlapped Connections. We do this here, since we control Oco and he is essentially headless.

UpdateNeighborIntersection ( Brunet.Relay.RelayEdge from, IDictionary msg ) : void

Whenever the node receives a new StatusMessage from a tunnel, we use this to build a consisting of the intersection of our peers creating a table of potential tunneling options. We close the edge if it is empty.

Описание методов

AttemptToCreateOverlap() защищенный Метод

First we try to find a third party we can connect with for overlap, if that is successful, we attempt to connect to him, if that is successful, we create a new tunnel edge.
protected AttemptToCreateOverlap ( RelayEdgeCallbackAction teca ) : void
teca RelayEdgeCallbackAction
Результат void

CloseHandler() защищенный Метод

When a RelayEdge closes, we must remove it from our hashtable.
protected CloseHandler ( object o, EventArgs ea ) : void
o object
ea System.EventArgs
Результат void

ConnectionHandler() защищенный Метод

We need to keep track of a current ConnectionList, so we listen to incoming connections. We also use this opportunity to rebuild our LocalTA.
protected ConnectionHandler ( object o, EventArgs ea ) : void
o object
ea System.EventArgs
Результат void

CreateEdge() защищенный Метод

Common code to Create an outgoing edge.
protected CreateEdge ( RelayEdgeCallbackAction teca, List overlap ) : void
teca RelayEdgeCallbackAction
overlap List
Результат void

CreateEdgeTo() защищенный Метод

The delayed callback for CreateEdgeTo, we create an edge if there is a potential non-tunnel overlap and allow the Linker to do the rest.
protected CreateEdgeTo ( RelayEdgeCallbackAction teca ) : void
teca RelayEdgeCallbackAction
Результат void

CreateEdgeTo() публичный Метод

Does not immediately create an edge to a remote node, instead, it tells a timer to wait 5 seconds prior to attempting an edge.
public CreateEdgeTo ( TransportAddress ta, EdgeCreationCallback ecb ) : void
ta TransportAddress
ecb EdgeCreationCallback
Результат void

DisconnectionHandler() защищенный Метод

When a disconnection occurs, we must make sure that none of our tunnels use that faulty edge / connection any more.
protected DisconnectionHandler ( object o, EventArgs ea ) : void
o object
ea System.EventArgs
Результат void

FailedEdgeCreate() защищенный Метод

Common code to signify the failure of edge creation.
protected FailedEdgeCreate ( RelayEdgeCallbackAction teca ) : void
teca RelayEdgeCallbackAction
Результат void

GetNearest() публичный статический Метод

Returns our nearest neighbors to the specified address, which is in turn used to help communicate with tunnel peer.
public static GetNearest ( Brunet.Address addr, ConnectionList cons ) : List
addr Brunet.Address
cons ConnectionList
Результат List

HandleData() публичный Метод

Where data packets prepended with a tunnel come. Here we receive data as well as create new RelayEdges.
public HandleData ( MemBlock data, ISender return_path, object state ) : void
data MemBlock
return_path ISender
state object
Результат void

HandleEdgeSend() публичный Метод

Used to send data over the tunnel via forwarding senders using a randomly selected peer from our overlap list.
public HandleEdgeSend ( Edge from, ICopyable data ) : void
from Edge
data ICopyable
Результат void

HandleRpc() публичный Метод

public HandleRpc ( ISender caller, string method, IList args, object rs ) : void
caller ISender
method string
args IList
rs object
Результат void

OcoTrim() защищенный Метод

A callback to trim Overlapped Connections. We do this here, since we control Oco and he is essentially headless.
protected OcoTrim ( System.DateTime now ) : void
now System.DateTime
Результат void

RelayEdgeListener() публичный Метод

public RelayEdgeListener ( Node node ) : Brunet
node Brunet.Node
Результат Brunet

RelayEdgeListener() публичный Метод

public RelayEdgeListener ( Node node, IRelayOverlap ito ) : Brunet
node Brunet.Node
ito IRelayOverlap
Результат Brunet

RelayEdgeListener() публичный Метод

public RelayEdgeListener ( Node node, IRelayOverlap ito, IForwarderSelectorFactory iasf ) : Brunet
node Brunet.Node
ito IRelayOverlap
iasf IForwarderSelectorFactory
Результат Brunet

Start() публичный Метод

public Start ( ) : void
Результат void

Stop() публичный Метод

public Stop ( ) : void
Результат void

UpdateNeighborIntersection() защищенный Метод

Whenever the node receives a new StatusMessage from a tunnel, we use this to build a consisting of the intersection of our peers creating a table of potential tunneling options. We close the edge if it is empty.
protected UpdateNeighborIntersection ( Brunet.Relay.RelayEdge from, IDictionary msg ) : void
from Brunet.Relay.RelayEdge
msg IDictionary
Результат void

Описание свойств

_connections защищенное свойство

protected ConnectionList _connections
Результат ConnectionList

_iasf защищенное свойство

protected IForwarderSelectorFactory _iasf
Результат IForwarderSelectorFactory

_ito защищенное свойство

protected IRelayOverlap _ito
Результат IRelayOverlap

_local_tas защищенное свойство

protected IList _local_tas
Результат IList

_node защищенное свойство

protected Node,Brunet _node
Результат Brunet.Node

_oco защищенное свойство

protected OverlapConnectionOverlord,Brunet.Relay _oco
Результат OverlapConnectionOverlord

_oco_trim_timeout защищенное свойство

protected int _oco_trim_timeout
Результат int

_oco_trim_timer защищенное свойство

protected FuzzyEvent _oco_trim_timer
Результат FuzzyEvent

_running защищенное свойство

protected int _running
Результат int

_started защищенное свойство

protected int _started
Результат int