Skip to content

Commit 35d0fce

Browse files
axpnetclaude
andcommitted
fix(aeroshare): disable relays in LAN discovery and disclose the mDNS announce in the default mode
Two findings from the pre-tag commit audit of the LAN (mDNS) discovery feature. The lan mode promised "no internet and no relay" but RelayMode stayed Staging, so an online endpoint still registered its NodeId with the n0 relays; relays are now fully disabled in lan mode (same-subnet peers connect directly), taking precedence over custom relay URLs too. And the default "both" mode now folds in the local mDNS announce without saying so: the discovery label and description disclose it honestly in all 47 languages, so the informed-default contract from the v4.1.1 privacy work holds. Alongside, the same locale pass drops the two orphaned introHub keys left behind by the Add Service table refactor (dead code). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent f40e3b1 commit 35d0fce

48 files changed

Lines changed: 184 additions & 406 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src-tauri/peer-l0/src/endpoint.rs

Lines changed: 43 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -157,22 +157,30 @@ impl PeerEndpoint {
157157
// (`relay(http://localhost:3340)`), discovered purely via the Mainline DHT. This is what makes
158158
// the "every capable user runs their own relay" model work. The earlier "same relay set"
159159
// claim (from the WI-4g observation) was wrong; that failure had another cause.
160-
let relay_mode = match cfg.custom_relay_urls.as_deref() {
161-
Some(urls) if !urls.is_empty() => {
162-
let parsed: Vec<iroh::RelayUrl> = urls
163-
.iter()
164-
.map(|u| {
165-
u.parse::<iroh::RelayUrl>()
166-
.with_context(|| format!("invalid custom relay URL: {u:?}"))
167-
})
168-
.collect::<Result<_>>()?;
169-
info!(
170-
count = parsed.len(),
171-
"PeerEndpoint using RelayMode::Custom (self-hosted/override relays)"
172-
);
173-
iroh::RelayMode::Custom(iroh::RelayMap::from_iter(parsed))
160+
// LAN-only discovery promises "local network, fully offline, no relay":
161+
// honor it by disabling relays entirely (same-subnet peers connect
162+
// directly, no hole punching needed), so no WAN service is ever
163+
// contacted; this takes precedence over custom relay URLs too.
164+
let relay_mode = if cfg.discovery == DiscoveryMode::Lan {
165+
iroh::RelayMode::Disabled
166+
} else {
167+
match cfg.custom_relay_urls.as_deref() {
168+
Some(urls) if !urls.is_empty() => {
169+
let parsed: Vec<iroh::RelayUrl> = urls
170+
.iter()
171+
.map(|u| {
172+
u.parse::<iroh::RelayUrl>()
173+
.with_context(|| format!("invalid custom relay URL: {u:?}"))
174+
})
175+
.collect::<Result<_>>()?;
176+
info!(
177+
count = parsed.len(),
178+
"PeerEndpoint using RelayMode::Custom (self-hosted/override relays)"
179+
);
180+
iroh::RelayMode::Custom(iroh::RelayMap::from_iter(parsed))
181+
}
182+
_ => iroh::RelayMode::Staging,
174183
}
175-
_ => iroh::RelayMode::Staging,
176184
};
177185
// Register every ALPN the receive loop must accept: the L0 gate binary
178186
// dials with `PEER_L0_ALPN`, the app's "Send file" receive loop accepts
@@ -377,22 +385,27 @@ impl ConnectivitySample {
377385
/// No L0 ALPN is registered here; the L1 docs paths use a Router + blobs/gossip/docs ALPNs instead.
378386
/// This reuses the relay/discovery logic so L1 gets the same hole-punch behavior as the proven L0 stack.
379387
pub async fn build_base_endpoint(cfg: PeerEndpointConfig) -> Result<Endpoint> {
380-
let relay_mode = match cfg.custom_relay_urls.as_deref() {
381-
Some(urls) if !urls.is_empty() => {
382-
let parsed: Vec<iroh::RelayUrl> = urls
383-
.iter()
384-
.map(|u| {
385-
u.parse::<iroh::RelayUrl>()
386-
.with_context(|| format!("invalid custom relay URL: {u:?}"))
387-
})
388-
.collect::<Result<_>>()?;
389-
info!(
390-
count = parsed.len(),
391-
"build_base_endpoint (L1) using RelayMode::Custom (self-hosted/override relays)"
392-
);
393-
iroh::RelayMode::Custom(iroh::RelayMap::from_iter(parsed))
388+
// Same LAN-only contract as PeerEndpoint::bind: no relay is ever contacted.
389+
let relay_mode = if cfg.discovery == DiscoveryMode::Lan {
390+
iroh::RelayMode::Disabled
391+
} else {
392+
match cfg.custom_relay_urls.as_deref() {
393+
Some(urls) if !urls.is_empty() => {
394+
let parsed: Vec<iroh::RelayUrl> = urls
395+
.iter()
396+
.map(|u| {
397+
u.parse::<iroh::RelayUrl>()
398+
.with_context(|| format!("invalid custom relay URL: {u:?}"))
399+
})
400+
.collect::<Result<_>>()?;
401+
info!(
402+
count = parsed.len(),
403+
"build_base_endpoint (L1) using RelayMode::Custom (self-hosted/override relays)"
404+
);
405+
iroh::RelayMode::Custom(iroh::RelayMap::from_iter(parsed))
406+
}
407+
_ => iroh::RelayMode::Staging,
394408
}
395-
_ => iroh::RelayMode::Staging,
396409
};
397410
let mut base = Endpoint::builder(iroh::endpoint::presets::Minimal).relay_mode(relay_mode);
398411
if let Some(seed) = cfg.identity_secret_key {

src/i18n/locales/bg.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4418,10 +4418,6 @@
44184418
"failed": "Последният опит за свързване е неуспешен",
44194419
"lastFailedAt": "Последен неуспех преди {time}"
44204420
},
4421-
"view": {
4422-
"grid": "Мрежа",
4423-
"list": "Списък"
4424-
},
44254421
"check": "Провери",
44264422
"scanning": "Сканиране...",
44274423
"checkAvailability": "Провери наличността на услугата",
@@ -4442,8 +4438,7 @@
44424438
"customFtp": "FTP / FTPS",
44434439
"customSftp": "SFTP",
44444440
"customS3": "S3",
4445-
"customWebdav": "WebDAV",
4446-
"customAzure": "Azure Blob"
4441+
"customWebdav": "WebDAV"
44474442
},
44484443
"healthCheck": "Проверка на достъпност",
44494444
"storageVersioning": "Версии на файлове: {size}",
@@ -5201,11 +5196,11 @@
52015196
"rateLimitUnit": "в минута",
52025197
"rateLimitOff": "Без ограничение на честотата (0): всеки сигнал е разрешен.",
52035198
"discoveryLabel": "Откриваемост",
5204-
"discovery_both": "n0 DNS + Mainline DHT (по подразбиране)",
5199+
"discovery_both": "n0 DNS + Mainline DHT + LAN mDNS (по подразбиране)",
52055200
"discovery_dht": "Само Mainline DHT",
52065201
"discovery_n0": "Само n0 DNS",
52075202
"discovery_none": "Без (не е откриваем)",
5208-
"discovery_both_desc": "Най-достъпен: докато приемате, адресът ви се публикува едновременно в директорията n0 и в публичния DHT.",
5203+
"discovery_both_desc": "Най-достъпен: докато приемате, адресът ви се публикува едновременно в директорията n0 и в публичния DHT, и се обявява в локалната ви мрежа чрез mDNS.",
52095204
"discovery_dht_desc": "Публикува се само в публичния Mainline DHT, без директорията n0.",
52105205
"discovery_n0_desc": "Публикува се само в директорията n0, без публичния DHT.",
52115206
"discovery_none_desc": "Вашият AeroFTP-ID не се публикува никъде, докато приемате, така че не може да бъде изброен в публичния DHT. Можете да бъдете достигнат само от някой, който вече разполага с пълния ви адрес (например чрез билет за устройство).",

src/i18n/locales/bn.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4418,10 +4418,6 @@
44184418
"failed": "শেষ সংযোগের চেষ্টা ব্যর্থ হয়েছে",
44194419
"lastFailedAt": "শেষ ব্যর্থতা {time} আগে"
44204420
},
4421-
"view": {
4422-
"grid": "গ্রিড",
4423-
"list": "তালিকা"
4424-
},
44254421
"check": "যাচাই",
44264422
"scanning": "স্ক্যান করা হচ্ছে...",
44274423
"checkAvailability": "পরিষেবার উপলব্ধতা যাচাই করুন",
@@ -4442,8 +4438,7 @@
44424438
"customFtp": "FTP / FTPS",
44434439
"customSftp": "SFTP",
44444440
"customS3": "S3",
4445-
"customWebdav": "WebDAV",
4446-
"customAzure": "Azure Blob"
4441+
"customWebdav": "WebDAV"
44474442
},
44484443
"healthCheck": "হেলথ চেক",
44494444
"storageVersioning": "ফাইল সংস্করণ: {size}",
@@ -5201,11 +5196,11 @@
52015196
"rateLimitUnit": "প্রতি মিনিটে",
52025197
"rateLimitOff": "কোনো হার সীমা নেই (0): প্রতিটি সংকেত অনুমোদিত।",
52035198
"discoveryLabel": "আবিষ্কারযোগ্যতা",
5204-
"discovery_both": "n0 DNS + Mainline DHT (ডিফল্ট)",
5199+
"discovery_both": "n0 DNS + Mainline DHT + LAN mDNS (ডিফল্ট)",
52055200
"discovery_dht": "শুধু Mainline DHT",
52065201
"discovery_n0": "শুধু n0 DNS",
52075202
"discovery_none": "কোনোটি নয় (আবিষ্কারযোগ্য নয়)",
5208-
"discovery_both_desc": "সর্বাধিক নাগালযোগ্য: গ্রহণ করার সময়, আপনার ঠিকানা n0 ডিরেক্টরি এবং সর্বজনীন DHT উভয়েই প্রকাশিত হয়।",
5203+
"discovery_both_desc": "সর্বাধিক নাগালযোগ্য: গ্রহণ করার সময়, আপনার ঠিকানা n0 ডিরেক্টরি এবং সর্বজনীন DHT উভয়েই প্রকাশিত হয়। এবং mDNS এর মাধ্যমে আপনার স্থানীয় নেটওয়ার্কে ঘোষণা করা হয়",
52095204
"discovery_dht_desc": "n0 ডিরেক্টরি ছাড়া শুধুমাত্র সর্বজনীন Mainline DHT-তে প্রকাশিত।",
52105205
"discovery_n0_desc": "সর্বজনীন DHT ছাড়া শুধুমাত্র n0 ডিরেক্টরিতে প্রকাশিত।",
52115206
"discovery_none_desc": "গ্রহণ করার সময় আপনার AeroFTP-ID কোথাও প্রকাশিত হয় না, তাই এটি সর্বজনীন DHT-তে গণনা করা যায় না। শুধুমাত্র এমন কেউ আপনার সাথে যোগাযোগ করতে পারবেন যিনি ইতিমধ্যে আপনার সম্পূর্ণ ঠিকানা ধারণ করেন (উদাহরণস্বরূপ একটি ড্রাইভ টিকিটের মাধ্যমে)।",

src/i18n/locales/ca.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4437,10 +4437,6 @@
44374437
"failed": "L'últim intent de connexió ha fallat",
44384438
"lastFailedAt": "Últim error fa {time}"
44394439
},
4440-
"view": {
4441-
"grid": "Quadrícula",
4442-
"list": "Llista"
4443-
},
44444440
"check": "Comprova",
44454441
"scanning": "Escanejant...",
44464442
"checkAvailability": "Comprova la disponibilitat del servei",
@@ -4461,8 +4457,7 @@
44614457
"customFtp": "FTP / FTPS",
44624458
"customSftp": "SFTP",
44634459
"customS3": "S3",
4464-
"customWebdav": "WebDAV",
4465-
"customAzure": "Azure Blob"
4460+
"customWebdav": "WebDAV"
44664461
},
44674462
"healthCheck": "Comprovació de disponibilitat",
44684463
"storageVersioning": "Versions del fitxer: {size}",
@@ -5220,11 +5215,11 @@
52205215
"rateLimitUnit": "per minut",
52215216
"rateLimitOff": "Sense límit de freqüència (0): es permet qualsevol senyal.",
52225217
"discoveryLabel": "Visibilitat",
5223-
"discovery_both": "n0 DNS + Mainline DHT (per defecte)",
5218+
"discovery_both": "n0 DNS + Mainline DHT + LAN mDNS (per defecte)",
52245219
"discovery_dht": "Només Mainline DHT",
52255220
"discovery_n0": "Només n0 DNS",
52265221
"discovery_none": "Cap (no visible)",
5227-
"discovery_both_desc": "Més accessible: mentre rebeu, la vostra adreça es publica tant al directori n0 com al DHT públic.",
5222+
"discovery_both_desc": "Més accessible: mentre rebeu, la vostra adreça es publica tant al directori n0 com al DHT públic, i s'anuncia a la vostra xarxa local mitjançant mDNS.",
52285223
"discovery_dht_desc": "Es publica només al Mainline DHT públic, sense el directori n0.",
52295224
"discovery_n0_desc": "Es publica només al directori n0, sense el DHT públic.",
52305225
"discovery_none_desc": "El vostre AeroFTP-ID no es publica enlloc mentre rebeu, de manera que no es pot enumerar al DHT públic. Només us pot contactar algú que ja tingui la vostra adreça completa (per exemple, mitjançant un tiquet d'unitat).",

src/i18n/locales/cs.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4418,10 +4418,6 @@
44184418
"failed": "Poslední pokus o připojení selhal",
44194419
"lastFailedAt": "Poslední selhání před {time}"
44204420
},
4421-
"view": {
4422-
"grid": "Mřížka",
4423-
"list": "Seznam"
4424-
},
44254421
"check": "Zkontrolovat",
44264422
"scanning": "Skenování...",
44274423
"checkAvailability": "Zkontrolovat dostupnost služby",
@@ -4442,8 +4438,7 @@
44424438
"customFtp": "FTP / FTPS",
44434439
"customSftp": "SFTP",
44444440
"customS3": "S3",
4445-
"customWebdav": "WebDAV",
4446-
"customAzure": "Azure Blob"
4441+
"customWebdav": "WebDAV"
44474442
},
44484443
"healthCheck": "Kontrola dostupnosti",
44494444
"storageVersioning": "Verze souborů: {size}",
@@ -5201,11 +5196,11 @@
52015196
"rateLimitUnit": "za minutu",
52025197
"rateLimitOff": "Bez limitu četnosti (0): povolen je každý signál.",
52035198
"discoveryLabel": "Viditelnost",
5204-
"discovery_both": "n0 DNS + Mainline DHT (výchozí)",
5199+
"discovery_both": "n0 DNS + Mainline DHT + LAN mDNS (výchozí)",
52055200
"discovery_dht": "Pouze Mainline DHT",
52065201
"discovery_n0": "Pouze n0 DNS",
52075202
"discovery_none": "Žádná (neviditelný)",
5208-
"discovery_both_desc": "Nejdostupnější: během příjmu je vaše adresa zveřejněna jak v adresáři n0, tak ve veřejném DHT.",
5203+
"discovery_both_desc": "Nejdostupnější: během příjmu je vaše adresa zveřejněna jak v adresáři n0, tak ve veřejném DHT a oznamována ve vaší místní síti přes mDNS.",
52095204
"discovery_dht_desc": "Zveřejněno pouze ve veřejném Mainline DHT, bez adresáře n0.",
52105205
"discovery_n0_desc": "Zveřejněno pouze v adresáři n0, bez veřejného DHT.",
52115206
"discovery_none_desc": "Vaše AeroFTP-ID není během příjmu nikde zveřejněno, takže jej nelze vyhledat ve veřejném DHT. Kontaktovat vás může pouze někdo, kdo již má vaši úplnou adresu (například prostřednictvím lístku jednotky).",

src/i18n/locales/cy.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4437,10 +4437,6 @@
44374437
"failed": "Methodd y cais cysylltu diwethaf",
44384438
"lastFailedAt": "Methiant diwethaf {time} yn ôl"
44394439
},
4440-
"view": {
4441-
"grid": "Grid",
4442-
"list": "Rhestr"
4443-
},
44444440
"check": "Gwirio",
44454441
"scanning": "Sganio...",
44464442
"checkAvailability": "Gwirio argaeledd y gwasanaeth",
@@ -4461,8 +4457,7 @@
44614457
"customFtp": "FTP / FTPS",
44624458
"customSftp": "SFTP",
44634459
"customS3": "S3",
4464-
"customWebdav": "WebDAV",
4465-
"customAzure": "Azure Blob"
4460+
"customWebdav": "WebDAV"
44664461
},
44674462
"healthCheck": "Gwiriad iechyd",
44684463
"storageVersioning": "Fersiynau ffeil: {size}",
@@ -5220,11 +5215,11 @@
52205215
"rateLimitUnit": "y funud",
52215216
"rateLimitOff": "Dim cyfyngiad cyfradd (0): caniateir pob signal.",
52225217
"discoveryLabel": "Darganfyddadwyedd",
5223-
"discovery_both": "n0 DNS + Mainline DHT (rhagosodedig)",
5218+
"discovery_both": "n0 DNS + Mainline DHT + LAN mDNS (rhagosodedig)",
52245219
"discovery_dht": "Mainline DHT yn unig",
52255220
"discovery_n0": "n0 DNS yn unig",
52265221
"discovery_none": "Dim (ddim yn ddarganfyddadwy)",
5227-
"discovery_both_desc": "Mwyaf cyraeddadwy: wrth dderbyn, mae eich cyfeiriad yn cael ei gyhoeddi i'r cyfeiriadur n0 a'r DHT cyhoeddus.",
5222+
"discovery_both_desc": "Mwyaf cyraeddadwy: wrth dderbyn, mae eich cyfeiriad yn cael ei gyhoeddi i'r cyfeiriadur n0 a'r DHT cyhoeddus ac yn cael ei ddatgan ar eich rhwydwaith lleol dros mDNS.",
52285223
"discovery_dht_desc": "Cyhoeddwyd i'r Mainline DHT cyhoeddus yn unig, heb y cyfeiriadur n0.",
52295224
"discovery_n0_desc": "Cyhoeddwyd i'r cyfeiriadur n0 yn unig, heb y DHT cyhoeddus.",
52305225
"discovery_none_desc": "Nid yw eich AeroFTP-ID yn cael ei gyhoeddi yn unman wrth dderbyn, felly ni ellir ei restru ar y DHT cyhoeddus. Dim ond rhywun sydd eisoes â'ch cyfeiriad llawn all gysylltu â chi (er enghraifft trwy docyn gyrru).",

src/i18n/locales/da.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4418,10 +4418,6 @@
44184418
"failed": "Sidste forbindelsesforsøg mislykkedes",
44194419
"lastFailedAt": "Seneste fejl for {time} siden"
44204420
},
4421-
"view": {
4422-
"grid": "Gitter",
4423-
"list": "Liste"
4424-
},
44254421
"check": "Tjek",
44264422
"scanning": "Scanner...",
44274423
"checkAvailability": "Tjek tjenestens tilgængelighed",
@@ -4442,8 +4438,7 @@
44424438
"customFtp": "FTP / FTPS",
44434439
"customSftp": "SFTP",
44444440
"customS3": "S3",
4445-
"customWebdav": "WebDAV",
4446-
"customAzure": "Azure Blob"
4441+
"customWebdav": "WebDAV"
44474442
},
44484443
"healthCheck": "Tilgængelighedstjek",
44494444
"storageVersioning": "Filversioner: {size}",
@@ -5201,11 +5196,11 @@
52015196
"rateLimitUnit": "pr. minut",
52025197
"rateLimitOff": "Ingen hastighedsgrænse (0): alle signaler tillades.",
52035198
"discoveryLabel": "Synlighed",
5204-
"discovery_both": "n0 DNS + Mainline DHT (standard)",
5199+
"discovery_both": "n0 DNS + Mainline DHT + LAN mDNS (standard)",
52055200
"discovery_dht": "Kun Mainline DHT",
52065201
"discovery_n0": "Kun n0 DNS",
52075202
"discovery_none": "Ingen (ikke synlig)",
5208-
"discovery_both_desc": "Mest tilgængelig: mens du modtager, offentliggøres din adresse både i n0-mappen og i det offentlige DHT.",
5203+
"discovery_both_desc": "Mest tilgængelig: mens du modtager, offentliggøres din adresse både i n0-mappen og i det offentlige DHT og annonceres på dit lokale netværk via mDNS.",
52095204
"discovery_dht_desc": "Offentliggøres kun i det offentlige Mainline DHT, uden n0-mappen.",
52105205
"discovery_n0_desc": "Offentliggøres kun i n0-mappen, uden det offentlige DHT.",
52115206
"discovery_none_desc": "Dit AeroFTP-ID offentliggøres ingen steder, mens du modtager, så det kan ikke opregnes i det offentlige DHT. Du kan kun nås af nogen, der allerede har din fulde adresse (for eksempel via en drevbillet).",

0 commit comments

Comments
 (0)