Add flag for printing DNS resolution errors.

This commit is contained in:
Steveice10 2020-05-30 10:49:39 -07:00
parent 5f73b5a7ae
commit 5291bea6a0
2 changed files with 12 additions and 0 deletions

View file

@ -0,0 +1,8 @@
package com.github.steveice10.packetlib;
public class BuiltinFlags {
public static final String PRINT_DNS_ERRORS = "print-dns-errors";
private BuiltinFlags() {
}
}

View file

@ -1,5 +1,6 @@
package com.github.steveice10.packetlib.tcp;
import com.github.steveice10.packetlib.BuiltinFlags;
import com.github.steveice10.packetlib.Client;
import com.github.steveice10.packetlib.ProxyInfo;
import com.github.steveice10.packetlib.packet.PacketProtocol;
@ -113,6 +114,9 @@ public class TcpClientSession extends TcpSession {
port = srv.getPort();
}
} catch(TextParseException e) {
if(getFlag(BuiltinFlags.PRINT_DNS_ERRORS, false)) {
e.printStackTrace();
}
}
bootstrap.remoteAddress(host, port);