1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.resolver.dns;
17
18 import java.net.UnknownHostException;
19 import java.util.List;
20
21 import io.netty.channel.Channel;
22 import io.netty.channel.EventLoop;
23 import io.netty.handler.codec.dns.DnsQuestion;
24 import io.netty.handler.codec.dns.DnsRecord;
25 import io.netty.handler.codec.dns.DnsRecordType;
26 import io.netty.util.ReferenceCountUtil;
27 import io.netty.util.concurrent.Promise;
28
29 final class DnsRecordResolveContext extends DnsResolveContext<DnsRecord> {
30
31 DnsRecordResolveContext(DnsNameResolver parent, Channel channel,
32 Promise<?> originalPromise, DnsQuestion question, DnsRecord[] additionals,
33 DnsServerAddressStream nameServerAddrs, int allowedQueries) {
34 this(parent, channel, originalPromise, question.name(), question.dnsClass(),
35 new DnsRecordType[] { question.type() },
36 additionals, nameServerAddrs, allowedQueries);
37 }
38
39 private DnsRecordResolveContext(DnsNameResolver parent, Channel channel,
40 Promise<?> originalPromise,
41 String hostname, int dnsClass, DnsRecordType[] expectedTypes,
42 DnsRecord[] additionals,
43 DnsServerAddressStream nameServerAddrs,
44 int allowedQueries) {
45 super(parent, channel, originalPromise, hostname, dnsClass, expectedTypes,
46 additionals, nameServerAddrs, allowedQueries);
47 }
48
49 @Override
50 DnsResolveContext<DnsRecord> newResolverContext(DnsNameResolver parent, Channel channel,
51 Promise<?> originalPromise,
52 String hostname,
53 int dnsClass, DnsRecordType[] expectedTypes,
54 DnsRecord[] additionals,
55 DnsServerAddressStream nameServerAddrs,
56 int allowedQueries) {
57 return new DnsRecordResolveContext(parent, channel, originalPromise, hostname, dnsClass,
58 expectedTypes, additionals, nameServerAddrs, allowedQueries);
59 }
60
61 @Override
62 DnsRecord convertRecord(DnsRecord record, String hostname, DnsRecord[] additionals, EventLoop eventLoop) {
63 return ReferenceCountUtil.retain(record);
64 }
65
66 @Override
67 List<DnsRecord> filterResults(List<DnsRecord> unfiltered) {
68 return unfiltered;
69 }
70
71 @Override
72 boolean isCompleteEarly(DnsRecord resolved) {
73 return false;
74 }
75
76 @Override
77 boolean isDuplicateAllowed() {
78 return true;
79 }
80
81 @Override
82 void cache(String hostname, DnsRecord[] additionals, DnsRecord result, DnsRecord convertedResult) {
83
84
85 }
86
87 @Override
88 void cache(String hostname, DnsRecord[] additionals, UnknownHostException cause) {
89
90
91 }
92
93 @Override
94 DnsCnameCache cnameCache() {
95
96 return NoopDnsCnameCache.INSTANCE;
97 }
98 }