Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions iroh/bench/src/iroh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@ pub fn server_endpoint(
#[cfg(feature = "local-relay")]
{
builder = builder.insecure_skip_relay_cert_verify(relay_url.is_some());
let path_selection = match opt.only_relay {
true => iroh::endpoint::PathSelection::RelayOnly,
false => iroh::endpoint::PathSelection::default(),
};
builder = builder.path_selection(path_selection);
if opt.only_relay {
builder = builder.clear_ip_transports();
}
}
let ep = builder
.alpns(vec![ALPN.to_vec()])
Expand Down Expand Up @@ -95,11 +93,9 @@ pub async fn connect_client(
#[cfg(feature = "local-relay")]
{
builder = builder.insecure_skip_relay_cert_verify(relay_url.is_some());
let path_selection = match opt.only_relay {
true => iroh::endpoint::PathSelection::RelayOnly,
false => iroh::endpoint::PathSelection::default(),
};
builder = builder.path_selection(path_selection);
if opt.only_relay {
builder = builder.clear_ip_transports();
}
}
let endpoint = builder
.alpns(vec![ALPN.to_vec()])
Expand Down
13 changes: 2 additions & 11 deletions iroh/examples/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,16 +242,7 @@ impl EndpointArgs {
}

if self.relay_only {
#[cfg(feature = "test-utils")]
{
builder = builder.path_selection(iroh::endpoint::PathSelection::RelayOnly)
}
#[cfg(not(feature = "test-utils"))]
{
n0_error::bail_any!(
"Must have the `discovery-local-network` enabled when using the `--mdns` flag"
);
}
builder = builder.clear_ip_transports();
}

if let Some(host) = self.dns_server {
Expand Down Expand Up @@ -280,7 +271,7 @@ impl EndpointArgs {
#[cfg(not(feature = "discovery-local-network"))]
{
n0_error::bail_any!(
"Must have the `test-utils` feature enabled when using the `--relay-only` flag"
"Must have the `discovery-local-network` enabled when using the `--mdns` flag"
);
}
}
Expand Down
26 changes: 0 additions & 26 deletions iroh/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,6 @@ pub use crate::magicsock::transports::TransportConfig;
/// is still no connection the configured [`crate::discovery::Discovery`] will be used however.
const DISCOVERY_WAIT_PERIOD: Duration = Duration::from_millis(500);

/// Defines the mode of path selection for all traffic flowing through
/// the endpoint.
#[cfg(any(test, feature = "test-utils"))]
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
pub enum PathSelection {
/// Uses all available paths
#[default]
All,
/// Forces all traffic to go exclusively through relays
RelayOnly,
}

/// Builder for [`Endpoint`].
///
/// By default the endpoint will generate a new random [`SecretKey`], which will result in a
Expand All @@ -113,8 +101,6 @@ pub struct Builder {
#[cfg(any(test, feature = "test-utils"))]
insecure_skip_relay_cert_verify: bool,
transports: Vec<TransportConfig>,
#[cfg(any(test, feature = "test-utils"))]
path_selection: PathSelection,
max_tls_tickets: usize,
}

Expand Down Expand Up @@ -176,8 +162,6 @@ impl Builder {
dns_resolver: None,
#[cfg(any(test, feature = "test-utils"))]
insecure_skip_relay_cert_verify: false,
#[cfg(any(test, feature = "test-utils"))]
path_selection: PathSelection::default(),
max_tls_tickets: DEFAULT_MAX_TLS_TICKETS,
transports,
}
Expand Down Expand Up @@ -224,8 +208,6 @@ impl Builder {
server_config,
#[cfg(any(test, feature = "test-utils"))]
insecure_skip_relay_cert_verify: self.insecure_skip_relay_cert_verify,
// #[cfg(any(test, feature = "test-utils"))]
// path_selection: self.path_selection,
metrics,
};

Expand Down Expand Up @@ -471,14 +453,6 @@ impl Builder {
self
}

/// This implies we only use the relay to communicate
/// and do not attempt to do any hole punching.
#[cfg(any(test, feature = "test-utils"))]
pub fn path_selection(mut self, path_selection: PathSelection) -> Self {
self.path_selection = path_selection;
self
}

/// Set the maximum number of TLS tickets to cache.
///
/// Set this to a larger value if you want to do 0rtt connections to a large
Expand Down
17 changes: 1 addition & 16 deletions iroh/src/magicsock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ use self::{
};
#[cfg(not(wasm_browser))]
use crate::dns::DnsResolver;
// #[cfg(any(test, feature = "test-utils"))]
// use crate::endpoint::PathSelection;
#[cfg(not(wasm_browser))]
use crate::net_report::QuicConfig;
use crate::{
Expand Down Expand Up @@ -136,10 +134,6 @@ pub(crate) struct Options {
/// May only be used in tests.
#[cfg(any(test, feature = "test-utils"))]
pub(crate) insecure_skip_relay_cert_verify: bool,

// /// Configuration for what path selection to use
// #[cfg(any(test, feature = "test-utils"))]
// pub(crate) path_selection: PathSelection,
pub(crate) metrics: EndpointMetrics,
}

Expand Down Expand Up @@ -936,8 +930,6 @@ impl Handle {
server_config,
#[cfg(any(test, feature = "test-utils"))]
insecure_skip_relay_cert_verify,
// #[cfg(any(test, feature = "test-utils"))]
// path_selection,
metrics,
} = opts;

Expand Down Expand Up @@ -1026,8 +1018,6 @@ impl Handle {
let endpoint_map = {
EndpointMap::new(
secret_key.public(),
// #[cfg(any(test, feature = "test-utils"))]
// path_selection,
metrics.magicsock.clone(),
direct_addrs.addrs.watch(),
disco.clone(),
Expand Down Expand Up @@ -1856,12 +1846,9 @@ mod tests {

use super::{EndpointIdMappedAddr, Options, endpoint_map::Source, mapped_addrs::MappedAddr};
use crate::{
Endpoint,
RelayMode,
SecretKey,
Endpoint, RelayMode, SecretKey,
discovery::static_provider::StaticProvider,
dns::DnsResolver,
// endpoint::PathSelection,
magicsock::{Handle, MagicSock, TransportConfig},
tls::{self, DEFAULT_MAX_TLS_TICKETS},
};
Expand All @@ -1883,7 +1870,6 @@ mod tests {
#[cfg(any(test, feature = "test-utils"))]
insecure_skip_relay_cert_verify: false,
#[cfg(any(test, feature = "test-utils"))]
// path_selection: PathSelection::default(),
discovery_user_data: None,
metrics: Default::default(),
}
Expand Down Expand Up @@ -2319,7 +2305,6 @@ mod tests {
proxy_url: None,
server_config,
insecure_skip_relay_cert_verify: false,
// path_selection: PathSelection::default(),
metrics: Default::default(),
};
let msock = MagicSock::spawn(opts).await?;
Expand Down
4 changes: 0 additions & 4 deletions iroh/src/magicsock/endpoint_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ use serde::{Deserialize, Serialize};
use tokio::sync::mpsc;
use tracing::warn;

// #[cfg(any(test, feature = "test-utils"))]
// use crate::endpoint::PathSelection;
pub(super) use self::endpoint_state::EndpointStateMessage;
pub(crate) use self::endpoint_state::PathsWatcher;
use self::endpoint_state::{EndpointStateActor, EndpointStateHandle};
Expand Down Expand Up @@ -69,8 +67,6 @@ impl EndpointMap {
/// Creates a new [`EndpointMap`].
pub(super) fn new(
local_endpoint_id: EndpointId,
// TODO:
// #[cfg(any(test, feature = "test-utils"))] path_selection: PathSelection,
metrics: Arc<MagicsockMetrics>,

local_addrs: n0_watcher::Direct<BTreeSet<DirectAddr>>,
Expand Down
4 changes: 0 additions & 4 deletions iroh/src/magicsock/endpoint_map/endpoint_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ use crate::{
util::MaybeFuture,
};

// TODO: Use this
// #[cfg(any(test, feature = "test-utils"))]
// use crate::endpoint::PathSelection;

mod guarded_channel;

// TODO: use this
Expand Down
Loading