Exemplo n.º 1
0
        private byte[] HandleRequest(byte[] data)
        {
            var query = new DnsPacket(data);

            ConsolePainter.WriteRequest($"GOT:\n{query}");

            if (!query.IsQuery)
            {
                return(null);
            }

            foreach (var question in query.Questions)
            {
                if (SupportedTypes.Contains(question.Type))
                {
                    return(FindCachedAnswerOrResend(query, cache[question.Type]));
                }

                ConsolePainter.WriteWarning(
                    $"Message with the type code {question.Type} is not currently supported!");
            }

            return(null);
        }