private void AddLoggedDnsQuery(string Name, int Type, IPAddress Address, string ResolvedString, TimeSpan?ttl) { // WARNING: this function is called from a worker thread DnsCacheMonitor.DnsCacheEntry Entry = new DnsCacheMonitor.DnsCacheEntry() { HostName = Name, RecordType = (DnsApi.DnsRecordType)Type }; if (ttl == null) { Entry.ExpirationTime = Entry.TimeStamp; Entry.State = DnsCacheMonitor.DnsCacheEntry.States.NotFound; } else { Entry.ExpirationTime = Entry.TimeStamp.Add(ttl.Value); if (Address == null && ResolvedString == null) { Entry.State = DnsCacheMonitor.DnsCacheEntry.States.Blocked; } else { Entry.State = DnsCacheMonitor.DnsCacheEntry.States.Resolved; } } Entry.Address = Address; Entry.ResolvedString = ResolvedString; App.engine?.RunInEngineThread(() => { App.engine.DnsInspector?.AddDnsCacheEntry(Entry); QueryLogList.Add(Entry); while (QueryLogList.Count > QueryLogLimit) { QueryLogList.RemoveAt(0); } }); }
///////////////////////////////////////// // Dns Proxy protected byte[] PutQuery(DnsCacheMonitor.DnsCacheEntry entry) { return(PutXmlObj(entry)); }
public void AddDnsCacheEntry(DnsCacheMonitor.DnsCacheEntry curEntry) { dnsCacheMonitor.AddCacheEntry(curEntry); }