Class PeerServiceFactory
- Namespace
- NLightning.Infrastructure.Node.Factories
- Assembly
- NLightning.Infrastructure.dll
Factory for creating peer services.
public class PeerServiceFactory : IPeerServiceFactory
- Inheritance
-
PeerServiceFactory
- Implements
- Inherited Members
Constructors
PeerServiceFactory(ILoggerFactory, IMessageFactory, IMessageServiceFactory, ISecureKeyManager, ITransportServiceFactory, IOptions<NodeOptions>, IServiceProvider)
public PeerServiceFactory(ILoggerFactory loggerFactory, IMessageFactory messageFactory, IMessageServiceFactory messageServiceFactory, ISecureKeyManager secureKeyManager, ITransportServiceFactory transportServiceFactory, IOptions<NodeOptions> nodeOptions, IServiceProvider serviceProvider)
Parameters
loggerFactory
ILoggerFactorymessageFactory
IMessageFactorymessageServiceFactory
IMessageServiceFactorysecureKeyManager
ISecureKeyManagertransportServiceFactory
ITransportServiceFactorynodeOptions
IOptions<NodeOptions>serviceProvider
IServiceProvider
Methods
CreateConnectedPeerAsync(CompactPubKey, TcpClient)
Creates a peer we're connecting to.
public Task<IPeerService> CreateConnectedPeerAsync(CompactPubKey peerPubKey, TcpClient tcpClient)
Parameters
peerPubKey
CompactPubKeyPeer public key
tcpClient
TcpClientTCP client
Returns
- Task<IPeerService>
A task that represents the asynchronous operation. The task result contains the created peer.
Exceptions
- ConnectionException
Thrown when the connection to the peer fails.
CreateConnectingPeerAsync(TcpClient)
Creates a peer connecting to us.
public Task<IPeerService> CreateConnectingPeerAsync(TcpClient tcpClient)
Parameters
tcpClient
TcpClientTCP client
Returns
- Task<IPeerService>
A task that represents the asynchronous operation. The task result contains the created peer.
Exceptions
- ConnectionException
Thrown when the connection to the peer fails.