Example usage for io.netty.handler.codec.dns DefaultDnsRawRecord DefaultDnsRawRecord

List of usage examples for io.netty.handler.codec.dns DefaultDnsRawRecord DefaultDnsRawRecord

Introduction

In this page you can find the example usage for io.netty.handler.codec.dns DefaultDnsRawRecord DefaultDnsRawRecord.

Prototype

public DefaultDnsRawRecord(String name, DnsRecordType type, long timeToLive, ByteBuf content) 

Source Link

Document

Creates a new #CLASS_IN IN-class record.

Usage

From source file:com.linecorp.armeria.client.endpoint.dns.DnsAddressEndpointGroupTest.java

License:Apache License

private static DnsRecord newAddressRecord(String name, String ipAddr) {
    return new DefaultDnsRawRecord(name, NetUtil.isValidIpV4Address(ipAddr) ? A : AAAA, 60,
            Unpooled.wrappedBuffer(NetUtil.createByteArrayFromIpAddressString(ipAddr)));
}

From source file:com.linecorp.armeria.client.endpoint.dns.DnsAddressEndpointGroupTest.java

License:Apache License

private static DnsRecord newCompatibleAddressRecord(String name, String ipV4Addr) {
    final ByteBuf content = Unpooled.buffer();
    content.writeZero(12);/* w  w w.ja  va  2 s .c om*/
    content.writeBytes(NetUtil.createByteArrayFromIpAddressString(ipV4Addr));
    return new DefaultDnsRawRecord(name, AAAA, 60, content);
}

From source file:com.linecorp.armeria.client.endpoint.dns.DnsAddressEndpointGroupTest.java

License:Apache License

private static DnsRecord newBadAddressRecord(String name, boolean ipV4) {
    return new DefaultDnsRawRecord(name, ipV4 ? A : AAAA, 60, Unpooled.EMPTY_BUFFER);
}

From source file:com.linecorp.armeria.client.endpoint.dns.DnsAddressEndpointGroupTest.java

License:Apache License

private static DnsRecord newMappedAddressRecord(String name, String ipV4Addr) {
    final ByteBuf content = Unpooled.buffer();
    content.writeZero(10);// w  w w .  j  ava2  s.co m
    content.writeShort(0xFFFF);
    content.writeBytes(NetUtil.createByteArrayFromIpAddressString(ipV4Addr));
    return new DefaultDnsRawRecord(name, AAAA, 60, content);
}

From source file:com.linecorp.armeria.client.endpoint.dns.DnsAddressEndpointGroupTest.java

License:Apache License

private static DnsRecord newCnameRecord(String name, String actualName) {
    final ByteBuf content = Unpooled.buffer();
    DnsNameEncoder.encodeName(actualName, content);
    return new DefaultDnsRawRecord(name, CNAME, 60, content);
}

From source file:com.linecorp.armeria.client.endpoint.dns.DnsServiceEndpointGroupTest.java

License:Apache License

private static DnsRecord newSrvRecord(String hostname, int weight, int port, String target) {
    final ByteBuf content = Unpooled.buffer();
    content.writeShort(1); // priority unused
    content.writeShort(weight);/*from  ww  w.j  a va2 s. co  m*/
    content.writeShort(port);
    DnsNameEncoder.encodeName(target, content);
    return new DefaultDnsRawRecord(hostname, SRV, 60, content);
}

From source file:com.linecorp.armeria.client.endpoint.dns.DnsServiceEndpointGroupTest.java

License:Apache License

private static DnsRecord newTooShortSrvRecord(String hostname) {
    return new DefaultDnsRawRecord(hostname, SRV, 60, Unpooled.wrappedBuffer(new byte[4]));
}

From source file:com.linecorp.armeria.client.endpoint.dns.DnsServiceEndpointGroupTest.java

License:Apache License

private static DnsRecord newBadNameSrvRecord(String hostname) {
    return new DefaultDnsRawRecord(hostname, SRV, 60,
            Unpooled.wrappedBuffer(new byte[] { 0, 0, 0, 0, 0, 0, 127, 127, 127 }));
}

From source file:com.linecorp.armeria.client.endpoint.dns.DnsTextEndpointGroupTest.java

License:Apache License

private static DnsRecord newTxtRecord(String hostname, String text) {
    final ByteBuf content = Unpooled.buffer();
    content.writeByte(text.length());//ww w .j  a va  2  s.  c  o m
    content.writeBytes(text.getBytes(StandardCharsets.US_ASCII));
    return new DefaultDnsRawRecord(hostname, TXT, 60, content);
}

From source file:com.linecorp.armeria.client.endpoint.dns.DnsTextEndpointGroupTest.java

License:Apache License

private static DnsRecord newTooShortTxtRecord(String hostname) {
    return new DefaultDnsRawRecord(hostname, TXT, 60, Unpooled.EMPTY_BUFFER);
}