Class PeerService
- Namespace
- NLightning.Bolts.BOLT1.Services
- Assembly
- NLightning.Bolts.dll
Service for managing peers.
public sealed class PeerService : IPeerService
- Inheritance
-
PeerService
- Implements
- Inherited Members
Remarks
This class is used to manage peers in the network.
Constructors
PeerService(NodeOptions, ITransportServiceFactory, IPingPongServiceFactory, IMessageServiceFactory)
Service for managing peers.
public PeerService(NodeOptions nodeOptions, ITransportServiceFactory transportServiceFactory, IPingPongServiceFactory pingPongServiceFactory, IMessageServiceFactory messageServiceFactory)
Parameters
nodeOptions
NodeOptionsThe node options.
transportServiceFactory
ITransportServiceFactoryThe transport service factory.
pingPongServiceFactory
IPingPongServiceFactoryThe ping pong service factory.
messageServiceFactory
IMessageServiceFactoryThe message service factory.
Remarks
This class is used to manage peers in the network.
- See Also
Methods
AcceptPeerAsync(TcpClient)
Accepts a peer.
public Task AcceptPeerAsync(TcpClient tcpClient)
Parameters
tcpClient
TcpClientThe TCP client.
Returns
- Task
A task that represents the asynchronous operation.
Exceptions
- ErrorException
Thrown when the connection to the peer fails.
ConnectToPeerAsync(PeerAddress)
Connects to a peer.
public Task ConnectToPeerAsync(PeerAddress peerAddress)
Parameters
peerAddress
PeerAddressThe peer address to connect to.
Returns
- Task
A task that represents the asynchronous operation.
Exceptions
- ConnectionException
Thrown when the connection to the peer fails.