Disable debug log

This commit is contained in:
PeratX 2017-09-06 20:14:02 +08:00
parent 89b9c0ef95
commit f0e2e22b73

View File

@ -216,12 +216,12 @@ public class UdpProvider extends Provider {
* @param responsePayload The payload of the response
*/
void handleDnsResponse(IpPacket requestPacket, byte[] responsePayload) {
try {
/*try {
DNSMessage message = new DNSMessage(responsePayload);
Logger.info(message.toString());
} catch (IOException e) {
Logger.logException(e);
}
}*/
UdpPacket udpOutPacket = (UdpPacket) requestPacket.getPayload();
UdpPacket.Builder payLoadBuilder = new UdpPacket.Builder(udpOutPacket)
.srcPort(udpOutPacket.getHeader().getDstPort())
@ -322,20 +322,17 @@ public class UdpProvider extends Provider {
String response = RuleResolver.resolve(dnsQueryName, dnsMsg.getQuestion().type);
if (response != null && dnsMsg.getQuestion().type == Record.TYPE.A) {
Logger.info("Provider: Resolved " + dnsQueryName + " Local resolver response: " + response);
DNSMessage.Builder builder = dnsMsg.asBuilder().setQrFlag(false);
int[] ip = new int[4];
byte i = 0;
for (String block : response.split("\\.")) {
ip[i] = Integer.parseInt(block);
i++;
}
builder.addAnswer(new Record<>(dnsQueryName, Record.TYPE.A, 1, 64, new A(ip[0], ip[1], ip[2], ip[3])));
DNSMessage.Builder builder = dnsMsg.asBuilder()
.setQrFlag(true)
.addAnswer(new Record<>(dnsQueryName, Record.TYPE.A, 1, 64,
new A(Inet4Address.getByName(response).getAddress())));
handleDnsResponse(parsedPacket, builder.build().toArray());
} else if (response != null && dnsMsg.getQuestion().type == Record.TYPE.AAAA) {
Logger.info("Provider: Resolved " + dnsQueryName + " Local resolver response: " + response);
DNSMessage.Builder builder = dnsMsg.asBuilder().setQrFlag(false);
builder.addAnswer(new Record<>(dnsQueryName, Record.TYPE.AAAA, 1, 64,
new AAAA(Inet6Address.getByName(response).getAddress())));
DNSMessage.Builder builder = dnsMsg.asBuilder()
.setQrFlag(true)
.addAnswer(new Record<>(dnsQueryName, Record.TYPE.AAAA, 1, 64,
new AAAA(Inet6Address.getByName(response).getAddress())));
handleDnsResponse(parsedPacket, builder.build().toArray());
} else {
Logger.info("Provider: Resolving " + dnsQueryName + " Type: " + dnsMsg.getQuestion().type.name() + " Sending to " + destAddr);