Search in sources :

Example 1 with DnsTranslator

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.");
    }
}
Also used : BindException(java.net.BindException) DnsTranslator(edu.umass.cs.gnsserver.gnamed.DnsTranslator) UdpDnsServer(edu.umass.cs.gnsserver.gnamed.UdpDnsServer)

Aggregations

DnsTranslator (edu.umass.cs.gnsserver.gnamed.DnsTranslator)1 UdpDnsServer (edu.umass.cs.gnsserver.gnamed.UdpDnsServer)1 BindException (java.net.BindException)1