tilo-net 0.5.0

The network capability on Linux, macOS and the web: async HTTP with streaming bodies, WebSocket, WebTransport, network status, raw sockets on the desktop, and Tilo's one TLS provider and trust source.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
#![cfg(not(target_family = "wasm"))]
#![allow(
    clippy::unwrap_used,
    clippy::expect_used,
    clippy::panic,
    clippy::indexing_slicing,
    reason = "a failed unwrap or index in a test is its assertion"
)]

use std::net::IpAddr;
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::time::Duration;

use bytes::Bytes;
use http_body_util::{BodyExt as _, Full};
use test_http::{Reply, Responder};
use tilo_net::proxy::host::{
    Budgets, Caller, Config, Destinations, FetchProxy, Lookup, MEDIA_PIECE, Rate, RateLimits,
    Workspace,
};
use tilo_net::proxy::{ERROR_HEADER, FINAL_URL_HEADER, MARKER_HEADER, Proxy};

const DEVICE: Caller = Caller([7; 32]);

fn request(method: &str, target: &str, body: &'static [u8]) -> http::Request<Full<Bytes>> {
    let query: String = url::form_urlencoded::Serializer::new(String::new())
        .append_pair("url", target)
        .finish();
    http::Request::builder()
        .method(method)
        .uri(format!("/_tilo/net/fetch?{query}"))
        .header(MARKER_HEADER, "1")
        .body(Full::new(Bytes::from_static(body)))
        .unwrap()
}

fn local(mut config: Config) -> FetchProxy {
    config.destinations = Destinations::Any;
    FetchProxy::new(config).unwrap()
}

async fn body_of(response: http::Response<tilo_net::proxy::host::ProxyBody>) -> String {
    String::from_utf8(
        response
            .into_body()
            .collect()
            .await
            .unwrap()
            .to_bytes()
            .to_vec(),
    )
    .unwrap()
}

#[tokio::test]
async fn a_get_answers_the_target_with_headers_the_page_origin_cannot_act_on_renamed() {
    let target = Responder::start(vec![
        Reply::status(200)
            .header("Content-Type", "application/json")
            .header("Set-Cookie", "session=target")
            .header("WWW-Authenticate", "Basic realm=\"api\"")
            .header("Cache-Control", "public, max-age=600")
            .header("Clear-Site-Data", "\"storage\"")
            .header("Access-Control-Allow-Origin", "*")
            .header("X-Tilo-Proxy-Error", "blocked")
            .header("X-Answer", "42")
            .body("[{\"title\":\"trending\"}]"),
    ]);
    let proxy = local(Config::default());
    let mut sent = request(
        "GET",
        &format!("{}/api/v1/trending?region=NL", target.url()),
        b"",
    );
    let headers = sent.headers_mut();
    headers.insert("x-tilo-session", "page-session".parse().unwrap());
    headers.insert("cookie", "host-cookie=1".parse().unwrap());
    headers.insert("user-agent", "Browser".parse().unwrap());
    headers.insert("x-tilo-forward-user-agent", "tube/0.1".parse().unwrap());
    headers.insert("x-forwarded-for", "203.0.113.5".parse().unwrap());
    let response = proxy.serve(DEVICE, sent).await;

    assert_eq!(response.status(), 200);
    let headers = response.headers();
    assert!(
        !headers.contains_key(ERROR_HEADER),
        "the target cannot fake a proxy failure"
    );
    assert_eq!(headers["x-tilo-forward-x-tilo-proxy-error"], "blocked");
    assert_eq!(headers["content-type"], "application/json");
    assert_eq!(headers["x-answer"], "42");
    assert_eq!(headers["cache-control"], "private, no-store");
    assert_eq!(
        headers["x-tilo-forward-cache-control"],
        "public, max-age=600"
    );
    for name in [
        "set-cookie",
        "www-authenticate",
        "clear-site-data",
        "access-control-allow-origin",
    ] {
        assert!(
            !headers.contains_key(name),
            "{name} must not reach the page's origin"
        );
        assert!(headers.contains_key(format!("x-tilo-forward-{name}").as_str()));
    }
    assert_eq!(
        headers[FINAL_URL_HEADER],
        format!("{}/api/v1/trending?region=NL", target.url())
    );
    assert_eq!(body_of(response).await, "[{\"title\":\"trending\"}]");

    let seen = target.next_request();
    assert_eq!(seen.method, "GET");
    assert_eq!(seen.target, "/api/v1/trending?region=NL");
    assert_eq!(seen.header("user-agent"), Some("tube/0.1"));
    assert_eq!(seen.header("x-tilo-session"), None);
    assert_eq!(seen.header("cookie"), None);
    assert_eq!(seen.header("x-forwarded-for"), None);
    assert_eq!(proxy.metrics().answered, 1);
}

#[tokio::test]
async fn redirects_are_followed_and_drop_credentials_across_origins() {
    let other = Responder::start(vec![Reply::status(200).body("moved here")]);
    let first = Responder::start(vec![
        Reply::status(302).header("Location", &format!("{}/landing", other.url())),
    ]);
    let proxy = local(Config::default());
    let mut sent = request("GET", &format!("{}/start", first.url()), b"");
    sent.headers_mut()
        .insert("authorization", "Bearer app-key".parse().unwrap());
    let response = proxy.serve(DEVICE, sent).await;
    assert_eq!(response.status(), 200);
    assert_eq!(
        response.headers()[FINAL_URL_HEADER],
        format!("{}/landing", other.url())
    );
    assert_eq!(body_of(response).await, "moved here");
    assert_eq!(
        first.next_request().header("authorization"),
        Some("Bearer app-key")
    );
    assert_eq!(other.next_request().header("authorization"), None);
}

#[tokio::test]
async fn the_host_network_is_refused_by_address_and_by_what_a_name_resolves_to() {
    let target = Responder::silent();
    // Every lookup is counted: the connection must use the checked answer,
    // not a second lookup a rebinding name could answer differently.
    let lookups = Arc::new(AtomicUsize::new(0));
    let counted = Arc::clone(&lookups);
    let lookup: Lookup = Arc::new(move |name: String| {
        counted.fetch_add(1, Ordering::SeqCst);
        Box::pin(async move {
            Ok(match name.as_str() {
                "rebind.test" => vec![
                    "93.184.216.34".parse::<IpAddr>().unwrap(),
                    "127.0.0.1".parse().unwrap(),
                ],
                "metadata.test" => vec!["169.254.169.254".parse().unwrap()],
                _ => vec!["10.0.0.7".parse().unwrap()],
            })
        })
    });
    let proxy = FetchProxy::with_lookup(Config::default(), lookup).unwrap();
    let port = target.port();
    for url in [
        format!("http://127.0.0.1:{port}/"),
        format!("http://[::1]:{port}/"),
        format!("http://[::ffff:127.0.0.1]:{port}/"),
        "http://10.1.2.3/".to_owned(),
        "http://169.254.169.254/latest/meta-data/".to_owned(),
        format!("http://rebind.test:{port}/"),
        "http://metadata.test/".to_owned(),
        "https://internal.test/".to_owned(),
    ] {
        let response = proxy.serve(DEVICE, request("GET", &url, b"")).await;
        assert_eq!(response.status(), 403, "{url}");
        assert_eq!(response.headers()[ERROR_HEADER], "blocked", "{url}");
    }
    assert_eq!(lookups.load(Ordering::SeqCst), 3, "one lookup per name");
    target.assert_untouched();
}

#[tokio::test]
async fn malformed_requests_ports_and_methods_are_refused() {
    let proxy = local(Config::default());
    let mut unmarked = request("GET", "https://example.com/", b"");
    unmarked.headers_mut().remove(MARKER_HEADER);
    let cases = [
        (unmarked, 400, "bad-request"),
        (
            request("GET", "ftp://example.com/", b""),
            400,
            "bad-request",
        ),
        (request("GET", "not a url", b""), 400, "bad-request"),
        (
            request("CONNECT", "https://example.com/", b""),
            400,
            "bad-request",
        ),
        (
            request("TRACE", "https://example.com/", b""),
            400,
            "bad-request",
        ),
        (
            request("GET", "http://example.com:25/", b""),
            403,
            "blocked",
        ),
        (
            request("GET", "http://example.com:22/", b""),
            403,
            "blocked",
        ),
    ];
    for (sent, status, code) in cases {
        let response = proxy.serve(DEVICE, sent).await;
        assert_eq!(response.status(), status);
        assert_eq!(response.headers()[ERROR_HEADER], code);
    }
}

#[tokio::test]
async fn bodies_beyond_the_limits_are_refused() {
    let target = Responder::start(vec![
        Reply::status(200).body(vec![b'x'; 4096]),
        Reply::status(200)
            .body(vec![b'y'; 4096])
            .without_content_length(),
    ]);
    let proxy = local(Config {
        max_request_bytes: 1024,
        max_response_bytes: 1024,
        ..Config::default()
    });

    let response = proxy
        .serve(
            DEVICE,
            request("POST", &format!("{}/upload", target.url()), &[0; 2048]),
        )
        .await;
    assert_eq!(response.status(), 413);
    assert_eq!(response.headers()[ERROR_HEADER], "too-large");

    // A declared length over the limit is refused before the body.
    let response = proxy
        .serve(
            DEVICE,
            request("GET", &format!("{}/big", target.url()), b""),
        )
        .await;
    assert_eq!(response.status(), 413);
    assert_eq!(response.headers()[ERROR_HEADER], "too-large");

    // An undeclared one breaks off at the limit, never reading as whole.
    let response = proxy
        .serve(
            DEVICE,
            request("GET", &format!("{}/stream", target.url()), b""),
        )
        .await;
    assert_eq!(response.status(), 200);
    assert!(response.into_body().collect().await.is_err());
}

#[tokio::test]
async fn a_target_slower_than_the_deadline_times_out() {
    let target = Responder::handle(|_| {
        std::thread::sleep(Duration::from_secs(3));
        Some(Reply::status(200).body("late"))
    });
    let proxy = local(Config {
        deadline: Duration::from_millis(500),
        ..Config::default()
    });
    let started = std::time::Instant::now();
    let response = proxy
        .serve(
            DEVICE,
            request("GET", &format!("{}/slow", target.url()), b""),
        )
        .await;
    assert_eq!(response.status(), 504);
    assert_eq!(response.headers()[ERROR_HEADER], "timeout");
    assert!(started.elapsed() < Duration::from_secs(2));
}

#[tokio::test]
async fn each_device_and_each_destination_has_a_budget() {
    let target = Responder::handle(|_| Some(Reply::status(204)));
    let tight = Rate {
        burst: 2.0,
        per_minute: 1.0,
    };
    let proxy = local(Config {
        limits: RateLimits {
            device_requests: tight,
            ..RateLimits::default()
        },
        ..Config::default()
    });
    let url = format!("{}/ping", target.url());
    for _ in 0..2 {
        assert_eq!(
            proxy
                .serve(DEVICE, request("GET", &url, b""))
                .await
                .status(),
            204
        );
    }
    let refused = proxy.serve(DEVICE, request("GET", &url, b"")).await;
    assert_eq!(refused.status(), 429);
    assert_eq!(refused.headers()[ERROR_HEADER], "rate-limited");
    assert!(
        refused.headers()["retry-after"]
            .to_str()
            .unwrap()
            .parse::<u64>()
            .unwrap()
            >= 1
    );
    let other = Caller([8; 32]);
    assert_eq!(
        proxy.serve(other, request("GET", &url, b"")).await.status(),
        204
    );

    // One destination, from every device together.
    let proxy = local(Config {
        limits: RateLimits {
            destination_requests: tight,
            ..RateLimits::default()
        },
        ..Config::default()
    });
    for device in 0..2u8 {
        let response = proxy
            .serve(Caller([device; 32]), request("GET", &url, b""))
            .await;
        assert_eq!(response.status(), 204);
    }
    let refused = proxy
        .serve(Caller([9; 32]), request("GET", &url, b""))
        .await;
    assert_eq!(refused.status(), 429);
    let metrics = proxy.metrics();
    assert_eq!(metrics.answered, 2);
    assert!(metrics.failed.contains(&("rate-limited", 1)));
    assert!(
        proxy
            .prometheus("tilo_fetch_proxy")
            .contains("tilo_fetch_proxy_requests_total{outcome=\"rate-limited\"} 1")
    );
}

#[tokio::test]
async fn a_device_that_fetched_too_much_waits() {
    let target = Responder::handle(|_| Some(Reply::status(200).body(vec![b'z'; 2048])));
    let proxy = local(Config {
        limits: RateLimits {
            device_bytes: Rate {
                burst: 1024.0,
                per_minute: 1.0,
            },
            ..RateLimits::default()
        },
        ..Config::default()
    });
    let url = format!("{}/blob", target.url());
    let response = proxy.serve(DEVICE, request("GET", &url, b"")).await;
    assert_eq!(response.status(), 200);
    assert_eq!(body_of(response).await.len(), 2048);
    let refused = proxy.serve(DEVICE, request("GET", &url, b"")).await;
    assert_eq!(refused.status(), 429);
    assert_eq!(refused.headers()[ERROR_HEADER], "rate-limited");
}

fn media_request(method: &str, target: &str, range: &str) -> http::Request<Full<Bytes>> {
    let proxy = Proxy {
        endpoint: url::Url::parse("http://host.example/_tilo/net/fetch").unwrap(),
        session: Some("ab12".into()),
    };
    let url = tilo_net::proxy::media_url(&proxy, &url::Url::parse(target).unwrap());
    http::Request::builder()
        .method(method)
        .uri(format!("{}?{}", url.path(), url.query().unwrap()))
        .header("range", range)
        .body(Full::new(Bytes::new()))
        .unwrap()
}

#[tokio::test]
async fn a_media_element_streams_through_the_query_form_a_piece_at_a_time() {
    let target = Responder::start(vec![
        Reply::status(206)
            .header("Content-Type", "video/mp4")
            .header("Content-Range", "bytes 0-3/11829048")
            .header("Accept-Ranges", "bytes")
            .body("mp4!"),
        Reply::status(206)
            .header("Content-Type", "video/mp4")
            .header("Content-Range", "bytes 9000000-9000003/11829048")
            .body("more"),
    ]);
    let proxy = local(Config::default());
    let video = format!("{}/videoplayback?itag=18", target.url());

    // An open-ended range is asked of the target one piece at a time.
    let response = proxy
        .serve(DEVICE, media_request("GET", &video, "bytes=0-"))
        .await;
    assert_eq!(response.status(), 206);
    assert_eq!(response.headers()["content-range"], "bytes 0-3/11829048");
    assert_eq!(response.headers()["accept-ranges"], "bytes");
    assert_eq!(body_of(response).await, "mp4!");
    let seen = target.next_request();
    assert_eq!(seen.target, "/videoplayback?itag=18");
    let piece_end = MEDIA_PIECE - 1;
    assert_eq!(
        seen.header("range"),
        Some(format!("bytes=0-{piece_end}").as_str())
    );

    // A bounded range goes as the element asked.
    let response = proxy
        .serve(
            DEVICE,
            media_request("GET", &video, "bytes=9000000-9000003"),
        )
        .await;
    assert_eq!(response.status(), 206);
    assert_eq!(
        target.next_request().header("range"),
        Some("bytes=9000000-9000003")
    );

    // Only a GET or HEAD may name itself in the query: a form a cross-site
    // page submits sends a POST.
    let response = proxy
        .serve(DEVICE, media_request("POST", &video, "bytes=0-"))
        .await;
    assert_eq!(response.status(), 400);
    assert_eq!(response.headers()[ERROR_HEADER], "bad-request");
    let post = media_request("POST", &video, "bytes=0-");
    assert_eq!(
        tilo_net::proxy::host::query_session(post.method(), post.uri()),
        None
    );
    let get = media_request("GET", &video, "bytes=0-");
    assert_eq!(
        tilo_net::proxy::host::query_session(get.method(), get.uri()).as_deref(),
        Some("ab12")
    );
}

fn budgeted(
    visitor_bytes: Option<u64>,
    workspace_bytes: Option<u64>,
    window: Duration,
) -> FetchProxy {
    local(Config {
        budgets: Budgets {
            window,
            visitor_bytes,
            workspace_bytes,
        },
        ..Config::default()
    })
}

#[tokio::test]
async fn a_visitor_that_received_its_budget_is_refused_until_the_window_turns_over() {
    let target = Responder::handle(|_| Some(Reply::status(200).body(vec![b'v'; 2048])));
    let window = Duration::from_millis(600);
    let proxy = budgeted(Some(2048), None, window);
    let url = format!("{}/piece", target.url());
    let response = proxy.serve(DEVICE, request("GET", &url, b"")).await;
    assert_eq!(response.status(), 200);
    assert_eq!(body_of(response).await.len(), 2048);

    let refused = proxy.serve(DEVICE, request("GET", &url, b"")).await;
    assert_eq!(refused.status(), 429);
    assert_eq!(refused.headers()[ERROR_HEADER], "over-budget");
    assert_eq!(refused.headers()["retry-after"], "1");
    assert!(body_of(refused).await.contains("for now"));
    let other = proxy
        .serve(Caller([8; 32]), request("GET", &url, b""))
        .await;
    assert_eq!(other.status(), 200);
    assert_eq!(body_of(other).await.len(), 2048);
    let metrics = proxy.metrics();
    assert!(metrics.failed.contains(&("over-budget", 1)));
    assert!(
        proxy
            .prometheus("tilo_fetch_proxy")
            .contains("tilo_fetch_proxy_requests_total{outcome=\"over-budget\"} 1")
    );

    tokio::time::sleep(window).await;
    let renewed = proxy.serve(DEVICE, request("GET", &url, b"")).await;
    assert_eq!(renewed.status(), 200, "a new window, a new budget");
}

#[tokio::test]
async fn everyone_in_a_workspace_shares_its_budget() {
    let target = Responder::handle(|_| Some(Reply::status(200).body(vec![b'r'; 1500])));
    let proxy = budgeted(None, Some(3000), Duration::from_secs(3600));
    let url = format!("{}/piece", target.url());
    let studio = [Workspace(1)];
    for device in 1..=2u8 {
        let response = proxy
            .serve_in(Caller([device; 32]), &studio, request("GET", &url, b""))
            .await;
        assert_eq!(response.status(), 200);
        body_of(response).await;
    }
    let refused = proxy
        .serve_in(Caller([3; 32]), &studio, request("GET", &url, b""))
        .await;
    assert_eq!(refused.status(), 429);
    assert_eq!(refused.headers()[ERROR_HEADER], "over-budget");
    let retry: u64 = refused.headers()["retry-after"]
        .to_str()
        .unwrap()
        .parse()
        .unwrap();
    assert!(
        (3500..=3600).contains(&retry),
        "until the window turns over: {retry}"
    );
    let refused = proxy
        .serve_in(
            Caller([4; 32]),
            &[Workspace(2), Workspace(1)],
            request("GET", &url, b""),
        )
        .await;
    assert_eq!(refused.headers()[ERROR_HEADER], "over-budget");
    let response = proxy
        .serve_in(Caller([3; 32]), &[Workspace(2)], request("GET", &url, b""))
        .await;
    assert_eq!(response.status(), 200);
}

#[tokio::test]
async fn a_response_that_spends_the_budget_ends_in_an_error_not_a_short_body() {
    let target = Responder::start(vec![Reply::status(200).body(vec![b'm'; 1024 * 1024])]);
    let proxy = budgeted(Some(1024), None, Duration::from_secs(3600));
    let url = format!("{}/video", target.url());
    let response = proxy.serve(DEVICE, request("GET", &url, b"")).await;
    assert_eq!(response.status(), 200);
    assert!(
        response.into_body().collect().await.is_err(),
        "the page sees the body break off, never a whole short one"
    );
    let refused = proxy
        .serve(DEVICE, media_request("GET", &url, "bytes=1024-"))
        .await;
    assert_eq!(refused.status(), 429);
    assert_eq!(refused.headers()[ERROR_HEADER], "over-budget");
}

/// A server's own request to an address a person named reaches the public
/// internet alone: an address inside the network is refused before anything
/// is dialled, and a name that resolves inside it is never dialled.
#[tokio::test]
async fn a_guarded_client_reaches_no_address_inside_the_network() {
    use tilo_net::proxy::host::{check_destination, guarded_client, refused_address};

    let inside = Responder::silent();
    let literal = url::Url::parse(&inside.url()).unwrap();
    assert!(matches!(
        check_destination(&literal, Destinations::Public),
        Err(tilo_net::NetError::Blocked(_))
    ));
    check_destination(&literal, Destinations::Any).unwrap();
    let public = url::Url::parse("https://models.example/v1/models").unwrap();
    check_destination(&public, Destinations::Public).unwrap();
    let file = url::Url::parse("file:///etc/hostname").unwrap();
    assert!(check_destination(&file, Destinations::Any).is_err());

    let resolves_inside: Lookup =
        Arc::new(|_| Box::pin(async { Ok(vec![IpAddr::from([127, 0, 0, 1])]) }));
    let guarded = guarded_client(Destinations::Public, Arc::clone(&resolves_inside)).unwrap();
    let named = format!("http://models.example:{}/v1/models", inside.port());
    let refused = guarded.get(&named).send().await.unwrap_err();
    assert!(
        refused_address(&refused),
        "a caller reads that the name was refused, not that nobody answered: {refused:?}"
    );
    inside.assert_untouched();
    // A request that fails for another reason is not such a refusal.
    let closed = {
        let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap();
        listener.local_addr().unwrap().port()
    };
    let let_in = guarded_client(Destinations::Any, Arc::clone(&resolves_inside)).unwrap();
    let nobody = let_in
        .get(format!("http://models.example:{closed}/"))
        .send()
        .await
        .unwrap_err();
    assert!(!refused_address(&nobody));

    // The same name is dialled where it resolves once every address is let.
    let answering = Responder::start(vec![Reply::status(200).body("listed")]);
    let open = guarded_client(Destinations::Any, resolves_inside).unwrap();
    let answer = open
        .get(format!("http://models.example:{}/", answering.port()))
        .send()
        .await
        .unwrap();
    assert_eq!(answer.status(), 200);
}