Commit be957c2
authored
Refactor DNS to pass full messages up to the VA (#8513)
Change the exported methods of the bdns package to have consistent
arguments and return values. Specifically:
- Split LookupHost into two more specific methods, LookupA and
LookupAAAA.
- Since each method now returns the results of a single DNS query,
update all four Lookup methods to return only a single resolver, rather
than a slice of resolver addresses.
- Create a new generic "Result" type, which embeds the upstream
miekg/dns.Msg type, and also helpfully extracts all the answer records
of a specific type. This embedding is important for the future, since we
want to extract this result's Authenticated Data bit and all CNAME hops
for logging in the VA.
- Use this new type as the return type for all four Lookup methods,
removing the custom pre-processing (e.g. producing a dig-like string for
CAA lookups, or filtering out Restricted IP addresses) from each method.
This unification and simplification allows us to streamline the body of
bdns.exchangeOne, to reduce code duplication around incrementing metrics
and clarify the retry loop's exit condition. Importantly, bdns.Exchange
(which actually performs the DoH network calls) remains untouched.
As a result of the changes to LookupA and LookupAAAA, move most of
LookupHost's old logic into the VA's getAddrs function. We're still
doing the exact same merging and filtering of IP addresses, just within
the VA rather than within the DNS abstraction layer. This also moves
usage of the `allowRestrictedAddrs` boolean from bdns.Client to va.impl,
and allows us to remove bdns.NewTest.
These interface changes require extensive test changes to match. Strip
the bdns.MockClient down to almost nothing, because its guts had far too
much knowledge of the desires of specific tests in a wholly different
package (the VA). Instead, break the MockClient down into three much
smaller fakes, and move them into the VA test files that actually need
them. Have each test case explicitly specify which fake it is using,
encouraging the use of smaller and more test-specific fakes in the
future. Finally, use this opportunity to turn multiple linear tests into
table-driven tests.
Part of #27001 parent 3922886 commit be957c2
File tree
16 files changed
+949
-1002
lines changed- bdns
- cmd
- boulder-va
- remoteva
- va
16 files changed
+949
-1002
lines changedLarge diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | 6 | | |
11 | 7 | | |
12 | | - | |
13 | | - | |
14 | 8 | | |
15 | 9 | | |
16 | 10 | | |
17 | | - | |
18 | | - | |
19 | | - | |
| 11 | + | |
20 | 12 | | |
21 | 13 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
| 14 | + | |
| 15 | + | |
91 | 16 | | |
92 | 17 | | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
107 | 21 | | |
108 | 22 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
156 | 26 | | |
157 | 27 | | |
158 | | - | |
159 | | - | |
160 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
161 | 31 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
| 11 | + | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | 21 | | |
24 | 22 | | |
25 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
125 | 113 | | |
126 | 114 | | |
127 | 115 | | |
| |||
155 | 143 | | |
156 | 144 | | |
157 | 145 | | |
| 146 | + | |
158 | 147 | | |
159 | 148 | | |
160 | 149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
131 | 118 | | |
132 | 119 | | |
133 | 120 | | |
| |||
142 | 129 | | |
143 | 130 | | |
144 | 131 | | |
| 132 | + | |
145 | 133 | | |
146 | 134 | | |
147 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
| 157 | + | |
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| 216 | + | |
216 | 217 | | |
217 | | - | |
218 | | - | |
219 | | - | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
220 | 225 | | |
221 | 226 | | |
222 | | - | |
223 | | - | |
| 227 | + | |
224 | 228 | | |
225 | 229 | | |
226 | 230 | | |
| |||
0 commit comments