Table of Contents

Class PeerManager

Namespace
NLightning.Application.Node.Managers
Assembly
NLightning.Application.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(IChannelManager, ILogger<PeerManager>, IPeerServiceFactory, ITcpService, IServiceProvider)

public PeerManager(IChannelManager channelManager, ILogger<PeerManager> logger, IPeerServiceFactory peerServiceFactory, ITcpService tcpService, IServiceProvider serviceProvider)

Parameters

channelManager IChannelManager
logger ILogger<PeerManager>
peerServiceFactory IPeerServiceFactory
tcpService ITcpService
serviceProvider IServiceProvider

Methods

ConnectToPeerAsync(PeerAddressInfo)

Connects to a peer.

public Task ConnectToPeerAsync(PeerAddressInfo peerAddressInfo)

Parameters

peerAddressInfo PeerAddressInfo

The 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(CompactPubKey)

Disconnects a peer.

public void DisconnectPeer(CompactPubKey pubKey)

Parameters

pubKey CompactPubKey

StartAsync(CancellationToken)

Starts the peer manager asynchronously.

public Task StartAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The cancellation token to monitor for cancellation requests.

Returns

Task

A task that represents the asynchronous operation.

StopAsync()

Stops the peer manager asynchronously.

public Task StopAsync()

Returns

Task

A task that represents the asynchronous operation.

See Also