Home / Function/ DnsServerAddressStream() — netty Function Reference

DnsServerAddressStream() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  a0a3ef5b_50ac_f197_edc6_5c2f3f1c03c1["DnsServerAddressStream()"]
  3bc002ec_f54e_a55f_0b37_77eac88c60db["DnsResolveContext"]
  a0a3ef5b_50ac_f197_edc6_5c2f3f1c03c1 -->|defined in| 3bc002ec_f54e_a55f_0b37_77eac88c60db
  07f53a31_718c_c4a3_04b0_19d21f5a6af4["query()"]
  a0a3ef5b_50ac_f197_edc6_5c2f3f1c03c1 -->|calls| 07f53a31_718c_c4a3_04b0_19d21f5a6af4
  style a0a3ef5b_50ac_f197_edc6_5c2f3f1c03c1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

resolver-dns/src/main/java/io/netty/resolver/dns/DnsResolveContext.java lines 394–432

    private DnsServerAddressStream getNameServersFromCache(String hostname) {
        int len = hostname.length();

        if (len == 0) {
            // We never cache for root servers.
            return null;
        }

        // We always store in the cache with a trailing '.'.
        if (hostname.charAt(len - 1) != '.') {
            hostname += ".";
        }

        int idx = hostname.indexOf('.');
        if (idx == hostname.length() - 1) {
            // We are not interested in handling '.' as we should never serve the root servers from cache.
            return null;
        }

        // We start from the closed match and then move down.
        for (;;) {
            // Skip '.' as well.
            hostname = hostname.substring(idx + 1);

            int idx2 = hostname.indexOf('.');
            if (idx2 <= 0 || idx2 == hostname.length() - 1) {
                // We are not interested in handling '.TLD.' as we should never serve the root servers from cache.
                return null;
            }
            idx = idx2;

            DnsServerAddressStream entries = authoritativeDnsServerCache().get(hostname);
            if (entries != null) {
                // The returned List may contain unresolved InetSocketAddress instances that will be
                // resolved on the fly in query(....).
                return entries;
            }
        }
    }

Subdomains

Calls

Frequently Asked Questions

What does DnsServerAddressStream() do?
DnsServerAddressStream() is a function in the netty codebase, defined in resolver-dns/src/main/java/io/netty/resolver/dns/DnsResolveContext.java.
Where is DnsServerAddressStream() defined?
DnsServerAddressStream() is defined in resolver-dns/src/main/java/io/netty/resolver/dns/DnsResolveContext.java at line 394.
What does DnsServerAddressStream() call?
DnsServerAddressStream() calls 1 function(s): query.

Analyze Your Own Codebase

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

Try Supermodel Free