/// <inheritdoc/> public void AddPeer(NetworkAddress networkAddress, IPAddress source) { if (networkAddress.Endpoint.Address.IsRoutable(true) == false) return; var peerToAdd = PeerAddress.Create(networkAddress, source); this.Peers.TryAdd(peerToAdd.EndPoint, peerToAdd); }
/// <inheritdoc/> public void AddPeer(IPEndPoint endPoint, IPAddress source) { if (!endPoint.Address.IsRoutable(true)) { return; } var peerToAdd = PeerAddress.Create(endPoint, source); this.Peers.TryAdd(peerToAdd.Endpoint, peerToAdd); }
/// <inheritdoc/> public void AddPeer(NetworkAddress networkAddress, IPAddress source, PeerIntroductionType peerIntroductionType) { if (networkAddress.Endpoint.Address.IsRoutable(true) == false) { return; } var peerToAdd = PeerAddress.Create(networkAddress, source, peerIntroductionType); this.Peers.TryAdd(peerToAdd.NetworkAddress.Endpoint, peerToAdd); }
private void AddPeerWithoutCleanup(IPEndPoint endPoint, IPAddress source) { if (!endPoint.Address.IsRoutable(true)) { return; } IPEndPoint ipv6EndPoint = endPoint.MapToIpv6(); PeerAddress peerToAdd = PeerAddress.Create(ipv6EndPoint, source.MapToIPv6()); this.peerInfoByPeerAddress.TryAdd(ipv6EndPoint, peerToAdd); }
private PeerAddress AddPeerWithoutCleanup(IPEndPoint endPoint, IPAddress source) { if (!endPoint.Address.IsRoutable(true)) { this.logger.LogTrace("(-)[PEER_NOT_ADDED_ISROUTABLE]:{0}", endPoint); return(null); } IPEndPoint ipv6EndPoint = endPoint.MapToIpv6(); PeerAddress peerToAdd = PeerAddress.Create(ipv6EndPoint, source.MapToIPv6()); var added = this.peerInfoByPeerAddress.TryAdd(ipv6EndPoint, peerToAdd); if (added) { this.logger.LogTrace("(-)[PEER_ADDED]:{0}", endPoint); return(peerToAdd); } this.logger.LogTrace("(-)[PEER_NOT_ADDED_ALREADY_EXISTS]:{0}", endPoint); return(null); }