cleanup
This commit is contained in:
@@ -2,6 +2,7 @@ package mindustry.net;
|
|||||||
|
|
||||||
import arc.func.*;
|
import arc.func.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
|
import arc.net.dns.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
|
|
||||||
@@ -15,7 +16,7 @@ public class Dns{
|
|||||||
private static final Pattern ipPattern = Pattern.compile("^((0|1\\d?\\d?|2[0-4]?\\d?|25[0-5]?|[3-9]\\d?)\\.){3}(0|1\\d?\\d?|2[0-4]?\\d?|25[0-5]?|[3-9]\\d?)$");
|
private static final Pattern ipPattern = Pattern.compile("^((0|1\\d?\\d?|2[0-4]?\\d?|25[0-5]?|[3-9]\\d?)\\.){3}(0|1\\d?\\d?|2[0-4]?\\d?|25[0-5]?|[3-9]\\d?)$");
|
||||||
private static final int aRecord = 1, srvRecord = 33;
|
private static final int aRecord = 1, srvRecord = 33;
|
||||||
private static IntMap<ObjectMap<String, Seq<?>>> cache = new IntMap<>();
|
private static IntMap<ObjectMap<String, Seq<?>>> cache = new IntMap<>();
|
||||||
private static Seq<InetSocketAddress> nameservers = Seq.with(new InetSocketAddress("1.1.1.1", 53), new InetSocketAddress("8.8.8.8", 53));
|
private static Seq<InetSocketAddress> defNameservers = Seq.with(new InetSocketAddress("1.1.1.1", 53), new InetSocketAddress("8.8.8.8", 53));
|
||||||
|
|
||||||
static <T> void resolve(int type, String domain, Func<ByteBuffer, T> reader, Cons<Seq<T>> result, Cons<Exception> error){
|
static <T> void resolve(int type, String domain, Func<ByteBuffer, T> reader, Cons<Seq<T>> result, Cons<Exception> error){
|
||||||
ObjectMap<String, Seq<?>> map;
|
ObjectMap<String, Seq<?>> map;
|
||||||
@@ -30,7 +31,7 @@ public class Dns{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
send(Seq.with(new InetSocketAddress("1.1.1.1", 53)), 0, type, domain, reader, records -> {
|
send(ArcDns.getNameservers(), 0, type, domain, reader, records -> {
|
||||||
synchronized(cache){
|
synchronized(cache){
|
||||||
//cache the records
|
//cache the records
|
||||||
map.put(domain, records);
|
map.put(domain, records);
|
||||||
|
|||||||
Reference in New Issue
Block a user