Enable Iroh local network discovery

This commit is contained in:
Eric Wendland 2026-05-16 14:33:45 +02:00
commit bfc5df698c
12 changed files with 136 additions and 16 deletions

View file

@ -161,6 +161,7 @@ pub fn handle_request(
iroh_enabled: node.iroh_status.enabled,
endpoint_id: node.iroh_status.endpoint_id.clone(),
iroh_relay_mode: node.iroh_status.relay_mode.clone(),
iroh_local_discovery: node.iroh_status.local_discovery,
iroh: node.iroh_status.note.clone(),
})),
ControlRequest::NodeId => Ok(ControlResponse::NodeId(NodeIdResponse {
@ -456,8 +457,10 @@ async fn start_daemon_iroh_endpoint(
let node_config = GethConfig::load(&node.paths.config_file())?;
let relay_mode = node_config.iroh.relay_mode.clone();
let relay_mode_label = relay_mode.label();
let local_discovery = node_config.iroh.local_discovery;
let iroh_relay_mode = config_relay_mode_to_iroh(&relay_mode, &node_config.iroh.relay_maps);
let config = GethIrohConfig::local_with_relay(node.paths.iroh_key(), iroh_relay_mode);
let mut config = GethIrohConfig::local_with_relay(node.paths.iroh_key(), iroh_relay_mode);
config.local_discovery = local_discovery;
match geth_iroh::start_endpoint(&config).await {
Ok(endpoint) => {
let status = endpoint.status();
@ -473,6 +476,7 @@ async fn start_daemon_iroh_endpoint(
enabled: false,
endpoint_id: None,
relay_mode: relay_mode_label,
local_discovery,
note: format!("Iroh endpoint failed to start: {error}"),
};
Ok(None)