Class PeerManager
- Namespace
- NLightning.Infrastructure.Node.Managers
- Assembly
- NLightning.Infrastructure.dll
Service for managing peers.
public sealed class PeerManager : IPeerManager
- Inheritance
-
PeerManager
- Implements
- Inherited Members
Remarks
This class is used to manage peers in the network.
Constructors
PeerManager(ILogger<PeerManager>, IOptions<NodeOptions>, IPeerFactory)
public PeerManager(ILogger<PeerManager> logger, IOptions<NodeOptions> nodeOptions, IPeerFactory peerFactory)
Parameters
logger
ILogger<PeerManager>nodeOptions
IOptions<NodeOptions>peerFactory
IPeerFactory
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.
DisconnectPeer(PubKey)
Disconnects a peer.
public void DisconnectPeer(PubKey pubKey)
Parameters
pubKey
PubKeyPubkey of the peer