Esempio n. 1
0
        private static async Task <IDnsPacket> ConstructPacketFromSimpleAsync(SimpleDnsPacket packet)
        {
            var header    = new DnsHeader(GenerateId(), new SendParameters(OPCode.Standard, true, false), 1, 0, 0, 0);
            var dnsPacket = new SendDnsPacket(header, packet.Query);

            return(await TransmitAsync(new Send(dnsPacket, packet.ServerIPAddress, packet.Type)));
        }
Esempio n. 2
0
        public Send(SendDnsPacket sendPacket, IPAddress serverIpAddress, int port, TransmissionType type)
        {
            SendingDnsPacket = sendPacket;
            ServerAddress    = serverIpAddress;
            Type             = type;
            Port             = port;

            var socketOptions = SocketTypes(type);

            _st = socketOptions.Item1;
            _pt = socketOptions.Item2;
        }
Esempio n. 3
0
 public Send(SendDnsPacket sendPacket, IPAddress serverIpAddress, TransmissionType type) : this(sendPacket, serverIpAddress, 53, type)
 {
 }
Esempio n. 4
0
 /// <summary>
 /// Queries DNS using the SendDnsPacket object asynchronously.
 /// </summary>
 /// <param name="packet"></param>
 /// <param name="serverIpAddress"></param>
 /// <returns></returns>
 /// <exception cref="T:Kitson.Dns.CustomExceptions.DnsConnectException"></exception>
 public static async Task <IDnsPacket> DnsAsync(SendDnsPacket packet, IPAddress serverIpAddress)
 {
     return(await TransmitAsync(new Send(packet, serverIpAddress, TransmissionType.UDP)));
 }
Esempio n. 5
0
 /// <summary>
 /// Queries DNS using the SendDnsPacket object synchronously.
 /// </summary>
 /// <param name="packet"></param>
 /// <param name="serverIpAddress"></param>
 /// <returns></returns>
 /// <exception cref="T:Kitson.Dns.CustomExceptions.DnsConnectException"></exception>
 public static IDnsPacket Dns(SendDnsPacket packet, IPAddress serverIpAddress)
 {
     return(TransmitSynchronous(new Send(packet, serverIpAddress, TransmissionType.UDP)));
 }