Initial IPv6 support

This commit is contained in:
PeratX 2017-06-03 18:28:43 +08:00
parent 85685a3e3b
commit 97475e681d
4 changed files with 12 additions and 13 deletions

View File

@ -30,13 +30,13 @@ Features:
__Users must comply with local laws and regulations.__<br>
DNS server providers
DNS Server Providers
-------------
* __CuteDNS__ - *Restart service recently.*
* __[Pure DNS](http://puredns.cn/)__ - *I DO NOT KNOW HOW TO DESCRIBE~~~*
* __[AIXYZ DNS](https://aixyz.com/)__ - __*For academic purposes only.*__
Rule providers
Rule Providers
-------------
* __[hosts](https://github.com/racaljk/hosts)__ by *[Cthulhu](https://github.com/racaljk)* - [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh)
* __[google-hosts](https://github.com/fengixng/google-hosts)__ by *[fengixng](https://github.com/fengixng)* - None

View File

@ -15,8 +15,8 @@ import de.measite.minidns.DNSMessage;
import de.measite.minidns.Question;
import de.measite.minidns.Record;
import de.measite.minidns.record.A;
import de.measite.minidns.record.InternetAddressRR;
import de.measite.minidns.source.NetworkDataSource;
import de.measite.minidns.util.InetAddressUtil;
import org.itxtech.daedalus.Daedalus;
import org.itxtech.daedalus.R;
import org.itxtech.daedalus.util.DnsServerHelper;
@ -103,13 +103,13 @@ public class DnsTestFragment extends ToolbarFragment {
try {
long startTime = System.currentTimeMillis();
DNSMessage responseMessage = dnsQuery.query(message.build(), InetAddressUtil.ipv4From(dnsServer), 53);//Auto forward ports
DNSMessage responseMessage = dnsQuery.query(message.build(), InetAddress.getByName(dnsServer), 53);//Auto forward ports
long endTime = System.currentTimeMillis();
Set<A> answers = responseMessage.getAnswersFor(question);
Set<InternetAddressRR> answers = responseMessage.getAnswersFor(question);
if (answers != null && answers.size() > 0) {
for (A a : answers) {
InetAddress inetAddress = a.getInetAddress();
for (InternetAddressRR answer : answers) {
InetAddress inetAddress = answer.getInetAddress();
testText.append("\n").append(getResources().getString(R.string.test_result_resolved)).append(" ").append(inetAddress.getHostAddress());
}
testText.append("\n").append(getResources().getString(R.string.test_time_used)).append(" ").

View File

@ -345,8 +345,8 @@ public class UdpDnsProvider extends DnsProvider {
String dnsQueryName = dnsMsg.getQuestion().name.toString();
try {
String response;
if ((response = RulesResolver.resolve(dnsQueryName)) != null) {
String response = RulesResolver.resolve(dnsQueryName);
if (response != null) {
Logger.info("DnsProvider: Resolved " + dnsQueryName + " Local resolver response: " + response);
DNSMessage.Builder builder = dnsMsg.asBuilder();
int[] ip = new int[4];

View File

@ -11,7 +11,6 @@ import android.os.Build;
import android.os.ParcelFileDescriptor;
import android.support.v7.app.NotificationCompat;
import android.util.Log;
import de.measite.minidns.util.InetAddressUtil;
import org.itxtech.daedalus.Daedalus;
import org.itxtech.daedalus.R;
import org.itxtech.daedalus.activity.MainActivity;
@ -23,7 +22,7 @@ import org.itxtech.daedalus.util.DnsServerHelper;
import org.itxtech.daedalus.util.Logger;
import org.itxtech.daedalus.util.RulesResolver;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.util.HashMap;
/**
@ -210,8 +209,8 @@ public class DaedalusVpnService extends VpnService implements Runnable {
aliasSecondary = secondaryServer;
}
Inet4Address primaryDNSServer = InetAddressUtil.ipv4From(aliasPrimary);
Inet4Address secondaryDNSServer = InetAddressUtil.ipv4From(aliasSecondary);
InetAddress primaryDNSServer = InetAddress.getByName(aliasPrimary);
InetAddress secondaryDNSServer = InetAddress.getByName(aliasSecondary);
Logger.info("Daedalus VPN service is listening on " + primaryDNSServer.getHostAddress() + " and " + secondaryDNSServer.getHostAddress());
builder.setSession("Daedalus")
.addDnsServer(primaryDNSServer)