use of net.sf.ivmaidns.dns.DNSMsgHeader in project fqrouter by fqrouter.
the class DnsUtils method resolveA.
public static List<Inet4Address> resolveA(String domain, InetSocketAddress dnsServer) throws Exception {
DNSMsgHeader qHeader = DNSMsgHeader.construct(DNSMsgHeader.QUERY, true, 1, 0, 0, 0, false);
DNSRecord[] records = new DNSRecord[1];
records[0] = new DNSRecord(new DNSName(domain, null), DNSRecord.A, DNSRecord.IN);
byte[] query = DNSConnection.encode(qHeader, records);
try {
return resolveAOverUdp(dnsServer, query);
} catch (Exception e) {
LogUtils.e("failed to resolve over udp", e);
return resolveAOverTcp(dnsServer, query);
}
}
use of net.sf.ivmaidns.dns.DNSMsgHeader in project fqrouter by fqrouter.
the class DnsUtils method resolveTXT.
public static String resolveTXT(String domain, InetSocketAddress dnsServer) throws Exception {
DNSMsgHeader qHeader = DNSMsgHeader.construct(DNSMsgHeader.QUERY, true, 1, 0, 0, 0, false);
DNSRecord[] records = new DNSRecord[1];
records[0] = new DNSRecord(new DNSName(domain, null), DNSRecord.TXT, DNSRecord.IN);
byte[] request = DNSConnection.encode(qHeader, records);
try {
return resolveTXTOverUdp(dnsServer, request);
} catch (Exception e) {
LogUtils.e("failed to resolve txt over udp at " + dnsServer, e);
return resolveTXTOverTcp(dnsServer, request);
}
}
Aggregations