Updated dependencies and MiniDNS
This commit is contained in:
parent
0b0fd83724
commit
a3e877794b
@ -47,11 +47,11 @@ dependencies {
|
||||
//DNS
|
||||
implementation 'org.pcap4j:pcap4j-core:1.7.3'
|
||||
implementation 'org.pcap4j:pcap4j-packetfactory-static:1.7.3'
|
||||
implementation 'de.measite.minidns:minidns-core:0.2.4'
|
||||
implementation 'com.google.code.gson:gson:2.8.2'
|
||||
implementation 'org.minidns:minidns-client:0.3.0'
|
||||
implementation 'com.google.code.gson:gson:2.8.4'
|
||||
//Analytics
|
||||
implementation 'com.google.firebase:firebase-core:15.0.0'
|
||||
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.1'
|
||||
implementation 'com.google.firebase:firebase-core:15.0.2'
|
||||
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.2'
|
||||
}
|
||||
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
@ -9,15 +9,15 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.*;
|
||||
import de.measite.minidns.DNSMessage;
|
||||
import de.measite.minidns.Question;
|
||||
import de.measite.minidns.Record;
|
||||
import de.measite.minidns.source.NetworkDataSource;
|
||||
import org.itxtech.daedalus.Daedalus;
|
||||
import org.itxtech.daedalus.R;
|
||||
import org.itxtech.daedalus.util.Logger;
|
||||
import org.itxtech.daedalus.util.server.AbstractDNSServer;
|
||||
import org.itxtech.daedalus.util.server.DNSServerHelper;
|
||||
import org.minidns.dnsmessage.DnsMessage;
|
||||
import org.minidns.dnsmessage.Question;
|
||||
import org.minidns.record.Record;
|
||||
import org.minidns.source.NetworkDataSource;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
@ -139,7 +139,7 @@ public class DNSTestFragment extends ToolbarFragment {
|
||||
}
|
||||
}
|
||||
}};
|
||||
DNSQuery dnsQuery = new DNSQuery();
|
||||
DnsQuery dnsQuery = new DnsQuery();
|
||||
Record.TYPE type = ((Type) spinnerType.getSelectedItem()).getType();
|
||||
for (AbstractDNSServer dnsServer : dnsServers) {
|
||||
testText = testServer(dnsQuery, type, dnsServer, testDomain, testText);
|
||||
@ -152,7 +152,7 @@ public class DNSTestFragment extends ToolbarFragment {
|
||||
}
|
||||
|
||||
|
||||
private StringBuilder testServer(DNSQuery dnsQuery, Record.TYPE type, AbstractDNSServer server, String domain, StringBuilder testText) {
|
||||
private StringBuilder testServer(DnsQuery dnsQuery, Record.TYPE type, AbstractDNSServer server, String domain, StringBuilder testText) {
|
||||
Logger.debug("Testing DNS server " + server.getAddress() + ":" + server.getPort());
|
||||
testText.append(getString(R.string.test_domain)).append(" ").append(domain).append("\n").append(getString(R.string.test_dns_server)).append(" ").append(server.getAddress()).append(":").append(server.getPort());
|
||||
|
||||
@ -160,16 +160,16 @@ public class DNSTestFragment extends ToolbarFragment {
|
||||
|
||||
boolean succ = false;
|
||||
try {
|
||||
DNSMessage.Builder message = DNSMessage.builder()
|
||||
DnsMessage.Builder message = DnsMessage.builder()
|
||||
.addQuestion(new Question(domain, type))
|
||||
.setId((new Random()).nextInt())
|
||||
.setRecursionDesired(true)
|
||||
.setOpcode(DNSMessage.OPCODE.QUERY)
|
||||
.setResponseCode(DNSMessage.RESPONSE_CODE.NO_ERROR)
|
||||
.setOpcode(DnsMessage.OPCODE.QUERY)
|
||||
.setResponseCode(DnsMessage.RESPONSE_CODE.NO_ERROR)
|
||||
.setQrFlag(false);
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
DNSMessage response = dnsQuery.query(message.build(), InetAddress.getByName(server.getAddress()), server.getPort());
|
||||
DnsMessage response = dnsQuery.query(message.build(), InetAddress.getByName(server.getAddress()), server.getPort());
|
||||
long endTime = System.currentTimeMillis();
|
||||
|
||||
if (response.answerSection.size() > 0) {
|
||||
@ -280,8 +280,8 @@ public class DNSTestFragment extends ToolbarFragment {
|
||||
}
|
||||
}
|
||||
|
||||
private class DNSQuery extends NetworkDataSource {
|
||||
public DNSMessage query(DNSMessage message, InetAddress address, int port) throws IOException {
|
||||
private class DnsQuery extends NetworkDataSource {
|
||||
public DnsMessage query(DnsMessage message, InetAddress address, int port) throws IOException {
|
||||
return queryUdp(message, address, port);
|
||||
}
|
||||
}
|
||||
|
@ -8,15 +8,15 @@ import android.system.Os;
|
||||
import android.system.OsConstants;
|
||||
import android.system.StructPollfd;
|
||||
import android.util.Log;
|
||||
import de.measite.minidns.DNSMessage;
|
||||
import de.measite.minidns.Record;
|
||||
import de.measite.minidns.record.A;
|
||||
import de.measite.minidns.record.AAAA;
|
||||
import org.itxtech.daedalus.Daedalus;
|
||||
import org.itxtech.daedalus.service.DaedalusVpnService;
|
||||
import org.itxtech.daedalus.util.Logger;
|
||||
import org.itxtech.daedalus.util.RuleResolver;
|
||||
import org.itxtech.daedalus.util.server.DNSServerHelper;
|
||||
import org.minidns.dnsmessage.DnsMessage;
|
||||
import org.minidns.record.A;
|
||||
import org.minidns.record.AAAA;
|
||||
import org.minidns.record.Record;
|
||||
import org.pcap4j.packet.*;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
@ -220,7 +220,7 @@ public class UdpProvider extends Provider {
|
||||
void handleDnsResponse(IpPacket requestPacket, byte[] responsePayload) {
|
||||
if (Daedalus.getPrefs().getBoolean("settings_debug_output", false)) {
|
||||
try {
|
||||
Logger.debug(new DNSMessage(responsePayload).toString());
|
||||
Logger.debug(new DnsMessage(responsePayload).toString());
|
||||
} catch (IOException e) {
|
||||
Logger.logException(e);
|
||||
}
|
||||
@ -308,9 +308,9 @@ public class UdpProvider extends Provider {
|
||||
}
|
||||
|
||||
byte[] dnsRawData = (parsedUdp).getPayload().getRawData();
|
||||
DNSMessage dnsMsg;
|
||||
DnsMessage dnsMsg;
|
||||
try {
|
||||
dnsMsg = new DNSMessage(dnsRawData);
|
||||
dnsMsg = new DnsMessage(dnsRawData);
|
||||
if (Daedalus.getPrefs().getBoolean("settings_debug_output", false)) {
|
||||
Logger.debug(dnsMsg.toString());
|
||||
}
|
||||
@ -328,14 +328,14 @@ 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()
|
||||
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()
|
||||
DnsMessage.Builder builder = dnsMsg.asBuilder()
|
||||
.setQrFlag(true)
|
||||
.addAnswer(new Record<>(dnsQueryName, Record.TYPE.AAAA, 1, 64,
|
||||
new AAAA(Inet6Address.getByName(response).getAddress())));
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.itxtech.daedalus.util;
|
||||
|
||||
import de.measite.minidns.Record;
|
||||
import org.minidns.record.Record;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
|
@ -9,8 +9,8 @@ buildscript {
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.1.1'
|
||||
classpath 'com.google.gms:google-services:3.2.0'
|
||||
classpath 'com.android.tools.build:gradle:3.1.2'
|
||||
classpath 'com.google.gms:google-services:3.3.1'
|
||||
classpath 'io.fabric.tools:gradle:1.25.1'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
Loading…
Reference in New Issue
Block a user