Home / Function/ buildAliasMap() — netty Function Reference

buildAliasMap() — netty Function Reference

Architecture documentation for the buildAliasMap() function in DnsResolveContext.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  e8e0f39e_4c0b_4101_2c4b_e74b1af9a114["buildAliasMap()"]
  3bc002ec_f54e_a55f_0b37_77eac88c60db["DnsResolveContext"]
  e8e0f39e_4c0b_4101_2c4b_e74b1af9a114 -->|defined in| 3bc002ec_f54e_a55f_0b37_77eac88c60db
  6b22df1c_91b5_21bf_29f9_518f692074d4["onResponse()"]
  6b22df1c_91b5_21bf_29f9_518f692074d4 -->|calls| e8e0f39e_4c0b_4101_2c4b_e74b1af9a114
  1ff8f220_55f4_0cc5_b454_65682e36be5e["onExpectedResponse()"]
  1ff8f220_55f4_0cc5_b454_65682e36be5e -->|calls| e8e0f39e_4c0b_4101_2c4b_e74b1af9a114
  e1a10468_2ab8_17c7_5dfe_66d356b0d510["cache()"]
  e8e0f39e_4c0b_4101_2c4b_e74b1af9a114 -->|calls| e1a10468_2ab8_17c7_5dfe_66d356b0d510
  style e8e0f39e_4c0b_4101_2c4b_e74b1af9a114 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

resolver-dns/src/main/java/io/netty/resolver/dns/DnsResolveContext.java lines 975–1012

    private static Map<String, String> buildAliasMap(DnsResponse response, DnsCnameCache cache, EventLoop loop) {
        final int answerCount = response.count(DnsSection.ANSWER);
        Map<String, String> cnames = null;
        for (int i = 0; i < answerCount; i ++) {
            final DnsRecord r = response.recordAt(DnsSection.ANSWER, i);
            final DnsRecordType type = r.type();
            if (type != DnsRecordType.CNAME) {
                continue;
            }

            if (!(r instanceof DnsRawRecord)) {
                continue;
            }

            final ByteBuf recordContent = ((ByteBufHolder) r).content();
            final String domainName = decodeDomainName(recordContent);
            if (domainName == null) {
                continue;
            }

            if (cnames == null) {
                cnames = new HashMap<String, String>(min(8, answerCount));
            }

            String name = r.name().toLowerCase(Locale.US);
            String mapping = domainName.toLowerCase(Locale.US);

            // Cache the CNAME as well.
            String nameWithDot = hostnameWithDot(name);
            String mappingWithDot = hostnameWithDot(mapping);
            if (!nameWithDot.equalsIgnoreCase(mappingWithDot)) {
                cache.cache(nameWithDot, mappingWithDot, r.timeToLive(), loop);
                cnames.put(name, mapping);
            }
        }

        return cnames != null? cnames : Collections.<String, String>emptyMap();
    }

Subdomains

Calls

Frequently Asked Questions

What does buildAliasMap() do?
buildAliasMap() is a function in the netty codebase, defined in resolver-dns/src/main/java/io/netty/resolver/dns/DnsResolveContext.java.
Where is buildAliasMap() defined?
buildAliasMap() is defined in resolver-dns/src/main/java/io/netty/resolver/dns/DnsResolveContext.java at line 975.
What does buildAliasMap() call?
buildAliasMap() calls 1 function(s): cache.
What calls buildAliasMap()?
buildAliasMap() is called by 2 function(s): onExpectedResponse, onResponse.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free