AbstractDnsRecord Class — netty Architecture
Architecture documentation for the AbstractDnsRecord class in AbstractDnsRecord.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 56bf6218_8eb5_4d08_1ee5_032eb0e90f4a["AbstractDnsRecord"] 821729cc_d075_fc84_8dea_9942f96b764c["AbstractDnsRecord.java"] 56bf6218_8eb5_4d08_1ee5_032eb0e90f4a -->|defined in| 821729cc_d075_fc84_8dea_9942f96b764c 324a8243_d403_cd98_a112_af6e9c58fbf2["AbstractDnsRecord()"] 56bf6218_8eb5_4d08_1ee5_032eb0e90f4a -->|method| 324a8243_d403_cd98_a112_af6e9c58fbf2 456c7dd7_89a2_cce2_9712_4effb755fb9f["String()"] 56bf6218_8eb5_4d08_1ee5_032eb0e90f4a -->|method| 456c7dd7_89a2_cce2_9712_4effb755fb9f abbb58fb_88e0_3134_9e59_96f12995549c["DnsRecordType()"] 56bf6218_8eb5_4d08_1ee5_032eb0e90f4a -->|method| abbb58fb_88e0_3134_9e59_96f12995549c b6700497_4f93_5d40_1bd1_d62fb1d4624e["dnsClass()"] 56bf6218_8eb5_4d08_1ee5_032eb0e90f4a -->|method| b6700497_4f93_5d40_1bd1_d62fb1d4624e 863f392e_b659_8948_d480_889362e67f09["timeToLive()"] 56bf6218_8eb5_4d08_1ee5_032eb0e90f4a -->|method| 863f392e_b659_8948_d480_889362e67f09 1fa01bba_5fa1_f89c_d48e_25437919606d["equals()"] 56bf6218_8eb5_4d08_1ee5_032eb0e90f4a -->|method| 1fa01bba_5fa1_f89c_d48e_25437919606d 71e8e8d6_cce0_b840_0ec1_3f993d6c2ccf["hashCode()"] 56bf6218_8eb5_4d08_1ee5_032eb0e90f4a -->|method| 71e8e8d6_cce0_b840_0ec1_3f993d6c2ccf
Relationship Graph
Source Code
codec-dns/src/main/java/io/netty/handler/codec/dns/AbstractDnsRecord.java lines 29–163
public abstract class AbstractDnsRecord implements DnsRecord {
private final String name;
private final DnsRecordType type;
private final short dnsClass;
private final long timeToLive;
private int hashCode;
/**
* Creates a new {@link #CLASS_IN IN-class} record.
*
* @param name the domain name
* @param type the type of the record
* @param timeToLive the TTL value of the record
*/
protected AbstractDnsRecord(String name, DnsRecordType type, long timeToLive) {
this(name, type, CLASS_IN, timeToLive);
}
/**
* Creates a new record.
*
* @param name the domain name
* @param type the type of the record
* @param dnsClass the class of the record, usually one of the following:
* <ul>
* <li>{@link #CLASS_IN}</li>
* <li>{@link #CLASS_CSNET}</li>
* <li>{@link #CLASS_CHAOS}</li>
* <li>{@link #CLASS_HESIOD}</li>
* <li>{@link #CLASS_NONE}</li>
* <li>{@link #CLASS_ANY}</li>
* </ul>
* @param timeToLive the TTL value of the record
*/
protected AbstractDnsRecord(String name, DnsRecordType type, int dnsClass, long timeToLive) {
checkPositiveOrZero(timeToLive, "timeToLive");
// Convert to ASCII which will also check that the length is not too big.
// See:
// - https://github.com/netty/netty/issues/4937
// - https://github.com/netty/netty/issues/4935
this.name = appendTrailingDot(IDNtoASCII(name));
this.type = checkNotNull(type, "type");
this.dnsClass = (short) dnsClass;
this.timeToLive = timeToLive;
}
private static String IDNtoASCII(String name) {
checkNotNull(name, "name");
if (PlatformDependent.isAndroid() && DefaultDnsRecordDecoder.ROOT.equals(name)) {
// Prior Android 10 there was a bug that did not correctly parse ".".
//
// See https://github.com/netty/netty/issues/10034
return name;
}
return IDN.toASCII(name);
}
private static String appendTrailingDot(String name) {
if (name.length() > 0 && name.charAt(name.length() - 1) != '.') {
return name + '.';
}
return name;
}
@Override
public String name() {
return name;
}
@Override
public DnsRecordType type() {
return type;
}
@Override
public int dnsClass() {
return dnsClass & 0xFFFF;
}
@Override
Source
Frequently Asked Questions
What is the AbstractDnsRecord class?
AbstractDnsRecord is a class in the netty codebase, defined in codec-dns/src/main/java/io/netty/handler/codec/dns/AbstractDnsRecord.java.
Where is AbstractDnsRecord defined?
AbstractDnsRecord is defined in codec-dns/src/main/java/io/netty/handler/codec/dns/AbstractDnsRecord.java at line 29.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free