use of edu.umass.cs.gnsserver.gnamed.DnsTranslator in project GNS by MobilityFirst.
the class GNSApp method startDNS.
private void startDNS() throws SecurityException, SocketException, UnknownHostException {
try {
if (Config.getGlobalBoolean(GNSConfig.GNSC.DNS_GNS_ONLY)) {
dnsTranslator = new DnsTranslator(Inet4Address.getByName("0.0.0.0"), 53, requestHandler);
dnsTranslator.start();
} else if (Config.getGlobalBoolean(GNSConfig.GNSC.DNS_ONLY)) {
if (Config.getGlobalString(GNSConfig.GNSC.GNS_SERVER_IP) == GNSConfig.NONE) {
GNSConfig.getLogger().severe("FAILED TO START DNS SERVER: GNS Server IP must be specified");
return;
}
GNSConfig.getLogger().info("GNS Server IP" + Config.getGlobalString(GNSConfig.GNSC.GNS_SERVER_IP));
udpDnsServer = new UdpDnsServer(Inet4Address.getByName("0.0.0.0"), 53, Config.getGlobalString(GNSConfig.GNSC.DNS_UPSTREAM_SERVER_IP), Config.getGlobalString(GNSConfig.GNSC.GNS_SERVER_IP), requestHandler);
udpDnsServer.start();
} else {
udpDnsServer = new UdpDnsServer(Inet4Address.getByName("0.0.0.0"), 53, Config.getGlobalString(GNSConfig.GNSC.DNS_UPSTREAM_SERVER_IP), null, requestHandler);
udpDnsServer.start();
}
} catch (BindException e) {
GNSConfig.getLogger().warning("Not running DNS Service because it needs root permission! " + "If you want DNS run the server using sudo.");
}
}
Aggregations