Commit 2699acd
committed
feat: add DNS resolution to TrustedPeer
Introduce an enum wrapping either a pre-resolved AddrV2 or a
DNS hostname, and a new TrustedPeer::from_hostname constructor. Hostnames
are resolved via tokio::net::lookup_host inside PeerMap::next_peer at
each attempt, so the backing IP can change between reconnections without
the caller pre-resolving.
Like IP-based trusted peers, hostname peers are consumed on use. Retries
and re-resolution across node lifetimes are the client's responsibility
(rebuild the node on NoReachablePeers). If a hostname fails to resolve,
it is logged and the next whitelist entry is tried; the node only
surfaces NoReachablePeers once the entire whitelist is exhausted.
Useful when the backing IP of a peer may change between reconnections,
e.g. a Kubernetes service whose pod IP rotates.1 parent 3704bda commit 2699acd
3 files changed
Lines changed: 97 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
188 | 200 | | |
189 | 201 | | |
190 | 202 | | |
| |||
205 | 217 | | |
206 | 218 | | |
207 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
208 | 223 | | |
209 | 224 | | |
210 | 225 | | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
217 | 232 | | |
218 | 233 | | |
219 | 234 | | |
220 | 235 | | |
221 | | - | |
| 236 | + | |
222 | 237 | | |
223 | | - | |
| 238 | + | |
224 | 239 | | |
225 | 240 | | |
226 | 241 | | |
| |||
233 | 248 | | |
234 | 249 | | |
235 | 250 | | |
236 | | - | |
| 251 | + | |
237 | 252 | | |
238 | 253 | | |
239 | 254 | | |
| |||
247 | 262 | | |
248 | 263 | | |
249 | 264 | | |
250 | | - | |
| 265 | + | |
251 | 266 | | |
252 | 267 | | |
253 | 268 | | |
254 | 269 | | |
255 | 270 | | |
256 | | - | |
257 | | - | |
258 | | - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
259 | 283 | | |
260 | 284 | | |
261 | 285 | | |
| |||
284 | 308 | | |
285 | 309 | | |
286 | 310 | | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | 311 | | |
294 | 312 | | |
295 | 313 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
221 | | - | |
| 220 | + | |
222 | 221 | | |
223 | 222 | | |
224 | 223 | | |
225 | | - | |
226 | | - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
227 | 253 | | |
228 | 254 | | |
229 | 255 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
685 | 685 | | |
686 | 686 | | |
687 | 687 | | |
| 688 | + | |
688 | 689 | | |
689 | 690 | | |
690 | 691 | | |
| |||
694 | 695 | | |
695 | 696 | | |
696 | 697 | | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
697 | 726 | | |
698 | 727 | | |
699 | 728 | | |
| |||
0 commit comments