Examples of ARecord


Examples of org.xbill.DNS.ARecord

                "\"moniker\": \"bar\" }";

        Protocol protocol = new JSONBackendProtocol();
        Record result = protocol.decode(update.getBytes(), conf);

        ARecord rec = (ARecord) result;
        Assert.assertEquals("foo.example.com.", rec.getName().toString());
        Assert.assertEquals("192.168.0.1", rec.getAddress().getHostAddress());
        Assert.assertEquals(12345, rec.getTTL());
    }
View Full Code Here

Examples of org.xbill.DNS.ARecord

    @Test
    public void basicOperation() throws Exception {
        Ehcache cache = TestUtils.getEhcache();
        Configuration conf = new TestingConfiguration("conf", "example.com.", 1);

        ARecord arec = new ARecord(new Name("foo.example.com."),
                DClass.IN, 1, InetAddress.getByName("localhost"));

        SimpleBackend backend = new SimpleBackend("A", arec);
        backend.setConfiguration(conf);
        backend.setCache(cache);
View Full Code Here

Examples of org.xbill.DNS.ARecord

        int ttl = configuration.getTtl(update.moniker);

        Record record;
        if("ipv4".equals(update.family)) {
            record =  new ARecord(qualified, DClass.IN, ttl, address);
        } else if ("ipv6".equals(update.family)) {
            record = new AAAARecord(qualified, DClass.IN, ttl, address);
        } else {
            throw new ProtocolCodingException("Can't decode " + new String(data));
        }
View Full Code Here

Examples of org.xbill.DNS.ARecord

        long ttl = configuration.getTtl(moniker);

        switch (type) {
            case IPV4_UPDATE:
                rec = new ARecord(qualified, DClass.IN, ttl, addr);
                break;
            case IPV6_UPDATE:
                rec = new AAAARecord(qualified, DClass.IN, ttl, addr);
                break;
        }
View Full Code Here

Examples of org.xbill.DNS.ARecord

   
    if(!ignoreTTL)
      rmap.put("ttl", rec.getTTL());
   
    if (rec instanceof ARecord) {
      ARecord arec = (ARecord) rec;
      rmap.put("addr", arec.getAddress().getHostAddress());
    }
    else if (rec instanceof AAAARecord) {
      AAAARecord arec = (AAAARecord) rec;
      rmap.put("addrv6", arec.getAddress().getHostAddress());
    }
    else if (rec instanceof PTRRecord) {
      PTRRecord ptr = (PTRRecord) rec;
      rmap.put("target", ptr.getTarget().toString());
    }
View Full Code Here

Examples of org.xbill.DNS.ARecord

                                        }
                                    }
                                } else {
                                    Object value = hm.get(type);
                                    if ("A".equals(type)) {
                                        records.add(new ARecord(hostname,
                                                DClass.IN, 3600, Address
                                                        .getByAddress((String) value)));
                                    } else if ("AAAA".equals(type)) {
                                        records.add(new AAAARecord(hostname,
                                                DClass.IN, 3600, Address
View Full Code Here

Examples of org.xbill.DNS.ARecord

        if (rr != null && rr.length > 0) {
            records = new ArrayList<String>();
            for (int i = 0; i < rr.length; i++) {
                switch (rr[i].getType()) {
                    case Type.A:
                        ARecord a = (ARecord) rr[i];
                        records.add(a.getAddress().getHostAddress());
                        break;
                    case Type.AAAA:
                        AAAARecord aaaa = (AAAARecord) rr[i];
                        records.add(aaaa.getAddress().getHostAddress());
                        break;
View Full Code Here

Examples of org.xbill.DNS.ARecord

   
    protected void storeDNSRecord(final CrawlURI curi, final String dnsName,
        final CrawlHost targetHost, final Record[] rrecordSet) {
        // Get TTL and IP info from the first A record (there may be
        // multiple, e.g. www.washington.edu) then update the CrawlServer
        ARecord arecord = getFirstARecord(rrecordSet);
        if (arecord == null) {
            throw new NullPointerException("Got null arecord for " +
                dnsName);
        }
        targetHost.setIP(arecord.getAddress(), arecord.getTTL());
        try {
          recordDNS(curi, rrecordSet);
            curi.setFetchStatus(S_DNS_SUCCESS);
            curi.setDNSServerIPLabel(ResolverConfig.getCurrentConfig().server());
        } catch (IOException e) {
View Full Code Here

Examples of org.xbill.DNS.ARecord

        host.setIP(null, 0);
        curi.setFetchStatus(S_DOMAIN_UNRESOLVABLE);
    }
   
    protected ARecord getFirstARecord(Record[] rrecordSet) {
        ARecord arecord = null;
        if (rrecordSet == null || rrecordSet.length == 0) {
            if (logger.isLoggable(Level.FINEST)) {
                logger.finest("rrecordSet is null or zero length: " +
                    rrecordSet);
            }
View Full Code Here

Examples of org.xbill.DNS.ARecord

            return org.xbill.DNS.Address.getByAddress(name);
        } catch (UnknownHostException e) {
            Record[] records = lookupNoException(name, Type.A, "A");

            if (records != null && records.length >= 1) {
                ARecord a = (ARecord) records[0];
                return InetAddress.getByAddress(name, a.getAddress().getAddress());
            } else
                throw e;
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.