Table of Contents

Interface IPeerManager

Namespace
NLightning.Domain.Node.Interfaces
Assembly
NLightning.Domain.dll

Interface for the peer manager.

public interface IPeerManager

Methods

ConnectToPeerAsync(PeerAddressInfo)

Connects to a peer.

Task<PeerModel> ConnectToPeerAsync(PeerAddressInfo peerAddressInfo)

Parameters

peerAddressInfo PeerAddressInfo

The peer address to connect to.

Returns

Task<PeerModel>

A task that represents the asynchronous operation.

DisconnectPeer(CompactPubKey, Exception?)

Disconnects a peer.

void DisconnectPeer(CompactPubKey compactPubKey, Exception? exception = null)

Parameters

compactPubKey CompactPubKey

CompactPubKey of the peer

exception Exception

Optional exception that caused the disconnection

GetPeer(CompactPubKey)

PeerModel? GetPeer(CompactPubKey peerId)

Parameters

peerId CompactPubKey

Returns

PeerModel

ListPeers()

List<PeerModel> ListPeers()

Returns

List<PeerModel>

StartAsync(CancellationToken)

Starts the peer manager asynchronously.

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.

Task StopAsync()

Returns

Task

A task that represents the asynchronous operation.