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