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
// Copyright 2024 Saorsa Labs Limited
//
// This software is licensed under the MIT license <LICENSE-MIT or
// https://opensource.org/licenses/MIT> or the Apache License, Version 2.0
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, at your
// option. This file may not be copied, modified, or distributed except
// according to those terms.
//
// Unless required by applicable law or agreed to in writing, software
// distributed under these licenses is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//! # Canary-gated relay acquisition
//!
//! Every non-client node tries to acquire a MASQUE relay from an XOR-closest
//! peer after bootstrap. Once a candidate accepts, the driver asks
//! independent randomized non-close witnesses to cold-dial the relay-allocated
//! address and confirm this node's authenticated identity before the address
//! is published to the DHT.
//!
//! ## Module layout
//!
//! - [`acquisition`]: the reusable XOR-closest [`RelayAcquisition`]
//! coordinator. Pure logic — wraps a [`RelaySessionEstablisher`] trait so
//! the walk can be unit-tested with mock establishers.
//! - [`canary`]: internal request/response protocol and quorum check used
//! to verify a freshly acquired relay from third-party vantage points.
//! - [`session`]: the [`run_relay_acquisition`] entry point. Builds the
//! filtered candidate list from the routing table and hands it to the
//! coordinator.
//! - [`driver`]: the [`spawn_acquisition_driver`] background task. Owns
//! every state transition for this node's relay: initial acquisition,
//! backoff retry, K-closest-eviction watch, tunnel-health poll, and
//! the republish-then-reacquire sequence on loss.
pub
pub
pub
pub
pub use ;
pub use spawn_acquisition_driver;