| | | 1 | | using System.Net.Sockets; |
| | | 2 | | |
| | | 3 | | namespace NLightning.Infrastructure.Node.ValueObjects; |
| | | 4 | | |
| | | 5 | | using Domain.Crypto.ValueObjects; |
| | | 6 | | |
| | | 7 | | public readonly record struct ConnectedPeer |
| | | 8 | | { |
| | | 9 | | /// <summary> |
| | | 10 | | /// The public key of the peer we are connected to. |
| | | 11 | | /// </summary> |
| | 12 | 12 | | public CompactPubKey CompactPubKey { get; } |
| | | 13 | | |
| | | 14 | | /// <summary> |
| | | 15 | | /// The host address of the connected peer. |
| | | 16 | | /// </summary> |
| | 4 | 17 | | public string Host { get; } |
| | | 18 | | |
| | | 19 | | /// <summary> |
| | | 20 | | /// The port used by the peer to establish the connection. |
| | | 21 | | /// </summary> |
| | 4 | 22 | | public uint Port { get; } |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// The TCP client representing the connection to the peer. |
| | | 26 | | /// </summary> |
| | 4 | 27 | | public TcpClient TcpClient { get; } |
| | | 28 | | |
| | | 29 | | /// <summary> |
| | | 30 | | /// Represents a connected peer in the network, consisting of a compact public key and a TCP client. |
| | | 31 | | /// </summary> |
| | | 32 | | /// <param name="compactPubKey">The compact public key of the peer.</param> |
| | | 33 | | /// <param name="tcpClient">The TCP client representing the connection to the peer.</param> |
| | | 34 | | public ConnectedPeer(CompactPubKey compactPubKey, string host, uint port, TcpClient tcpClient) |
| | | 35 | | { |
| | 4 | 36 | | CompactPubKey = compactPubKey; |
| | 4 | 37 | | Host = host; |
| | 4 | 38 | | Port = port; |
| | 4 | 39 | | TcpClient = tcpClient; |
| | 4 | 40 | | } |
| | | 41 | | } |