private async IAsyncEnumerable <string> SearchNode(IDnsClient client, string query, SearchContext searchContext) { if (!searchContext.VisitedRefs.Contains(query)) { searchContext.VisitedRefs.Add(query); IEnumerable <string> lookupResult = await client.Lookup(query); foreach (string node in lookupResult) { EnrTreeNode treeNode = EnrTreeParser.ParseNode(node); foreach (string link in treeNode.Links) { DnsClient linkedTreeLookup = new(link); await foreach (string nodeRecordText in SearchTree(linkedTreeLookup, searchContext)) { yield return(nodeRecordText); } } foreach (string nodeRecordText in treeNode.Records) { yield return(nodeRecordText); } foreach (string nodeRef in treeNode.Refs) { searchContext.RefsToVisit.Enqueue(nodeRef); } } } }
public void SetUp() { _dnsClient = A.Fake <IDnsClient>(); _config = A.Fake <IMxPollerConfig>(); _log = A.Fake <ILogger <MxProcessor> >(); _mxProcessor = new MxProcessor(_dnsClient, _config, _log); }
public void SetUp() { _dnsClient = A.Fake <IDnsClient>(); _spfRecordExpander = A.Fake <ISpfRecordsParser>(); _spfRedirectTermExpander = new SpfRedirectTermExpander(_dnsClient, _spfRecordExpander); }
public void SetUp() { _dnsClient = A.Fake <IDnsClient>(); _tlsRptRecordsParser = A.Fake <ITlsRptRecordsParser>(); _config = A.Fake <ITlsRptPollerConfig>(); _evaluator = A.Fake <ITlsRptRecordsEvaluator>(); _tlsRptProcessor = new TlsRptProcessor(_dnsClient, _tlsRptRecordsParser, _evaluator, _config); }
public MxProcessor(IDnsClient dnsClient, IMxPollerConfig config, ILogger <MxProcessor> log) { _dnsClient = dnsClient; _config = config; _log = log; }
public virtual void Dispose() { if (!Object.ReferenceEquals(null, _Client)) { _Client.Dispose(); _Client = null; } }
/// <summary> /// Associate a client to the resolver. /// <para>Note that the connection with a client gets lost during serialization.</para> /// </summary> /// <param name="client"></param> public void Connect(IDnsClient client) { if (object.ReferenceEquals(null, client)) { throw new ArgumentNullException("client"); } _Client = client; }
internal static void LogResponse(IDnsClient client, int byteLength, DNS.Header header, System.Net.IPEndPoint remote) { ((IMessageLogger)client).LogMessageCreate(LogMessageText.RESPONSE.INFO.ResponseReceived(byteLength, remote)); if (header.RCODEValue != 0) ((IMessageLogger)client).LogMessageCreate(LogMessageText.RESPONSE.WARN.ResponseNonZero(header.RCODEValue, header.RCODE)); if (header.TC) ((IMessageLogger)client).LogMessageCreate(LogMessageText.RESPONSE.WARN.ResponseTruncated()); }
public MessageDeliverer(IMessageRepository messageRepository, IAccountRepository accountRepository, IDnsClient dnsClient, ILog log, IFolderRepository folderRepository) { _cancellationToken = _cancellationTokenSource.Token; _messageRepository = messageRepository; _accountRepository = accountRepository; _dnsClient = dnsClient; _log = log; _folderRepository = folderRepository; }
public TlsRptProcessor(IDnsClient dnsClient, ITlsRptRecordsParser parser, ITlsRptRecordsEvaluator evaluator, ITlsRptPollerConfig config) { _dnsClient = dnsClient; _parser = parser; _evaluator = evaluator; _config = config; }
public void SetUp() { _dnsClient = A.Fake <IDnsClient>(); _spfRecordsParser = A.Fake <ISpfRecordsParser>(); _spfRecordExpander = A.Fake <ISpfRecordExpander>(); _evaluator = A.Fake <IEvaluator <SpfPollResult> >(); _config = A.Fake <ISpfPollerConfig>(); _spfProcessor = new SpfProcessor(_dnsClient, _spfRecordsParser, _spfRecordExpander, _evaluator, _config); }
public SpfProcessor(IDnsClient dnsClient, ISpfRecordsParser spfRecordsParser, ISpfRecordExpander spfRecordExpander, IEvaluator <SpfPollResult> pollResultRulesEvaluator, ISpfPollerConfig config) { _dnsClient = dnsClient; _spfRecordsParser = spfRecordsParser; _spfRecordExpander = spfRecordExpander; _pollResultRulesEvaluator = pollResultRulesEvaluator; _config = config; }
public DfsOptions(BlockOptions blockOptions, DiscoveryOptions discoveryOptions, RepositoryOptions repositoryOptions, KeyChainOptions keyChainOptions, SwarmOptions swarmOptions, IDnsClient dnsClient) { Block = blockOptions; Discovery = discoveryOptions; Repository = repositoryOptions; KeyChain = keyChainOptions; Swarm = swarmOptions; Dns = dnsClient; //KeyChain.DefaultKeyType = "ed25519"; //Constants.KeyChainDefaultKeyType; // The seed nodes for the catalyst network. //Options.Discovery.BootstrapPeers = seedServers; var swarmKey = "07a8e9d0c43400927ab274b7fa443596b71e609bacae47bd958e5cd9f59d6ca3"; // Do not use the public IPFS network, use a private network // of catalyst only nodes. Swarm.PrivateNetworkKey = new PreSharedKey { Value = swarmKey.ToHexBuffer() }; var seedServers = new[] { new MultiAddress( "/ip4/46.101.132.61/tcp/4001/ipfs/18n3naE9kBZoVvgYMV6saMZdtAkDHgs8MDwwhtyLu8JpYitY4Nk8jmyGgQ4Gt3VKNson"), new MultiAddress( "/ip4/188.166.13.135/tcp/4001/ipfs/18n3naE9kBZoVvgYMV6saMZe2AAPTCoujCxhJHECaySDEsPrEz9W2u7uo6hAbJhYzhPg"), new MultiAddress( "/ip4/167.172.73.132/tcp/4001/ipfs/18n3naE9kBZoVvgYMV6saMZe1E9wXdykR6h3Q9EaQcQc6hdNAXyCTEzoGfcA2wQgCRyg") }; if (Swarm.PrivateNetworkKey == null) { var path = Path.Combine(Repository.Folder, "swarm.key"); if (File.Exists(path)) { using var x = File.OpenText(path); Swarm.PrivateNetworkKey = new PreSharedKey(); Swarm.PrivateNetworkKey.Import(x); } } }
public static async Task <string> Resolve(this IDnsClient dnsClient, string host, TimeSpan timeout) { var cts = new CancellationTokenSource(); try { return(await dnsClient.Resolve(host, cts.Token).TimeoutAfter(timeout)); } catch (TimeoutException) { cts.Cancel(); return(string.Empty); } }
internal static void LogResponse(IDnsClient client, int byteLength, DNS.Header header, System.Net.IPEndPoint remote) { ((IMessageLogger)client).LogMessageCreate(LogMessageText.RESPONSE.INFO.ResponseReceived(byteLength, remote)); if (header.RCODEValue != 0) { ((IMessageLogger)client).LogMessageCreate(LogMessageText.RESPONSE.WARN.ResponseNonZero(header.RCODEValue, header.RCODE)); } if (header.TC) { ((IMessageLogger)client).LogMessageCreate(LogMessageText.RESPONSE.WARN.ResponseTruncated()); } }
private void RefreshDnsClient() { if (!_addressChanged) { return; } _addressChanged = false; var dnsServers = _dnsClients.NameServers(); if (_dnsClient.NameServers.ToHashSet().SetEquals(dnsServers)) { return; } _dnsClient = _dnsClients.DnsClient(dnsServers); }
public static async Task RunQuery(this IDnsClient client, string host, DnsQueryType queryType, DnsResponseCode expectedResponseCode = DnsResponseCode.NoError) { var query = DnsQueryFactory.CreateQuery(host, queryType); var answer = await client.Query(query); Assert.Equal(host, answer.Header.Host); Assert.Equal(query.Id, answer.Header.Id); Assert.Equal(expectedResponseCode, answer.Header.ResponseCode); if (expectedResponseCode == DnsResponseCode.NoError && !answer.Header.Truncation) { Assert.True(answer.Answers.Count > 0); } else { Assert.Empty(answer.Answers); } }
public DnsUdpServer(ILogger <DnsUdpServer> logger, IPEndPoint endpoint, IDnsClient dnsClient) { _logger = logger; _listener = new UdpClient(endpoint); _dnsClient = dnsClient; }
public SpfMxTermExpander(IDnsClient dnsClient) { _dnsClient = dnsClient; }
public DnsUdpServer(IPEndPoint endpoint, IDnsClient dnsClient) : this(new NullLogger <DnsUdpServer>(), endpoint, dnsClient) { }
/// <summary> /// Create a new filter client using the specified logger, <see cref="IDnsFilter"/> and <see cref="IDnsClient"/>. /// </summary> public DnsFilterClient(ILogger <DnsFilterClient> logger, IDnsFilter dnsFilter, IDnsClient dnsClient) { _logger = logger; _dnsFilter = dnsFilter; _dnsClient = dnsClient; }
public ExternalDelivery(IMessageRepository messageRepository, IDnsClient dnsClient, ILog log) { _messageRepository = messageRepository; _dnsClient = dnsClient; _log = log; }
/// <summary> /// Associate a client to the resolver. /// <para>Note that the connection with a client gets lost during serialization.</para> /// </summary> /// <param name="client"></param> public void Connect(IDnsClient client) { if (object.ReferenceEquals(null, client)) throw new ArgumentNullException("client"); _Client = client; }
/// <summary> /// Create a new filter client using the specified <see cref="IDnsFilter"/> and <see cref="IDnsClient"/>. /// </summary> public DnsFilterClient(IDnsFilter dnsFilter, IDnsClient dnsClient) : this(new NullLogger <DnsFilterClient>(), dnsFilter, dnsClient) { }
/// <summary> /// Construct a new caching DNS client using the specified client to /// forward requests to, and the specified memory cache. /// </summary> /// <param name="dnsClient">The see <see cref="IDnsClient"/> to delegate uncached requests to.</param> /// <param name="objectCache">The in-memory cache to use.</param> public DnsCachingClient(IDnsClient dnsClient, ObjectCache objectCache) : this(new NullLogger <DnsCachingClient>(), dnsClient, objectCache) { }
/// <summary> /// Construct a new caching DNS client using the specified logger, /// DNS client to forward requests to, and the specified memory cache. /// </summary> /// <param name="logger">The <see cref="ILogger"/> instance to use.</param> /// <param name="dnsClient">The see <see cref="IDnsClient"/> to delegate uncached requests to.</param> /// <param name="objectCache">The in-memory cache to use.</param> public DnsCachingClient(ILogger <DnsCachingClient> logger, IDnsClient dnsClient, ObjectCache objectCache) { _logger = logger; _dnsClient = dnsClient; _objectCache = objectCache; }
public virtual void Dispose() { if (!Object.ReferenceEquals(null, _Client)) { _Client.Dispose(); _Client = null; } }
public void TestInitialize() { _dnsClient = Substitute.For <IDnsClient>(); }
public SpfRedirectTermExpander(IDnsClient dnsClient, ISpfRecordsParser recordsParser) { _dnsClient = dnsClient; _recordsParser = recordsParser; }
internal static void LogRequest(IDnsClient client, int byteLength, System.Net.IPEndPoint remote) { ((IMessageLogger)client).LogMessageCreate(LogMessageText.REQUEST.INFO.SendingRequest( byteLength, client.NetworkProtocol, remote)); }
public DnsMiddleware(RequestDelegate next, IDnsClient dnsClient, IDnsMiddlewareConfig middlewareConfig) { _next = next; _dnsClient = dnsClient; _middlewareConfig = middlewareConfig; }
public SafeDnsClient(IDnsClient origin) { Ensure.NotNull(origin, nameof(origin)); _origin = origin; }
/// <summary> /// Creates a new instance of the Dns Manager and stores the authentication information passed. /// </summary> /// <param name="dnsClient">The DNS client to manage the requests</param> public DnsManager(IDnsClient dnsClient, int defaultTtl /* string apiKey, string apiSecret, int defaultTtl*/) { this._dnsClient = dnsClient; this._defaultTtl = defaultTtl; }
public void SetUp() { _dnsClient = A.Fake <IDnsClient>(); _spfATermExpander = new SpfATermExpander(_dnsClient); }
public ExternalDelivery(IMessageRepository messageRepository, IDnsClient dnsClient, ILog log) { _messageRepository = messageRepository; _dnsClient = dnsClient; _log = log; }