Skip to content

An open-source cross-platform alternative to AirDrop

Expose channel direction reachability and probe peer on /register (#3722)

Tien Nam Doef2578911a0a
diff --git a/app/assets/i18n/_missing_translations_ga.json b/app/assets/i18n/_missing_translations_ga.json
index 32f5c8c6..140b4a3f 100644
--- a/app/assets/i18n/_missing_translations_ga.json
+++ b/app/assets/i18n/_missing_translations_ga.json
@@ -25,15 +25,12 @@
"verify": "Verify",
"info": {
"name": "Name",
- "address": "Address",
"version": "Version",
"protocol": "Protocol v{version}"
},
"logs": {
"title": "Logs",
- "empty": "No logs available.",
- "discovered": "Discovered via {protocol} ({host})",
- "updated": "Updated via {protocol} ({host})"
+ "empty": "No logs available."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/ar.json b/app/assets/i18n/ar.json
index 03889f35..c1d70d6f 100644
--- a/app/assets/i18n/ar.json
+++ b/app/assets/i18n/ar.json
@@ -212,15 +212,12 @@
"verify": "تحقق",
"info": {
"name": "الاسم",
- "address": "العنوان",
"version": "الإصدار",
"protocol": "البروتوكول v{version}"
},
"logs": {
"title": "السجلات",
- "empty": "لا توجد سجلات متاحة.",
- "discovered": "تم الاكتشاف عبر {protocol} ({host})",
- "updated": "تم التحديث عبر {protocol} ({host})"
+ "empty": "لا توجد سجلات متاحة."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/az.json b/app/assets/i18n/az.json
index 9fb344b1..41c312cc 100644
--- a/app/assets/i18n/az.json
+++ b/app/assets/i18n/az.json
@@ -212,15 +212,12 @@
"verify": "Doğrula",
"info": {
"name": "Ad",
- "address": "Ünvan",
"version": "Versiya",
"protocol": "Protokol v{version}"
},
"logs": {
"title": "Jurnallar",
- "empty": "Jurnal mövcud deyil.",
- "discovered": "{protocol} vasitəsilə aşkarlandı ({host})",
- "updated": "{protocol} vasitəsilə yeniləndi ({host})"
+ "empty": "Jurnal mövcud deyil."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/be.json b/app/assets/i18n/be.json
index 3bd0daaa..5febac60 100644
--- a/app/assets/i18n/be.json
+++ b/app/assets/i18n/be.json
@@ -212,15 +212,12 @@
"verify": "Спраўдзіць",
"info": {
"name": "Назва",
- "address": "Адрас",
"version": "Версія",
"protocol": "Пратакол v{version}"
},
"logs": {
"title": "Журнал",
- "empty": "Няма запісаў у журнале.",
- "discovered": "Выяўлена праз {protocol} ({host})",
- "updated": "Абноўлена праз {protocol} ({host})"
+ "empty": "Няма запісаў у журнале."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/bg.json b/app/assets/i18n/bg.json
index fc40b801..fe4f31b8 100644
--- a/app/assets/i18n/bg.json
+++ b/app/assets/i18n/bg.json
@@ -212,15 +212,12 @@
"verify": "Проверка",
"info": {
"name": "Име",
- "address": "Адрес",
"version": "Версия",
"protocol": "Протокол v{version}"
},
"logs": {
"title": "Дневници",
- "empty": "Няма налични дневници.",
- "discovered": "Открито чрез {protocol} ({host})",
- "updated": "Обновено чрез {protocol} ({host})"
+ "empty": "Няма налични дневници."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/bn.json b/app/assets/i18n/bn.json
index 29473f91..028922cb 100644
--- a/app/assets/i18n/bn.json
+++ b/app/assets/i18n/bn.json
@@ -212,15 +212,12 @@
"verify": "যাচাই করুন",
"info": {
"name": "নাম",
- "address": "ঠিকানা",
"version": "সংস্করণ",
"protocol": "প্রোটোকল v{version}"
},
"logs": {
"title": "লগ",
- "empty": "কোনো লগ নেই।",
- "discovered": "{protocol} এর মাধ্যমে আবিষ্কৃত ({host})",
- "updated": "{protocol} এর মাধ্যমে আপডেট হয়েছে ({host})"
+ "empty": "কোনো লগ নেই।"
}
},
"verifyPage": {
diff --git a/app/assets/i18n/ca.json b/app/assets/i18n/ca.json
index 7a2b5d6f..ca307e95 100644
--- a/app/assets/i18n/ca.json
+++ b/app/assets/i18n/ca.json
@@ -212,15 +212,12 @@
"verify": "Verifica",
"info": {
"name": "Nom",
- "address": "Adreça",
"version": "Versió",
"protocol": "Protocol v{version}"
},
"logs": {
"title": "Registres",
- "empty": "No hi ha registres disponibles.",
- "discovered": "Descobert mitjançant {protocol} ({host})",
- "updated": "Actualitzat mitjançant {protocol} ({host})"
+ "empty": "No hi ha registres disponibles."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/cs.json b/app/assets/i18n/cs.json
index 833e3dbd..0d285614 100644
--- a/app/assets/i18n/cs.json
+++ b/app/assets/i18n/cs.json
@@ -212,15 +212,12 @@
"verify": "Ověřit",
"info": {
"name": "Název",
- "address": "Adresa",
"version": "Verze",
"protocol": "Protokol v{version}"
},
"logs": {
"title": "Záznamy",
- "empty": "Žádné záznamy nejsou k dispozici.",
- "discovered": "Objeveno přes {protocol} ({host})",
- "updated": "Aktualizováno přes {protocol} ({host})"
+ "empty": "Žádné záznamy nejsou k dispozici."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/da.json b/app/assets/i18n/da.json
index 5a583c4a..0c55bf8a 100644
--- a/app/assets/i18n/da.json
+++ b/app/assets/i18n/da.json
@@ -212,15 +212,12 @@
"verify": "Verificer",
"info": {
"name": "Navn",
- "address": "Adresse",
"version": "Version",
"protocol": "Protokol v{version}"
},
"logs": {
"title": "Logfiler",
- "empty": "Ingen logfiler tilgængelige.",
- "discovered": "Opdaget via {protocol} ({host})",
- "updated": "Opdateret via {protocol} ({host})"
+ "empty": "Ingen logfiler tilgængelige."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/de.json b/app/assets/i18n/de.json
index 32dfd714..1ea1fe84 100644
--- a/app/assets/i18n/de.json
+++ b/app/assets/i18n/de.json
@@ -212,15 +212,12 @@
"verify": "Verifizieren",
"info": {
"name": "Name",
- "address": "Adresse",
"version": "Version",
"protocol": "Protokoll v{version}"
},
"logs": {
"title": "Logs",
- "empty": "Keine Logs vorhanden.",
- "discovered": "Entdeckt über {protocol} ({host})",
- "updated": "Aktualisiert über {protocol} ({host})"
+ "empty": "Keine Logs vorhanden."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/el.json b/app/assets/i18n/el.json
index 8f1a0927..7fc9c040 100644
--- a/app/assets/i18n/el.json
+++ b/app/assets/i18n/el.json
@@ -212,15 +212,12 @@
"verify": "Επαλήθευση",
"info": {
"name": "Όνομα",
- "address": "Διεύθυνση",
"version": "Έκδοση",
"protocol": "Πρωτόκολλο v{version}"
},
"logs": {
"title": "Αρχεία καταγραφής",
- "empty": "Δεν υπάρχουν διαθέσιμα αρχεία καταγραφής.",
- "discovered": "Εντοπίστηκε μέσω {protocol} ({host})",
- "updated": "Ενημερώθηκε μέσω {protocol} ({host})"
+ "empty": "Δεν υπάρχουν διαθέσιμα αρχεία καταγραφής."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/en.json b/app/assets/i18n/en.json
index e1a3fcc8..2b762dde 100644
--- a/app/assets/i18n/en.json
+++ b/app/assets/i18n/en.json
@@ -214,15 +214,26 @@
"verify": "Verify",
"info": {
"name": "Name",
- "address": "Address",
"version": "Version",
"protocol": "Protocol v{version}"
},
+ "channels": {
+ "title": "Channels",
+ "you": "You",
+ "outgoing": "Outgoing",
+ "incoming": "Incoming",
+ "works": "Works",
+ "notTested": "Not tested",
+ "failed": "Failed",
+ "notSeen": "Not seen"
+ },
"logs": {
"title": "Logs",
"empty": "No logs available.",
- "discovered": "Discovered via {protocol} ({host})",
- "updated": "Updated via {protocol} ({host})"
+ "outbound": "Reached via {protocol} ({host})",
+ "outboundFailed": "Could not reach via {protocol} ({host}): {error}",
+ "inbound": "Reached us via {protocol} ({host})",
+ "multicastInbound": "Announcement heard ({host})"
}
},
"verifyPage": {
diff --git a/app/assets/i18n/es-ES.json b/app/assets/i18n/es-ES.json
index 8368aeac..1ef394ab 100644
--- a/app/assets/i18n/es-ES.json
+++ b/app/assets/i18n/es-ES.json
@@ -212,15 +212,12 @@
"verify": "Verificar",
"info": {
"name": "Nombre",
- "address": "Dirección",
"version": "Versión",
"protocol": "Protocolo v{version}"
},
"logs": {
"title": "Registros",
- "empty": "No hay registros disponibles.",
- "discovered": "Descubierto mediante {protocol} ({host})",
- "updated": "Actualizado mediante {protocol} ({host})"
+ "empty": "No hay registros disponibles."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/et.json b/app/assets/i18n/et.json
index 2928709b..f7d0d2e3 100644
--- a/app/assets/i18n/et.json
+++ b/app/assets/i18n/et.json
@@ -212,15 +212,12 @@
"verify": "Kontrolli",
"info": {
"name": "Nimi",
- "address": "Aadress",
"version": "Versioon",
"protocol": "Protokoll v{version}"
},
"logs": {
"title": "Logid",
- "empty": "Logisid pole saadaval.",
- "discovered": "Avastatud {protocol} kaudu ({host})",
- "updated": "Uuendatud {protocol} kaudu ({host})"
+ "empty": "Logisid pole saadaval."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/eu.json b/app/assets/i18n/eu.json
index e54ecb65..371556f2 100644
--- a/app/assets/i18n/eu.json
+++ b/app/assets/i18n/eu.json
@@ -212,15 +212,12 @@
"verify": "Egiaztatu",
"info": {
"name": "Izena",
- "address": "Helbidea",
"version": "Bertsioa",
"protocol": "Protokoloa v{version}"
},
"logs": {
"title": "Erregistroak",
- "empty": "Ez dago erregistrorik eskuragarri.",
- "discovered": "{protocol} bidez aurkitua ({host})",
- "updated": "{protocol} bidez eguneratua ({host})"
+ "empty": "Ez dago erregistrorik eskuragarri."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/fa.json b/app/assets/i18n/fa.json
index 007f9663..3ba86bc0 100644
--- a/app/assets/i18n/fa.json
+++ b/app/assets/i18n/fa.json
@@ -212,15 +212,12 @@
"verify": "تأیید هویت",
"info": {
"name": "نام",
- "address": "آدرس",
"version": "نسخه",
"protocol": "پروتکل نسخه {version}"
},
"logs": {
"title": "گزارش‌ها",
- "empty": "هیچ گزارشی موجود نیست.",
- "discovered": "شناسایی شده از طریق {protocol} ({host})",
- "updated": "به‌روزرسانی شده از طریق {protocol} ({host})"
+ "empty": "هیچ گزارشی موجود نیست."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/fi.json b/app/assets/i18n/fi.json
index fe17ad3e..9f906cc6 100644
--- a/app/assets/i18n/fi.json
+++ b/app/assets/i18n/fi.json
@@ -212,15 +212,12 @@
"verify": "Vahvista",
"info": {
"name": "Nimi",
- "address": "Osoite",
"version": "Versio",
"protocol": "Protokolla v{version}"
},
"logs": {
"title": "Lokit",
- "empty": "Lokeja ei ole saatavilla.",
- "discovered": "Löydetty {protocol}-protokollan kautta ({host})",
- "updated": "Päivitetty {protocol}-protokollan kautta ({host})"
+ "empty": "Lokeja ei ole saatavilla."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/fil-PH.json b/app/assets/i18n/fil-PH.json
index 363bf8dd..c75f927a 100644
--- a/app/assets/i18n/fil-PH.json
+++ b/app/assets/i18n/fil-PH.json
@@ -212,15 +212,12 @@
"verify": "I-verify",
"info": {
"name": "Pangalan",
- "address": "Address",
"version": "Bersyon",
"protocol": "Protocol v{version}"
},
"logs": {
"title": "Mga Log",
- "empty": "Walang available na mga log.",
- "discovered": "Natuklasan sa pamamagitan ng {protocol} ({host})",
- "updated": "Na-update sa pamamagitan ng {protocol} ({host})"
+ "empty": "Walang available na mga log."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/fr.json b/app/assets/i18n/fr.json
index 56476a81..0d3bb944 100644
--- a/app/assets/i18n/fr.json
+++ b/app/assets/i18n/fr.json
@@ -212,15 +212,12 @@
"verify": "Vérifier",
"info": {
"name": "Nom",
- "address": "Adresse",
"version": "Version",
"protocol": "Protocole v{version}"
},
"logs": {
"title": "Journaux",
- "empty": "Aucun journal disponible.",
- "discovered": "Découvert via {protocol} ({host})",
- "updated": "Mis à jour via {protocol} ({host})"
+ "empty": "Aucun journal disponible."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/gl.json b/app/assets/i18n/gl.json
index 27074fe0..b0387719 100644
--- a/app/assets/i18n/gl.json
+++ b/app/assets/i18n/gl.json
@@ -212,15 +212,12 @@
"verify": "Verificar",
"info": {
"name": "Nome",
- "address": "Enderezo",
"version": "Versión",
"protocol": "Protocolo v{version}"
},
"logs": {
"title": "Rexistros",
- "empty": "Non hai rexistros dispoñibles.",
- "discovered": "Descuberto mediante {protocol} ({host})",
- "updated": "Actualizado mediante {protocol} ({host})"
+ "empty": "Non hai rexistros dispoñibles."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/gu.json b/app/assets/i18n/gu.json
index 5c1fa7f2..ce3c23af 100644
--- a/app/assets/i18n/gu.json
+++ b/app/assets/i18n/gu.json
@@ -212,15 +212,12 @@
"verify": "ચકાસો",
"info": {
"name": "નામ",
- "address": "સરનામું",
"version": "સંસ્કરણ",
"protocol": "પ્રોટોકોલ v{version}"
},
"logs": {
"title": "લોગ",
- "empty": "કોઈ લોગ ઉપલબ્ધ નથી.",
- "discovered": "{protocol} દ્વારા શોધાયું ({host})",
- "updated": "{protocol} દ્વારા અપડેટ થયું ({host})"
+ "empty": "કોઈ લોગ ઉપલબ્ધ નથી."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/he.json b/app/assets/i18n/he.json
index 7f638f44..4ea5dde8 100644
--- a/app/assets/i18n/he.json
+++ b/app/assets/i18n/he.json
@@ -214,15 +214,12 @@
"verify": "אימות",
"info": {
"name": "שם",
- "address": "כתובת",
"version": "גרסה",
"protocol": "פרוטוקול גרסה {version}"
},
"logs": {
"title": "יומני רישום",
- "empty": "אין יומנים זמינים",
- "discovered": "התגלה באמצעות {protocol} ({host})",
- "updated": "עודכן באמצעות {protocol} ({host})"
+ "empty": "אין יומנים זמינים"
}
},
"verifyPage": {
diff --git a/app/assets/i18n/hi.json b/app/assets/i18n/hi.json
index c573ab38..abd31710 100644
--- a/app/assets/i18n/hi.json
+++ b/app/assets/i18n/hi.json
@@ -212,15 +212,12 @@
"verify": "सत्यापित करें",
"info": {
"name": "नाम",
- "address": "पता",
"version": "संस्करण",
"protocol": "प्रोटोकॉल v{version}"
},
"logs": {
"title": "लॉग",
- "empty": "कोई लॉग उपलब्ध नहीं।",
- "discovered": "{protocol} के ज़रिए खोजा गया ({host})",
- "updated": "{protocol} के ज़रिए अपडेट किया गया ({host})"
+ "empty": "कोई लॉग उपलब्ध नहीं।"
}
},
"verifyPage": {
diff --git a/app/assets/i18n/hu.json b/app/assets/i18n/hu.json
index 3382b7b7..da9b9c15 100644
--- a/app/assets/i18n/hu.json
+++ b/app/assets/i18n/hu.json
@@ -212,15 +212,12 @@
"verify": "Ellenőrzés",
"info": {
"name": "Név",
- "address": "Cím",
"version": "Verzió",
"protocol": "Protokoll v{version}"
},
"logs": {
"title": "Naplók",
- "empty": "Nincs elérhető napló.",
- "discovered": "Felfedezve {protocol} útján ({host})",
- "updated": "Frissítve {protocol} útján ({host})"
+ "empty": "Nincs elérhető napló."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/hy.json b/app/assets/i18n/hy.json
index 9fce6d93..e374f099 100644
--- a/app/assets/i18n/hy.json
+++ b/app/assets/i18n/hy.json
@@ -212,15 +212,12 @@
"verify": "Հաստատել",
"info": {
"name": "Անուն",
- "address": "Հասցե",
"version": "Վերսիա",
"protocol": "v{version} պրոտոկոլ"
},
"logs": {
"title": "Լոգեր",
- "empty": "Լոգեր չկան։",
- "discovered": "Գտնվել է {protocol} ({host}) միջոցով",
- "updated": "Թարմացվել է {protocol} ({host}) միջոցով"
+ "empty": "Լոգեր չկան։"
}
},
"verifyPage": {
diff --git a/app/assets/i18n/id.json b/app/assets/i18n/id.json
index dd34034c..c30290fc 100644
--- a/app/assets/i18n/id.json
+++ b/app/assets/i18n/id.json
@@ -212,15 +212,12 @@
"verify": "Verifikasi",
"info": {
"name": "Nama",
- "address": "Alamat",
"version": "Versi",
"protocol": "Protokol v{version}"
},
"logs": {
"title": "Log",
- "empty": "Tidak ada log yang tersedia.",
- "discovered": "Ditemukan melalui {protocol} ({host})",
- "updated": "Diperbarui melalui {protocol} ({host})"
+ "empty": "Tidak ada log yang tersedia."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/it.json b/app/assets/i18n/it.json
index 240486ba..e5252b72 100644
--- a/app/assets/i18n/it.json
+++ b/app/assets/i18n/it.json
@@ -212,15 +212,12 @@
"verify": "Verifica",
"info": {
"name": "Nome",
- "address": "Indirizzo",
"version": "Versione",
"protocol": "Protocollo v{version}"
},
"logs": {
"title": "Log",
- "empty": "Nessun log disponibile.",
- "discovered": "Rilevato tramite {protocol} ({host})",
- "updated": "Aggiornato tramite {protocol} ({host})"
+ "empty": "Nessun log disponibile."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/ja.json b/app/assets/i18n/ja.json
index 14f6ab4a..1f598396 100644
--- a/app/assets/i18n/ja.json
+++ b/app/assets/i18n/ja.json
@@ -212,15 +212,12 @@
"verify": "検証",
"info": {
"name": "名前",
- "address": "アドレス",
"version": "バージョン",
"protocol": "プロトコル v{version}"
},
"logs": {
"title": "ログ",
- "empty": "ログはありません。",
- "discovered": "{protocol} 経由で発見 ({host})",
- "updated": "{protocol} 経由で更新 ({host})"
+ "empty": "ログはありません。"
}
},
"verifyPage": {
diff --git a/app/assets/i18n/km.json b/app/assets/i18n/km.json
index 3022acdc..d56267b2 100644
--- a/app/assets/i18n/km.json
+++ b/app/assets/i18n/km.json
@@ -212,15 +212,12 @@
"verify": "ផ្ទៀងផ្ទាត់",
"info": {
"name": "ឈ្មោះ",
- "address": "អាសយដ្ឋាន",
"version": "កំណែ",
"protocol": "ពិធីការ v{version}"
},
"logs": {
"title": "កំណត់ហេតុ",
- "empty": "មិនមានកំណត់ហេតុទេ។",
- "discovered": "បានរកឃើញតាមរយៈ {protocol} ({host})",
- "updated": "បានធ្វើបច្ចុប្បន្នភាពតាមរយៈ {protocol} ({host})"
+ "empty": "មិនមានកំណត់ហេតុទេ។"
}
},
"verifyPage": {
diff --git a/app/assets/i18n/ko.json b/app/assets/i18n/ko.json
index 4658b52b..2518f92c 100644
--- a/app/assets/i18n/ko.json
+++ b/app/assets/i18n/ko.json
@@ -212,15 +212,12 @@
"verify": "검증",
"info": {
"name": "이름",
- "address": "주소",
"version": "버전",
"protocol": "프로토콜 v{version}"
},
"logs": {
"title": "로그",
- "empty": "사용 가능한 로그가 없습니다.",
- "discovered": "{protocol}을(를) 통해 발견됨 ({host})",
- "updated": "{protocol}을(를) 통해 업데이트됨 ({host})"
+ "empty": "사용 가능한 로그가 없습니다."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/ky.json b/app/assets/i18n/ky.json
index 9f8c2935..2d4d26a2 100644
--- a/app/assets/i18n/ky.json
+++ b/app/assets/i18n/ky.json
@@ -212,15 +212,12 @@
"verify": "Текшерүү",
"info": {
"name": "Түзмөктүн аты",
- "address": "Дарек",
"version": "Версия",
"protocol": "Протокол v{version}"
},
"logs": {
"title": "Журналдар",
- "empty": "Журналдар жок.",
- "discovered": "{protocol} аркылуу табылды ({host})",
- "updated": "{protocol} аркылуу жаңыртылды ({host})"
+ "empty": "Журналдар жок."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/lo.json b/app/assets/i18n/lo.json
index 33ea6142..74d8d245 100644
--- a/app/assets/i18n/lo.json
+++ b/app/assets/i18n/lo.json
@@ -212,15 +212,12 @@
"verify": "ກວດສອບ",
"info": {
"name": "ຊື່",
- "address": "ທີ່ຢູ່",
"version": "ເວີຊັນ",
"protocol": "ໂປຣໂຕເຄລ v{version}"
},
"logs": {
"title": "ບັນທຶກ",
- "empty": "ບໍ່ມີບັນທຶກ.",
- "discovered": "ຄົ້ນພົບຜ່ານ {protocol} ({host})",
- "updated": "ອັບເດດຜ່ານ {protocol} ({host})"
+ "empty": "ບໍ່ມີບັນທຶກ."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/ml.json b/app/assets/i18n/ml.json
index 8d56c949..2369ccf0 100644
--- a/app/assets/i18n/ml.json
+++ b/app/assets/i18n/ml.json
@@ -212,15 +212,12 @@
"verify": "പരിശോധിക്കുക",
"info": {
"name": "പേര്",
- "address": "വിലാസം",
"version": "പതിപ്പ്",
"protocol": "പ്രോട്ടോക്കോൾ v{version}"
},
"logs": {
"title": "ലോഗുകൾ",
- "empty": "ലോഗുകളൊന്നും ലഭ്യമല്ല.",
- "discovered": "{protocol} വഴി കണ്ടെത്തി ({host})",
- "updated": "{protocol} വഴി അപ്ഡേറ്റ് ചെയ്തു ({host})"
+ "empty": "ലോഗുകളൊന്നും ലഭ്യമല്ല."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/mn.json b/app/assets/i18n/mn.json
index aa299cd1..750c6efc 100644
--- a/app/assets/i18n/mn.json
+++ b/app/assets/i18n/mn.json
@@ -212,15 +212,12 @@
"verify": "Баталгаажуулах",
"info": {
"name": "Нэр",
- "address": "Хаяг",
"version": "Хувилбар",
"protocol": "Протокол v{version}"
},
"logs": {
"title": "Логууд",
- "empty": "Лог байхгүй байна.",
- "discovered": "{protocol}-оор илэрсэн ({host})",
- "updated": "{protocol}-оор шинэчлэгдсэн ({host})"
+ "empty": "Лог байхгүй байна."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/ms.json b/app/assets/i18n/ms.json
index fe7c69e8..669ace0f 100644
--- a/app/assets/i18n/ms.json
+++ b/app/assets/i18n/ms.json
@@ -212,15 +212,12 @@
"verify": "Sahkan",
"info": {
"name": "Nama",
- "address": "Alamat",
"version": "Versi",
"protocol": "Protokol v{version}"
},
"logs": {
"title": "Log",
- "empty": "Tiada log tersedia.",
- "discovered": "Ditemui melalui {protocol} ({host})",
- "updated": "Dikemas kini melalui {protocol} ({host})"
+ "empty": "Tiada log tersedia."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/ne.json b/app/assets/i18n/ne.json
index 7ff1d301..597c93f2 100644
--- a/app/assets/i18n/ne.json
+++ b/app/assets/i18n/ne.json
@@ -212,15 +212,12 @@
"verify": "प्रमाणित गर्नुहोस्",
"info": {
"name": "नाम",
- "address": "ठेगाना",
"version": "संस्करण",
"protocol": "प्रोटोकल v{version}"
},
"logs": {
"title": "लगहरू",
- "empty": "कुनै लग उपलब्ध छैन।",
- "discovered": "{protocol} मार्फत फेला पर्यो ({host})",
- "updated": "{protocol} मार्फत अपडेट भयो ({host})"
+ "empty": "कुनै लग उपलब्ध छैन।"
}
},
"verifyPage": {
diff --git a/app/assets/i18n/nl.json b/app/assets/i18n/nl.json
index a90f14cd..d367ba20 100644
--- a/app/assets/i18n/nl.json
+++ b/app/assets/i18n/nl.json
@@ -212,15 +212,12 @@
"verify": "Verifiëren",
"info": {
"name": "Naam",
- "address": "Adres",
"version": "Versie",
"protocol": "Protocol v{version}"
},
"logs": {
"title": "Logboeken",
- "empty": "Geen logboeken beschikbaar.",
- "discovered": "Ontdekt via {protocol} ({host})",
- "updated": "Bijgewerkt via {protocol} ({host})"
+ "empty": "Geen logboeken beschikbaar."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/pl.json b/app/assets/i18n/pl.json
index c0d6125a..612f6956 100644
--- a/app/assets/i18n/pl.json
+++ b/app/assets/i18n/pl.json
@@ -212,15 +212,12 @@
"verify": "Zweryfikuj",
"info": {
"name": "Nazwa",
- "address": "Adres",
"version": "Wersja",
"protocol": "Protokół v{version}"
},
"logs": {
"title": "Dzienniki",
- "empty": "Brak dostępnych dzienników.",
- "discovered": "Wykryto przez {protocol} ({host})",
- "updated": "Zaktualizowano przez {protocol} ({host})"
+ "empty": "Brak dostępnych dzienników."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/pt-BR.json b/app/assets/i18n/pt-BR.json
index d4106075..3e091a68 100644
--- a/app/assets/i18n/pt-BR.json
+++ b/app/assets/i18n/pt-BR.json
@@ -212,15 +212,12 @@
"verify": "Verificar",
"info": {
"name": "Nome",
- "address": "Endereço",
"version": "Versão",
"protocol": "Protocolo v{version}"
},
"logs": {
"title": "Registros",
- "empty": "Nenhum registro disponível.",
- "discovered": "Descoberto via {protocol} ({host})",
- "updated": "Atualizado via {protocol} ({host})"
+ "empty": "Nenhum registro disponível."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/pt-PT.json b/app/assets/i18n/pt-PT.json
index ebc0eca5..ec3d36d8 100644
--- a/app/assets/i18n/pt-PT.json
+++ b/app/assets/i18n/pt-PT.json
@@ -212,15 +212,12 @@
"verify": "Verificar",
"info": {
"name": "Nome",
- "address": "Endereço",
"version": "Versão",
"protocol": "Protocolo v{version}"
},
"logs": {
"title": "Registos",
- "empty": "Nenhum registo disponível.",
- "discovered": "Descoberto via {protocol} ({host})",
- "updated": "Atualizado via {protocol} ({host})"
+ "empty": "Nenhum registo disponível."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/ro.json b/app/assets/i18n/ro.json
index 6b67fc59..0640fd9f 100644
--- a/app/assets/i18n/ro.json
+++ b/app/assets/i18n/ro.json
@@ -212,15 +212,12 @@
"verify": "Verifică",
"info": {
"name": "Nume",
- "address": "Adresă",
"version": "Versiune",
"protocol": "Protocol v{version}"
},
"logs": {
"title": "Jurnale",
- "empty": "Nu sunt jurnale disponibile.",
- "discovered": "Descoperit prin {protocol} ({host})",
- "updated": "Actualizat prin {protocol} ({host})"
+ "empty": "Nu sunt jurnale disponibile."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/ru.json b/app/assets/i18n/ru.json
index 737ec3da..bc6b009b 100644
--- a/app/assets/i18n/ru.json
+++ b/app/assets/i18n/ru.json
@@ -212,15 +212,12 @@
"verify": "Проверить",
"info": {
"name": "Имя устройства",
- "address": "Адрес",
"version": "Версия",
"protocol": "Протокол v{version}"
},
"logs": {
"title": "Журналы",
- "empty": "Нет доступных журналов.",
- "discovered": "Обнаружено через {protocol} ({host})",
- "updated": "Обновлено через {protocol} ({host})"
+ "empty": "Нет доступных журналов."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/si.json b/app/assets/i18n/si.json
index 000e6697..89908ee1 100644
--- a/app/assets/i18n/si.json
+++ b/app/assets/i18n/si.json
@@ -212,15 +212,12 @@
"verify": "සත්‍යාපනය",
"info": {
"name": "නම",
- "address": "ලිපිනය",
"version": "අනුවාදය",
"protocol": "නියමාවලිය v{version}"
},
"logs": {
"title": "ලොග",
- "empty": "ලොග නොමැත.",
- "discovered": "{protocol} හරහා සොයාගන්නා ලදී ({host})",
- "updated": "{protocol} හරහා යාවත්කාල කරන ලදී ({host})"
+ "empty": "ලොග නොමැත."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/sk.json b/app/assets/i18n/sk.json
index 5983f076..b5c798d2 100644
--- a/app/assets/i18n/sk.json
+++ b/app/assets/i18n/sk.json
@@ -212,15 +212,12 @@
"verify": "Overiť",
"info": {
"name": "Názov",
- "address": "Adresa",
"version": "Verzia",
"protocol": "Protokol v{version}"
},
"logs": {
"title": "Záznamy",
- "empty": "Nie sú k dispozícii žiadne záznamy.",
- "discovered": "Objavené cez {protocol} ({host})",
- "updated": "Aktualizované cez {protocol} ({host})"
+ "empty": "Nie sú k dispozícii žiadne záznamy."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/sl.json b/app/assets/i18n/sl.json
index ef4caeeb..bc26fe64 100644
--- a/app/assets/i18n/sl.json
+++ b/app/assets/i18n/sl.json
@@ -212,15 +212,12 @@
"verify": "Preveri",
"info": {
"name": "Ime",
- "address": "Naslov",
"version": "Različica",
"protocol": "Protokol v{version}"
},
"logs": {
"title": "Dnevniki",
- "empty": "Ni razpoložljivih dnevnikov.",
- "discovered": "Odkrito prek {protocol} ({host})",
- "updated": "Posodobljeno prek {protocol} ({host})"
+ "empty": "Ni razpoložljivih dnevnikov."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/sr-Cyrl.json b/app/assets/i18n/sr-Cyrl.json
index 559d3c41..4c5e55fe 100644
--- a/app/assets/i18n/sr-Cyrl.json
+++ b/app/assets/i18n/sr-Cyrl.json
@@ -212,15 +212,12 @@
"verify": "Провери",
"info": {
"name": "Име",
- "address": "Адреса",
"version": "Верзија",
"protocol": "Протокол v{version}"
},
"logs": {
"title": "Евиденција",
- "empty": "Нема доступне евиденције.",
- "discovered": "Откривено путем {protocol} ({host})",
- "updated": "Ажурирано путем {protocol} ({host})"
+ "empty": "Нема доступне евиденције."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/sr.json b/app/assets/i18n/sr.json
index 5cee8d80..e4d9ffa5 100644
--- a/app/assets/i18n/sr.json
+++ b/app/assets/i18n/sr.json
@@ -212,15 +212,12 @@
"verify": "Proveri",
"info": {
"name": "Ime",
- "address": "Adresa",
"version": "Verzija",
"protocol": "Protokol v{version}"
},
"logs": {
"title": "Evidencija",
- "empty": "Nema dostupne evidencije.",
- "discovered": "Otkriveno putem {protocol} ({host})",
- "updated": "Ažurirano putem {protocol} ({host})"
+ "empty": "Nema dostupne evidencije."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/sv.json b/app/assets/i18n/sv.json
index a42e24fa..7c6dfdfa 100644
--- a/app/assets/i18n/sv.json
+++ b/app/assets/i18n/sv.json
@@ -212,15 +212,12 @@
"verify": "Verifiera",
"info": {
"name": "Namn",
- "address": "Adress",
"version": "Version",
"protocol": "Protokoll v{version}"
},
"logs": {
"title": "Loggar",
- "empty": "Inga loggar tillgängliga.",
- "discovered": "Upptäckt via {protocol} ({host})",
- "updated": "Uppdaterad via {protocol} ({host})"
+ "empty": "Inga loggar tillgängliga."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/ta.json b/app/assets/i18n/ta.json
index 78927806..7f7dd958 100644
--- a/app/assets/i18n/ta.json
+++ b/app/assets/i18n/ta.json
@@ -212,15 +212,12 @@
"verify": "சரிபார்",
"info": {
"name": "பெயர்",
- "address": "முகவரி",
"version": "பதிப்பு",
"protocol": "நெறிமுறை v{version}"
},
"logs": {
"title": "பதிவுகள்",
- "empty": "பதிவுகள் எதுவும் இல்லை.",
- "discovered": "{protocol} வழியாகக் கண்டறியப்பட்டது ({host})",
- "updated": "{protocol} வழியாக புதுப்பிக்கப்பட்டது ({host})"
+ "empty": "பதிவுகள் எதுவும் இல்லை."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/th.json b/app/assets/i18n/th.json
index a280b3df..30202b55 100644
--- a/app/assets/i18n/th.json
+++ b/app/assets/i18n/th.json
@@ -212,15 +212,12 @@
"verify": "ตรวจสอบ",
"info": {
"name": "ชื่อ",
- "address": "ที่อยู่",
"version": "เวอร์ชัน",
"protocol": "โปรโตคอล v{version}"
},
"logs": {
"title": "บันทึก",
- "empty": "ไม่มีบันทึก",
- "discovered": "ค้นพบผ่าน {protocol} ({host})",
- "updated": "อัปเดตผ่าน {protocol} ({host})"
+ "empty": "ไม่มีบันทึก"
}
},
"verifyPage": {
diff --git a/app/assets/i18n/tr.json b/app/assets/i18n/tr.json
index 5eb88dfc..35f1f9c0 100644
--- a/app/assets/i18n/tr.json
+++ b/app/assets/i18n/tr.json
@@ -212,15 +212,12 @@
"verify": "Doğrula",
"info": {
"name": "Ad",
- "address": "Adres",
"version": "Sürüm",
"protocol": "Protokol v{version}"
},
"logs": {
"title": "Günlükler",
- "empty": "Kullanılabilir günlük yok.",
- "discovered": "{protocol} üzerinden keşfedildi ({host})",
- "updated": "{protocol} üzerinden güncellendi ({host})"
+ "empty": "Kullanılabilir günlük yok."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/uk.json b/app/assets/i18n/uk.json
index ae6eef03..e8320a82 100644
--- a/app/assets/i18n/uk.json
+++ b/app/assets/i18n/uk.json
@@ -212,15 +212,12 @@
"verify": "Перевірити",
"info": {
"name": "Ім'я пристрою",
- "address": "Адреса",
"version": "Версія",
"protocol": "Протокол v{version}"
},
"logs": {
"title": "Журнали",
- "empty": "Немає доступних журналів.",
- "discovered": "Виявлено через {protocol} ({host})",
- "updated": "Оновлено через {protocol} ({host})"
+ "empty": "Немає доступних журналів."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/ur.json b/app/assets/i18n/ur.json
index dfb189f8..b487d066 100644
--- a/app/assets/i18n/ur.json
+++ b/app/assets/i18n/ur.json
@@ -212,15 +212,12 @@
"verify": "تصدیق کریں",
"info": {
"name": "نام",
- "address": "پتہ",
"version": "ورژن",
"protocol": "پروٹوکول v{version}"
},
"logs": {
"title": "لاگز",
- "empty": "کوئی لاگ دستیاب نہیں۔",
- "discovered": "{protocol} کے ذریعے دریافت ہوا ({host})",
- "updated": "{protocol} کے ذریعے اپ ڈیٹ ہوا ({host})"
+ "empty": "کوئی لاگ دستیاب نہیں۔"
}
},
"verifyPage": {
diff --git a/app/assets/i18n/uz.json b/app/assets/i18n/uz.json
index 949d199b..40c71025 100644
--- a/app/assets/i18n/uz.json
+++ b/app/assets/i18n/uz.json
@@ -212,15 +212,12 @@
"verify": "Tasdiqlash",
"info": {
"name": "Nomi",
- "address": "Manzil",
"version": "Versiya",
"protocol": "Protokol v{version}"
},
"logs": {
"title": "Jurnallar",
- "empty": "Jurnallar mavjud emas.",
- "discovered": "{protocol} orqali topildi ({host})",
- "updated": "{protocol} orqali yangilandi ({host})"
+ "empty": "Jurnallar mavjud emas."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/vi.json b/app/assets/i18n/vi.json
index 80b1a7c9..4a11f9b3 100644
--- a/app/assets/i18n/vi.json
+++ b/app/assets/i18n/vi.json
@@ -212,15 +212,12 @@
"verify": "Xác minh",
"info": {
"name": "Tên",
- "address": "Địa chỉ",
"version": "Phiên bản",
"protocol": "Giao thức v{version}"
},
"logs": {
"title": "Nhật ký",
- "empty": "Không có nhật ký nào.",
- "discovered": "Được phát hiện qua {protocol} ({host})",
- "updated": "Được cập nhật qua {protocol} ({host})"
+ "empty": "Không có nhật ký nào."
}
},
"verifyPage": {
diff --git a/app/assets/i18n/zh-CN.json b/app/assets/i18n/zh-CN.json
index 675d5f0e..507bcd5e 100644
--- a/app/assets/i18n/zh-CN.json
+++ b/app/assets/i18n/zh-CN.json
@@ -212,15 +212,12 @@
"verify": "验证",
"info": {
"name": "名称",
- "address": "地址",
"version": "版本",
"protocol": "协议 v{version}"
},
"logs": {
"title": "日志",
- "empty": "没有可用的日志。",
- "discovered": "通过 {protocol} 发现 ({host})",
- "updated": "通过 {protocol} 更新 ({host})"
+ "empty": "没有可用的日志。"
}
},
"verifyPage": {
diff --git a/app/assets/i18n/zh-HK.json b/app/assets/i18n/zh-HK.json
index ab28faa0..7a07d684 100644
--- a/app/assets/i18n/zh-HK.json
+++ b/app/assets/i18n/zh-HK.json
@@ -213,15 +213,12 @@
"verify": "驗證",
"info": {
"name": "名稱",
- "address": "地址",
"version": "版本",
"protocol": "Protocol v{version}"
},
"logs": {
"title": "記錄",
- "empty": "冇任何記錄。",
- "discovered": "透過 {protocol} ({host}) 偵測到",
- "updated": "透過 {protocol} ({host}) 更新"
+ "empty": "冇任何記錄。"
}
},
"verifyPage": {
diff --git a/app/assets/i18n/zh-TW.json b/app/assets/i18n/zh-TW.json
index 5e0c2fd0..4c36c4c1 100644
--- a/app/assets/i18n/zh-TW.json
+++ b/app/assets/i18n/zh-TW.json
@@ -212,15 +212,12 @@
"verify": "驗證",
"info": {
"name": "名稱",
- "address": "位址",
"version": "版本",
"protocol": "協定 v{version}"
},
"logs": {
"title": "記錄",
- "empty": "沒有可用的記錄。",
- "discovered": "透過 {protocol} 發現 ({host})",
- "updated": "透過 {protocol} 更新 ({host})"
+ "empty": "沒有可用的記錄。"
}
},
"verifyPage": {
diff --git a/app/lib/gen/strings.g.dart b/app/lib/gen/strings.g.dart
index ccc45601..11373769 100644
--- a/app/lib/gen/strings.g.dart
+++ b/app/lib/gen/strings.g.dart
@@ -4,7 +4,7 @@
/// To regenerate, run: `dart run slang`
///
/// Locales: 59
-/// Strings: 21533 (364 per locale)
+/// Strings: 21374 (362 per locale)
// coverage:ignore-file
// ignore_for_file: type=lint, unused_import
diff --git a/app/lib/gen/strings_ar.g.dart b/app/lib/gen/strings_ar.g.dart
index 19dfa5fd..228e1f9a 100644
--- a/app/lib/gen/strings_ar.g.dart
+++ b/app/lib/gen/strings_ar.g.dart
@@ -1137,8 +1137,6 @@ class _Translations$deviceDetailsPage$info$ar extends Translations$deviceDetails
@override
String get name => 'الاسم';
@override
- String get address => 'العنوان';
- @override
String get version => 'الإصدار';
@override
String protocol({required Object version}) => 'البروتوكول v${version}';
@@ -1155,10 +1153,6 @@ class _Translations$deviceDetailsPage$logs$ar extends Translations$deviceDetails
String get title => 'السجلات';
@override
String get empty => 'لا توجد سجلات متاحة.';
- @override
- String discovered({required Object protocol, required Object host}) => 'تم الاكتشاف عبر ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'تم التحديث عبر ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_az.g.dart b/app/lib/gen/strings_az.g.dart
index b243baa6..a8b15863 100644
--- a/app/lib/gen/strings_az.g.dart
+++ b/app/lib/gen/strings_az.g.dart
@@ -1053,8 +1053,6 @@ class _Translations$deviceDetailsPage$info$az extends Translations$deviceDetails
@override
String get name => 'Ad';
@override
- String get address => 'Ünvan';
- @override
String get version => 'Versiya';
@override
String protocol({required Object version}) => 'Protokol v${version}';
@@ -1071,10 +1069,6 @@ class _Translations$deviceDetailsPage$logs$az extends Translations$deviceDetails
String get title => 'Jurnallar';
@override
String get empty => 'Jurnal mövcud deyil.';
- @override
- String discovered({required Object protocol, required Object host}) => '${protocol} vasitəsilə aşkarlandı (${host})';
- @override
- String updated({required Object protocol, required Object host}) => '${protocol} vasitəsilə yeniləndi (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_be.g.dart b/app/lib/gen/strings_be.g.dart
index c0282186..c20565d2 100644
--- a/app/lib/gen/strings_be.g.dart
+++ b/app/lib/gen/strings_be.g.dart
@@ -1053,8 +1053,6 @@ class _Translations$deviceDetailsPage$info$be extends Translations$deviceDetails
@override
String get name => 'Назва';
@override
- String get address => 'Адрас';
- @override
String get version => 'Версія';
@override
String protocol({required Object version}) => 'Пратакол v${version}';
@@ -1071,10 +1069,6 @@ class _Translations$deviceDetailsPage$logs$be extends Translations$deviceDetails
String get title => 'Журнал';
@override
String get empty => 'Няма запісаў у журнале.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Выяўлена праз ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Абноўлена праз ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_bg.g.dart b/app/lib/gen/strings_bg.g.dart
index 1372e5bb..c950c65d 100644
--- a/app/lib/gen/strings_bg.g.dart
+++ b/app/lib/gen/strings_bg.g.dart
@@ -1054,8 +1054,6 @@ class _Translations$deviceDetailsPage$info$bg extends Translations$deviceDetails
@override
String get name => 'Име';
@override
- String get address => 'Адрес';
- @override
String get version => 'Версия';
@override
String protocol({required Object version}) => 'Протокол v${version}';
@@ -1072,10 +1070,6 @@ class _Translations$deviceDetailsPage$logs$bg extends Translations$deviceDetails
String get title => 'Дневници';
@override
String get empty => 'Няма налични дневници.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Открито чрез ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Обновено чрез ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_bn.g.dart b/app/lib/gen/strings_bn.g.dart
index baba0291..d7280c4c 100644
--- a/app/lib/gen/strings_bn.g.dart
+++ b/app/lib/gen/strings_bn.g.dart
@@ -1138,8 +1138,6 @@ class _Translations$deviceDetailsPage$info$bn extends Translations$deviceDetails
@override
String get name => 'নাম';
@override
- String get address => 'ঠিকানা';
- @override
String get version => 'সংস্করণ';
@override
String protocol({required Object version}) => 'প্রোটোকল v${version}';
@@ -1156,10 +1154,6 @@ class _Translations$deviceDetailsPage$logs$bn extends Translations$deviceDetails
String get title => 'লগ';
@override
String get empty => 'কোনো লগ নেই।';
- @override
- String discovered({required Object protocol, required Object host}) => '${protocol} এর মাধ্যমে আবিষ্কৃত (${host})';
- @override
- String updated({required Object protocol, required Object host}) => '${protocol} এর মাধ্যমে আপডেট হয়েছে (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_ca.g.dart b/app/lib/gen/strings_ca.g.dart
index 10a8b32b..849235c1 100644
--- a/app/lib/gen/strings_ca.g.dart
+++ b/app/lib/gen/strings_ca.g.dart
@@ -1139,8 +1139,6 @@ class _Translations$deviceDetailsPage$info$ca extends Translations$deviceDetails
@override
String get name => 'Nom';
@override
- String get address => 'Adreça';
- @override
String get version => 'Versió';
@override
String protocol({required Object version}) => 'Protocol v${version}';
@@ -1157,10 +1155,6 @@ class _Translations$deviceDetailsPage$logs$ca extends Translations$deviceDetails
String get title => 'Registres';
@override
String get empty => 'No hi ha registres disponibles.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Descobert mitjançant ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Actualitzat mitjançant ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_cs.g.dart b/app/lib/gen/strings_cs.g.dart
index 8fc0745a..456656f1 100644
--- a/app/lib/gen/strings_cs.g.dart
+++ b/app/lib/gen/strings_cs.g.dart
@@ -1052,8 +1052,6 @@ class _Translations$deviceDetailsPage$info$cs extends Translations$deviceDetails
@override
String get name => 'Název';
@override
- String get address => 'Adresa';
- @override
String get version => 'Verze';
@override
String protocol({required Object version}) => 'Protokol v${version}';
@@ -1070,10 +1068,6 @@ class _Translations$deviceDetailsPage$logs$cs extends Translations$deviceDetails
String get title => 'Záznamy';
@override
String get empty => 'Žádné záznamy nejsou k dispozici.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Objeveno přes ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Aktualizováno přes ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_da.g.dart b/app/lib/gen/strings_da.g.dart
index 33c650da..9cd78a88 100644
--- a/app/lib/gen/strings_da.g.dart
+++ b/app/lib/gen/strings_da.g.dart
@@ -1052,8 +1052,6 @@ class _Translations$deviceDetailsPage$info$da extends Translations$deviceDetails
@override
String get name => 'Navn';
@override
- String get address => 'Adresse';
- @override
String get version => 'Version';
@override
String protocol({required Object version}) => 'Protokol v${version}';
@@ -1070,10 +1068,6 @@ class _Translations$deviceDetailsPage$logs$da extends Translations$deviceDetails
String get title => 'Logfiler';
@override
String get empty => 'Ingen logfiler tilgængelige.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Opdaget via ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Opdateret via ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_de.g.dart b/app/lib/gen/strings_de.g.dart
index 90fd0ccd..36a97f8b 100644
--- a/app/lib/gen/strings_de.g.dart
+++ b/app/lib/gen/strings_de.g.dart
@@ -1053,8 +1053,6 @@ class _Translations$deviceDetailsPage$info$de extends Translations$deviceDetails
@override
String get name => 'Name';
@override
- String get address => 'Adresse';
- @override
String get version => 'Version';
@override
String protocol({required Object version}) => 'Protokoll v${version}';
@@ -1071,10 +1069,6 @@ class _Translations$deviceDetailsPage$logs$de extends Translations$deviceDetails
String get title => 'Logs';
@override
String get empty => 'Keine Logs vorhanden.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Entdeckt über ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Aktualisiert über ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_el.g.dart b/app/lib/gen/strings_el.g.dart
index 77d26890..b1235b53 100644
--- a/app/lib/gen/strings_el.g.dart
+++ b/app/lib/gen/strings_el.g.dart
@@ -1140,8 +1140,6 @@ class _Translations$deviceDetailsPage$info$el extends Translations$deviceDetails
@override
String get name => 'Όνομα';
@override
- String get address => 'Διεύθυνση';
- @override
String get version => 'Έκδοση';
@override
String protocol({required Object version}) => 'Πρωτόκολλο v${version}';
@@ -1158,10 +1156,6 @@ class _Translations$deviceDetailsPage$logs$el extends Translations$deviceDetails
String get title => 'Αρχεία καταγραφής';
@override
String get empty => 'Δεν υπάρχουν διαθέσιμα αρχεία καταγραφής.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Εντοπίστηκε μέσω ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Ενημερώθηκε μέσω ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_en.g.dart b/app/lib/gen/strings_en.g.dart
index 3cfde33d..364052b9 100644
--- a/app/lib/gen/strings_en.g.dart
+++ b/app/lib/gen/strings_en.g.dart
@@ -405,6 +405,7 @@ class Translations$deviceDetailsPage$en {
String get verify => 'Verify';
late final Translations$deviceDetailsPage$info$en info = Translations$deviceDetailsPage$info$en.internal(_root);
+ late final Translations$deviceDetailsPage$channels$en channels = Translations$deviceDetailsPage$channels$en.internal(_root);
late final Translations$deviceDetailsPage$logs$en logs = Translations$deviceDetailsPage$logs$en.internal(_root);
}
@@ -1326,9 +1327,6 @@ class Translations$deviceDetailsPage$info$en {
/// en: 'Name'
String get name => 'Name';
- /// en: 'Address'
- String get address => 'Address';
-
/// en: 'Version'
String get version => 'Version';
@@ -1336,6 +1334,39 @@ class Translations$deviceDetailsPage$info$en {
String protocol({required Object version}) => 'Protocol v${version}';
}
+// Path: deviceDetailsPage.channels
+class Translations$deviceDetailsPage$channels$en {
+ Translations$deviceDetailsPage$channels$en.internal(this._root);
+
+ final Translations _root; // ignore: unused_field
+
+ // Translations
+
+ /// en: 'Channels'
+ String get title => 'Channels';
+
+ /// en: 'You'
+ String get you => 'You';
+
+ /// en: 'Outgoing'
+ String get outgoing => 'Outgoing';
+
+ /// en: 'Incoming'
+ String get incoming => 'Incoming';
+
+ /// en: 'Works'
+ String get works => 'Works';
+
+ /// en: 'Not tested'
+ String get notTested => 'Not tested';
+
+ /// en: 'Failed'
+ String get failed => 'Failed';
+
+ /// en: 'Not seen'
+ String get notSeen => 'Not seen';
+}
+
// Path: deviceDetailsPage.logs
class Translations$deviceDetailsPage$logs$en {
Translations$deviceDetailsPage$logs$en.internal(this._root);
@@ -1350,11 +1381,18 @@ class Translations$deviceDetailsPage$logs$en {
/// en: 'No logs available.'
String get empty => 'No logs available.';
- /// en: 'Discovered via {protocol} ({host})'
- String discovered({required Object protocol, required Object host}) => 'Discovered via ${protocol} (${host})';
+ /// en: 'Reached via {protocol} ({host})'
+ String outbound({required Object protocol, required Object host}) => 'Reached via ${protocol} (${host})';
+
+ /// en: 'Could not reach via {protocol} ({host}): {error}'
+ String outboundFailed({required Object protocol, required Object host, required Object error}) =>
+ 'Could not reach via ${protocol} (${host}): ${error}';
+
+ /// en: 'Reached us via {protocol} ({host})'
+ String inbound({required Object protocol, required Object host}) => 'Reached us via ${protocol} (${host})';
- /// en: 'Updated via {protocol} ({host})'
- String updated({required Object protocol, required Object host}) => 'Updated via ${protocol} (${host})';
+ /// en: 'Announcement heard ({host})'
+ String multicastInbound({required Object host}) => 'Announcement heard (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_es_ES.g.dart b/app/lib/gen/strings_es_ES.g.dart
index c4cc15bc..e2510184 100644
--- a/app/lib/gen/strings_es_ES.g.dart
+++ b/app/lib/gen/strings_es_ES.g.dart
@@ -1058,8 +1058,6 @@ class _Translations$deviceDetailsPage$info$es_ES extends Translations$deviceDeta
@override
String get name => 'Nombre';
@override
- String get address => 'Dirección';
- @override
String get version => 'Versión';
@override
String protocol({required Object version}) => 'Protocolo v${version}';
@@ -1076,10 +1074,6 @@ class _Translations$deviceDetailsPage$logs$es_ES extends Translations$deviceDeta
String get title => 'Registros';
@override
String get empty => 'No hay registros disponibles.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Descubierto mediante ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Actualizado mediante ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_et.g.dart b/app/lib/gen/strings_et.g.dart
index d468b231..e2e53892 100644
--- a/app/lib/gen/strings_et.g.dart
+++ b/app/lib/gen/strings_et.g.dart
@@ -1053,8 +1053,6 @@ class _Translations$deviceDetailsPage$info$et extends Translations$deviceDetails
@override
String get name => 'Nimi';
@override
- String get address => 'Aadress';
- @override
String get version => 'Versioon';
@override
String protocol({required Object version}) => 'Protokoll v${version}';
@@ -1071,10 +1069,6 @@ class _Translations$deviceDetailsPage$logs$et extends Translations$deviceDetails
String get title => 'Logid';
@override
String get empty => 'Logisid pole saadaval.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Avastatud ${protocol} kaudu (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Uuendatud ${protocol} kaudu (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_eu.g.dart b/app/lib/gen/strings_eu.g.dart
index 605f7b59..cba7f829 100644
--- a/app/lib/gen/strings_eu.g.dart
+++ b/app/lib/gen/strings_eu.g.dart
@@ -1054,8 +1054,6 @@ class _Translations$deviceDetailsPage$info$eu extends Translations$deviceDetails
@override
String get name => 'Izena';
@override
- String get address => 'Helbidea';
- @override
String get version => 'Bertsioa';
@override
String protocol({required Object version}) => 'Protokoloa v${version}';
@@ -1072,10 +1070,6 @@ class _Translations$deviceDetailsPage$logs$eu extends Translations$deviceDetails
String get title => 'Erregistroak';
@override
String get empty => 'Ez dago erregistrorik eskuragarri.';
- @override
- String discovered({required Object protocol, required Object host}) => '${protocol} bidez aurkitua (${host})';
- @override
- String updated({required Object protocol, required Object host}) => '${protocol} bidez eguneratua (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_fa.g.dart b/app/lib/gen/strings_fa.g.dart
index 5952acc8..2c6acc54 100644
--- a/app/lib/gen/strings_fa.g.dart
+++ b/app/lib/gen/strings_fa.g.dart
@@ -1138,8 +1138,6 @@ class _Translations$deviceDetailsPage$info$fa extends Translations$deviceDetails
@override
String get name => 'نام';
@override
- String get address => 'آدرس';
- @override
String get version => 'نسخه';
@override
String protocol({required Object version}) => 'پروتکل نسخه ${version}';
@@ -1156,10 +1154,6 @@ class _Translations$deviceDetailsPage$logs$fa extends Translations$deviceDetails
String get title => 'گزارش‌ها';
@override
String get empty => 'هیچ گزارشی موجود نیست.';
- @override
- String discovered({required Object protocol, required Object host}) => 'شناسایی شده از طریق ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'به‌روزرسانی شده از طریق ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_fi.g.dart b/app/lib/gen/strings_fi.g.dart
index c9d2d800..d75d4d58 100644
--- a/app/lib/gen/strings_fi.g.dart
+++ b/app/lib/gen/strings_fi.g.dart
@@ -1146,8 +1146,6 @@ class _Translations$deviceDetailsPage$info$fi extends Translations$deviceDetails
@override
String get name => 'Nimi';
@override
- String get address => 'Osoite';
- @override
String get version => 'Versio';
@override
String protocol({required Object version}) => 'Protokolla v${version}';
@@ -1164,10 +1162,6 @@ class _Translations$deviceDetailsPage$logs$fi extends Translations$deviceDetails
String get title => 'Lokit';
@override
String get empty => 'Lokeja ei ole saatavilla.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Löydetty ${protocol}-protokollan kautta (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Päivitetty ${protocol}-protokollan kautta (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_fil_PH.g.dart b/app/lib/gen/strings_fil_PH.g.dart
index 2d0e6edb..171580d7 100644
--- a/app/lib/gen/strings_fil_PH.g.dart
+++ b/app/lib/gen/strings_fil_PH.g.dart
@@ -1148,8 +1148,6 @@ class _Translations$deviceDetailsPage$info$fil_PH extends Translations$deviceDet
@override
String get name => 'Pangalan';
@override
- String get address => 'Address';
- @override
String get version => 'Bersyon';
@override
String protocol({required Object version}) => 'Protocol v${version}';
@@ -1166,10 +1164,6 @@ class _Translations$deviceDetailsPage$logs$fil_PH extends Translations$deviceDet
String get title => 'Mga Log';
@override
String get empty => 'Walang available na mga log.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Natuklasan sa pamamagitan ng ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Na-update sa pamamagitan ng ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_fr.g.dart b/app/lib/gen/strings_fr.g.dart
index 094faed8..6c405d59 100644
--- a/app/lib/gen/strings_fr.g.dart
+++ b/app/lib/gen/strings_fr.g.dart
@@ -1054,8 +1054,6 @@ class _Translations$deviceDetailsPage$info$fr extends Translations$deviceDetails
@override
String get name => 'Nom';
@override
- String get address => 'Adresse';
- @override
String get version => 'Version';
@override
String protocol({required Object version}) => 'Protocole v${version}';
@@ -1072,10 +1070,6 @@ class _Translations$deviceDetailsPage$logs$fr extends Translations$deviceDetails
String get title => 'Journaux';
@override
String get empty => 'Aucun journal disponible.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Découvert via ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Mis à jour via ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_gl.g.dart b/app/lib/gen/strings_gl.g.dart
index afebd179..7d10907a 100644
--- a/app/lib/gen/strings_gl.g.dart
+++ b/app/lib/gen/strings_gl.g.dart
@@ -1053,8 +1053,6 @@ class _Translations$deviceDetailsPage$info$gl extends Translations$deviceDetails
@override
String get name => 'Nome';
@override
- String get address => 'Enderezo';
- @override
String get version => 'Versión';
@override
String protocol({required Object version}) => 'Protocolo v${version}';
@@ -1071,10 +1069,6 @@ class _Translations$deviceDetailsPage$logs$gl extends Translations$deviceDetails
String get title => 'Rexistros';
@override
String get empty => 'Non hai rexistros dispoñibles.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Descuberto mediante ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Actualizado mediante ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_gu.g.dart b/app/lib/gen/strings_gu.g.dart
index eae20a51..22d8fa36 100644
--- a/app/lib/gen/strings_gu.g.dart
+++ b/app/lib/gen/strings_gu.g.dart
@@ -1136,8 +1136,6 @@ class _Translations$deviceDetailsPage$info$gu extends Translations$deviceDetails
@override
String get name => 'નામ';
@override
- String get address => 'સરનામું';
- @override
String get version => 'સંસ્કરણ';
@override
String protocol({required Object version}) => 'પ્રોટોકોલ v${version}';
@@ -1154,10 +1152,6 @@ class _Translations$deviceDetailsPage$logs$gu extends Translations$deviceDetails
String get title => 'લોગ';
@override
String get empty => 'કોઈ લોગ ઉપલબ્ધ નથી.';
- @override
- String discovered({required Object protocol, required Object host}) => '${protocol} દ્વારા શોધાયું (${host})';
- @override
- String updated({required Object protocol, required Object host}) => '${protocol} દ્વારા અપડેટ થયું (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_he.g.dart b/app/lib/gen/strings_he.g.dart
index 24e29a9d..7e6a51cb 100644
--- a/app/lib/gen/strings_he.g.dart
+++ b/app/lib/gen/strings_he.g.dart
@@ -1055,8 +1055,6 @@ class _Translations$deviceDetailsPage$info$he extends Translations$deviceDetails
@override
String get name => 'שם';
@override
- String get address => 'כתובת';
- @override
String get version => 'גרסה';
@override
String protocol({required Object version}) => 'פרוטוקול גרסה ${version}';
@@ -1073,10 +1071,6 @@ class _Translations$deviceDetailsPage$logs$he extends Translations$deviceDetails
String get title => 'יומני רישום';
@override
String get empty => 'אין יומנים זמינים';
- @override
- String discovered({required Object protocol, required Object host}) => 'התגלה באמצעות ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'עודכן באמצעות ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_hi.g.dart b/app/lib/gen/strings_hi.g.dart
index a9cda32c..d8a83cf3 100644
--- a/app/lib/gen/strings_hi.g.dart
+++ b/app/lib/gen/strings_hi.g.dart
@@ -1137,8 +1137,6 @@ class _Translations$deviceDetailsPage$info$hi extends Translations$deviceDetails
@override
String get name => 'नाम';
@override
- String get address => 'पता';
- @override
String get version => 'संस्करण';
@override
String protocol({required Object version}) => 'प्रोटोकॉल v${version}';
@@ -1155,10 +1153,6 @@ class _Translations$deviceDetailsPage$logs$hi extends Translations$deviceDetails
String get title => 'लॉग';
@override
String get empty => 'कोई लॉग उपलब्ध नहीं।';
- @override
- String discovered({required Object protocol, required Object host}) => '${protocol} के ज़रिए खोजा गया (${host})';
- @override
- String updated({required Object protocol, required Object host}) => '${protocol} के ज़रिए अपडेट किया गया (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_hu.g.dart b/app/lib/gen/strings_hu.g.dart
index 288ec72c..04c8fe66 100644
--- a/app/lib/gen/strings_hu.g.dart
+++ b/app/lib/gen/strings_hu.g.dart
@@ -1053,8 +1053,6 @@ class _Translations$deviceDetailsPage$info$hu extends Translations$deviceDetails
@override
String get name => 'Név';
@override
- String get address => 'Cím';
- @override
String get version => 'Verzió';
@override
String protocol({required Object version}) => 'Protokoll v${version}';
@@ -1071,10 +1069,6 @@ class _Translations$deviceDetailsPage$logs$hu extends Translations$deviceDetails
String get title => 'Naplók';
@override
String get empty => 'Nincs elérhető napló.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Felfedezve ${protocol} útján (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Frissítve ${protocol} útján (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_hy.g.dart b/app/lib/gen/strings_hy.g.dart
index b2fe7b76..a8f3e977 100644
--- a/app/lib/gen/strings_hy.g.dart
+++ b/app/lib/gen/strings_hy.g.dart
@@ -1136,8 +1136,6 @@ class _Translations$deviceDetailsPage$info$hy extends Translations$deviceDetails
@override
String get name => 'Անուն';
@override
- String get address => 'Հասցե';
- @override
String get version => 'Վերսիա';
@override
String protocol({required Object version}) => 'v${version} պրոտոկոլ';
@@ -1154,10 +1152,6 @@ class _Translations$deviceDetailsPage$logs$hy extends Translations$deviceDetails
String get title => 'Լոգեր';
@override
String get empty => 'Լոգեր չկան։';
- @override
- String discovered({required Object protocol, required Object host}) => 'Գտնվել է ${protocol} (${host}) միջոցով';
- @override
- String updated({required Object protocol, required Object host}) => 'Թարմացվել է ${protocol} (${host}) միջոցով';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_id.g.dart b/app/lib/gen/strings_id.g.dart
index b0d31dd6..c56d4e5e 100644
--- a/app/lib/gen/strings_id.g.dart
+++ b/app/lib/gen/strings_id.g.dart
@@ -1053,8 +1053,6 @@ class _Translations$deviceDetailsPage$info$id extends Translations$deviceDetails
@override
String get name => 'Nama';
@override
- String get address => 'Alamat';
- @override
String get version => 'Versi';
@override
String protocol({required Object version}) => 'Protokol v${version}';
@@ -1071,10 +1069,6 @@ class _Translations$deviceDetailsPage$logs$id extends Translations$deviceDetails
String get title => 'Log';
@override
String get empty => 'Tidak ada log yang tersedia.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Ditemukan melalui ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Diperbarui melalui ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_it.g.dart b/app/lib/gen/strings_it.g.dart
index 623869f6..ea15cfc7 100644
--- a/app/lib/gen/strings_it.g.dart
+++ b/app/lib/gen/strings_it.g.dart
@@ -1053,8 +1053,6 @@ class _Translations$deviceDetailsPage$info$it extends Translations$deviceDetails
@override
String get name => 'Nome';
@override
- String get address => 'Indirizzo';
- @override
String get version => 'Versione';
@override
String protocol({required Object version}) => 'Protocollo v${version}';
@@ -1071,10 +1069,6 @@ class _Translations$deviceDetailsPage$logs$it extends Translations$deviceDetails
String get title => 'Log';
@override
String get empty => 'Nessun log disponibile.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Rilevato tramite ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Aggiornato tramite ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_ja.g.dart b/app/lib/gen/strings_ja.g.dart
index 220649a8..a757e395 100644
--- a/app/lib/gen/strings_ja.g.dart
+++ b/app/lib/gen/strings_ja.g.dart
@@ -1047,8 +1047,6 @@ class _Translations$deviceDetailsPage$info$ja extends Translations$deviceDetails
@override
String get name => '名前';
@override
- String get address => 'アドレス';
- @override
String get version => 'バージョン';
@override
String protocol({required Object version}) => 'プロトコル v${version}';
@@ -1065,10 +1063,6 @@ class _Translations$deviceDetailsPage$logs$ja extends Translations$deviceDetails
String get title => 'ログ';
@override
String get empty => 'ログはありません。';
- @override
- String discovered({required Object protocol, required Object host}) => '${protocol} 経由で発見 (${host})';
- @override
- String updated({required Object protocol, required Object host}) => '${protocol} 経由で更新 (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_km.g.dart b/app/lib/gen/strings_km.g.dart
index fac4252f..ca15d0d1 100644
--- a/app/lib/gen/strings_km.g.dart
+++ b/app/lib/gen/strings_km.g.dart
@@ -1138,8 +1138,6 @@ class _Translations$deviceDetailsPage$info$km extends Translations$deviceDetails
@override
String get name => 'ឈ្មោះ';
@override
- String get address => 'អាសយដ្ឋាន';
- @override
String get version => 'កំណែ';
@override
String protocol({required Object version}) => 'ពិធីការ v${version}';
@@ -1156,10 +1154,6 @@ class _Translations$deviceDetailsPage$logs$km extends Translations$deviceDetails
String get title => 'កំណត់ហេតុ';
@override
String get empty => 'មិនមានកំណត់ហេតុទេ។';
- @override
- String discovered({required Object protocol, required Object host}) => 'បានរកឃើញតាមរយៈ ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'បានធ្វើបច្ចុប្បន្នភាពតាមរយៈ ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_ko.g.dart b/app/lib/gen/strings_ko.g.dart
index cb67a37a..ca1abe69 100644
--- a/app/lib/gen/strings_ko.g.dart
+++ b/app/lib/gen/strings_ko.g.dart
@@ -1047,8 +1047,6 @@ class _Translations$deviceDetailsPage$info$ko extends Translations$deviceDetails
@override
String get name => '이름';
@override
- String get address => '주소';
- @override
String get version => '버전';
@override
String protocol({required Object version}) => '프로토콜 v${version}';
@@ -1065,10 +1063,6 @@ class _Translations$deviceDetailsPage$logs$ko extends Translations$deviceDetails
String get title => '로그';
@override
String get empty => '사용 가능한 로그가 없습니다.';
- @override
- String discovered({required Object protocol, required Object host}) => '${protocol}을(를) 통해 발견됨 (${host})';
- @override
- String updated({required Object protocol, required Object host}) => '${protocol}을(를) 통해 업데이트됨 (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_ky.g.dart b/app/lib/gen/strings_ky.g.dart
index 1296df55..5ddef8b0 100644
--- a/app/lib/gen/strings_ky.g.dart
+++ b/app/lib/gen/strings_ky.g.dart
@@ -1138,8 +1138,6 @@ class _Translations$deviceDetailsPage$info$ky extends Translations$deviceDetails
@override
String get name => 'Түзмөктүн аты';
@override
- String get address => 'Дарек';
- @override
String get version => 'Версия';
@override
String protocol({required Object version}) => 'Протокол v${version}';
@@ -1156,10 +1154,6 @@ class _Translations$deviceDetailsPage$logs$ky extends Translations$deviceDetails
String get title => 'Журналдар';
@override
String get empty => 'Журналдар жок.';
- @override
- String discovered({required Object protocol, required Object host}) => '${protocol} аркылуу табылды (${host})';
- @override
- String updated({required Object protocol, required Object host}) => '${protocol} аркылуу жаңыртылды (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_lo.g.dart b/app/lib/gen/strings_lo.g.dart
index 7020858e..0e57e389 100644
--- a/app/lib/gen/strings_lo.g.dart
+++ b/app/lib/gen/strings_lo.g.dart
@@ -1133,8 +1133,6 @@ class _Translations$deviceDetailsPage$info$lo extends Translations$deviceDetails
@override
String get name => 'ຊື່';
@override
- String get address => 'ທີ່ຢູ່';
- @override
String get version => 'ເວີຊັນ';
@override
String protocol({required Object version}) => 'ໂປຣໂຕເຄລ v${version}';
@@ -1151,10 +1149,6 @@ class _Translations$deviceDetailsPage$logs$lo extends Translations$deviceDetails
String get title => 'ບັນທຶກ';
@override
String get empty => 'ບໍ່ມີບັນທຶກ.';
- @override
- String discovered({required Object protocol, required Object host}) => 'ຄົ້ນພົບຜ່ານ ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'ອັບເດດຜ່ານ ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_ml.g.dart b/app/lib/gen/strings_ml.g.dart
index f9a5efef..b7efaf64 100644
--- a/app/lib/gen/strings_ml.g.dart
+++ b/app/lib/gen/strings_ml.g.dart
@@ -1052,8 +1052,6 @@ class _Translations$deviceDetailsPage$info$ml extends Translations$deviceDetails
@override
String get name => 'പേര്';
@override
- String get address => 'വിലാസം';
- @override
String get version => 'പതിപ്പ്';
@override
String protocol({required Object version}) => 'പ്രോട്ടോക്കോൾ v${version}';
@@ -1070,10 +1068,6 @@ class _Translations$deviceDetailsPage$logs$ml extends Translations$deviceDetails
String get title => 'ലോഗുകൾ';
@override
String get empty => 'ലോഗുകളൊന്നും ലഭ്യമല്ല.';
- @override
- String discovered({required Object protocol, required Object host}) => '${protocol} വഴി കണ്ടെത്തി (${host})';
- @override
- String updated({required Object protocol, required Object host}) => '${protocol} വഴി അപ്ഡേറ്റ് ചെയ്തു (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_mn.g.dart b/app/lib/gen/strings_mn.g.dart
index 14ec0049..e1fc9dc1 100644
--- a/app/lib/gen/strings_mn.g.dart
+++ b/app/lib/gen/strings_mn.g.dart
@@ -1053,8 +1053,6 @@ class _Translations$deviceDetailsPage$info$mn extends Translations$deviceDetails
@override
String get name => 'Нэр';
@override
- String get address => 'Хаяг';
- @override
String get version => 'Хувилбар';
@override
String protocol({required Object version}) => 'Протокол v${version}';
@@ -1071,10 +1069,6 @@ class _Translations$deviceDetailsPage$logs$mn extends Translations$deviceDetails
String get title => 'Логууд';
@override
String get empty => 'Лог байхгүй байна.';
- @override
- String discovered({required Object protocol, required Object host}) => '${protocol}-оор илэрсэн (${host})';
- @override
- String updated({required Object protocol, required Object host}) => '${protocol}-оор шинэчлэгдсэн (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_ms.g.dart b/app/lib/gen/strings_ms.g.dart
index b3f27aad..dbef00cb 100644
--- a/app/lib/gen/strings_ms.g.dart
+++ b/app/lib/gen/strings_ms.g.dart
@@ -1135,8 +1135,6 @@ class _Translations$deviceDetailsPage$info$ms extends Translations$deviceDetails
@override
String get name => 'Nama';
@override
- String get address => 'Alamat';
- @override
String get version => 'Versi';
@override
String protocol({required Object version}) => 'Protokol v${version}';
@@ -1153,10 +1151,6 @@ class _Translations$deviceDetailsPage$logs$ms extends Translations$deviceDetails
String get title => 'Log';
@override
String get empty => 'Tiada log tersedia.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Ditemui melalui ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Dikemas kini melalui ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_ne.g.dart b/app/lib/gen/strings_ne.g.dart
index 9245a0c5..cff2babc 100644
--- a/app/lib/gen/strings_ne.g.dart
+++ b/app/lib/gen/strings_ne.g.dart
@@ -1138,8 +1138,6 @@ class _Translations$deviceDetailsPage$info$ne extends Translations$deviceDetails
@override
String get name => 'नाम';
@override
- String get address => 'ठेगाना';
- @override
String get version => 'संस्करण';
@override
String protocol({required Object version}) => 'प्रोटोकल v${version}';
@@ -1156,10 +1154,6 @@ class _Translations$deviceDetailsPage$logs$ne extends Translations$deviceDetails
String get title => 'लगहरू';
@override
String get empty => 'कुनै लग उपलब्ध छैन।';
- @override
- String discovered({required Object protocol, required Object host}) => '${protocol} मार्फत फेला पर्यो (${host})';
- @override
- String updated({required Object protocol, required Object host}) => '${protocol} मार्फत अपडेट भयो (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_nl.g.dart b/app/lib/gen/strings_nl.g.dart
index fde8ee3b..1114020d 100644
--- a/app/lib/gen/strings_nl.g.dart
+++ b/app/lib/gen/strings_nl.g.dart
@@ -1054,8 +1054,6 @@ class _Translations$deviceDetailsPage$info$nl extends Translations$deviceDetails
@override
String get name => 'Naam';
@override
- String get address => 'Adres';
- @override
String get version => 'Versie';
@override
String protocol({required Object version}) => 'Protocol v${version}';
@@ -1072,10 +1070,6 @@ class _Translations$deviceDetailsPage$logs$nl extends Translations$deviceDetails
String get title => 'Logboeken';
@override
String get empty => 'Geen logboeken beschikbaar.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Ontdekt via ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Bijgewerkt via ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_pl.g.dart b/app/lib/gen/strings_pl.g.dart
index 76949cbc..7537f9ff 100644
--- a/app/lib/gen/strings_pl.g.dart
+++ b/app/lib/gen/strings_pl.g.dart
@@ -1053,8 +1053,6 @@ class _Translations$deviceDetailsPage$info$pl extends Translations$deviceDetails
@override
String get name => 'Nazwa';
@override
- String get address => 'Adres';
- @override
String get version => 'Wersja';
@override
String protocol({required Object version}) => 'Protokół v${version}';
@@ -1071,10 +1069,6 @@ class _Translations$deviceDetailsPage$logs$pl extends Translations$deviceDetails
String get title => 'Dzienniki';
@override
String get empty => 'Brak dostępnych dzienników.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Wykryto przez ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Zaktualizowano przez ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_pt_BR.g.dart b/app/lib/gen/strings_pt_BR.g.dart
index f9c5315a..4440b9a8 100644
--- a/app/lib/gen/strings_pt_BR.g.dart
+++ b/app/lib/gen/strings_pt_BR.g.dart
@@ -1137,8 +1137,6 @@ class Translations$deviceDetailsPage$info$pt_BR extends Translations$deviceDetai
@override
String get name => 'Nome';
@override
- String get address => 'Endereço';
- @override
String get version => 'Versão';
@override
String protocol({required Object version}) => 'Protocolo v${version}';
@@ -1155,10 +1153,6 @@ class Translations$deviceDetailsPage$logs$pt_BR extends Translations$deviceDetai
String get title => 'Registros';
@override
String get empty => 'Nenhum registro disponível.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Descoberto via ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Atualizado via ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_pt_PT.g.dart b/app/lib/gen/strings_pt_PT.g.dart
index 224c1b26..f2b3684c 100644
--- a/app/lib/gen/strings_pt_PT.g.dart
+++ b/app/lib/gen/strings_pt_PT.g.dart
@@ -1149,8 +1149,6 @@ class Translations$deviceDetailsPage$info$pt_PT extends Translations$deviceDetai
@override
String get name => 'Nome';
@override
- String get address => 'Endereço';
- @override
String get version => 'Versão';
@override
String protocol({required Object version}) => 'Protocolo v${version}';
@@ -1167,10 +1165,6 @@ class Translations$deviceDetailsPage$logs$pt_PT extends Translations$deviceDetai
String get title => 'Registos';
@override
String get empty => 'Nenhum registo disponível.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Descoberto via ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Atualizado via ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_ro.g.dart b/app/lib/gen/strings_ro.g.dart
index d0ba31c7..dc9dbb3c 100644
--- a/app/lib/gen/strings_ro.g.dart
+++ b/app/lib/gen/strings_ro.g.dart
@@ -1136,8 +1136,6 @@ class _Translations$deviceDetailsPage$info$ro extends Translations$deviceDetails
@override
String get name => 'Nume';
@override
- String get address => 'Adresă';
- @override
String get version => 'Versiune';
@override
String protocol({required Object version}) => 'Protocol v${version}';
@@ -1154,10 +1152,6 @@ class _Translations$deviceDetailsPage$logs$ro extends Translations$deviceDetails
String get title => 'Jurnale';
@override
String get empty => 'Nu sunt jurnale disponibile.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Descoperit prin ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Actualizat prin ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_ru.g.dart b/app/lib/gen/strings_ru.g.dart
index 5ace8baa..771af149 100644
--- a/app/lib/gen/strings_ru.g.dart
+++ b/app/lib/gen/strings_ru.g.dart
@@ -1054,8 +1054,6 @@ class _Translations$deviceDetailsPage$info$ru extends Translations$deviceDetails
@override
String get name => 'Имя устройства';
@override
- String get address => 'Адрес';
- @override
String get version => 'Версия';
@override
String protocol({required Object version}) => 'Протокол v${version}';
@@ -1072,10 +1070,6 @@ class _Translations$deviceDetailsPage$logs$ru extends Translations$deviceDetails
String get title => 'Журналы';
@override
String get empty => 'Нет доступных журналов.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Обнаружено через ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Обновлено через ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_si.g.dart b/app/lib/gen/strings_si.g.dart
index fdba79ea..de841e9e 100644
--- a/app/lib/gen/strings_si.g.dart
+++ b/app/lib/gen/strings_si.g.dart
@@ -1054,8 +1054,6 @@ class _Translations$deviceDetailsPage$info$si extends Translations$deviceDetails
@override
String get name => 'නම';
@override
- String get address => 'ලිපිනය';
- @override
String get version => 'අනුවාදය';
@override
String protocol({required Object version}) => 'නියමාවලිය v${version}';
@@ -1072,10 +1070,6 @@ class _Translations$deviceDetailsPage$logs$si extends Translations$deviceDetails
String get title => 'ලොග';
@override
String get empty => 'ලොග නොමැත.';
- @override
- String discovered({required Object protocol, required Object host}) => '${protocol} හරහා සොයාගන්නා ලදී (${host})';
- @override
- String updated({required Object protocol, required Object host}) => '${protocol} හරහා යාවත්කාල කරන ලදී (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_sk.g.dart b/app/lib/gen/strings_sk.g.dart
index 9da221ba..8e3a5bff 100644
--- a/app/lib/gen/strings_sk.g.dart
+++ b/app/lib/gen/strings_sk.g.dart
@@ -1137,8 +1137,6 @@ class _Translations$deviceDetailsPage$info$sk extends Translations$deviceDetails
@override
String get name => 'Názov';
@override
- String get address => 'Adresa';
- @override
String get version => 'Verzia';
@override
String protocol({required Object version}) => 'Protokol v${version}';
@@ -1155,10 +1153,6 @@ class _Translations$deviceDetailsPage$logs$sk extends Translations$deviceDetails
String get title => 'Záznamy';
@override
String get empty => 'Nie sú k dispozícii žiadne záznamy.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Objavené cez ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Aktualizované cez ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_sl.g.dart b/app/lib/gen/strings_sl.g.dart
index e1c37fb9..cf5d0232 100644
--- a/app/lib/gen/strings_sl.g.dart
+++ b/app/lib/gen/strings_sl.g.dart
@@ -1136,8 +1136,6 @@ class _Translations$deviceDetailsPage$info$sl extends Translations$deviceDetails
@override
String get name => 'Ime';
@override
- String get address => 'Naslov';
- @override
String get version => 'Različica';
@override
String protocol({required Object version}) => 'Protokol v${version}';
@@ -1154,10 +1152,6 @@ class _Translations$deviceDetailsPage$logs$sl extends Translations$deviceDetails
String get title => 'Dnevniki';
@override
String get empty => 'Ni razpoložljivih dnevnikov.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Odkrito prek ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Posodobljeno prek ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_sr.g.dart b/app/lib/gen/strings_sr.g.dart
index 11433103..5536ee1b 100644
--- a/app/lib/gen/strings_sr.g.dart
+++ b/app/lib/gen/strings_sr.g.dart
@@ -1143,8 +1143,6 @@ class Translations$deviceDetailsPage$info$sr extends Translations$deviceDetailsP
@override
String get name => 'Ime';
@override
- String get address => 'Adresa';
- @override
String get version => 'Verzija';
@override
String protocol({required Object version}) => 'Protokol v${version}';
@@ -1161,10 +1159,6 @@ class Translations$deviceDetailsPage$logs$sr extends Translations$deviceDetailsP
String get title => 'Evidencija';
@override
String get empty => 'Nema dostupne evidencije.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Otkriveno putem ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Ažurirano putem ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_sr_Cyrl.g.dart b/app/lib/gen/strings_sr_Cyrl.g.dart
index f784a469..b77b2f2a 100644
--- a/app/lib/gen/strings_sr_Cyrl.g.dart
+++ b/app/lib/gen/strings_sr_Cyrl.g.dart
@@ -1145,8 +1145,6 @@ class _Translations$deviceDetailsPage$info$sr_Cyrl extends Translations$deviceDe
@override
String get name => 'Име';
@override
- String get address => 'Адреса';
- @override
String get version => 'Верзија';
@override
String protocol({required Object version}) => 'Протокол v${version}';
@@ -1163,10 +1161,6 @@ class _Translations$deviceDetailsPage$logs$sr_Cyrl extends Translations$deviceDe
String get title => 'Евиденција';
@override
String get empty => 'Нема доступне евиденције.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Откривено путем ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Ажурирано путем ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_sv.g.dart b/app/lib/gen/strings_sv.g.dart
index 0eaf834e..cfdf915a 100644
--- a/app/lib/gen/strings_sv.g.dart
+++ b/app/lib/gen/strings_sv.g.dart
@@ -1136,8 +1136,6 @@ class _Translations$deviceDetailsPage$info$sv extends Translations$deviceDetails
@override
String get name => 'Namn';
@override
- String get address => 'Adress';
- @override
String get version => 'Version';
@override
String protocol({required Object version}) => 'Protokoll v${version}';
@@ -1154,10 +1152,6 @@ class _Translations$deviceDetailsPage$logs$sv extends Translations$deviceDetails
String get title => 'Loggar';
@override
String get empty => 'Inga loggar tillgängliga.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Upptäckt via ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Uppdaterad via ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_ta.g.dart b/app/lib/gen/strings_ta.g.dart
index babeb6d7..958d4466 100644
--- a/app/lib/gen/strings_ta.g.dart
+++ b/app/lib/gen/strings_ta.g.dart
@@ -1138,8 +1138,6 @@ class _Translations$deviceDetailsPage$info$ta extends Translations$deviceDetails
@override
String get name => 'பெயர்';
@override
- String get address => 'முகவரி';
- @override
String get version => 'பதிப்பு';
@override
String protocol({required Object version}) => 'நெறிமுறை v${version}';
@@ -1156,10 +1154,6 @@ class _Translations$deviceDetailsPage$logs$ta extends Translations$deviceDetails
String get title => 'பதிவுகள்';
@override
String get empty => 'பதிவுகள் எதுவும் இல்லை.';
- @override
- String discovered({required Object protocol, required Object host}) => '${protocol} வழியாகக் கண்டறியப்பட்டது (${host})';
- @override
- String updated({required Object protocol, required Object host}) => '${protocol} வழியாக புதுப்பிக்கப்பட்டது (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_th.g.dart b/app/lib/gen/strings_th.g.dart
index 50f3bce1..848945df 100644
--- a/app/lib/gen/strings_th.g.dart
+++ b/app/lib/gen/strings_th.g.dart
@@ -1139,8 +1139,6 @@ class _Translations$deviceDetailsPage$info$th extends Translations$deviceDetails
@override
String get name => 'ชื่อ';
@override
- String get address => 'ที่อยู่';
- @override
String get version => 'เวอร์ชัน';
@override
String protocol({required Object version}) => 'โปรโตคอล v${version}';
@@ -1157,10 +1155,6 @@ class _Translations$deviceDetailsPage$logs$th extends Translations$deviceDetails
String get title => 'บันทึก';
@override
String get empty => 'ไม่มีบันทึก';
- @override
- String discovered({required Object protocol, required Object host}) => 'ค้นพบผ่าน ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'อัปเดตผ่าน ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_tr.g.dart b/app/lib/gen/strings_tr.g.dart
index c99a54f4..ce62c2d5 100644
--- a/app/lib/gen/strings_tr.g.dart
+++ b/app/lib/gen/strings_tr.g.dart
@@ -1053,8 +1053,6 @@ class _Translations$deviceDetailsPage$info$tr extends Translations$deviceDetails
@override
String get name => 'Ad';
@override
- String get address => 'Adres';
- @override
String get version => 'Sürüm';
@override
String protocol({required Object version}) => 'Protokol v${version}';
@@ -1071,10 +1069,6 @@ class _Translations$deviceDetailsPage$logs$tr extends Translations$deviceDetails
String get title => 'Günlükler';
@override
String get empty => 'Kullanılabilir günlük yok.';
- @override
- String discovered({required Object protocol, required Object host}) => '${protocol} üzerinden keşfedildi (${host})';
- @override
- String updated({required Object protocol, required Object host}) => '${protocol} üzerinden güncellendi (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_uk.g.dart b/app/lib/gen/strings_uk.g.dart
index 0474ce29..a2d251a9 100644
--- a/app/lib/gen/strings_uk.g.dart
+++ b/app/lib/gen/strings_uk.g.dart
@@ -1053,8 +1053,6 @@ class _Translations$deviceDetailsPage$info$uk extends Translations$deviceDetails
@override
String get name => 'Ім\'я пристрою';
@override
- String get address => 'Адреса';
- @override
String get version => 'Версія';
@override
String protocol({required Object version}) => 'Протокол v${version}';
@@ -1071,10 +1069,6 @@ class _Translations$deviceDetailsPage$logs$uk extends Translations$deviceDetails
String get title => 'Журнали';
@override
String get empty => 'Немає доступних журналів.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Виявлено через ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Оновлено через ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_ur.g.dart b/app/lib/gen/strings_ur.g.dart
index 9267afab..86225435 100644
--- a/app/lib/gen/strings_ur.g.dart
+++ b/app/lib/gen/strings_ur.g.dart
@@ -1053,8 +1053,6 @@ class _Translations$deviceDetailsPage$info$ur extends Translations$deviceDetails
@override
String get name => 'نام';
@override
- String get address => 'پتہ';
- @override
String get version => 'ورژن';
@override
String protocol({required Object version}) => 'پروٹوکول v${version}';
@@ -1071,10 +1069,6 @@ class _Translations$deviceDetailsPage$logs$ur extends Translations$deviceDetails
String get title => 'لاگز';
@override
String get empty => 'کوئی لاگ دستیاب نہیں۔';
- @override
- String discovered({required Object protocol, required Object host}) => '${protocol} کے ذریعے دریافت ہوا (${host})';
- @override
- String updated({required Object protocol, required Object host}) => '${protocol} کے ذریعے اپ ڈیٹ ہوا (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_uz.g.dart b/app/lib/gen/strings_uz.g.dart
index c717ac64..5baaeae9 100644
--- a/app/lib/gen/strings_uz.g.dart
+++ b/app/lib/gen/strings_uz.g.dart
@@ -1053,8 +1053,6 @@ class _Translations$deviceDetailsPage$info$uz extends Translations$deviceDetails
@override
String get name => 'Nomi';
@override
- String get address => 'Manzil';
- @override
String get version => 'Versiya';
@override
String protocol({required Object version}) => 'Protokol v${version}';
@@ -1071,10 +1069,6 @@ class _Translations$deviceDetailsPage$logs$uz extends Translations$deviceDetails
String get title => 'Jurnallar';
@override
String get empty => 'Jurnallar mavjud emas.';
- @override
- String discovered({required Object protocol, required Object host}) => '${protocol} orqali topildi (${host})';
- @override
- String updated({required Object protocol, required Object host}) => '${protocol} orqali yangilandi (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_vi.g.dart b/app/lib/gen/strings_vi.g.dart
index e3b9d720..f87adf20 100644
--- a/app/lib/gen/strings_vi.g.dart
+++ b/app/lib/gen/strings_vi.g.dart
@@ -1053,8 +1053,6 @@ class _Translations$deviceDetailsPage$info$vi extends Translations$deviceDetails
@override
String get name => 'Tên';
@override
- String get address => 'Địa chỉ';
- @override
String get version => 'Phiên bản';
@override
String protocol({required Object version}) => 'Giao thức v${version}';
@@ -1071,10 +1069,6 @@ class _Translations$deviceDetailsPage$logs$vi extends Translations$deviceDetails
String get title => 'Nhật ký';
@override
String get empty => 'Không có nhật ký nào.';
- @override
- String discovered({required Object protocol, required Object host}) => 'Được phát hiện qua ${protocol} (${host})';
- @override
- String updated({required Object protocol, required Object host}) => 'Được cập nhật qua ${protocol} (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_zh_CN.g.dart b/app/lib/gen/strings_zh_CN.g.dart
index 2b33725b..8d350974 100644
--- a/app/lib/gen/strings_zh_CN.g.dart
+++ b/app/lib/gen/strings_zh_CN.g.dart
@@ -1135,8 +1135,6 @@ class Translations$deviceDetailsPage$info$zh_CN extends Translations$deviceDetai
@override
String get name => '名称';
@override
- String get address => '地址';
- @override
String get version => '版本';
@override
String protocol({required Object version}) => '协议 v${version}';
@@ -1153,10 +1151,6 @@ class Translations$deviceDetailsPage$logs$zh_CN extends Translations$deviceDetai
String get title => '日志';
@override
String get empty => '没有可用的日志。';
- @override
- String discovered({required Object protocol, required Object host}) => '通过 ${protocol} 发现 (${host})';
- @override
- String updated({required Object protocol, required Object host}) => '通过 ${protocol} 更新 (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_zh_HK.g.dart b/app/lib/gen/strings_zh_HK.g.dart
index 789d9761..b0cb3adb 100644
--- a/app/lib/gen/strings_zh_HK.g.dart
+++ b/app/lib/gen/strings_zh_HK.g.dart
@@ -1053,8 +1053,6 @@ class Translations$deviceDetailsPage$info$zh_HK extends Translations$deviceDetai
@override
String get name => '名稱';
@override
- String get address => '地址';
- @override
String get version => '版本';
@override
String protocol({required Object version}) => 'Protocol v${version}';
@@ -1071,10 +1069,6 @@ class Translations$deviceDetailsPage$logs$zh_HK extends Translations$deviceDetai
String get title => '記錄';
@override
String get empty => '冇任何記錄。';
- @override
- String discovered({required Object protocol, required Object host}) => '透過 ${protocol} (${host}) 偵測到';
- @override
- String updated({required Object protocol, required Object host}) => '透過 ${protocol} (${host}) 更新';
}
// Path: progressPage.total
diff --git a/app/lib/gen/strings_zh_TW.g.dart b/app/lib/gen/strings_zh_TW.g.dart
index fe7a18cf..684c6174 100644
--- a/app/lib/gen/strings_zh_TW.g.dart
+++ b/app/lib/gen/strings_zh_TW.g.dart
@@ -1052,8 +1052,6 @@ class Translations$deviceDetailsPage$info$zh_TW extends Translations$deviceDetai
@override
String get name => '名稱';
@override
- String get address => '位址';
- @override
String get version => '版本';
@override
String protocol({required Object version}) => '協定 v${version}';
@@ -1070,10 +1068,6 @@ class Translations$deviceDetailsPage$logs$zh_TW extends Translations$deviceDetai
String get title => '記錄';
@override
String get empty => '沒有可用的記錄。';
- @override
- String discovered({required Object protocol, required Object host}) => '透過 ${protocol} 發現 (${host})';
- @override
- String updated({required Object protocol, required Object host}) => '透過 ${protocol} 更新 (${host})';
}
// Path: progressPage.total
diff --git a/app/lib/pages/device_details_page.dart b/app/lib/pages/device_details_page.dart
index 17b9772a..b7bd7bb8 100644
--- a/app/lib/pages/device_details_page.dart
+++ b/app/lib/pages/device_details_page.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:localsend_app/config/theme.dart';
import 'package:localsend_app/gen/strings.g.dart';
import 'package:localsend_app/model/persistence/favorite_device.dart';
import 'package:localsend_app/pages/verify_page.dart';
@@ -8,6 +9,7 @@ import 'package:localsend_app/util/favorites.dart';
import 'package:localsend_app/util/system_date_time_formatter.dart';
import 'package:localsend_app/util/ui/snackbar.dart';
import 'package:localsend_app/widget/big_button.dart';
+import 'package:localsend_app/widget/dialogs/custom_bottom_sheet.dart';
import 'package:localsend_app/widget/dialogs/favorite_delete_dialog.dart';
import 'package:localsend_app/widget/dialogs/favorite_edit_dialog.dart';
import 'package:localsend_app/widget/responsive_list_view.dart';
@@ -16,8 +18,8 @@ import 'package:localsend_isolates/model/device.dart';
import 'package:refena_flutter/refena_flutter.dart';
import 'package:routerino/routerino.dart';
-/// Shows the general information of a discovered device and
-/// the log of its retained discovery confirmations.
+/// Shows the general information of a discovered device, what is known about
+/// each direction of its channels, and the log of its retained observations.
class DeviceDetailsPage extends StatefulWidget {
final Device device;
@@ -65,6 +67,7 @@ class _DeviceDetailsPageState extends State<DeviceDetailsPage> with Refena {
Widget build(BuildContext context) {
final device = widget.device;
final favoriteEntry = ref.watch(favoritesProvider).findDevice(device);
+ final httpChannels = device.channels.whereType<HttpChannel>().toList();
return Scaffold(
appBar: AppBar(
title: Text(t.deviceDetailsPage.title),
@@ -106,7 +109,6 @@ class _DeviceDetailsPageState extends State<DeviceDetailsPage> with Refena {
for (final entry in {
t.deviceDetailsPage.info.name: device.alias,
t.deviceDetailsPage.info.version: t.deviceDetailsPage.info.protocol(version: device.version),
- if (device.ip != null) t.deviceDetailsPage.info.address: '${device.ip}:${device.port}',
}.entries)
TableRow(
children: [
@@ -122,6 +124,12 @@ class _DeviceDetailsPageState extends State<DeviceDetailsPage> with Refena {
),
],
),
+ if (httpChannels.isNotEmpty) ...[
+ const SizedBox(height: 20),
+ Text(t.deviceDetailsPage.channels.title, style: Theme.of(context).textTheme.titleMedium),
+ const SizedBox(height: 10),
+ _HttpChannels(alias: device.alias, channels: httpChannels),
+ ],
const SizedBox(height: 20),
Row(
children: [
@@ -175,12 +183,300 @@ class _DeviceDetailsPageState extends State<DeviceDetailsPage> with Refena {
}
}
+/// The HTTP channels of the device, condensed into one arrow per direction
+/// between this device and the peer.
+class _HttpChannels extends StatelessWidget {
+ final String alias;
+ final List<HttpChannel> channels;
+
+ const _HttpChannels({required this.alias, required this.channels});
+
+ @override
+ Widget build(BuildContext context) {
+ final outgoing = _outgoingState(channels);
+ final incoming = channels.any((c) => c.inbound != null) ? _ArrowState.works : _ArrowState.unknown;
+ // The row starts with this device, so in RTL the outgoing arrow points left.
+ final outgoingRightwards = Directionality.of(context) == TextDirection.ltr;
+ return Card(
+ margin: EdgeInsets.zero,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(10),
+ ),
+ color: Theme.of(context).colorScheme.secondaryContainerIfDark,
+ child: Padding(
+ padding: const EdgeInsets.all(15),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(TransmissionMethod.http.label, style: Theme.of(context).textTheme.titleSmall),
+ const SizedBox(height: 10),
+ Row(
+ children: [
+ Text(t.deviceDetailsPage.channels.you),
+ const SizedBox(width: 4),
+ InkWell(
+ key: const ValueKey('device_details.http_channels'),
+ borderRadius: BorderRadius.circular(8),
+ onTap: () async => await context.pushBottomSheet(() => _HttpChannelsSheet(channels: channels)),
+ child: Padding(
+ padding: const EdgeInsets.all(8),
+ // Stacked and shifted apart like a "swap" icon: each head reaches
+ // past the tail of the other arrow.
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Padding(
+ padding: const EdgeInsetsDirectional.only(start: _swapShift),
+ child: _DirectionArrow(
+ state: outgoing,
+ rightwards: outgoingRightwards,
+ tooltip:
+ '${t.deviceDetailsPage.channels.outgoing}: ${switch (outgoing) {
+ _ArrowState.works => t.deviceDetailsPage.channels.works,
+ _ArrowState.unknown => t.deviceDetailsPage.channels.notTested,
+ _ArrowState.failed => t.deviceDetailsPage.channels.failed,
+ }}',
+ ),
+ ),
+ const SizedBox(height: 2),
+ _DirectionArrow(
+ state: incoming,
+ rightwards: !outgoingRightwards,
+ tooltip:
+ '${t.deviceDetailsPage.channels.incoming}: ${incoming == _ArrowState.works ? t.deviceDetailsPage.channels.works : t.deviceDetailsPage.channels.notSeen}',
+ ),
+ ],
+ ),
+ ),
+ ),
+ const SizedBox(width: 4),
+ Flexible(
+ child: Text(alias, overflow: TextOverflow.ellipsis),
+ ),
+ ],
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
+
+/// Every HTTP channel of the device with the status of each direction.
+class _HttpChannelsSheet extends StatelessWidget {
+ final List<HttpChannel> channels;
+
+ const _HttpChannelsSheet({required this.channels});
+
+ @override
+ Widget build(BuildContext context) {
+ return CustomBottomSheet(
+ title: TransmissionMethod.http.label,
+ description: null,
+ child: ConstrainedBox(
+ constraints: BoxConstraints(maxHeight: MediaQuery.sizeOf(context).height * 0.4),
+ child: SingleChildScrollView(
+ padding: const EdgeInsets.only(top: 20),
+ child: SizedBox(
+ width: double.infinity,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ for (final channel in channels) _ChannelInfo(channel),
+ ],
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}
+
+/// One address of the device with the status of each direction as text.
+class _ChannelInfo extends StatelessWidget {
+ final HttpChannel channel;
+
+ const _ChannelInfo(this.channel);
+
+ @override
+ Widget build(BuildContext context) {
+ return Padding(
+ padding: const EdgeInsets.only(bottom: 10),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ SelectableText('${channel.host}:${channel.port}'),
+ const SizedBox(height: 5),
+ Table(
+ columnWidths: const {
+ 0: IntrinsicColumnWidth(),
+ 1: FlexColumnWidth(),
+ },
+ children: [
+ for (final entry in {
+ t.deviceDetailsPage.channels.outgoing: channel.outgoingStatus,
+ t.deviceDetailsPage.channels.incoming: channel.incomingStatus,
+ }.entries)
+ TableRow(
+ children: [
+ Padding(
+ padding: const EdgeInsets.only(right: 15, bottom: 5),
+ child: Text(entry.key, style: const TextStyle(color: Colors.grey)),
+ ),
+ Padding(
+ padding: const EdgeInsets.only(bottom: 5),
+ child: Text(entry.value),
+ ),
+ ],
+ ),
+ ],
+ ),
+ ],
+ ),
+ );
+ }
+}
+
+/// How far the two arrows of the swap icon are shifted apart.
+const _swapShift = 10.0;
+
+/// This device → the peer: works as soon as one channel works, and only
+/// counts as failed when no channel works and at least one failed.
+_ArrowState _outgoingState(List<HttpChannel> channels) {
+ if (channels.any((c) => c.outbound == ChannelOutbound.reachable)) {
+ return _ArrowState.works;
+ }
+ if (channels.any((c) => c.outbound == ChannelOutbound.failed)) {
+ return _ArrowState.failed;
+ }
+ return _ArrowState.unknown;
+}
+
+enum _ArrowState {
+ /// At least one channel works in this direction.
+ works,
+
+ /// Nothing is known about this direction.
+ unknown,
+
+ /// Every tested channel failed in this direction.
+ failed,
+}
+
+class _DirectionArrow extends StatelessWidget {
+ final _ArrowState state;
+ final bool rightwards;
+ final String tooltip;
+
+ const _DirectionArrow({required this.state, required this.rightwards, required this.tooltip});
+
+ @override
+ Widget build(BuildContext context) {
+ final colorScheme = Theme.of(context).colorScheme;
+ return Tooltip(
+ message: tooltip,
+ child: Semantics(
+ label: tooltip,
+ child: CustomPaint(
+ size: const Size(30, 12),
+ painter: _ArrowPainter(
+ state: state,
+ rightwards: rightwards,
+ color: switch (state) {
+ _ArrowState.works => colorScheme.primary,
+ _ArrowState.unknown => colorScheme.outline,
+ _ArrowState.failed => colorScheme.error,
+ },
+ ),
+ ),
+ ),
+ );
+ }
+}
+
+/// A horizontal arrow with a triangular head: bold with a filled head when
+/// the direction works, thin with a hollow head when it is unknown, and
+/// thin, dashed with a hollow head when it failed.
+class _ArrowPainter extends CustomPainter {
+ final _ArrowState state;
+ final bool rightwards;
+ final Color color;
+
+ const _ArrowPainter({required this.state, required this.rightwards, required this.color});
+
+ @override
+ void paint(Canvas canvas, Size size) {
+ if (!rightwards) {
+ canvas.translate(size.width, 0);
+ canvas.scale(-1, 1);
+ }
+
+ final bold = state == _ArrowState.works;
+ final strokeWidth = bold ? 2.5 : 1.5;
+ final y = size.height / 2;
+ final headLength = size.height * 0.6;
+ final headHalfHeight = size.height / 2 - (bold ? 0 : strokeWidth / 2);
+ final headStart = size.width - headLength;
+ final paint = Paint()
+ ..color = color
+ ..strokeWidth = strokeWidth
+ ..style = PaintingStyle.stroke
+ ..strokeJoin = StrokeJoin.round;
+
+ if (state == _ArrowState.failed) {
+ const dash = 3.0;
+ const gap = 2.0;
+ for (var x = 0.0; x < headStart; x += dash + gap) {
+ canvas.drawLine(Offset(x, y), Offset((x + dash).clamp(0.0, headStart), y), paint);
+ }
+ } else {
+ canvas.drawLine(Offset(0, y), Offset(headStart, y), paint);
+ }
+
+ final head = Path()
+ ..moveTo(headStart, y - headHalfHeight)
+ ..lineTo(size.width - (bold ? 0 : strokeWidth / 2), y)
+ ..lineTo(headStart, y + headHalfHeight)
+ ..close();
+ canvas.drawPath(head, bold ? (Paint()..color = color) : paint);
+ }
+
+ @override
+ bool shouldRepaint(_ArrowPainter oldDelegate) {
+ return state != oldDelegate.state || rightwards != oldDelegate.rightwards || color != oldDelegate.color;
+ }
+}
+
+extension on HttpChannel {
+ String get protocolLabel => https ? 'HTTPS' : 'HTTP';
+
+ /// This device → the peer.
+ String get outgoingStatus {
+ return switch (outbound) {
+ ChannelOutbound.reachable => t.deviceDetailsPage.channels.works,
+ ChannelOutbound.untested => t.deviceDetailsPage.channels.notTested,
+ ChannelOutbound.failed => t.deviceDetailsPage.channels.failed,
+ };
+ }
+
+ /// The peer → this device.
+ String get incomingStatus {
+ return inbound != null ? t.deviceDetailsPage.channels.works : t.deviceDetailsPage.channels.notSeen;
+ }
+}
+
extension on DeviceLog {
String get description {
- final protocol = channel.https ? 'HTTPS' : 'HTTP';
- return switch (kind) {
- DeviceLogKind.discovered => t.deviceDetailsPage.logs.discovered(protocol: protocol, host: channel.host),
- DeviceLogKind.updated => t.deviceDetailsPage.logs.updated(protocol: protocol, host: channel.host),
+ return switch (event) {
+ DeviceLogOutbound(:final channel) => t.deviceDetailsPage.logs.outbound(protocol: channel.protocolLabel, host: channel.host),
+ DeviceLogOutboundFailed(:final channel, :final error) => t.deviceDetailsPage.logs.outboundFailed(
+ protocol: channel.protocolLabel,
+ host: channel.host,
+ error: error,
+ ),
+ DeviceLogInbound(:final channel) => t.deviceDetailsPage.logs.inbound(protocol: channel.protocolLabel, host: channel.host),
+ DeviceLogMulticastInbound(:final host) => t.deviceDetailsPage.logs.multicastInbound(host: host),
};
}
}
diff --git a/app/lib/provider/network/nearby_devices_provider.dart b/app/lib/provider/network/nearby_devices_provider.dart
index 21410822..3b0b2fc7 100644
--- a/app/lib/provider/network/nearby_devices_provider.dart
+++ b/app/lib/provider/network/nearby_devices_provider.dart
@@ -7,6 +7,7 @@ import 'package:localsend_app/provider/favorites_provider.dart';
import 'package:localsend_app/provider/logging/discovery_logs_provider.dart';
import 'package:localsend_isolates/isolate.dart';
import 'package:localsend_isolates/model/device.dart';
+import 'package:localsend_isolates/model/discovery_event.dart';
import 'package:refena_flutter/refena_flutter.dart';
/// This provider is responsible for:
@@ -46,15 +47,25 @@ class NearbyDevicesService extends ReduxNotifier<NearbyDevicesState> {
/// Starts the discovery (which binds the UDP port) and registers every
/// confirmed device: answered announcements, scan results and devices fed in
-/// via [IsolateDiscoveryAddDeviceAction] all arrive on this one stream.
+/// via [IsolateDiscoveryObserveInboundAction] all arrive on this one stream.
+///
+/// A device that was only heard announcing itself and did not answer is not
+/// registered: nothing about it is verified, so it only shows up in the
+/// discovery logs.
+///
/// This should run forever as long as the app is running.
class StartDiscoveryListener extends AsyncReduxAction<NearbyDevicesService, NearbyDevicesState> {
@override
Future<NearbyDevicesState> reduce() async {
final stream = external(notifier._isolateController).dispatchTakeResult(IsolateDiscoveryListenAction());
- await for (final device in stream) {
- await dispatchAsync(RegisterDeviceAction(device));
- notifier._discoveryLogger.addLog('[DISCOVER] ${device.alias} (${device.ip}, model: ${device.deviceModel})');
+ await for (final event in stream) {
+ switch (event) {
+ case DiscoveryDeviceEvent(:final device):
+ await dispatchAsync(RegisterDeviceAction(device));
+ notifier._discoveryLogger.addLog('[DISCOVER] ${device.alias} (${device.ip}, model: ${device.deviceModel})');
+ case DiscoveryUnreachableEvent(:final device, :final error):
+ notifier._discoveryLogger.addLog('[UNREACHABLE] ${device.alias} (${device.ip}:${device.port}): $error');
+ }
}
return state;
}
diff --git a/app/lib/provider/network/send_provider.dart b/app/lib/provider/network/send_provider.dart
index d4adf330..bfb30e6c 100644
--- a/app/lib/provider/network/send_provider.dart
+++ b/app/lib/provider/network/send_provider.dart
@@ -251,6 +251,7 @@ class SendNotifier extends Notifier<Map<String, SendSessionState>> {
rust_http.PrepareUploadResult? response;
bool invalidPin;
bool pinFirstAttempt = true;
+
String? pin;
final prepareUploadCancelToken = rust_cancel.createCancellationToken();
_prepareUploadCancelTokens[sessionId] = prepareUploadCancelToken;
@@ -269,7 +270,12 @@ class SendNotifier extends Notifier<Map<String, SendSessionState>> {
pin: pin,
cancelToken: prepareUploadCancelToken,
);
+ // Every answered request is reported: a failure observed in the
+ // meantime (e.g. while the PIN dialog was open) must be overwritten.
+ _reportOutbound(target);
} on rust_http.RsHttpClientError_StatusCode catch (e) {
+ // Declined, busy, wrong PIN, ...: the peer answered, so it was reached.
+ _reportOutbound(target);
switch (e.status) {
case 401:
invalidPin = true;
@@ -332,6 +338,14 @@ class SendNotifier extends Notifier<Map<String, SendSessionState>> {
return;
}
} catch (e) {
+ if (e is rust_http.RsHttpClientError_Unreachable) {
+ // Only a request without any response says that the address
+ // cannot be dialed; a canceled request does not.
+ _reportOutbound(target, error: e.field0);
+ } else if (e is rust_http.RsHttpClientError_Reqwest) {
+ // The peer answered, its response just could not be read.
+ _reportOutbound(target);
+ }
state = state.updateSession(
sessionId: sessionId,
state: (s) => s?.copyWith(
@@ -453,6 +467,32 @@ class SendNotifier extends Notifier<Map<String, SendSessionState>> {
await _sendLoop(sessionId, sendingFiles);
}
+ /// Tells the discovery whether [target] could be reached at the address it
+ /// was dialed at: without an [error] the address is marked as working in
+ /// the outgoing direction, with one — the reason — as failed.
+ /// Does nothing for a device without an address (WebRTC only).
+ void _reportOutbound(Device target, {String? error}) {
+ final ip = target.ip;
+ if (ip == null) {
+ return;
+ }
+
+ try {
+ ref
+ .redux(parentIsolateProvider)
+ .dispatch(
+ IsolateDiscoveryReportOutboundAction(
+ fingerprint: target.fingerprint,
+ channel: HttpChannel(host: ip, port: target.port, https: target.https),
+ error: error,
+ ),
+ );
+ } catch (e) {
+ // Only diagnostics: must never fail the transfer.
+ _logger.warning('Could not report the dialed address to the discovery', e);
+ }
+ }
+
/// Reports the total session progress to the foreground service notification,
/// so that it stays up to date while the app is minimized.
void _updateForegroundServiceProgress(String sessionId) {
diff --git a/app/lib/provider/network/server/controller/receive_controller.dart b/app/lib/provider/network/server/controller/receive_controller.dart
index 7417bb9c..701eb751 100644
--- a/app/lib/provider/network/server/controller/receive_controller.dart
+++ b/app/lib/provider/network/server/controller/receive_controller.dart
@@ -60,7 +60,7 @@ class ReceiveController {
// Feed the device into the discovery store; it comes back (and is
// registered) via the [StartDiscoveryListener] stream.
- server.ref.redux(parentIsolateProvider).dispatch(IsolateDiscoveryAddDeviceAction(device: event.info.toDevice(event.ip, withChannel: true)));
+ server.ref.redux(parentIsolateProvider).dispatch(IsolateDiscoveryObserveInboundAction(device: event.info.toDevice(event.ip, withChannel: true)));
server.ref.notifier(discoveryLoggerProvider).addLog('[DISCOVER/TCP] Received "/register" HTTP request: ${event.info.alias} (${event.ip})');
}
diff --git a/app/test/unit/model/device_test.dart b/app/test/unit/model/device_test.dart
index 99df2d09..33997076 100644
--- a/app/test/unit/model/device_test.dart
+++ b/app/test/unit/model/device_test.dart
@@ -2,6 +2,13 @@ import 'package:localsend_isolates/model/device.dart';
import 'package:test/test.dart';
void main() {
+ test('HttpChannel should default to an untested channel the device was never seen on', () {
+ const channel = HttpChannel(host: 'a', port: 1, https: true);
+
+ expect(channel.outbound, ChannelOutbound.untested);
+ expect(channel.inbound, isNull);
+ });
+
test('Should not have duplicate DeviceChannel', () {
final set = <DeviceChannel>{};
diff --git a/app/test/unit/provider/nearby_devices_provider_test.dart b/app/test/unit/provider/nearby_devices_provider_test.dart
new file mode 100644
index 00000000..88085391
--- /dev/null
+++ b/app/test/unit/provider/nearby_devices_provider_test.dart
@@ -0,0 +1,96 @@
+import 'package:localsend_app/provider/logging/discovery_logs_provider.dart';
+import 'package:localsend_app/provider/network/nearby_devices_provider.dart';
+import 'package:localsend_app/provider/persistence_provider.dart';
+import 'package:localsend_isolates/isolate.dart';
+import 'package:localsend_isolates/model/device.dart';
+import 'package:localsend_isolates/model/discovery_event.dart';
+import 'package:mockito/mockito.dart';
+import 'package:refena_flutter/refena_flutter.dart';
+import 'package:test/test.dart';
+
+import '../../mocks.mocks.dart';
+
+class _SyncState extends Fake implements SyncState {}
+
+void main() {
+ /// A container whose discovery emits the given [events] and then ends.
+ RefenaContainer createContainer(List<DiscoveryEvent> events) {
+ return RefenaContainer(
+ overrides: [
+ persistenceProvider.overrideWithValue(MockPersistenceService()),
+ parentIsolateProvider.overrideWithReducer(
+ notifier: (_) => IsolateController(initialState: ParentIsolateState.initial(_SyncState())),
+ reducer: {
+ IsolateDiscoveryListenAction: (state) => (state, Stream<DiscoveryEvent>.fromIterable(events)),
+ },
+ ),
+ ],
+ );
+ }
+
+ test('Should register a confirmed device', () async {
+ final device = _createDevice(fingerprint: '111', alias: 'Nice Banana');
+ final ref = createContainer([DiscoveryDeviceEvent(device: device)]);
+
+ await ref.redux(nearbyDevicesProvider).dispatchAsync(StartDiscoveryListener());
+
+ expect(ref.read(nearbyDevicesProvider).devices, {'111': device});
+ expect(ref.read(discoveryLoggerProvider).map((e) => e.log), ['[DISCOVER] Nice Banana (192.168.1.2, model: Pixel)']);
+ });
+
+ test('Should replace a device by its updated state', () async {
+ final untested = _createDevice(fingerprint: '111', outbound: ChannelOutbound.untested);
+ final failed = _createDevice(fingerprint: '111', outbound: ChannelOutbound.failed);
+ final ref = createContainer([DiscoveryDeviceEvent(device: untested), DiscoveryDeviceEvent(device: failed)]);
+
+ await ref.redux(nearbyDevicesProvider).dispatchAsync(StartDiscoveryListener());
+
+ expect(ref.read(nearbyDevicesProvider).devices, {'111': failed});
+ });
+
+ test('Should only log an unreachable device', () async {
+ final device = _createDevice(fingerprint: '222', alias: 'Shy Apple');
+ final ref = createContainer([DiscoveryUnreachableEvent(device: device, error: 'connection refused')]);
+
+ await ref.redux(nearbyDevicesProvider).dispatchAsync(StartDiscoveryListener());
+
+ expect(ref.read(nearbyDevicesProvider).devices, isEmpty);
+ expect(ref.read(nearbyDevicesProvider).allDevices, isEmpty);
+ expect(ref.read(discoveryLoggerProvider).map((e) => e.log), ['[UNREACHABLE] Shy Apple (192.168.1.2:53317): connection refused']);
+ });
+
+ test('Should keep a confirmed device when it is reported unreachable afterwards', () async {
+ final device = _createDevice(fingerprint: '111');
+ final ref = createContainer([
+ DiscoveryDeviceEvent(device: device),
+ DiscoveryUnreachableEvent(
+ device: _createDevice(fingerprint: '111', alias: 'Impostor'),
+ error: 'timed out',
+ ),
+ ]);
+
+ await ref.redux(nearbyDevicesProvider).dispatchAsync(StartDiscoveryListener());
+
+ expect(ref.read(nearbyDevicesProvider).devices, {'111': device});
+ });
+}
+
+Device _createDevice({
+ required String fingerprint,
+ String alias = 'Nice Banana',
+ ChannelOutbound outbound = ChannelOutbound.reachable,
+}) {
+ return Device(
+ signalingId: null,
+ ip: '192.168.1.2',
+ version: '2.1',
+ port: 53317,
+ https: true,
+ fingerprint: fingerprint,
+ alias: alias,
+ deviceModel: 'Pixel',
+ deviceType: DeviceType.mobile,
+ download: false,
+ channels: [HttpChannel(host: '192.168.1.2', port: 53317, https: true, outbound: outbound)],
+ );
+}
diff --git a/cli/src/app/devices.rs b/cli/src/app/devices.rs
index 3ca9e9f0..ebe7f6ff 100644
--- a/cli/src/app/devices.rs
+++ b/cli/src/app/devices.rs
@@ -2,7 +2,7 @@
//! and unpair actions.
use super::{App, Overlay};
-use crate::device_list::{DeviceList, DeviceListOutcome, DeviceRow, Row};
+use crate::device_list::{DeviceHost, DeviceList, DeviceListOutcome, DeviceRow, Row};
use crate::picker::PickerTarget;
use crate::sanitize;
use crate::storage::PairedChannel;
@@ -162,12 +162,85 @@ impl App {
}
}
-/// The addresses a stored device can be dialed at, best first.
-fn channel_hosts(stored: &StatefulDevice) -> Vec<String> {
+/// The addresses a stored device can be dialed at, best first, each with
+/// the state of its channel.
+fn channel_hosts(stored: &StatefulDevice) -> Vec<DeviceHost> {
stored
.get_ranked_channels()
.into_iter()
- .filter_map(|channel| channel.http())
- .map(|http| http.host.clone())
+ .filter_map(|channel| {
+ Some(DeviceHost {
+ host: channel.http()?.host.clone(),
+ state: *stored.channels.get(channel)?,
+ })
+ })
.collect()
}
+
+#[cfg(test)]
+mod tests {
+ use super::channel_hosts;
+ use localsend::discovery::{
+ ChannelState, DeviceChannel, DiscoveredDevice, HttpChannel, Outbound, StatefulDevice,
+ };
+ use localsend::model::discovery::ProtocolType;
+ use std::time::SystemTime;
+
+ fn channel(host: &str) -> DeviceChannel {
+ DeviceChannel::Http(HttpChannel {
+ host: host.to_string(),
+ port: 53317,
+ protocol: ProtocolType::Https,
+ })
+ }
+
+ #[test]
+ fn lists_each_host_with_the_state_of_its_channel_best_first() {
+ let now = SystemTime::now();
+ let failed = ChannelState {
+ outbound: Outbound::Failed(now),
+ inbound: None,
+ };
+ let untested = ChannelState {
+ outbound: Outbound::Untested,
+ inbound: Some(now),
+ };
+ let reachable = ChannelState {
+ outbound: Outbound::Reachable(now),
+ inbound: None,
+ };
+ let stored = StatefulDevice {
+ device: DiscoveredDevice {
+ alias: "Cute Tomato".to_string(),
+ version: "2.2".to_string(),
+ device_model: None,
+ device_type: None,
+ fingerprint: "tomato".to_string(),
+ channel: channel("192.168.0.10"),
+ download: false,
+ },
+ confirmed: true,
+ channels: [
+ (channel("10.0.0.10"), failed),
+ (channel("fe80::1%3"), untested),
+ (channel("192.168.0.10"), reachable),
+ ]
+ .into(),
+ logs: Vec::new(),
+ };
+
+ let hosts: Vec<(String, ChannelState)> = channel_hosts(&stored)
+ .into_iter()
+ .map(|host| (host.host, host.state))
+ .collect();
+
+ assert_eq!(
+ hosts,
+ [
+ ("192.168.0.10".to_string(), reachable),
+ ("fe80::1%3".to_string(), untested),
+ ("10.0.0.10".to_string(), failed),
+ ]
+ );
+ }
+}
diff --git a/cli/src/app/discovery.rs b/cli/src/app/discovery.rs
index 390e7b7e..5cb87c3e 100644
--- a/cli/src/app/discovery.rs
+++ b/cli/src/app/discovery.rs
@@ -1,6 +1,7 @@
//! Device discovery: the core discovery answers multicast announcements with
//! an HTTP register request and stores confirmed devices; the CLI assigns a
-//! hotkey slot to every device entering the store.
+//! hotkey slot to every device entering the store, and tells the user about
+//! the devices that announce themselves but do not answer.
use super::App;
use super::web_link::WebMode;
@@ -12,12 +13,21 @@ use localsend::discovery::{
DeviceChannel, DiscoveredDevice, DiscoveryEvent, DiscoveryHandle, HttpChannel,
};
use localsend::http::dto_v2::RegisterDtoV2;
+use std::collections::HashSet;
use std::sync::Arc;
+/// The longest failure reason shown in an unreachable notice, in characters.
+/// The reason is the error chain of a request to an unauthenticated peer.
+const MAX_REASON_CHARS: usize = 300;
+
impl App {
pub(super) fn handle_discovery(&mut self, event: DiscoveryEvent) {
let device = match &event {
DiscoveryEvent::Discovered { device } | DiscoveryEvent::Updated { device } => device,
+ DiscoveryEvent::Unreachable { device, error } => {
+ log_unreachable(&mut self.ui, &mut self.unreachable, device, error);
+ return;
+ }
DiscoveryEvent::MulticastFailed => {
self.ui.log(
Category::Discovery,
@@ -26,6 +36,7 @@ impl App {
return;
}
};
+ // Also after a failed request: it changed the ranking of the channels.
refresh_paired_channels(
&mut self.ui,
&mut self.storage.paired,
@@ -68,6 +79,73 @@ impl App {
}
}
+/// The unconfirmed devices the user was told about.
+///
+/// An announcing peer sends a burst of datagrams and re-announces for the
+/// whole run, and every announcement that is not answered arrives as an
+/// `Unreachable` event: the notice is logged once per device and address.
+pub(super) struct UnreachableNotices {
+ /// Fingerprint and host of every notice that was logged.
+ logged: HashSet<(String, String)>,
+}
+
+impl UnreachableNotices {
+ pub(super) fn new() -> Self {
+ Self {
+ logged: HashSet::new(),
+ }
+ }
+
+ /// The line telling the user that `device` — as carried by an
+ /// `Unreachable` event, with its `error` — is around but cannot be
+ /// dialed. `None` when that was said before for the address.
+ fn notice(&mut self, device: &DiscoveredDevice, error: &str) -> Option<String> {
+ let host = device
+ .http()
+ .map(|http| http.host.as_str())
+ .unwrap_or("unknown address");
+ if !self
+ .logged
+ .insert((device.fingerprint.clone(), host.to_string()))
+ {
+ return None;
+ }
+
+ // Everything but the host is unverified: it is what the announcement
+ // claimed, and what the peer answered.
+ Some(format!(
+ "{} ({host}): Announced itself, but could not be reached: {}",
+ sanitize::single_line(&device.alias),
+ shorten_reason(error),
+ ))
+ }
+}
+
+/// Sanitizes a failure reason for a log line and cuts it to
+/// [`MAX_REASON_CHARS`], marking the cut with an ellipsis.
+fn shorten_reason(reason: &str) -> String {
+ let reason = sanitize::single_line(reason);
+ match reason.char_indices().nth(MAX_REASON_CHARS) {
+ Some((end, _)) => format!("{}…", &reason[..end]),
+ None => reason,
+ }
+}
+
+/// Logs a device that was heard announcing itself but did not answer the
+/// register request (typically because a firewall blocks its server), once
+/// per address. Such a device stays out of the device store's confirmed
+/// devices, so it is neither listed nor selectable.
+pub(super) fn log_unreachable(
+ ui: &mut Ui,
+ notices: &mut UnreachableNotices,
+ device: &DiscoveredDevice,
+ error: &str,
+) {
+ if let Some(line) = notices.notice(device, error) {
+ ui.log(Category::Discovery, &line);
+ }
+}
+
/// Keeps a paired device's stored alias and channels in sync with the
/// discovery store, so the next run probes the addresses that worked last.
pub(super) fn refresh_paired_channels(
@@ -122,6 +200,96 @@ pub(super) fn device_confirmed(
};
let discovery = discovery.clone();
tokio::spawn(async move {
- discovery.add_device(device).await;
+ discovery.observe_inbound(device).await;
});
}
+
+#[cfg(test)]
+mod tests {
+ use super::{MAX_REASON_CHARS, UnreachableNotices};
+ use localsend::discovery::{DeviceChannel, DiscoveredDevice, HttpChannel};
+ use localsend::model::discovery::ProtocolType;
+
+ /// The device as an `Unreachable` event carries it.
+ fn device(alias: &str, fingerprint: &str, host: &str) -> DiscoveredDevice {
+ DiscoveredDevice {
+ alias: alias.to_string(),
+ version: "2.2".to_string(),
+ device_model: None,
+ device_type: None,
+ fingerprint: fingerprint.to_string(),
+ channel: DeviceChannel::Http(HttpChannel {
+ host: host.to_string(),
+ port: 53317,
+ protocol: ProtocolType::Https,
+ }),
+ download: false,
+ }
+ }
+
+ #[test]
+ fn tells_about_an_unconfirmed_device_with_the_reason() {
+ let device = device("Cute Tomato", "tomato", "192.168.0.10");
+
+ let line = UnreachableNotices::new().notice(&device, "connection refused");
+
+ assert_eq!(
+ line.as_deref(),
+ Some(
+ "Cute Tomato (192.168.0.10): Announced itself, but could not be reached: \
+ connection refused"
+ )
+ );
+ }
+
+ #[test]
+ fn tells_once_per_device_and_address() {
+ let tomato = device("Cute Tomato", "tomato", "192.168.0.10");
+ let tomato_v6 = device("Cute Tomato", "tomato", "fe80::1%3");
+ let cherry = device("Wise Cherry", "cherry", "192.168.0.10");
+ let mut notices = UnreachableNotices::new();
+
+ assert!(notices.notice(&tomato, "timed out").is_some());
+ assert!(
+ notices.notice(&tomato, "timed out").is_none(),
+ "the datagrams of a burst must not repeat the line"
+ );
+ assert!(
+ notices.notice(&tomato_v6, "timed out").is_some(),
+ "another address of the device must be told"
+ );
+ assert!(
+ notices.notice(&cherry, "timed out").is_some(),
+ "another device at the same address must be told"
+ );
+ assert!(notices.notice(&tomato_v6, "timed out").is_none());
+ assert!(notices.notice(&cherry, "timed out").is_none());
+ }
+
+ #[test]
+ fn sanitizes_what_the_peer_controls() {
+ let device = device("Cute\u{1b}[31m\nTomato", "tomato", "192.168.0.10");
+
+ let line = UnreachableNotices::new()
+ .notice(&device, "500;\u{1b}[2Jgone\r\n")
+ .unwrap();
+
+ assert_eq!(
+ line,
+ "Cute[31m Tomato (192.168.0.10): Announced itself, but could not be reached: \
+ 500;[2Jgone "
+ );
+ }
+
+ #[test]
+ fn cuts_an_overlong_reason() {
+ let device = device("Cute Tomato", "tomato", "192.168.0.10");
+ let reason = "ä".repeat(MAX_REASON_CHARS + 50);
+
+ let line = UnreachableNotices::new().notice(&device, &reason).unwrap();
+
+ let shown = line.rsplit(": ").next().unwrap();
+ assert_eq!(shown.chars().count(), MAX_REASON_CHARS + 1);
+ assert!(shown.ends_with('…'));
+ }
+}
diff --git a/cli/src/app/headless.rs b/cli/src/app/headless.rs
index 065e7a62..aa997466 100644
--- a/cli/src/app/headless.rs
+++ b/cli/src/app/headless.rs
@@ -55,6 +55,7 @@ pub(super) async fn run(
tick.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip);
let mut send: Option<SendState> = None;
+ let mut unreachable = discovery::UnreachableNotices::new();
let result = loop {
let event = tokio::select! {
Some(event) = events_rx.recv() => event,
@@ -67,7 +68,7 @@ pub(super) async fn run(
handle_server_event(&mut ui, &storage, &discovery, &mut send, event)
}
AppEvent::Discovery(event) => {
- handle_discovery(&mut ui, &mut storage, &discovery, event)
+ handle_discovery(&mut ui, &mut storage, &discovery, &mut unreachable, event)
}
AppEvent::Tick => render_progress(&mut ui, &mut send),
AppEvent::Log { category, text } => ui.log(category, &text),
@@ -77,6 +78,22 @@ pub(super) async fn run(
Err(reason) => break Err(anyhow::anyhow!(reason)),
}
}
+ AppEvent::SendDialed {
+ fingerprint,
+ channel,
+ result,
+ } => {
+ // Comes back as a discovery event, like every observation.
+ discovery.report_outbound(&fingerprint, channel, result);
+ // Saved right away: `SendEnded` may end the loop before that
+ // discovery event is handled.
+ discovery::refresh_paired_channels(
+ &mut ui,
+ &mut storage.paired,
+ &discovery,
+ &fingerprint,
+ );
+ }
AppEvent::SendSessionStarted {
session_id,
accepted_bytes,
@@ -190,10 +207,17 @@ fn handle_discovery(
ui: &mut Ui,
storage: &mut Repository,
discovery: &DiscoveryHandle,
+ unreachable: &mut discovery::UnreachableNotices,
event: DiscoveryEvent,
) {
let device = match &event {
DiscoveryEvent::Discovered { device } | DiscoveryEvent::Updated { device } => device,
+ // Explains a destination that "was not discovered": it is around,
+ // but its server cannot be dialed.
+ DiscoveryEvent::Unreachable { device, error } => {
+ discovery::log_unreachable(ui, unreachable, device, error);
+ return;
+ }
DiscoveryEvent::MulticastFailed => {
ui.log(
Category::Discovery,
@@ -202,6 +226,7 @@ fn handle_discovery(
return;
}
};
+ // Also after a failed request: it changed the ranking of the channels.
discovery::refresh_paired_channels(ui, &mut storage.paired, discovery, &device.fingerprint);
let DiscoveryEvent::Discovered { device } = event else {
diff --git a/cli/src/app/mod.rs b/cli/src/app/mod.rs
index 6cd09718..efb4a182 100644
--- a/cli/src/app/mod.rs
+++ b/cli/src/app/mod.rs
@@ -17,8 +17,8 @@ use crate::{Args, Command};
use crossterm::event::{Event, KeyEvent, KeyEventKind};
use keys::{Intent, KeyDecoder};
use localsend::discovery::{
- DEFAULT_DISCOVERY_TIMEOUT, DeviceIdentity, DiscoveryConfig, DiscoveryEvent, DiscoveryHandle,
- HttpChannel,
+ DEFAULT_DISCOVERY_TIMEOUT, DeviceChannel, DeviceIdentity, DiscoveryConfig, DiscoveryEvent,
+ DiscoveryHandle, HttpChannel,
};
use localsend::http::server::v2::ServerEventV2;
use localsend::http::server::web::{WebConfig, WebDownloadEvent};
@@ -58,6 +58,15 @@ pub enum AppEvent {
result: Result<(), String>,
},
+ /// The first request of the send task had an outcome: the device
+ /// answered (`Ok`), or it could not be reached over `channel` (`Err`
+ /// with the reason).
+ SendDialed {
+ fingerprint: String,
+ channel: DeviceChannel,
+ result: Result<(), String>,
+ },
+
/// The send task created its upload session.
SendSessionStarted {
session_id: String,
@@ -265,6 +274,10 @@ struct App {
/// The hotkeys (1-9) of the devices in the discovery store.
slots: Slots,
+ /// The devices that were logged as announcing themselves but out of
+ /// reach.
+ unreachable: discovery::UnreachableNotices,
+
/// Config, identity and paired devices, see [`storage::Repository`].
storage: storage::Repository,
@@ -339,6 +352,7 @@ async fn run_interactive(
keys: KeyDecoder::new(),
discovery: discovery.clone(),
slots: Slots::new(),
+ unreachable: discovery::UnreachableNotices::new(),
storage,
pending: None,
receive: None,
@@ -403,6 +417,23 @@ impl App {
file_id,
result,
} => self.receive_file_result(session_id, file_id, result),
+ AppEvent::SendDialed {
+ fingerprint,
+ channel,
+ result,
+ } => {
+ // Comes back as a discovery event, like every observation.
+ self.discovery
+ .report_outbound(&fingerprint, channel, result);
+ // Saved right away: in `send` mode, `SendEnded` may quit
+ // before that discovery event is handled.
+ discovery::refresh_paired_channels(
+ &mut self.ui,
+ &mut self.storage.paired,
+ &self.discovery,
+ &fingerprint,
+ );
+ }
AppEvent::SendSessionStarted {
session_id,
accepted_bytes,
diff --git a/cli/src/app/target.rs b/cli/src/app/target.rs
index ec84e22d..68da19f4 100644
--- a/cli/src/app/target.rs
+++ b/cli/src/app/target.rs
@@ -74,11 +74,12 @@ impl std::fmt::Display for TargetSelector {
mod tests {
use super::TargetSelector;
use localsend::discovery::{
- ChannelStatus, DeviceChannel, DiscoveredDevice, HttpChannel, StatefulDevice,
+ ChannelState, DeviceChannel, DiscoveredDevice, HttpChannel, Outbound, StatefulDevice,
};
use localsend::model::discovery::ProtocolType;
use std::collections::HashMap;
use std::net::{IpAddr, Ipv4Addr};
+ use std::time::SystemTime;
fn device(alias: &str, fingerprint: &str, host: &str) -> StatefulDevice {
let channel = DeviceChannel::Http(HttpChannel {
@@ -96,7 +97,14 @@ mod tests {
channel: channel.clone(),
download: false,
},
- channels: HashMap::from([(channel, ChannelStatus::Available)]),
+ confirmed: true,
+ channels: HashMap::from([(
+ channel,
+ ChannelState {
+ outbound: Outbound::Reachable(SystemTime::now()),
+ inbound: None,
+ },
+ )]),
logs: Vec::new(),
}
}
diff --git a/cli/src/device_list.rs b/cli/src/device_list.rs
index 3e2572e4..fd39ae7b 100644
--- a/cli/src/device_list.rs
+++ b/cli/src/device_list.rs
@@ -1,10 +1,11 @@
use crate::util;
use crossterm::event::{KeyCode, KeyEvent};
+use localsend::discovery::{ChannelState, Outbound};
use ratatui::Terminal;
use ratatui::backend::CrosstermBackend;
use ratatui::layout::{Constraint, Layout};
use ratatui::style::{Color, Modifier, Style};
-use ratatui::text::Span;
+use ratatui::text::{Line, Span};
use ratatui::widgets::{Block, Borders, HighlightSpacing, List, ListItem, ListState, Paragraph};
use std::io::Stdout;
@@ -33,12 +34,18 @@ pub struct DeviceRow {
/// The addresses the device was seen on, the best first; empty for a paired
/// device that has not been discovered in this run and therefore cannot
/// be sent to.
- pub hosts: Vec<String>,
+ pub hosts: Vec<DeviceHost>,
/// Whether the device is paired; the pair hotkey toggles it.
pub paired: bool,
}
+/// An address of a device, with what is known about each direction of it.
+pub struct DeviceHost {
+ pub host: String,
+ pub state: ChannelState,
+}
+
/// What a key press did to the device list.
pub enum DeviceListOutcome {
/// The list stays open.
@@ -191,10 +198,13 @@ impl DeviceList {
list_state,
} = self;
- let help = Span::raw(" ↑/↓: navigate Enter: send P: pair/unpair Esc: close");
+ let help = vec![
+ Line::raw(" ↑/↓: navigate Enter: send P: pair/unpair Esc: close"),
+ Line::raw(DIRECTION_LEGEND),
+ ];
let _ = terminal.draw(|frame| {
let [main_area, help_area] =
- Layout::vertical([Constraint::Fill(1), Constraint::Length(1)]).areas(frame.area());
+ Layout::vertical([Constraint::Fill(1), Constraint::Length(2)]).areas(frame.area());
let list = List::new(rows.iter().map(row_item))
.block(
@@ -231,8 +241,7 @@ fn row_item(row: &Row) -> ListItem<'_> {
};
match device.hosts.is_empty() {
false => {
- let hosts: Vec<String> =
- device.hosts.iter().map(|host| shorten_host(host)).collect();
+ let hosts: Vec<String> = device.hosts.iter().map(host_label).collect();
ListItem::new(Span::raw(format!(
" [{slot}] {} ({})",
device.alias,
@@ -248,6 +257,27 @@ fn row_item(row: &Row) -> ListItem<'_> {
}
}
+/// Explains the markers of [`host_label`] below the list.
+const DIRECTION_LEGEND: &str = " ←: reached us →: reachable →?: untested →x: failed";
+
+/// A host for the row, followed by what is known about each direction of
+/// its channel: `←` when the device reached us from the address (nothing
+/// when it never did, which cannot be told from being unable to), then `→`
+/// when we reached the device there, `→?` when that was never tried and
+/// `→x` when it failed. A channel proven both ways reads `←→`.
+fn host_label(host: &DeviceHost) -> String {
+ let inbound = match host.state.inbound {
+ Some(_) => "←",
+ None => "",
+ };
+ let outbound = match host.state.outbound {
+ Outbound::Reachable(_) => "→",
+ Outbound::Untested => "→?",
+ Outbound::Failed(_) => "→x",
+ };
+ format!("{} {inbound}{outbound}", shorten_host(&host.host))
+}
+
/// Shortens a host for the row: an IPv6 address is reduced to its last group
/// (keeping the scope), so `fe80::6888:8aff:febd:8578%15` renders as
/// `::8578%15`. Display only; sending always uses the full address.
@@ -269,6 +299,119 @@ fn shorten_host(host: &str) -> String {
#[cfg(test)]
mod tests {
use super::*;
+ use ratatui::buffer::Buffer;
+ use ratatui::layout::Rect;
+ use ratatui::widgets::Widget;
+ use std::time::SystemTime;
+
+ fn host(host: &str, outbound: Outbound, inbound: bool) -> DeviceHost {
+ DeviceHost {
+ host: host.to_string(),
+ state: ChannelState {
+ outbound,
+ inbound: inbound.then(SystemTime::now),
+ },
+ }
+ }
+
+ fn label(name: &str, outbound: Outbound, inbound: bool) -> String {
+ host_label(&host(name, outbound, inbound))
+ }
+
+ /// The row as the list draws it.
+ fn rendered(row: &Row) -> String {
+ let area = Rect::new(0, 0, 80, 1);
+ let mut buffer = Buffer::empty(area);
+ List::new([row_item(row)]).render(area, &mut buffer);
+ let line: String = buffer.content().iter().map(|cell| cell.symbol()).collect();
+ line.trim_end().to_string()
+ }
+
+ #[test]
+ fn test_device_row_lists_the_hosts_with_their_directions() {
+ let now = SystemTime::now();
+ let row = Row::Device(DeviceRow {
+ fingerprint: "tomato".to_string(),
+ alias: "Cute Tomato".to_string(),
+ slot: Some(1),
+ hosts: vec![
+ host("192.168.178.183", Outbound::Reachable(now), true),
+ host("fe80::6888:8aff:febd:8578%15", Outbound::Untested, true),
+ host("10.0.0.5", Outbound::Failed(now), false),
+ ],
+ paired: false,
+ });
+
+ assert_eq!(
+ rendered(&row),
+ " [1] Cute Tomato (192.168.178.183 ←→, ::8578%15 ←→?, 10.0.0.5 →x)"
+ );
+ }
+
+ #[test]
+ fn test_device_row_without_hosts_is_offline() {
+ let row = Row::Device(DeviceRow {
+ fingerprint: "cherry".to_string(),
+ alias: "Wise Cherry".to_string(),
+ slot: None,
+ hosts: Vec::new(),
+ paired: true,
+ });
+
+ assert_eq!(rendered(&row), " [-] Wise Cherry (offline)");
+ }
+
+ #[test]
+ fn test_host_label_marks_each_direction() {
+ let now = SystemTime::now();
+
+ assert_eq!(
+ label("192.168.178.183", Outbound::Reachable(now), true),
+ "192.168.178.183 ←→"
+ );
+ assert_eq!(
+ label("192.168.178.183", Outbound::Reachable(now), false),
+ "192.168.178.183 →"
+ );
+ assert_eq!(
+ label("192.168.178.183", Outbound::Untested, true),
+ "192.168.178.183 ←→?"
+ );
+ assert_eq!(
+ label("192.168.178.183", Outbound::Failed(now), true),
+ "192.168.178.183 ←→x"
+ );
+ assert_eq!(
+ label("192.168.178.183", Outbound::Failed(now), false),
+ "192.168.178.183 →x"
+ );
+ }
+
+ #[test]
+ fn test_host_label_shortens_the_host() {
+ assert_eq!(
+ label("fe80::6888:8aff:febd:8578%15", Outbound::Untested, true),
+ "::8578%15 ←→?"
+ );
+ }
+
+ #[test]
+ fn test_direction_legend_explains_every_marker() {
+ let now = SystemTime::now();
+ for outbound in [
+ Outbound::Reachable(now),
+ Outbound::Untested,
+ Outbound::Failed(now),
+ ] {
+ let label = label("10.0.0.1", outbound, false);
+ let marker = label.strip_prefix("10.0.0.1 ").unwrap();
+ assert!(
+ DIRECTION_LEGEND.contains(&format!(" {marker}: ")),
+ "the legend must explain {marker}"
+ );
+ }
+ assert!(DIRECTION_LEGEND.contains(" ←: "));
+ }
#[test]
fn test_shorten_host() {
diff --git a/cli/src/send_task.rs b/cli/src/send_task.rs
index 6165460d..6e34b102 100644
--- a/cli/src/send_task.rs
+++ b/cli/src/send_task.rs
@@ -12,6 +12,7 @@ use localsend::http::dto_v2::PrepareUploadRequestDtoV2;
use localsend::model::discovery::ProtocolType;
use localsend::model::transfer::{FileContent, FileDto};
use localsend::reqwest;
+use localsend::util::error::ErrorChain;
use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::Arc;
@@ -52,6 +53,8 @@ impl SendCancel {
/// file with a preview) usually ends after prepare-upload, as the receiver
/// has nothing left to download.
///
+/// Emits [AppEvent::SendDialed] once the first request shows whether the
+/// device can be reached over the dialed channel.
/// Always ends by emitting [AppEvent::SendEnded] with the transfer result.
pub async fn run_send(
identity: Arc<Identity>,
@@ -88,7 +91,10 @@ async fn send_inner(
}
};
- let Some(http) = device.get_best_channel().and_then(|channel| channel.http()) else {
+ let dialed = device
+ .get_best_channel()
+ .and_then(|channel| Some((channel, channel.http()?)));
+ let Some((channel, http)) = dialed else {
log(format!("{alias}: No dialable address")).await;
return false;
};
@@ -119,7 +125,7 @@ async fn send_inner(
info: identity.register_dto(),
files: files.clone(),
};
- let prepared = match client
+ let prepared = client
.prepare_upload(
protocol.clone(),
&http.host,
@@ -129,8 +135,21 @@ async fn send_inner(
None,
cancel.token.clone(),
)
- .await
- {
+ .await;
+
+ // The first request tells whether the device can be dialed on the
+ // channel; the discovery store ranks the device's channels by it.
+ if let Some(result) = channel_outcome(&prepared) {
+ let _ = events
+ .send(AppEvent::SendDialed {
+ fingerprint: device.device.fingerprint.clone(),
+ channel: channel.clone(),
+ result,
+ })
+ .await;
+ }
+
+ let prepared = match prepared {
Ok(prepared) => prepared,
Err(ClientError::Cancelled) => {
log(format!("{alias}: Cancelled")).await;
@@ -298,6 +317,36 @@ async fn send_inner(
true
}
+/// What the outcome of a request tells about the channel it was sent over:
+/// `Ok` when the device answered, `Err` — with the reason, for display —
+/// when it could not be reached. `None` when the outcome says nothing about
+/// the channel.
+///
+/// A device that answers with an error status (declined, busy, PIN required)
+/// was reached just as well as one that accepts.
+fn channel_outcome<T>(result: &Result<T, ClientError>) -> Option<Result<(), String>> {
+ match result {
+ // The request got no response: the connection could not be
+ // established (refused, timed out, failed TLS handshake) or broke.
+ Err(err) if err.is_unreachable() => Some(Err(ErrorChain(err).to_string())),
+
+ // Any other transport error means the response arrived, only its
+ // body could not be read or parsed.
+ Ok(_) | Err(ClientError::StatusCode(_) | ClientError::Reqwest(_)) => Some(Ok(())),
+
+ // The user gave up waiting, which is not a failure of the channel;
+ // the other errors are not errors of the transport. Whether the
+ // device was reached cannot be told from them, so nothing is claimed
+ // in either direction.
+ Err(
+ ClientError::Cancelled
+ | ClientError::Json(_)
+ | ClientError::Io(_)
+ | ClientError::Other(_),
+ ) => None,
+ }
+}
+
/// Builds a streaming request body from the file content, invoking `progress`
/// with the cumulative number of bytes of this file as chunks are sent.
fn upload_body(content: FileContent, progress: impl Fn(u64) + Send + 'static) -> reqwest::Body {
@@ -310,3 +359,165 @@ fn upload_body(content: FileContent, progress: impl Fn(u64) + Send + 'static) ->
});
reqwest::Body::wrap_stream(stream)
}
+
+#[cfg(test)]
+mod tests {
+ use super::channel_outcome;
+ use localsend::http::client::ClientError;
+ use localsend::http::client::v2::LsHttpClientV2;
+ use localsend::http::dto_v2::{
+ PrepareUploadRequestDtoV2, PrepareUploadResultV2, RegisterDtoV2,
+ };
+ use localsend::model::discovery::ProtocolType;
+ use std::collections::HashMap;
+ use tokio::io::{AsyncReadExt, AsyncWriteExt};
+ use tokio::net::TcpListener;
+ use tokio_util::sync::CancellationToken;
+
+ /// A device on a loopback port that reads one request and answers it
+ /// with `response`, or closes the connection without an answer.
+ async fn peer(response: Option<String>) -> u16 {
+ let listener = TcpListener::bind("127.0.0.1:0").await.unwrap();
+ let port = listener.local_addr().unwrap().port();
+ tokio::spawn(async move {
+ let (mut stream, _) = listener.accept().await.unwrap();
+ let mut request = Vec::new();
+ let mut buffer = [0u8; 1024];
+ while !request.windows(4).any(|window| window == b"\r\n\r\n") {
+ match stream.read(&mut buffer).await {
+ Ok(0) | Err(_) => return,
+ Ok(read) => request.extend_from_slice(&buffer[..read]),
+ }
+ }
+ let Some(response) = response else {
+ return;
+ };
+ let _ = stream.write_all(response.as_bytes()).await;
+ let _ = stream.shutdown().await;
+
+ // Closing with unread request bytes would reset the connection
+ // before the client has read the response.
+ while matches!(stream.read(&mut buffer).await, Ok(read) if read > 0) {}
+ });
+ port
+ }
+
+ /// A loopback port nobody listens on.
+ async fn closed_port() -> u16 {
+ let listener = TcpListener::bind("127.0.0.1:0").await.unwrap();
+ listener.local_addr().unwrap().port()
+ }
+
+ /// The first request of a send, to the device on the loopback port.
+ async fn prepare_upload(port: u16) -> Result<PrepareUploadResultV2, ClientError> {
+ let payload = PrepareUploadRequestDtoV2 {
+ info: RegisterDtoV2 {
+ alias: "Cute Tomato".to_string(),
+ version: "2.2".to_string(),
+ device_model: None,
+ device_type: None,
+ fingerprint: "tomato".to_string(),
+ port: 53317,
+ protocol: ProtocolType::Http,
+ download: false,
+ },
+ files: HashMap::new(),
+ };
+ LsHttpClientV2::try_new_without_cert()
+ .unwrap()
+ .prepare_upload(
+ ProtocolType::Http,
+ "127.0.0.1",
+ port,
+ None,
+ payload,
+ None,
+ CancellationToken::new(),
+ )
+ .await
+ }
+
+ #[tokio::test]
+ async fn an_accepting_device_was_reached() {
+ let response = "HTTP/1.1 204 No Content\r\nconnection: close\r\n\r\n";
+ let port = peer(Some(response.to_string())).await;
+
+ let result = prepare_upload(port).await;
+
+ assert!(result.is_ok());
+ assert_eq!(channel_outcome(&result), Some(Ok(())));
+ }
+
+ #[tokio::test]
+ async fn a_refusing_device_was_reached() {
+ for status in ["401 Unauthorized", "403 Forbidden", "409 Conflict"] {
+ let response =
+ format!("HTTP/1.1 {status}\r\nconnection: close\r\ncontent-length: 0\r\n\r\n");
+ let port = peer(Some(response)).await;
+
+ let result = prepare_upload(port).await;
+
+ assert!(
+ matches!(result, Err(ClientError::StatusCode(_))),
+ "{status} must be an error status"
+ );
+ assert_eq!(
+ channel_outcome(&result),
+ Some(Ok(())),
+ "{status} must count as an answer"
+ );
+ }
+ }
+
+ #[tokio::test]
+ async fn a_device_answering_garbage_was_reached() {
+ let response = "HTTP/1.1 200 OK\r\nconnection: close\r\ncontent-length: 8\r\n\r\nnot json";
+ let port = peer(Some(response.to_string())).await;
+
+ let result = prepare_upload(port).await;
+
+ assert!(matches!(result, Err(ClientError::Reqwest(_))));
+ assert_eq!(channel_outcome(&result), Some(Ok(())));
+ }
+
+ #[tokio::test]
+ async fn a_refused_connection_fails_the_channel_with_the_cause() {
+ let result = prepare_upload(closed_port().await).await;
+
+ let outermost = result.as_ref().err().unwrap().to_string();
+ match channel_outcome(&result) {
+ Some(Err(reason)) => assert!(
+ reason.starts_with(&outermost) && reason.len() > outermost.len(),
+ "the reason must carry the whole error chain, got: {reason}"
+ ),
+ outcome => panic!("expected a failure, got {outcome:?}"),
+ }
+ }
+
+ #[tokio::test]
+ async fn a_connection_closed_without_an_answer_fails_the_channel() {
+ let port = peer(None).await;
+
+ let result = prepare_upload(port).await;
+
+ assert!(matches!(channel_outcome(&result), Some(Err(_))));
+ }
+
+ #[test]
+ fn a_cancellation_says_nothing_about_the_channel() {
+ let result: Result<(), ClientError> = Err(ClientError::Cancelled);
+
+ assert_eq!(channel_outcome(&result), None);
+ }
+
+ #[test]
+ fn an_error_outside_of_the_transport_says_nothing_about_the_channel() {
+ let result: Result<(), ClientError> =
+ Err(ClientError::Other(anyhow::anyhow!("Certificate not found")));
+ assert_eq!(channel_outcome(&result), None);
+
+ let result: Result<(), ClientError> =
+ Err(ClientError::Io(std::io::ErrorKind::PermissionDenied.into()));
+ assert_eq!(channel_outcome(&result), None);
+ }
+}
diff --git a/packages/core/src/discovery/mod.rs b/packages/core/src/discovery/mod.rs
index 93b669fd..2afca4ec 100644
--- a/packages/core/src/discovery/mod.rs
+++ b/packages/core/src/discovery/mod.rs
@@ -1,12 +1,13 @@
mod store;
pub use store::{
- ChannelStatus, DeviceChannel, DeviceLog, DeviceLogKind, DiscoveredDevice, HttpChannel,
- StatefulDevice,
+ ChannelState, DeviceChannel, DeviceLog, DeviceLogEvent, DiscoveredDevice, HttpChannel,
+ Outbound, StatefulDevice,
};
use crate::http::client::{ClientError, LsHttpClientV2};
use crate::http::dto_v2::{RegisterDtoV2, RegisterResponseDtoV2};
+use crate::http::server::PeerIp;
use crate::model::discovery::{MulticastMessageV2, ProtocolType};
use crate::multicast::{self, MulticastConfig, MulticastDevice, MulticastEvent, MulticastHandle};
use crate::util::error::ErrorChain;
@@ -17,7 +18,7 @@ use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
use std::sync::Arc;
use std::time::{Duration, SystemTime};
-use store::DeviceStore;
+use store::{Announcement, DeviceStore, Observation};
use tokio::sync::{mpsc, oneshot};
/// The default timeout of the register requests sent by discovery, matching
@@ -77,9 +78,14 @@ pub struct DiscoveryConfig {
pub event_tx: Option<mpsc::Sender<DiscoveryEvent>>,
}
-/// An event emitted by the discovery. Every confirmation is also logged in
+/// An event emitted by the discovery. Every observation is also logged in
/// [`StatefulDevice::logs`]; the accumulated state is read from
/// [`DiscoveryHandle::devices`].
+///
+/// A confirmation is an HTTP request exchanged with the device in either
+/// direction: the device answered a request of this device, or it sent one
+/// to this device's server. Which direction a channel was confirmed in is
+/// kept in [`StatefulDevice::channels`].
#[derive(Clone, Debug)]
pub enum DiscoveryEvent {
/// A device was confirmed over one of its channels for the first time
@@ -90,12 +96,26 @@ pub enum DiscoveryEvent {
device: DiscoveredDevice,
},
- /// An already known device was confirmed again: it re-announced itself
- /// or was re-discovered, at a known or a new address.
+ /// An already confirmed device was observed again: it re-announced
+ /// itself or was re-discovered, at a known or a new address, or a
+ /// request to it failed (which only changes the ranking of its
+ /// channels).
Updated {
- /// The device as it was confirmed, like in
- /// [`DiscoveryEvent::Discovered`].
+ /// The device as it was observed, carrying only the channel the
+ /// observation happened on.
+ device: DiscoveredDevice,
+ },
+
+ /// A device that was never confirmed could not be reached: it was heard
+ /// announcing itself but the register request got no response. Such a
+ /// device is only listed in [`DiscoveryHandle::unconfirmed_devices`].
+ Unreachable {
+ /// The device carrying the channel that failed. Unverified: it is
+ /// what the announcement claimed.
device: DiscoveredDevice,
+
+ /// Why the request failed, for display.
+ error: String,
},
/// The multicast sockets failed permanently, e.g. because the OS
@@ -120,6 +140,10 @@ struct DiscoveryState {
/// The interface addresses a subnet scan is currently running for.
scanning: std::sync::Mutex<HashSet<Ipv4Addr>>,
+ /// The devices (by fingerprint) and channels a dial-back is currently
+ /// running for, see [`dial_back`].
+ dialing_back: std::sync::Mutex<HashSet<(String, DeviceChannel)>>,
+
/// Number of confirmations in this run, on which
/// [`DiscoveryHandle::discover_staged`] decides whether to escalate.
confirmations: AtomicU64,
@@ -179,17 +203,32 @@ impl DiscoveryState {
}
let device = confirmed_device(response.body, host.to_string(), port, protocol, fingerprint);
- let (_, merged) = self.found(device).await;
+ let (_, merged) = self.observed(device, Observation::Reached, None);
Ok(Some(merged))
}
- /// Puts a device into the store, logging the confirmation on it, and
- /// emits the resulting event. Returns whether the device is new, and
- /// its stored state after the merge.
- async fn found(&self, device: DiscoveredDevice) -> (bool, StatefulDevice) {
- self.confirmations.fetch_add(1, Ordering::Relaxed);
- let (event, merged) = self.store.upsert(device, SystemTime::now());
+ /// Puts an observation of a device (made on `device.channel`), after
+ /// hearing `announcement` when that is what led to it — into the store,
+ /// logging it on the device, and emits the resulting event. Returns
+ /// whether the device is new, and its stored state after the merge.
+ fn observed(
+ &self,
+ device: DiscoveredDevice,
+ observation: Observation,
+ announcement: Option<Announcement>,
+ ) -> (bool, StatefulDevice) {
+ if !matches!(observation, Observation::Failed(_)) {
+ self.confirmations.fetch_add(1, Ordering::Relaxed);
+ }
+ let (event, merged) =
+ self.store
+ .observe(device, observation, announcement, SystemTime::now());
let is_new = matches!(event, DiscoveryEvent::Discovered { .. });
+ self.emit(event);
+ (is_new, merged)
+ }
+
+ fn emit(&self, event: DiscoveryEvent) {
if let Some(event_tx) = &self.event_tx {
// Never wait for the application here. A subnet scan confirms up to
// 255 devices in a burst, far more than the channel holds, and
@@ -205,7 +244,6 @@ impl DiscoveryState {
tracing::debug!("Dropped a discovery event: {err}");
}
}
- (is_new, merged)
}
}
@@ -224,7 +262,7 @@ impl DiscoveryHandle {
///
/// Devices registering in response arrive at the application as server
/// events, not here: discovery only learns about peers that announce
- /// themselves. Feed them back via [`DiscoveryHandle::add_device`].
+ /// themselves. Feed them back via [`DiscoveryHandle::observe_inbound`].
///
/// Returns once the whole announcement burst has been sent, which takes a
/// few seconds, or immediately once discovery has been stopped or
@@ -240,7 +278,8 @@ impl DiscoveryHandle {
///
/// Discovery then neither hears nor sends announcements; it still learns
/// about devices through [`DiscoveryHandle::discover`],
- /// [`DiscoveryHandle::scan_subnet`] and [`DiscoveryHandle::add_device`].
+ /// [`DiscoveryHandle::scan_subnet`] and
+ /// [`DiscoveryHandle::observe_inbound`].
pub fn multicast_error(&self) -> Option<&anyhow::Error> {
self.multicast.as_ref().err()
}
@@ -388,19 +427,84 @@ impl DiscoveryHandle {
self.state.answering.store(answer, Ordering::Relaxed);
}
- /// Puts a device confirmed outside of discovery into the store, e.g. one
- /// that answered an announcement by registering with this device's HTTP
- /// server. The confirmation is emitted as `Discovered` or `Updated`;
- /// returns `true` when the device is new.
- pub async fn add_device(&self, device: DiscoveredDevice) -> bool {
- self.state.found(device).await.0
+ /// Puts a device that reached this device's HTTP server into the store,
+ /// e.g. one that answered an announcement by registering. The
+ /// confirmation is emitted as `Discovered` or `Updated`; returns `true`
+ /// when the device is new.
+ ///
+ /// `device.channel` is the address the request came from, with the port
+ /// the device claims to serve on. Only the inbound direction of that
+ /// channel is confirmed: a device new to the address is stored with
+ /// [`Outbound::Untested`], because its request says nothing about
+ /// whether it can be dialed back.
+ ///
+ /// An untested channel is therefore dialed back in the background, with
+ /// a register request: the outcome makes it [`Outbound::Reachable`] or
+ /// [`Outbound::Failed`] and is emitted as `Updated`.
+ /// A channel that was dialed before is not dialed again, so two devices
+ /// running this do not keep answering each other.
+ pub async fn observe_inbound(&self, device: DiscoveredDevice) -> bool {
+ let (is_new, merged) = self
+ .state
+ .observed(device.clone(), Observation::ReachedUs, None);
+
+ let untested = merged
+ .channels
+ .get(&device.channel)
+ .is_some_and(|channel| channel.outbound == Outbound::Untested);
+ if untested {
+ dial_back(self.state.clone(), device);
+ }
+ is_new
+ }
+
+ /// Records the outcome of a request the application sent to a stored
+ /// device over `channel`, e.g. a transfer: `Ok` makes the channel
+ /// [`Outbound::Reachable`], `Err` — carrying the reason, for display —
+ /// makes it [`Outbound::Failed`], which ranks it behind the device's
+ /// other channels. Emitted as `Updated` for a confirmed device.
+ ///
+ /// Only report failures to reach the device at all
+ /// ([`ClientError::is_unreachable`]), not requests that the device
+ /// answered with an error.
+ ///
+ /// Returns `false` when no device has the fingerprint.
+ pub fn report_outbound(
+ &self,
+ fingerprint: &str,
+ channel: DeviceChannel,
+ result: Result<(), String>,
+ ) -> bool {
+ let event =
+ self.state
+ .store
+ .report_outbound(fingerprint, channel, result, SystemTime::now());
+ match event {
+ Some(event) => {
+ self.state.emit(event);
+ true
+ }
+ None => false,
+ }
}
- /// All discovered devices in discovery order.
+ /// All confirmed devices in the order they were first observed.
pub fn devices(&self) -> Vec<StatefulDevice> {
self.state.store.devices()
}
+ /// The devices that were heard announcing themselves but did not answer
+ /// the register request, in the order they were first heard.
+ ///
+ /// Nothing about them is verified (announcements are unauthenticated),
+ /// so they are for diagnostics only — e.g. to tell the user that a
+ /// device is around but blocked by a firewall — and not transfer
+ /// targets. A device leaves this list with its first confirmation.
+ pub fn unconfirmed_devices(&self) -> Vec<StatefulDevice> {
+ self.state.store.unconfirmed_devices()
+ }
+
+ /// The confirmed device with the given fingerprint.
pub fn device_by_fingerprint(&self, fingerprint: &str) -> Option<StatefulDevice> {
self.state.store.by_fingerprint(fingerprint)
}
@@ -464,6 +568,7 @@ pub async fn start(config: DiscoveryConfig, stop_rx: oneshot::Receiver<()>) -> D
event_tx: config.event_tx,
answering: AtomicBool::new(true),
scanning: std::sync::Mutex::new(HashSet::new()),
+ dialing_back: std::sync::Mutex::new(HashSet::new()),
confirmations: AtomicU64::new(0),
});
@@ -501,23 +606,79 @@ pub async fn start(config: DiscoveryConfig, stop_rx: oneshot::Receiver<()>) -> D
}
/// Answers an announcement with a register request, as the protocol requires.
-/// The device enters the store only once that request succeeded, so that
-/// everything in the store is known to be reachable.
+/// The device is confirmed only once that request succeeded; a device that
+/// cannot be reached is stored unconfirmed, with the channel marked as failed.
async fn answer_announcement(
state: Arc<DiscoveryState>,
ip: IpAddr,
scope_id: Option<u32>,
message: MulticastMessageV2,
) {
- let host = match scope_id {
- Some(scope_id) => format!("{ip}%{scope_id}"),
- None => ip.to_string(),
+ let announcement = Announcement {
+ ip: PeerIp { ip, scope_id },
+ timestamp: SystemTime::now(),
+ };
+ let host = announcement.ip.to_string();
+
+ // Nothing but the announcement is known about the device so far.
+ let device = DiscoveredDevice {
+ alias: message.alias,
+ version: message.version,
+ device_model: message.device_model,
+ device_type: message.device_type,
+ fingerprint: message.fingerprint,
+ channel: DeviceChannel::Http(HttpChannel {
+ host,
+ port: message.port,
+ protocol: message.protocol,
+ }),
+ download: message.download,
+ };
+ dial(&state, device, Some(announcement)).await;
+}
+
+/// Dials a device that reached this device's server back on the channel its
+/// request came from, to learn whether that channel also works in the
+/// outbound direction. Runs in the background.
+///
+/// At most one dial-back runs per device and channel: a peer typically sends
+/// several requests in a row, e.g. one for every message of an announcement
+/// burst.
+fn dial_back(state: Arc<DiscoveryState>, device: DiscoveredDevice) {
+ let key = (device.fingerprint.clone(), device.channel.clone());
+ if !state.dialing_back.lock().unwrap().insert(key.clone()) {
+ return;
+ }
+
+ tokio::spawn(async move {
+ dial(&state, device, None).await;
+ state.dialing_back.lock().unwrap().remove(&key);
+ });
+}
+
+/// Sends a register request to a device whose identity is already claimed —
+/// by its announcement, heard as `announcement`, or by a request it sent to
+/// this device's server — over `device.channel`, and puts the outcome into
+/// the store: the channel is reachable when the device answered, failed when
+/// it could not be reached.
+async fn dial(
+ state: &DiscoveryState,
+ device: DiscoveredDevice,
+ announcement: Option<Announcement>,
+) {
+ let Some(HttpChannel {
+ host,
+ port,
+ protocol,
+ }) = device.http().cloned()
+ else {
+ return;
};
// Pin the claimed fingerprint, so nothing is sent to a device that does
// not hold the matching certificate.
- let expected_fingerprint = match message.protocol {
- ProtocolType::Https => Some(message.fingerprint.clone()),
+ let expected_fingerprint = match protocol {
+ ProtocolType::Https => Some(device.fingerprint.clone()),
ProtocolType::Http => None,
};
let client = match LsHttpClientV2::try_new(
@@ -529,7 +690,7 @@ async fn answer_announcement(
Ok(client) => client,
Err(err) => {
tracing::error!(
- "Could not create the client to answer {host}: {}",
+ "Could not create the client to register with {host}: {}",
ErrorChain(&err)
);
return;
@@ -537,29 +698,38 @@ async fn answer_announcement(
};
let result = client
- .register(message.protocol, &host, message.port, state.register_dto())
+ .register(protocol, &host, port, state.register_dto())
.await;
match result {
Ok(response) => {
// The pinned certificate identifies the peer, so the fingerprint
- // is taken from the announcement, not from the response body.
- let device = confirmed_device(
- response.body,
- host,
- message.port,
- message.protocol,
- message.fingerprint,
- );
- state.found(device).await;
+ // is the claimed one, not the one from the response body.
+ let device = confirmed_device(response.body, host, port, protocol, device.fingerprint);
+ state.observed(device, Observation::Reached, announcement);
}
Err(err) => {
- let url = format!("{}://{host}:{}", message.protocol.as_str(), message.port);
+ let error = ErrorChain(&err).to_string();
+ let url = format!("{}://{host}:{port}", protocol.as_str());
tracing::debug!(
- "Could not register with announcing device {} ({url}): {}",
- message.alias,
- ErrorChain(&err),
+ "Could not register with device {} ({url}): {error}",
+ device.alias,
);
+ if !err.is_unreachable() {
+ // The device answered, just not with its registration.
+ // A device dialed back already confirmed itself with its
+ // request, so the answer shows the channel works outbound.
+ // An announcing device stays unconfirmed: nothing it
+ // claimed is verified.
+ if announcement.is_none() {
+ state.observed(device, Observation::Reached, None);
+ }
+ return;
+ }
+
+ // The device is around but cannot be dialed, typically because
+ // a firewall blocks its server.
+ state.observed(device, Observation::Failed(error), announcement);
}
}
}
diff --git a/packages/core/src/discovery/store.rs b/packages/core/src/discovery/store.rs
index 364e4e3f..39cd3e22 100644
--- a/packages/core/src/discovery/store.rs
+++ b/packages/core/src/discovery/store.rs
@@ -1,18 +1,20 @@
//! The in-memory store of discovered devices.
use super::DiscoveryEvent;
+use crate::http::server::PeerIp;
use crate::model::discovery::{DeviceType, ProtocolType};
use std::collections::HashMap;
use std::net::IpAddr;
use std::sync::Mutex;
use std::time::SystemTime;
-/// How many log entries a device keeps. Every confirmation is logged and
+/// How many log entries a device keeps. Every observation is logged and
/// chatty peers re-announce for the whole run, so the oldest entries are
/// dropped beyond this.
const MAX_LOGS: usize = 100;
-/// A device discovered on the network, confirmed over one of its channels.
+/// A device discovered on the network, as it was observed on one of its
+/// channels.
#[derive(Clone, Debug)]
pub struct DiscoveredDevice {
/// The display name of the device.
@@ -31,7 +33,7 @@ pub struct DiscoveredDevice {
/// In HTTPS mode the SHA-256 hash of the certificate, otherwise a random string.
pub fingerprint: String,
- /// The channel the device was confirmed over.
+ /// The channel the device was observed on.
pub channel: DeviceChannel,
/// Whether the device's download API is active.
@@ -41,64 +43,155 @@ pub struct DiscoveredDevice {
/// A [`DiscoveredDevice`] as kept in the store.
#[derive(Clone, Debug)]
pub struct StatefulDevice {
- /// The device as it was most recently confirmed.
+ /// The device as it was most recently confirmed. For an unconfirmed
+ /// device: as it most recently announced itself.
pub device: DiscoveredDevice,
- /// Every channel the device was confirmed on, with its current status.
- /// Starts with `Available`, the application is responsible
- /// to set it to `NotReachable` on error.
- pub channels: HashMap<DeviceChannel, ChannelStatus>,
-
- /// The events that affected this device, oldest first, at most
- /// [`MAX_LOGS`]. Every confirmation is logged, so the last entry is when
- /// the device was last seen.
+ /// Whether an HTTP request was ever exchanged with the device, in either
+ /// direction.
+ ///
+ /// `false` for a device that was only heard announcing itself and did
+ /// not answer: announcements are unauthenticated, so nothing about such
+ /// a device is verified. It is kept for diagnostics and must not be
+ /// offered as a transfer target.
+ pub confirmed: bool,
+
+ /// Every channel the device was observed on, with what is known about
+ /// each direction.
+ pub channels: HashMap<DeviceChannel, ChannelState>,
+
+ /// The observations of this device in the order they were recorded, at
+ /// most [`MAX_LOGS`].
pub logs: Vec<DeviceLog>,
}
-/// Whether a [`DeviceChannel`] of a [`StatefulDevice`] is believed to work.
+/// What is known about a [`DeviceChannel`] of a [`StatefulDevice`], per
+/// direction: a channel that works one way does not have to work the other
+/// way (e.g. because of a firewall on one of the devices).
+#[derive(Clone, Copy, Debug, Eq, PartialEq)]
+pub struct ChannelState {
+ /// This device → the peer: whether the peer can be dialed on the channel.
+ pub outbound: Outbound,
+
+ /// The peer → this device: when the peer last reached this device's
+ /// server from the channel's address, `None` when it never did.
+ ///
+ /// There is no failed state: a request that does not arrive cannot be
+ /// observed.
+ pub inbound: Option<SystemTime>,
+}
+
+/// Whether a peer can be dialed on a channel.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
-pub enum ChannelStatus {
- /// The channel worked when it was last used.
- Available,
+pub enum Outbound {
+ /// No request was sent over the channel yet: the peer reached this
+ /// device from it, which says nothing about the way back.
+ Untested,
+
+ /// The last request over the channel was answered, at the given time.
+ Reachable(SystemTime),
- /// The channel failed when it was last used. A re-confirmation over the
- /// channel makes it available again.
- NotReachable,
+ /// The last request over the channel failed, at the given time.
+ Failed(SystemTime),
}
-/// A confirmation of a device, as retained on it for display.
+impl Outbound {
+ /// The preference when choosing a channel to dial: proven before
+ /// unknown before known to fail.
+ fn rank(&self) -> u8 {
+ match self {
+ Outbound::Reachable(_) => 2,
+ Outbound::Untested => 1,
+ Outbound::Failed(_) => 0,
+ }
+ }
+}
+
+/// An observation of a device, as retained on it for display.
#[derive(Clone, Debug)]
pub struct DeviceLog {
pub timestamp: SystemTime,
- /// Whether the confirmation discovered the device or re-confirmed it.
- pub kind: DeviceLogKind,
+ pub event: DeviceLogEvent,
+}
+
+/// What was observed about a device, and in which direction.
+#[derive(Clone, Debug, Eq, PartialEq)]
+pub enum DeviceLogEvent {
+ /// This device → the peer: a request over the channel was answered.
+ Outbound { channel: DeviceChannel },
- /// The channel the confirmation happened on.
- pub channel: DeviceChannel,
+ /// This device → the peer: a request over the channel failed.
+ OutboundFailed {
+ channel: DeviceChannel,
+
+ /// Why the request failed, for display.
+ error: String,
+ },
+
+ /// The peer → this device: the peer sent a request to this device's
+ /// server. The channel is the address the request came from, with the
+ /// port the peer claims to serve on.
+ Inbound { channel: DeviceChannel },
+
+ /// The peer → this device: an announcement of the peer was heard.
+ ///
+ /// The opposite direction has no counterpart: whether the peer hears
+ /// this device's announcements cannot be observed.
+ MulticastInbound {
+ /// The address the announcement came from, with the interface index
+ /// it arrived on for link-local IPv6 sources.
+ ip: PeerIp,
+ },
}
-/// What a logged confirmation meant for the device, mirroring the
-/// [`DiscoveryEvent`] variants.
-#[derive(Clone, Copy, Debug, Eq, PartialEq)]
-pub enum DeviceLogKind {
- /// The device entered the store.
- Discovered,
+impl DeviceLogEvent {
+ /// The channel the event proved to work, in either direction.
+ fn confirmed_channel(&self) -> Option<&DeviceChannel> {
+ match self {
+ DeviceLogEvent::Outbound { channel } | DeviceLogEvent::Inbound { channel } => {
+ Some(channel)
+ }
+ DeviceLogEvent::OutboundFailed { .. } | DeviceLogEvent::MulticastInbound { .. } => None,
+ }
+ }
+}
+
+/// What a request told about the channel it was sent over.
+pub(super) enum Observation {
+ /// This device → the peer: the peer answered.
+ Reached,
+
+ /// This device → the peer: the request failed, for the given reason.
+ Failed(String),
+
+ /// The peer → this device: the peer's request arrived.
+ ReachedUs,
+}
+
+/// An announcement heard over multicast, which led to an [`Observation`].
+pub(super) struct Announcement {
+ pub(super) ip: PeerIp,
- /// An already known device was confirmed again.
- Updated,
+ /// When the announcement was heard.
+ pub(super) timestamp: SystemTime,
}
impl StatefulDevice {
+ /// The channel to dial first. It is not necessarily reachable: when no
+ /// channel is, the least bad one is returned.
pub fn get_best_channel(&self) -> Option<&DeviceChannel> {
self.get_ranked_channels().into_iter().next()
}
+ /// The channels in the order to dial them: reachable before untested
+ /// before failed, then IPv6 before IPv4, then most recently confirmed
+ /// first.
pub fn get_ranked_channels(&self) -> Vec<&DeviceChannel> {
let mut channels: Vec<_> = self.channels.iter().collect();
- channels.sort_by_key(|(channel, status)| {
+ channels.sort_by_key(|(channel, state)| {
std::cmp::Reverse((
- **status == ChannelStatus::Available,
+ state.outbound.rank(),
channel.is_ipv6(),
self.last_confirmed(channel),
))
@@ -106,15 +199,135 @@ impl StatefulDevice {
channels.into_iter().map(|(channel, _)| channel).collect()
}
- /// The position of the channel's most recent confirmation in the logs;
- /// `None` when its confirmations have been dropped from the log cap.
+ /// The position of the channel's most recent confirmation (in either
+ /// direction) in the logs; `None` when its confirmations have been
+ /// dropped from the log cap or it was never confirmed.
fn last_confirmed(&self, channel: &DeviceChannel) -> Option<usize> {
- self.logs.iter().rposition(|log| log.channel == *channel)
+ self.logs
+ .iter()
+ .rposition(|log| log.event.confirmed_channel() == Some(channel))
+ }
+
+ /// Merges an observation of `device` — made on `device.channel` — into
+ /// the stored state. Returns the event describing what happened.
+ fn apply(
+ &mut self,
+ device: DiscoveredDevice,
+ observation: Observation,
+ timestamp: SystemTime,
+ ) -> DiscoveryEvent {
+ self.update_channel(&device.channel, &observation, timestamp);
+
+ let channel = device.channel.clone();
+ self.log(
+ timestamp,
+ match &observation {
+ Observation::Reached => DeviceLogEvent::Outbound { channel },
+ Observation::ReachedUs => DeviceLogEvent::Inbound { channel },
+ Observation::Failed(error) => DeviceLogEvent::OutboundFailed {
+ channel,
+ error: error.clone(),
+ },
+ },
+ );
+
+ if let Observation::Failed(error) = observation {
+ // A failed request carries no verified information: what a
+ // confirmed device said about itself must not be replaced by
+ // what an announcement claims.
+ if self.confirmed {
+ return DiscoveryEvent::Updated { device };
+ }
+ self.device = device.clone();
+ return DiscoveryEvent::Unreachable { device, error };
+ }
+
+ let is_new = !self.confirmed;
+ self.confirmed = true;
+ self.device = device.clone();
+ if is_new {
+ DiscoveryEvent::Discovered { device }
+ } else {
+ DiscoveryEvent::Updated { device }
+ }
+ }
+
+ /// Updates the per-direction state of `channel`.
+ ///
+ /// Channels are merged by endpoint: a confirmation over a known address
+ /// replaces its channel (e.g. when the port changed), an unknown address
+ /// adds one.
+ fn update_channel(
+ &mut self,
+ channel: &DeviceChannel,
+ observation: &Observation,
+ timestamp: SystemTime,
+ ) {
+ let same_endpoint = self
+ .channels
+ .keys()
+ .find(|known| known.same_endpoint(channel))
+ .cloned();
+
+ match observation {
+ Observation::Reached => {
+ // The inbound direction is about the address the peer's
+ // requests come from, which did not change.
+ let inbound = same_endpoint
+ .and_then(|known| self.channels.remove(&known))
+ .and_then(|state| state.inbound);
+ self.channels.insert(
+ channel.clone(),
+ ChannelState {
+ outbound: Outbound::Reachable(timestamp),
+ inbound,
+ },
+ );
+ }
+ Observation::ReachedUs => {
+ // What is known about the outbound direction only holds for
+ // the exact channel: the peer may claim another port by now.
+ let outbound =
+ match same_endpoint.and_then(|known| self.channels.remove_entry(&known)) {
+ Some((known, state)) if known == *channel => state.outbound,
+ _ => Outbound::Untested,
+ };
+ self.channels.insert(
+ channel.clone(),
+ ChannelState {
+ outbound,
+ inbound: Some(timestamp),
+ },
+ );
+ }
+ Observation::Failed(_) => {
+ // A failure never replaces a channel: when the address is
+ // known with another port, the failure says nothing about
+ // that one, and is only logged.
+ if same_endpoint.is_none_or(|known| known == *channel) {
+ self.channels
+ .entry(channel.clone())
+ .or_insert(ChannelState {
+ outbound: Outbound::Untested,
+ inbound: None,
+ })
+ .outbound = Outbound::Failed(timestamp);
+ }
+ }
+ }
+ }
+
+ fn log(&mut self, timestamp: SystemTime, event: DeviceLogEvent) {
+ self.logs.push(DeviceLog { timestamp, event });
+ if self.logs.len() > MAX_LOGS {
+ let excess = self.logs.len() - MAX_LOGS;
+ self.logs.drain(..excess);
+ }
}
}
impl DiscoveredDevice {
- /// The device's HTTP channel, when it was confirmed over HTTP.
+ /// The device's HTTP channel, when it was observed over HTTP.
pub fn http(&self) -> Option<&HttpChannel> {
self.channel.http()
}
@@ -172,8 +385,8 @@ pub struct HttpChannel {
pub protocol: ProtocolType,
}
-/// All devices discovered in this run, identified by fingerprint, in
-/// discovery order.
+/// All devices observed in this run, identified by fingerprint, in the order
+/// they were first observed.
pub(super) struct DeviceStore {
devices: Mutex<Vec<StatefulDevice>>,
}
@@ -185,83 +398,123 @@ impl DeviceStore {
}
}
- /// Adds or updates a device, logging the confirmation on it. Returns the
- /// event describing what happened — [`DiscoveryEvent::Discovered`] for a
- /// new device, [`DiscoveryEvent::Updated`] for a known one — and the
- /// stored state after the merge.
+ /// Merges an observation of a device — made on `device.channel`, after
+ /// hearing `announcement` when that is what led to it — into the store,
+ /// logging it on the device. Returns the event describing what happened
+ /// and the stored state after the merge.
///
- /// Channels are merged by endpoint: a rediscovery over a known address
- /// replaces its channel (and makes it available again), an unknown
- /// address adds one.
- pub(super) fn upsert(
+ /// A confirmation ([`Observation::Reached`], [`Observation::ReachedUs`])
+ /// yields [`DiscoveryEvent::Discovered`] the first time and
+ /// [`DiscoveryEvent::Updated`] afterwards. A failure yields `Updated`
+ /// for a confirmed device and [`DiscoveryEvent::Unreachable`] otherwise;
+ /// an unknown device then enters the store unconfirmed.
+ pub(super) fn observe(
&self,
device: DiscoveredDevice,
+ observation: Observation,
+ announcement: Option<Announcement>,
timestamp: SystemTime,
) -> (DiscoveryEvent, StatefulDevice) {
let mut devices = self.devices.lock().unwrap();
- match devices
- .iter_mut()
- .find(|known| known.device.fingerprint == device.fingerprint)
+ let index = match devices
+ .iter()
+ .position(|known| known.device.fingerprint == device.fingerprint)
{
- Some(known) => {
- known
- .channels
- .retain(|channel, _| !channel.same_endpoint(&device.channel));
- known
- .channels
- .insert(device.channel.clone(), ChannelStatus::Available);
-
- known.logs.push(DeviceLog {
- timestamp,
- kind: DeviceLogKind::Updated,
- channel: device.channel.clone(),
- });
- if known.logs.len() > MAX_LOGS {
- let excess = known.logs.len() - MAX_LOGS;
- known.logs.drain(..excess);
- }
-
- let event = DiscoveryEvent::Updated {
- device: device.clone(),
- };
- known.device = device;
- (event, known.clone())
- }
+ Some(index) => index,
None => {
- let known = StatefulDevice {
- channels: HashMap::from([(device.channel.clone(), ChannelStatus::Available)]),
- logs: vec![DeviceLog {
- timestamp,
- kind: DeviceLogKind::Discovered,
- channel: device.channel.clone(),
- }],
+ devices.push(StatefulDevice {
device: device.clone(),
- };
- devices.push(known.clone());
- (DiscoveryEvent::Discovered { device }, known)
+ confirmed: false,
+ channels: HashMap::new(),
+ logs: Vec::new(),
+ });
+ devices.len() - 1
}
+ };
+ let known = &mut devices[index];
+
+ if let Some(announcement) = announcement {
+ known.log(
+ announcement.timestamp,
+ DeviceLogEvent::MulticastInbound {
+ ip: announcement.ip,
+ },
+ );
}
+ let event = known.apply(device, observation, timestamp);
+ (event, known.clone())
+ }
+
+ /// Merges the outcome of a request sent to a known device over
+ /// `channel` into the store, like [`DeviceStore::observe`]. Returns
+ /// `None` when no device has the fingerprint.
+ pub(super) fn report_outbound(
+ &self,
+ fingerprint: &str,
+ channel: DeviceChannel,
+ result: Result<(), String>,
+ timestamp: SystemTime,
+ ) -> Option<DiscoveryEvent> {
+ let mut devices = self.devices.lock().unwrap();
+ let known = devices
+ .iter_mut()
+ .find(|known| known.device.fingerprint == fingerprint)?;
+
+ let device = DiscoveredDevice {
+ channel,
+ ..known.device.clone()
+ };
+ let observation = match result {
+ Ok(()) => Observation::Reached,
+ Err(error) => Observation::Failed(error),
+ };
+ Some(known.apply(device, observation, timestamp))
}
- /// All discovered devices in discovery order.
+ /// All confirmed devices in the order they were first observed.
pub(super) fn devices(&self) -> Vec<StatefulDevice> {
- self.devices.lock().unwrap().clone()
+ self.filtered(|known| known.confirmed)
+ }
+
+ /// The devices that were heard announcing themselves but never
+ /// confirmed, in the order they were first heard.
+ pub(super) fn unconfirmed_devices(&self) -> Vec<StatefulDevice> {
+ self.filtered(|known| !known.confirmed)
}
+ /// The confirmed device with the given fingerprint.
pub(super) fn by_fingerprint(&self, fingerprint: &str) -> Option<StatefulDevice> {
self.devices
.lock()
.unwrap()
.iter()
- .find(|known| known.device.fingerprint == fingerprint)
+ .find(|known| known.confirmed && known.device.fingerprint == fingerprint)
.cloned()
}
+
+ fn filtered(&self, predicate: impl Fn(&StatefulDevice) -> bool) -> Vec<StatefulDevice> {
+ self.devices
+ .lock()
+ .unwrap()
+ .iter()
+ .filter(|known| predicate(known))
+ .cloned()
+ .collect()
+ }
}
#[cfg(test)]
mod tests {
use super::*;
+ fn channel(host: &str, port: u16) -> DeviceChannel {
+ DeviceChannel::Http(HttpChannel {
+ host: host.to_string(),
+ port,
+ protocol: ProtocolType::Https,
+ })
+ }
+
fn device(fingerprint: &str, host: &str) -> DiscoveredDevice {
DiscoveredDevice {
alias: format!("Alias of {fingerprint}"),
@@ -269,50 +522,137 @@ mod tests {
device_model: None,
device_type: Some(DeviceType::Desktop),
fingerprint: fingerprint.to_string(),
- channel: DeviceChannel::Http(HttpChannel {
- host: host.to_string(),
- port: 53317,
- protocol: ProtocolType::Https,
- }),
+ channel: channel(host, 53317),
download: false,
}
}
+ /// This device reached `device`.
+ fn reach(store: &DeviceStore, device: DiscoveredDevice) -> DiscoveryEvent {
+ store
+ .observe(device, Observation::Reached, None, SystemTime::now())
+ .0
+ }
+
+ /// `device` reached this device.
+ fn reached_by(store: &DeviceStore, device: DiscoveredDevice) -> DiscoveryEvent {
+ store
+ .observe(device, Observation::ReachedUs, None, SystemTime::now())
+ .0
+ }
+
+ /// This device could not reach `device`.
+ fn fail(store: &DeviceStore, device: DiscoveredDevice) -> DiscoveryEvent {
+ store
+ .observe(
+ device,
+ Observation::Failed("connection refused".to_string()),
+ None,
+ SystemTime::now(),
+ )
+ .0
+ }
+
fn channel_host(channel: &DeviceChannel) -> &str {
channel.http().unwrap().host.as_str()
}
+ fn state_of(known: &StatefulDevice, host: &str) -> ChannelState {
+ *known
+ .channels
+ .iter()
+ .find(|(channel, _)| channel_host(channel) == host)
+ .unwrap_or_else(|| panic!("no channel for {host}"))
+ .1
+ }
+
+ fn ranked_hosts(known: &StatefulDevice) -> Vec<&str> {
+ known
+ .get_ranked_channels()
+ .into_iter()
+ .map(channel_host)
+ .collect()
+ }
+
/// The marker telling log entries apart: the host the confirmation
/// happened on.
fn log_marker(log: &DeviceLog) -> &str {
- log.channel.http().unwrap().host.as_str()
+ channel_host(log.event.confirmed_channel().unwrap())
}
#[test]
- fn test_upsert_reports_only_the_first_confirmation_as_discovered() {
+ fn test_only_the_first_confirmation_is_reported_as_discovered() {
let store = DeviceStore::new();
- let now = SystemTime::now();
- let (event, _) = store.upsert(device("a", "192.168.0.10"), now);
+ let event = reach(&store, device("a", "192.168.0.10"));
assert!(matches!(event, DiscoveryEvent::Discovered { .. }));
- let (event, _) = store.upsert(device("b", "192.168.0.11"), now);
+ let event = reached_by(&store, device("b", "192.168.0.11"));
assert!(matches!(event, DiscoveryEvent::Discovered { .. }));
- let (event, _) = store.upsert(device("a", "10.0.0.10"), now);
+ let event = reach(&store, device("a", "10.0.0.10"));
+ assert!(matches!(event, DiscoveryEvent::Updated { .. }));
+ let event = reached_by(&store, device("a", "10.0.0.10"));
assert!(matches!(event, DiscoveryEvent::Updated { .. }));
}
#[test]
- fn test_upsert_logs_every_confirmation() {
+ fn test_every_observation_is_logged_with_its_direction() {
let store = DeviceStore::new();
- store.upsert(device("a", "192.168.0.10"), SystemTime::now());
- store.upsert(device("a", "fe80::1%3"), SystemTime::now());
+ reach(&store, device("a", "192.168.0.10"));
+ reached_by(&store, device("a", "fe80::1%3"));
+ fail(&store, device("a", "10.0.0.10"));
- let known = store.by_fingerprint("a").unwrap();
- assert_eq!(known.logs.len(), 2, "every confirmation must be logged");
- assert_eq!(known.logs[0].kind, DeviceLogKind::Discovered);
- assert_eq!(known.logs[1].kind, DeviceLogKind::Updated);
- assert_eq!(log_marker(&known.logs[1]), "fe80::1%3");
+ let events: Vec<DeviceLogEvent> = store
+ .by_fingerprint("a")
+ .unwrap()
+ .logs
+ .into_iter()
+ .map(|log| log.event)
+ .collect();
+ assert_eq!(
+ events,
+ [
+ DeviceLogEvent::Outbound {
+ channel: channel("192.168.0.10", 53317)
+ },
+ DeviceLogEvent::Inbound {
+ channel: channel("fe80::1%3", 53317)
+ },
+ DeviceLogEvent::OutboundFailed {
+ channel: channel("10.0.0.10", 53317),
+ error: "connection refused".to_string(),
+ },
+ ]
+ );
+ }
+
+ #[test]
+ fn test_announcement_is_logged_before_what_it_led_to() {
+ let store = DeviceStore::new();
+ let heard = SystemTime::now();
+ let ip = PeerIp {
+ ip: "192.168.0.10".parse().unwrap(),
+ scope_id: None,
+ };
+
+ store.observe(
+ device("a", "192.168.0.10"),
+ Observation::Reached,
+ Some(Announcement {
+ ip,
+ timestamp: heard,
+ }),
+ SystemTime::now(),
+ );
+
+ let logs = store.by_fingerprint("a").unwrap().logs;
+ assert_eq!(logs.len(), 2);
+ assert_eq!(logs[0].event, DeviceLogEvent::MulticastInbound { ip });
+ assert_eq!(
+ logs[0].timestamp, heard,
+ "the announcement must be logged with the time it was heard"
+ );
+ assert!(matches!(logs[1].event, DeviceLogEvent::Outbound { .. }));
}
#[test]
@@ -320,7 +660,7 @@ mod tests {
let store = DeviceStore::new();
for i in 0..MAX_LOGS + 5 {
- store.upsert(device("a", &i.to_string()), SystemTime::now());
+ reach(&store, device("a", &i.to_string()));
}
let logs = store.by_fingerprint("a").unwrap().logs;
@@ -333,22 +673,74 @@ mod tests {
}
#[test]
- fn test_upsert_collects_channels_of_a_multi_homed_device() {
+ fn test_answered_request_makes_the_channel_reachable() {
+ let store = DeviceStore::new();
+
+ reach(&store, device("a", "192.168.0.10"));
+
+ let state = state_of(&store.by_fingerprint("a").unwrap(), "192.168.0.10");
+ assert!(matches!(state.outbound, Outbound::Reachable(_)));
+ assert_eq!(
+ state.inbound, None,
+ "reaching a device must not claim that it can reach us"
+ );
+ }
+
+ #[test]
+ fn test_incoming_request_leaves_the_outbound_direction_untested() {
+ let store = DeviceStore::new();
+
+ reached_by(&store, device("a", "192.168.0.10"));
+
+ let state = state_of(&store.by_fingerprint("a").unwrap(), "192.168.0.10");
+ assert_eq!(
+ state.outbound,
+ Outbound::Untested,
+ "a device reaching us must not count as reachable"
+ );
+ assert!(state.inbound.is_some());
+ }
+
+ #[test]
+ fn test_directions_of_a_channel_are_tracked_independently() {
let store = DeviceStore::new();
- store.upsert(device("a", "192.168.0.10"), SystemTime::now());
- store.upsert(device("a", "fe80::1%3"), SystemTime::now());
+ reach(&store, device("a", "192.168.0.10"));
+ reached_by(&store, device("a", "192.168.0.10"));
+ let state = state_of(&store.by_fingerprint("a").unwrap(), "192.168.0.10");
+ assert!(
+ matches!(state.outbound, Outbound::Reachable(_)),
+ "an incoming request must keep the proven outbound direction"
+ );
+ assert!(state.inbound.is_some());
+
+ fail(&store, device("a", "192.168.0.10"));
+ let state = state_of(&store.by_fingerprint("a").unwrap(), "192.168.0.10");
+ assert!(matches!(state.outbound, Outbound::Failed(_)));
+ assert!(
+ state.inbound.is_some(),
+ "a failed request must keep the inbound direction"
+ );
+
+ reach(&store, device("a", "192.168.0.10"));
+ let state = state_of(&store.by_fingerprint("a").unwrap(), "192.168.0.10");
+ assert!(
+ matches!(state.outbound, Outbound::Reachable(_)),
+ "an answered request must make a failed channel reachable again"
+ );
+ assert!(state.inbound.is_some());
+ }
+
+ #[test]
+ fn test_channels_of_a_multi_homed_device_are_collected() {
+ let store = DeviceStore::new();
+
+ reach(&store, device("a", "192.168.0.10"));
+ reach(&store, device("a", "fe80::1%3"));
let devices = store.devices();
assert_eq!(devices.len(), 1);
let known = &devices[0];
- assert!(
- known
- .channels
- .values()
- .all(|status| *status == ChannelStatus::Available),
- "a confirmed channel must be available"
- );
let mut hosts: Vec<&str> = known.channels.keys().map(channel_host).collect();
hosts.sort();
assert_eq!(
@@ -364,17 +756,16 @@ mod tests {
}
#[test]
- fn test_upsert_replaces_channel_of_known_endpoint() {
+ fn test_confirmation_replaces_channel_of_known_endpoint() {
let store = DeviceStore::new();
- store.upsert(device("a", "192.168.0.10"), SystemTime::now());
- store.upsert(device("a", "fe80::1%3"), SystemTime::now());
+ reach(&store, device("a", "192.168.0.10"));
+ reached_by(&store, device("a", "192.168.0.10"));
+ reach(&store, device("a", "fe80::1%3"));
let mut update = device("a", "192.168.0.10");
- match &mut update.channel {
- DeviceChannel::Http(http) => http.port = 54000,
- }
- store.upsert(update, SystemTime::now());
+ update.channel = channel("192.168.0.10", 54000);
+ reach(&store, update);
let known = store.by_fingerprint("a").unwrap();
let mut channels: Vec<(&str, u16)> = known
@@ -391,18 +782,184 @@ mod tests {
[("192.168.0.10", 54000), ("fe80::1%3", 53317)],
"a known address must be replaced, not duplicated"
);
+ assert!(
+ state_of(&known, "192.168.0.10").inbound.is_some(),
+ "the inbound direction belongs to the address, not to the port"
+ );
+ }
+
+ #[test]
+ fn test_incoming_request_claiming_another_port_resets_the_outbound_direction() {
+ let store = DeviceStore::new();
+
+ reach(&store, device("a", "192.168.0.10"));
+
+ let mut update = device("a", "192.168.0.10");
+ update.channel = channel("192.168.0.10", 54000);
+ reached_by(&store, update);
+
+ let known = store.by_fingerprint("a").unwrap();
+ assert_eq!(
+ known.channels.keys().collect::<Vec<_>>(),
+ [&channel("192.168.0.10", 54000)],
+ "the claimed port must replace the known one"
+ );
+ assert_eq!(
+ state_of(&known, "192.168.0.10").outbound,
+ Outbound::Untested,
+ "the proof for the old port must not carry over to the new one"
+ );
+ }
+
+ #[test]
+ fn test_failure_does_not_touch_the_same_address_with_another_port() {
+ let store = DeviceStore::new();
+
+ reach(&store, device("a", "192.168.0.10"));
+
+ let mut failed = device("a", "192.168.0.10");
+ failed.channel = channel("192.168.0.10", 54000);
+ fail(&store, failed);
+
+ let known = store.by_fingerprint("a").unwrap();
+ assert_eq!(
+ known.channels.keys().collect::<Vec<_>>(),
+ [&channel("192.168.0.10", 53317)],
+ "a failure must not replace or add a channel for a known address"
+ );
+ assert!(matches!(
+ state_of(&known, "192.168.0.10").outbound,
+ Outbound::Reachable(_)
+ ));
+ assert!(
+ matches!(
+ known.logs.last().unwrap().event,
+ DeviceLogEvent::OutboundFailed { .. }
+ ),
+ "the failure must still be logged"
+ );
+ }
+
+ #[test]
+ fn test_unanswered_device_is_stored_unconfirmed() {
+ let store = DeviceStore::new();
+
+ let event = fail(&store, device("a", "192.168.0.10"));
+ match event {
+ DiscoveryEvent::Unreachable { error, .. } => assert_eq!(error, "connection refused"),
+ other => panic!("expected an Unreachable event, got {other:?}"),
+ }
+
+ assert!(
+ store.devices().is_empty(),
+ "an unconfirmed device must not be listed as discovered"
+ );
+ assert!(store.by_fingerprint("a").is_none());
+
+ let unconfirmed = store.unconfirmed_devices();
+ assert_eq!(unconfirmed.len(), 1);
+ assert!(!unconfirmed[0].confirmed);
+ assert!(matches!(
+ state_of(&unconfirmed[0], "192.168.0.10").outbound,
+ Outbound::Failed(_)
+ ));
}
#[test]
- fn test_get_channel_prefers_the_most_recent_confirmation() {
+ fn test_unconfirmed_device_is_discovered_by_its_first_confirmation() {
let store = DeviceStore::new();
- store.upsert(device("a", "192.168.0.10"), SystemTime::now());
- store.upsert(device("a", "10.0.0.10"), SystemTime::now());
+ fail(&store, device("a", "192.168.0.10"));
+ let event = reached_by(&store, device("a", "192.168.0.10"));
+
+ assert!(
+ matches!(event, DiscoveryEvent::Discovered { .. }),
+ "the first confirmation must discover the device"
+ );
+ assert!(store.unconfirmed_devices().is_empty());
+ let known = store.by_fingerprint("a").unwrap();
+ assert!(known.confirmed);
+ let state = state_of(&known, "192.168.0.10");
+ assert!(
+ matches!(state.outbound, Outbound::Failed(_)),
+ "an incoming request must keep the failed outbound direction"
+ );
+ assert!(state.inbound.is_some());
+ }
+
+ #[test]
+ fn test_failure_does_not_replace_what_a_confirmed_device_said() {
+ let store = DeviceStore::new();
+
+ reach(&store, device("a", "192.168.0.10"));
+
+ let mut claimed = device("a", "10.0.0.10");
+ claimed.alias = "Claimed".to_string();
+ fail(&store, claimed);
+
+ let known = store.by_fingerprint("a").unwrap();
+ assert_eq!(known.device.alias, "Alias of a");
+ assert_eq!(channel_host(&known.device.channel), "192.168.0.10");
+ assert!(
+ matches!(state_of(&known, "10.0.0.10").outbound, Outbound::Failed(_)),
+ "the failed address must still be recorded"
+ );
+ }
+
+ #[test]
+ fn test_reported_outcome_updates_the_channel() {
+ let store = DeviceStore::new();
+ let now = SystemTime::now();
+
+ reach(&store, device("a", "192.168.0.10"));
+
+ let event = store.report_outbound(
+ "a",
+ channel("192.168.0.10", 53317),
+ Err("timed out".to_string()),
+ now,
+ );
+ match event {
+ // The device stays confirmed: only the ranking of its channels
+ // changed.
+ Some(DiscoveryEvent::Updated { device }) => {
+ assert_eq!(device.alias, "Alias of a");
+ assert_eq!(channel_host(&device.channel), "192.168.0.10");
+ }
+ other => panic!("expected an Updated event, got {other:?}"),
+ }
+ let known = store.by_fingerprint("a").unwrap();
+ assert_eq!(
+ state_of(&known, "192.168.0.10").outbound,
+ Outbound::Failed(now)
+ );
+
+ let event = store.report_outbound("a", channel("192.168.0.10", 53317), Ok(()), now);
+ assert!(matches!(event, Some(DiscoveryEvent::Updated { .. })));
+ let known = store.by_fingerprint("a").unwrap();
+ assert_eq!(
+ state_of(&known, "192.168.0.10").outbound,
+ Outbound::Reachable(now)
+ );
+
+ assert!(
+ store
+ .report_outbound("unknown", channel("192.168.0.10", 53317), Ok(()), now)
+ .is_none(),
+ "an outcome for an unknown device must be ignored"
+ );
+ }
+
+ #[test]
+ fn test_ranking_prefers_the_most_recent_confirmation() {
+ let store = DeviceStore::new();
+
+ reach(&store, device("a", "192.168.0.10"));
+ reach(&store, device("a", "10.0.0.10"));
let known = store.by_fingerprint("a").unwrap();
assert_eq!(channel_host(known.get_best_channel().unwrap()), "10.0.0.10");
- store.upsert(device("a", "192.168.0.10"), SystemTime::now());
+ reach(&store, device("a", "192.168.0.10"));
let known = store.by_fingerprint("a").unwrap();
assert_eq!(
channel_host(known.get_best_channel().unwrap()),
@@ -412,11 +969,11 @@ mod tests {
}
#[test]
- fn test_get_channel_prefers_ipv6_over_ipv4() {
+ fn test_ranking_prefers_ipv6_over_ipv4() {
let store = DeviceStore::new();
- store.upsert(device("a", "fe80::1%3"), SystemTime::now());
- store.upsert(device("a", "192.168.0.10"), SystemTime::now());
+ reach(&store, device("a", "fe80::1%3"));
+ reach(&store, device("a", "192.168.0.10"));
let known = store.by_fingerprint("a").unwrap();
assert_eq!(
@@ -427,59 +984,42 @@ mod tests {
}
#[test]
- fn test_get_channel_prefers_available_channels() {
+ fn test_ranking_prefers_reachable_over_untested_over_failed() {
let store = DeviceStore::new();
- store.upsert(device("a", "192.168.0.10"), SystemTime::now());
- store.upsert(device("a", "fe80::1%3"), SystemTime::now());
+ fail(&store, device("a", "fe80::2%3"));
+ reach(&store, device("a", "192.168.0.10"));
+ reached_by(&store, device("a", "fe80::1%3"));
- let mut known = store.by_fingerprint("a").unwrap();
- for (channel, status) in known.channels.iter_mut() {
- if channel_host(channel) == "fe80::1%3" {
- *status = ChannelStatus::NotReachable;
- }
- }
+ let known = store.by_fingerprint("a").unwrap();
assert_eq!(
- channel_host(known.get_best_channel().unwrap()),
- "192.168.0.10",
- "an available IPv4 channel must beat a not-reachable IPv6 one"
+ ranked_hosts(&known),
+ ["192.168.0.10", "fe80::1%3", "fe80::2%3"],
+ "a proven IPv4 channel must beat a more recent IPv6 one that only reached us"
);
}
#[test]
- fn test_get_channels_sorts_best_first() {
+ fn test_ranking_sorts_best_first() {
let store = DeviceStore::new();
- store.upsert(device("a", "192.168.0.10"), SystemTime::now());
- store.upsert(device("a", "10.0.0.10"), SystemTime::now());
- store.upsert(device("a", "fe80::1%3"), SystemTime::now());
+ reach(&store, device("a", "192.168.0.10"));
+ reach(&store, device("a", "10.0.0.10"));
+ reach(&store, device("a", "fe80::1%3"));
- let mut known = store.by_fingerprint("a").unwrap();
- let hosts: Vec<&str> = known
- .get_ranked_channels()
- .into_iter()
- .map(channel_host)
- .collect();
+ let known = store.by_fingerprint("a").unwrap();
assert_eq!(
- hosts,
+ ranked_hosts(&known),
["fe80::1%3", "10.0.0.10", "192.168.0.10"],
"IPv6 must come first, then the more recent IPv4 confirmation"
);
- for (channel, status) in known.channels.iter_mut() {
- if channel_host(channel) == "fe80::1%3" {
- *status = ChannelStatus::NotReachable;
- }
- }
- let hosts: Vec<&str> = known
- .get_ranked_channels()
- .into_iter()
- .map(channel_host)
- .collect();
+ fail(&store, device("a", "fe80::1%3"));
+ let known = store.by_fingerprint("a").unwrap();
assert_eq!(
- hosts,
+ ranked_hosts(&known),
["10.0.0.10", "192.168.0.10", "fe80::1%3"],
- "a not-reachable channel must sort last"
+ "a failed channel must sort last"
);
}
@@ -487,9 +1027,9 @@ mod tests {
fn test_devices_keep_discovery_order() {
let store = DeviceStore::new();
- store.upsert(device("a", "192.168.0.10"), SystemTime::now());
- store.upsert(device("b", "192.168.0.11"), SystemTime::now());
- store.upsert(device("a", "192.168.0.12"), SystemTime::now());
+ reach(&store, device("a", "192.168.0.10"));
+ reach(&store, device("b", "192.168.0.11"));
+ reach(&store, device("a", "192.168.0.12"));
let fingerprints: Vec<String> = store
.devices()
diff --git a/packages/core/src/http/client/mod.rs b/packages/core/src/http/client/mod.rs
index b1aed771..0bc87cce 100644
--- a/packages/core/src/http/client/mod.rs
+++ b/packages/core/src/http/client/mod.rs
@@ -49,6 +49,20 @@ pub enum ClientError {
Cancelled,
}
+impl ClientError {
+ /// Whether the request got no response: the connection could not be
+ /// established (refused, timed out, failed TLS handshake) or broke
+ /// before the peer answered.
+ ///
+ /// `false` for every error that leaves open whether the peer was
+ /// reached, and for a peer that answered with an error status or with a
+ /// body that could not be read: it was reached just as well as one that
+ /// answered properly.
+ pub fn is_unreachable(&self) -> bool {
+ matches!(self, ClientError::Reqwest(err) if !err.is_body() && !err.is_decode())
+ }
+}
+
impl LsHttpClient {
/// Creates a client for the given protocol version.
///
diff --git a/packages/core/tests/discovery.rs b/packages/core/tests/discovery.rs
index cc4d1d9d..519a96c2 100644
--- a/packages/core/tests/discovery.rs
+++ b/packages/core/tests/discovery.rs
@@ -10,7 +10,8 @@
use localsend::crypto::cert::generate_self_signed;
use localsend::discovery::{
- self, DeviceIdentity, DiscoveryConfig, DiscoveryEvent, DiscoveryHandle,
+ self, DeviceChannel, DeviceIdentity, DeviceLogEvent, DiscoveredDevice, DiscoveryConfig,
+ DiscoveryEvent, DiscoveryHandle, HttpChannel, Outbound,
};
use localsend::http::server::web::WebConfig;
use localsend::http::server::{start_with_port, ServerConfigV2, TlsConfig};
@@ -94,20 +95,50 @@ struct TestInstance {
impl TestInstance {
/// Waits for the discovery of the device with the given fingerprint,
/// ignoring unrelated devices that may be on the network.
- async fn next_discovery(
+ async fn next_discovery(&mut self, fingerprint: &str) -> Option<DiscoveredDevice> {
+ self.next_device(fingerprint, |event| match event {
+ DiscoveryEvent::Discovered { device } => Some(device),
+ _ => None,
+ })
+ .await
+ }
+
+ /// Waits for a re-confirmation of the device with the given fingerprint,
+ /// ignoring unrelated devices that may be on the network.
+ async fn next_update(&mut self, fingerprint: &str) -> Option<DiscoveredDevice> {
+ self.next_device(fingerprint, |event| match event {
+ DiscoveryEvent::Updated { device } => Some(device),
+ _ => None,
+ })
+ .await
+ }
+
+ /// Waits for a failed request to the unconfirmed device with the given
+ /// fingerprint, ignoring unrelated devices that may be on the network.
+ async fn next_unreachable(&mut self, fingerprint: &str) -> Option<DiscoveredDevice> {
+ self.next_device(fingerprint, |event| match event {
+ DiscoveryEvent::Unreachable { device, .. } => Some(device),
+ _ => None,
+ })
+ .await
+ }
+
+ /// Waits for an event that `pick` accepts and that is about the device
+ /// with the given fingerprint.
+ async fn next_device(
&mut self,
fingerprint: &str,
- ) -> Option<localsend::discovery::DiscoveredDevice> {
+ pick: impl Fn(DiscoveryEvent) -> Option<DiscoveredDevice>,
+ ) -> Option<DiscoveredDevice> {
let deadline = tokio::time::Instant::now() + RECEIVE_TIMEOUT;
loop {
let event = tokio::time::timeout_at(deadline, self.events.recv())
.await
.ok()??;
- let DiscoveryEvent::Discovered { device } = event else {
- continue;
- };
- if device.fingerprint == fingerprint {
- return Some(device);
+ if let Some(device) = pick(event) {
+ if device.fingerprint == fingerprint {
+ return Some(device);
+ }
}
}
}
@@ -453,3 +484,266 @@ async fn test_announcement_is_answered_and_device_stored() {
"answering over HTTP must not make the receiver appear on the announcer's side"
);
}
+
+/// A device as the application reports it after the device sent a request to
+/// this device's server from 127.0.0.1, claiming to serve on `port`.
+fn inbound_peer(port: u16) -> DiscoveredDevice {
+ DiscoveredDevice {
+ alias: "Peer".to_string(),
+ version: PROTOCOL_VERSION_V2.to_string(),
+ device_model: None,
+ device_type: None,
+ fingerprint: "peer-fingerprint".to_string(),
+ channel: DeviceChannel::Http(HttpChannel {
+ host: "127.0.0.1".to_string(),
+ port,
+ protocol: ProtocolType::Http,
+ }),
+ download: false,
+ }
+}
+
+#[tokio::test]
+async fn test_inbound_device_is_dialed_back() {
+ let multicast_port = NEXT_MULTICAST_PORT.fetch_add(1, Ordering::Relaxed);
+ let (server_port, _server_stop) = start_register_server("Peer", "peer-fingerprint", None).await;
+
+ let Some(mut instance) = start_instance("Host", multicast_port, announce_port()).await else {
+ return skip("no network interface available for multicast");
+ };
+
+ // The peer registered with this device's server.
+ let peer = inbound_peer(server_port);
+ let channel = peer.channel.clone();
+ let is_new = instance.handle.observe_inbound(peer).await;
+ assert!(is_new, "a device reaching us must be discovered");
+ instance
+ .next_discovery("peer-fingerprint")
+ .await
+ .expect("The inbound device must be emitted");
+
+ // Its request says nothing about the way back, which is why the peer is
+ // dialed back on its own.
+ let dialed = instance
+ .next_update("peer-fingerprint")
+ .await
+ .expect("The answer to the dial-back must be emitted");
+ assert_eq!(dialed.channel, channel);
+
+ let stored = instance
+ .handle
+ .device_by_fingerprint("peer-fingerprint")
+ .expect("The inbound device must be stored");
+ let state = stored.channels[&channel];
+ assert!(matches!(state.outbound, Outbound::Reachable(_)));
+ assert!(
+ state.inbound.is_some(),
+ "dialing back must keep the inbound direction"
+ );
+ assert_eq!(stored.channels.len(), 1);
+ assert_eq!(
+ stored
+ .logs
+ .iter()
+ .map(|log| log.event.clone())
+ .collect::<Vec<_>>(),
+ vec![
+ DeviceLogEvent::Inbound {
+ channel: channel.clone()
+ },
+ DeviceLogEvent::Outbound { channel },
+ ],
+ );
+}
+
+#[tokio::test]
+async fn test_inbound_device_that_cannot_be_dialed_back_is_marked_as_failed() {
+ let multicast_port = NEXT_MULTICAST_PORT.fetch_add(1, Ordering::Relaxed);
+
+ let Some(mut instance) = start_instance("Host", multicast_port, announce_port()).await else {
+ return skip("no network interface available for multicast");
+ };
+
+ // The peer claims a port that nobody listens on, like a device whose
+ // server is blocked by a firewall.
+ let peer = inbound_peer(announce_port());
+ let channel = peer.channel.clone();
+ instance.handle.observe_inbound(peer).await;
+ instance
+ .next_discovery("peer-fingerprint")
+ .await
+ .expect("The inbound device must be emitted");
+
+ let failed = instance
+ .next_update("peer-fingerprint")
+ .await
+ .expect("The failed dial-back must be emitted");
+ assert_eq!(failed.channel, channel);
+
+ let stored = instance
+ .handle
+ .device_by_fingerprint("peer-fingerprint")
+ .expect("A device that reached us must stay confirmed");
+ let state = stored.channels[&channel];
+ assert!(matches!(state.outbound, Outbound::Failed(_)));
+ assert!(state.inbound.is_some());
+ assert!(instance.handle.unconfirmed_devices().is_empty());
+}
+
+#[tokio::test]
+async fn test_inbound_device_is_not_dialed_back_on_a_tested_channel() {
+ let multicast_port = NEXT_MULTICAST_PORT.fetch_add(1, Ordering::Relaxed);
+ let (server_port, _server_stop) = start_register_server("Peer", "peer-fingerprint", None).await;
+
+ let Some(instance) = start_instance("Host", multicast_port, announce_port()).await else {
+ return skip("no network interface available for multicast");
+ };
+
+ // The peer was dialed before it reached us, like a device answering a
+ // register request with one of its own: answering that one again would
+ // go back and forth forever.
+ instance
+ .handle
+ .discover("127.0.0.1", server_port, ProtocolType::Http)
+ .await
+ .expect("Targeted discovery failed")
+ .expect("The peer must not be mistaken for the device itself");
+
+ let peer = inbound_peer(server_port);
+ let channel = peer.channel.clone();
+ let is_new = instance.handle.observe_inbound(peer).await;
+ assert!(!is_new);
+
+ // A dial-back over loopback would be answered long before this.
+ tokio::time::sleep(Duration::from_millis(200)).await;
+
+ let stored = instance
+ .handle
+ .device_by_fingerprint("peer-fingerprint")
+ .expect("The peer must be stored");
+ assert_eq!(
+ stored
+ .logs
+ .iter()
+ .map(|log| log.event.clone())
+ .collect::<Vec<_>>(),
+ vec![
+ DeviceLogEvent::Outbound {
+ channel: channel.clone()
+ },
+ DeviceLogEvent::Inbound { channel },
+ ],
+ "a channel that was dialed before must not be dialed again"
+ );
+}
+
+#[tokio::test]
+async fn test_reported_failure_marks_the_channel_and_is_emitted() {
+ let multicast_port = NEXT_MULTICAST_PORT.fetch_add(1, Ordering::Relaxed);
+ let (server_port, _server_stop) =
+ start_register_server("Target", "target-fingerprint", None).await;
+
+ let Some(mut instance) = start_instance("Finder", multicast_port, announce_port()).await else {
+ return skip("no network interface available for multicast");
+ };
+
+ let device = instance
+ .handle
+ .discover("127.0.0.1", server_port, ProtocolType::Http)
+ .await
+ .expect("Targeted discovery failed")
+ .expect("The target must not be mistaken for the device itself");
+ let channel = device.device.channel.clone();
+
+ assert!(instance.handle.report_outbound(
+ "target-fingerprint",
+ channel.clone(),
+ Err("connection refused".to_string()),
+ ));
+
+ let failed = instance
+ .next_update("target-fingerprint")
+ .await
+ .expect("The failure must be emitted");
+ assert_eq!(failed.channel, channel);
+
+ let stored = instance
+ .handle
+ .device_by_fingerprint("target-fingerprint")
+ .expect("A failure must not remove a confirmed device");
+ assert!(matches!(
+ stored.channels[&channel].outbound,
+ Outbound::Failed(_)
+ ));
+ assert!(instance.handle.unconfirmed_devices().is_empty());
+
+ assert!(
+ !instance
+ .handle
+ .report_outbound("unknown-fingerprint", channel, Ok(())),
+ "an outcome for an unknown device must be rejected"
+ );
+}
+
+#[tokio::test]
+async fn test_unanswered_announcement_is_stored_unconfirmed() {
+ let multicast_port = NEXT_MULTICAST_PORT.fetch_add(1, Ordering::Relaxed);
+
+ let Some(mut receiver) = start_instance("Receiver", multicast_port, announce_port()).await
+ else {
+ return skip("no network interface available for multicast");
+ };
+ // The announcer advertises a port that nobody listens on, like a device
+ // whose server is blocked by a firewall.
+ let Some(announcer) = start_instance("Announcer", multicast_port, announce_port()).await else {
+ return skip("no network interface available for multicast");
+ };
+
+ announcer.handle.announce().await;
+
+ let Some(device) = receiver.next_unreachable(&announcer.fingerprint).await else {
+ return skip("multicast traffic is not delivered on this machine");
+ };
+ assert_eq!(device.alias, "Announcer");
+
+ assert!(
+ receiver
+ .handle
+ .device_by_fingerprint(&announcer.fingerprint)
+ .is_none(),
+ "a device that did not answer must not be discovered"
+ );
+ assert!(receiver
+ .handle
+ .devices()
+ .iter()
+ .all(|known| known.device.fingerprint != announcer.fingerprint));
+
+ let unconfirmed = receiver
+ .handle
+ .unconfirmed_devices()
+ .into_iter()
+ .find(|known| known.device.fingerprint == announcer.fingerprint)
+ .expect("The device that did not answer must be kept for diagnostics");
+ assert!(!unconfirmed.confirmed);
+ assert!(
+ unconfirmed.channels.values().all(|state| {
+ matches!(state.outbound, Outbound::Failed(_)) && state.inbound.is_none()
+ }),
+ "every address the device announced from must be marked as failed"
+ );
+ assert!(
+ unconfirmed
+ .logs
+ .iter()
+ .any(|log| matches!(log.event, DeviceLogEvent::MulticastInbound { .. })),
+ "the heard announcement must be logged"
+ );
+ assert!(
+ unconfirmed
+ .logs
+ .iter()
+ .any(|log| matches!(log.event, DeviceLogEvent::OutboundFailed { .. })),
+ "the failed register request must be logged"
+ );
+}
diff --git a/packages/localsend_isolates/lib/model/device.dart b/packages/localsend_isolates/lib/model/device.dart
index 8665ce59..820d4fa9 100644
--- a/packages/localsend_isolates/lib/model/device.dart
+++ b/packages/localsend_isolates/lib/model/device.dart
@@ -17,7 +17,23 @@ sealed class DeviceChannel with DeviceChannelMappable {
const DeviceChannel();
}
-/// The device's HTTP server, reachable at one address.
+/// Whether a device can be dialed on a [HttpChannel].
+@MappableEnum()
+enum ChannelOutbound {
+ /// No request was sent over the channel yet: the device reached this
+ /// device from it, which says nothing about the way back.
+ untested,
+
+ /// The last request over the channel was answered.
+ reachable,
+
+ /// The last request over the channel failed.
+ failed,
+}
+
+/// The device's HTTP server at one address, with what is known about each
+/// direction: a channel that works one way does not have to work the other
+/// way (e.g. because of a firewall on one of the devices).
@MappableClass()
class HttpChannel extends DeviceChannel with HttpChannelMappable {
/// The host to dial: an IP address, or the scoped form `fe80::1%3` for
@@ -30,7 +46,20 @@ class HttpChannel extends DeviceChannel with HttpChannelMappable {
/// Whether the HTTP server uses TLS.
final bool https;
- const HttpChannel({required this.host, required this.port, required this.https});
+ /// This device → the peer: whether the peer can be dialed at this address.
+ final ChannelOutbound outbound;
+
+ /// The peer → this device: when the peer last reached this device's server
+ /// from this address. `null` when it never did.
+ final DateTime? inbound;
+
+ const HttpChannel({
+ required this.host,
+ required this.port,
+ required this.https,
+ this.outbound = ChannelOutbound.untested,
+ this.inbound,
+ });
}
/// The device is reachable over WebRTC through a signaling server.
@@ -41,29 +70,61 @@ class SignalingChannel extends DeviceChannel with SignalingChannelMappable {
const SignalingChannel({required this.signalingServer});
}
-/// Whether a [DeviceLog] discovered the device or re-confirmed it.
-enum DeviceLogKind {
- discovered,
- updated,
-}
-
-/// One retained confirmation of a stored device, for the device details UI.
+/// One retained observation of a stored device, for the device details UI.
class DeviceLog {
- /// When the confirmation happened.
+ /// When the observation happened.
final DateTime timestamp;
- final DeviceLogKind kind;
-
- /// The channel the confirmation happened on.
- final HttpChannel channel;
+ final DeviceLogEvent event;
const DeviceLog({
required this.timestamp,
- required this.kind,
- required this.channel,
+ required this.event,
});
}
+/// What was observed about a device, and in which direction.
+///
+/// The channels only identify an address: their direction state is not set.
+sealed class DeviceLogEvent {
+ const DeviceLogEvent();
+}
+
+/// This device → the peer: a request over the channel was answered.
+class DeviceLogOutbound extends DeviceLogEvent {
+ final HttpChannel channel;
+
+ const DeviceLogOutbound({required this.channel});
+}
+
+/// This device → the peer: a request over the channel failed.
+class DeviceLogOutboundFailed extends DeviceLogEvent {
+ final HttpChannel channel;
+
+ /// Why the request failed, for display.
+ final String error;
+
+ const DeviceLogOutboundFailed({required this.channel, required this.error});
+}
+
+/// The peer → this device: the peer sent a request to this device's server.
+/// The channel is the address the request came from, with the port the peer
+/// claims to serve on.
+class DeviceLogInbound extends DeviceLogEvent {
+ final HttpChannel channel;
+
+ const DeviceLogInbound({required this.channel});
+}
+
+/// The peer → this device: an announcement of the peer was heard.
+class DeviceLogMulticastInbound extends DeviceLogEvent {
+ /// The address the announcement came from, in the scoped form `fe80::1%3`
+ /// for link-local IPv6.
+ final String host;
+
+ const DeviceLogMulticastInbound({required this.host});
+}
+
enum TransmissionMethod {
http('HTTP'),
webrtc('WebRTC')
@@ -94,7 +155,7 @@ class Device with DeviceMappable {
final DeviceType deviceType;
final bool download;
- /// Every channel the device was confirmed on, best first.
+ /// Every channel the device was observed on, best first.
final List<DeviceChannel> channels;
Set<TransmissionMethod> get transmissionMethods {
diff --git a/packages/localsend_isolates/lib/model/device.mapper.dart b/packages/localsend_isolates/lib/model/device.mapper.dart
index a48255e1..d9c81f12 100644
--- a/packages/localsend_isolates/lib/model/device.mapper.dart
+++ b/packages/localsend_isolates/lib/model/device.mapper.dart
@@ -66,6 +66,56 @@ extension DeviceTypeMapperExtension on DeviceType {
}
}
+class ChannelOutboundMapper extends EnumMapper<ChannelOutbound> {
+ ChannelOutboundMapper._();
+
+ static ChannelOutboundMapper? _instance;
+ static ChannelOutboundMapper ensureInitialized() {
+ if (_instance == null) {
+ MapperContainer.globals.use(_instance = ChannelOutboundMapper._());
+ }
+ return _instance!;
+ }
+
+ static ChannelOutbound fromValue(dynamic value) {
+ ensureInitialized();
+ return MapperContainer.globals.fromValue(value);
+ }
+
+ @override
+ ChannelOutbound decode(dynamic value) {
+ switch (value) {
+ case r'untested':
+ return ChannelOutbound.untested;
+ case r'reachable':
+ return ChannelOutbound.reachable;
+ case r'failed':
+ return ChannelOutbound.failed;
+ default:
+ throw MapperException.unknownEnumValue(value);
+ }
+ }
+
+ @override
+ dynamic encode(ChannelOutbound self) {
+ switch (self) {
+ case ChannelOutbound.untested:
+ return r'untested';
+ case ChannelOutbound.reachable:
+ return r'reachable';
+ case ChannelOutbound.failed:
+ return r'failed';
+ }
+ }
+}
+
+extension ChannelOutboundMapperExtension on ChannelOutbound {
+ String toValue() {
+ ChannelOutboundMapper.ensureInitialized();
+ return MapperContainer.globals.toValue<ChannelOutbound>(this) as String;
+ }
+}
+
class DeviceChannelMapper extends ClassMapperBase<DeviceChannel> {
DeviceChannelMapper._();
@@ -122,6 +172,7 @@ class HttpChannelMapper extends ClassMapperBase<HttpChannel> {
if (_instance == null) {
MapperContainer.globals.use(_instance = HttpChannelMapper._());
DeviceChannelMapper.ensureInitialized();
+ ChannelOutboundMapper.ensureInitialized();
}
return _instance!;
}
@@ -135,12 +186,27 @@ class HttpChannelMapper extends ClassMapperBase<HttpChannel> {
static const Field<HttpChannel, int> _f$port = Field('port', _$port);
static bool _$https(HttpChannel v) => v.https;
static const Field<HttpChannel, bool> _f$https = Field('https', _$https);
+ static ChannelOutbound _$outbound(HttpChannel v) => v.outbound;
+ static const Field<HttpChannel, ChannelOutbound> _f$outbound = Field(
+ 'outbound',
+ _$outbound,
+ opt: true,
+ def: ChannelOutbound.untested,
+ );
+ static DateTime? _$inbound(HttpChannel v) => v.inbound;
+ static const Field<HttpChannel, DateTime> _f$inbound = Field(
+ 'inbound',
+ _$inbound,
+ opt: true,
+ );
@override
final MappableFields<HttpChannel> fields = const {
#host: _f$host,
#port: _f$port,
#https: _f$https,
+ #outbound: _f$outbound,
+ #inbound: _f$inbound,
};
static HttpChannel _instantiate(DecodingData data) {
@@ -148,6 +214,8 @@ class HttpChannelMapper extends ClassMapperBase<HttpChannel> {
host: data.dec(_f$host),
port: data.dec(_f$port),
https: data.dec(_f$https),
+ outbound: data.dec(_f$outbound),
+ inbound: data.dec(_f$inbound),
);
}
@@ -212,7 +280,13 @@ extension HttpChannelValueCopy<$R, $Out>
abstract class HttpChannelCopyWith<$R, $In extends HttpChannel, $Out>
implements DeviceChannelCopyWith<$R, $In, $Out> {
@override
- $R call({String? host, int? port, bool? https});
+ $R call({
+ String? host,
+ int? port,
+ bool? https,
+ ChannelOutbound? outbound,
+ DateTime? inbound,
+ });
HttpChannelCopyWith<$R2, $In, $Out2> $chain<$R2, $Out2>(Then<$Out2, $R2> t);
}
@@ -225,11 +299,19 @@ class _HttpChannelCopyWithImpl<$R, $Out>
late final ClassMapperBase<HttpChannel> $mapper =
HttpChannelMapper.ensureInitialized();
@override
- $R call({String? host, int? port, bool? https}) => $apply(
+ $R call({
+ String? host,
+ int? port,
+ bool? https,
+ ChannelOutbound? outbound,
+ Object? inbound = $none,
+ }) => $apply(
FieldCopyWithData({
if (host != null) #host: host,
if (port != null) #port: port,
if (https != null) #https: https,
+ if (outbound != null) #outbound: outbound,
+ if (inbound != $none) #inbound: inbound,
}),
);
@override
@@ -237,6 +319,8 @@ class _HttpChannelCopyWithImpl<$R, $Out>
host: data.get(#host, or: $value.host),
port: data.get(#port, or: $value.port),
https: data.get(#https, or: $value.https),
+ outbound: data.get(#outbound, or: $value.outbound),
+ inbound: data.get(#inbound, or: $value.inbound),
);
@override
diff --git a/packages/localsend_isolates/lib/model/discovery_event.dart b/packages/localsend_isolates/lib/model/discovery_event.dart
new file mode 100644
index 00000000..6502a2e7
--- /dev/null
+++ b/packages/localsend_isolates/lib/model/discovery_event.dart
@@ -0,0 +1,31 @@
+import 'package:localsend_isolates/model/device.dart';
+
+/// An event of the running discovery.
+sealed class DiscoveryEvent {
+ const DiscoveryEvent();
+}
+
+/// The state of a confirmed device changed: it was discovered or confirmed
+/// again, or a request to it failed. Carries the merged state, so the device
+/// re-appears with everything known about its channels so far.
+class DiscoveryDeviceEvent extends DiscoveryEvent {
+ final Device device;
+
+ const DiscoveryDeviceEvent({required this.device});
+}
+
+/// A device was heard announcing itself but did not answer the register
+/// request, typically because a firewall blocks its server.
+///
+/// Nothing about such a device is verified (announcements are
+/// unauthenticated): it is for diagnostics only and must not be offered as a
+/// transfer target.
+class DiscoveryUnreachableEvent extends DiscoveryEvent {
+ /// The device as its announcements claim it.
+ final Device device;
+
+ /// Why the most recent register request failed, for display.
+ final String error;
+
+ const DiscoveryUnreachableEvent({required this.device, required this.error});
+}
diff --git a/packages/localsend_isolates/lib/rust/api/discovery.dart b/packages/localsend_isolates/lib/rust/api/discovery.dart
index 401d2087..7e3c53cb 100644
--- a/packages/localsend_isolates/lib/rust/api/discovery.dart
+++ b/packages/localsend_isolates/lib/rust/api/discovery.dart
@@ -4,10 +4,13 @@
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
+import 'package:freezed_annotation/freezed_annotation.dart' hide protected;
import 'package:localsend_isolates/rust/api/model.dart';
import 'package:localsend_isolates/rust/frb_generated.dart';
-// These functions are ignored because they are not marked as `pub`: `rs_device_log`, `rs_stored_device`, `stop`
+part 'discovery.freezed.dart';
+
+// These functions are ignored because they are not marked as `pub`: `merged_event`, `millis_since_epoch`, `rs_device_channel`, `rs_device_log`, `rs_stored_channel`, `rs_stored_device`, `stop`, `unconfirmed_device`
// These types are ignored because they are neither used by any `pub` functions nor (for structs and enums) marked `#[frb(unignore)]`: `DiscoveryInstance`
/// Starts the discovery: binds the UDP multicast sockets on all usable
@@ -27,8 +30,8 @@ import 'package:localsend_isolates/rust/frb_generated.dart';
/// Cannot fail besides an invalid [group]: when no multicast socket could be
/// bound (e.g. the port is taken by another process), discovery still runs
/// without multicast — see [RsDiscovery::multicast_error] — and still learns
-/// about devices through [RsDiscovery::discover], [RsDiscovery::scan_subnet]
-/// and [RsDiscovery::add_device].
+/// about devices through [RsDiscovery::discover_staged],
+/// [RsDiscovery::scan_subnet] and [RsDiscovery::observe_inbound].
Future<RsDiscovery> startDiscovery({
required String group,
required int port,
@@ -63,23 +66,18 @@ Future<RsDiscovery> startDiscovery({
// Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<RsDiscovery>>
abstract class RsDiscovery implements RustOpaqueInterface {
- /// Puts a device confirmed outside of the discovery into the store, e.g.
- /// one that answered an announcement by registering with this device's
- /// HTTP server. The device is emitted on [RsDiscovery::listen].
- Future<void> addDevice({required RsDiscoveredDevice device});
-
/// Announces this device to the network, which makes every other LocalSend
/// device on it register with this device over HTTP.
///
/// Devices registering in response arrive at the application as server
- /// events, not here: feed them back via [RsDiscovery::add_device].
+ /// events, not here: feed them back via [RsDiscovery::observe_inbound].
///
/// Returns once the whole announcement burst has been sent, which takes a
/// few seconds, or immediately once the discovery has been stopped or
/// multicast is unavailable.
Future<void> announce();
- /// The retained confirmations of a stored device, oldest first, capped at
+ /// The retained observations of a stored device, oldest first, capped at
/// the store's log limit. Empty when the fingerprint is unknown.
Future<List<RsDeviceLog>> deviceLogs({required String fingerprint});
@@ -101,8 +99,8 @@ abstract class RsDiscovery implements RustOpaqueInterface {
required BigInt graceMs,
});
- /// Emits a [RsStoredDevice] for every device confirmation until the
- /// discovery is stopped. Can only be listened to once.
+ /// Emits a [RsDiscoveryEvent] for every observation of a device until
+ /// the discovery is stopped. Can only be listened to once.
///
/// Also ends when the multicast sockets failed permanently (e.g. because
/// the OS invalidated them while the application was suspended): the
@@ -111,12 +109,33 @@ abstract class RsDiscovery implements RustOpaqueInterface {
///
/// Also returns when the Dart side of the stream is gone (e.g. after a
/// hot restart), so this call does not keep the discovery alive forever.
- Stream<RsStoredDevice> listen();
+ Stream<RsDiscoveryEvent> listen();
/// The reason the multicast sockets could not be bound, when they could
/// not. Discovery then neither hears nor sends announcements.
Future<String?> multicastError();
+ /// Puts a device that reached this device's HTTP server into the store,
+ /// e.g. one that answered an announcement by registering. The device is
+ /// emitted on [RsDiscovery::listen].
+ ///
+ /// Only the inbound direction of the address is confirmed: an address
+ /// new to the device is stored with [RsOutbound::Untested] and dialed
+ /// back in the background, whose outcome is emitted as well.
+ Future<void> observeInbound({required RsDiscoveredDevice device});
+
+ /// Records the outcome of a request the application sent to a stored
+ /// device over [channel], e.g. a transfer: without an [error] the channel
+ /// becomes [RsOutbound::Reachable], with one — the reason, for display —
+ /// it becomes [RsOutbound::Failed], which ranks it behind the device's
+ /// other channels. The device is emitted on [RsDiscovery::listen].
+ ///
+ /// Only report failures to reach the device at all, not requests that
+ /// the device answered with an error.
+ ///
+ /// Returns `false` when no device has the fingerprint.
+ Future<bool> reportOutbound({required String fingerprint, required RsDeviceChannel channel, String? error});
+
/// Scans the `/24` subnet of the local interface address [interface_ip]
/// by sending every other host a register request, for networks that do
/// not carry multicast.
@@ -140,12 +159,7 @@ abstract class RsDiscovery implements RustOpaqueInterface {
Future<void> stop();
}
-enum DeviceLogKind {
- discovered,
- updated,
-}
-
-/// An address a stored device was confirmed on and is dialed at.
+/// The address of a device's HTTP server.
class RsDeviceChannel {
/// The host to dial: an IP address, or the scoped form `fe80::1%3` for
/// link-local IPv6 (the Rust HTTP client accepts both back as a host).
@@ -170,39 +184,62 @@ class RsDeviceChannel {
other is RsDeviceChannel && runtimeType == other.runtimeType && host == other.host && port == other.port && protocol == other.protocol;
}
-/// One retained confirmation of a stored device, for the device details UI.
+/// One retained observation of a stored device, for the device details UI.
class RsDeviceLog {
- /// When the confirmation happened, in milliseconds since the Unix epoch.
+ /// When the observation happened, in milliseconds since the Unix epoch.
final BigInt timestampMillis;
-
- /// Whether the confirmation discovered the device or re-confirmed it.
- final DeviceLogKind kind;
-
- /// The channel the confirmation happened on.
- final RsDeviceChannel channel;
+ final RsDeviceLogEvent event;
const RsDeviceLog({
required this.timestampMillis,
- required this.kind,
- required this.channel,
+ required this.event,
});
@override
- int get hashCode => timestampMillis.hashCode ^ kind.hashCode ^ channel.hashCode;
+ int get hashCode => timestampMillis.hashCode ^ event.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
- other is RsDeviceLog &&
- runtimeType == other.runtimeType &&
- timestampMillis == other.timestampMillis &&
- kind == other.kind &&
- channel == other.channel;
+ other is RsDeviceLog && runtimeType == other.runtimeType && timestampMillis == other.timestampMillis && event == other.event;
+}
+
+@freezed
+sealed class RsDeviceLogEvent with _$RsDeviceLogEvent {
+ const RsDeviceLogEvent._();
+
+ /// This device → the peer: a request over the channel was answered.
+ const factory RsDeviceLogEvent.outbound({
+ required RsDeviceChannel channel,
+ }) = RsDeviceLogEvent_Outbound;
+
+ /// This device → the peer: a request over the channel failed.
+ const factory RsDeviceLogEvent.outboundFailed({
+ required RsDeviceChannel channel,
+
+ /// Why the request failed, for display.
+ required String error,
+ }) = RsDeviceLogEvent_OutboundFailed;
+
+ /// The peer → this device: the peer sent a request to this device's
+ /// server. The channel is the address the request came from, with the
+ /// port the peer claims to serve on.
+ const factory RsDeviceLogEvent.inbound({
+ required RsDeviceChannel channel,
+ }) = RsDeviceLogEvent_Inbound;
+
+ /// The peer → this device: an announcement of the peer was heard.
+ const factory RsDeviceLogEvent.multicastInbound({
+ /// The address the announcement came from, in the scoped form
+ /// `fe80::1%3` for link-local IPv6.
+ required String host,
+ }) = RsDeviceLogEvent_MulticastInbound;
}
-/// A single device confirmation over HTTP, fed into the store via
-/// [RsDiscovery::add_device]: the device's register request was accepted by
-/// our server, so it is known to be reachable at [RsDiscoveredDevice::host].
+/// A device that reached this device's HTTP server, fed into the store via
+/// [RsDiscovery::observe_inbound]: its request arrived from
+/// [RsDiscoveredDevice::host], which says nothing about whether it can be
+/// dialed back there.
class RsDiscoveredDevice {
final String alias;
@@ -214,12 +251,12 @@ class RsDiscoveredDevice {
/// Fingerprint identifying the device; devices are deduplicated by it.
final String fingerprint;
- /// The host the device was confirmed on: an IP address, or the scoped
- /// form `fe80::1%3` for link-local IPv6 (the Rust HTTP client accepts
- /// both back as a host).
+ /// The host the request came from: an IP address, or the scoped form
+ /// `fe80::1%3` for link-local IPv6 (the Rust HTTP client accepts both
+ /// back as a host).
final String host;
- /// The port of the device's HTTP server.
+ /// The port the device claims its HTTP server listens on.
final int port;
final ProtocolType protocol;
@@ -266,15 +303,94 @@ class RsDiscoveredDevice {
download == other.download;
}
+@freezed
+sealed class RsDiscoveryEvent with _$RsDiscoveryEvent {
+ const RsDiscoveryEvent._();
+
+ /// The state of a confirmed device changed: it was discovered or
+ /// confirmed again (answered announcements, scan results and devices fed
+ /// in via [RsDiscovery::observe_inbound]), or a request to it failed.
+ /// Carries the merged state, so the device re-appears with everything
+ /// known about its channels so far.
+ const factory RsDiscoveryEvent.device(
+ RsStoredDevice field0,
+ ) = RsDiscoveryEvent_Device;
+
+ /// A device was heard announcing itself but did not answer the register
+ /// request, typically because a firewall blocks its server.
+ ///
+ /// Nothing about such a device is verified (announcements are
+ /// unauthenticated): it is for diagnostics only and must not be offered
+ /// as a transfer target.
+ const factory RsDiscoveryEvent.unreachable({
+ /// The merged state of the device, as its announcements claim it.
+ required RsStoredDevice device,
+
+ /// Why the most recent register request failed, for display.
+ required String error,
+ }) = RsDiscoveryEvent_Unreachable;
+}
+
+/// Whether a peer can be dialed on a channel.
+enum RsOutbound {
+ /// No request was sent over the channel yet: the peer reached this
+ /// device from it, which says nothing about the way back.
+ untested,
+
+ /// The last request over the channel was answered.
+ reachable,
+
+ /// The last request over the channel failed.
+ failed,
+}
+
+/// An address of a stored device with what is known about each direction: a
+/// channel that works one way does not have to work the other way (e.g.
+/// because of a firewall on one of the devices).
+class RsStoredChannel {
+ /// The host to dial: an IP address, or the scoped form `fe80::1%3` for
+ /// link-local IPv6 (the Rust HTTP client accepts both back as a host).
+ final String host;
+
+ /// The port of the device's HTTP server at this address.
+ final int port;
+ final ProtocolType protocol;
+
+ /// This device → the peer: whether the peer can be dialed at this address.
+ final RsOutbound outbound;
+
+ /// The peer → this device: when the peer last reached this device's
+ /// server from this address, in milliseconds since the Unix epoch.
+ /// `None` when it never did.
+ final BigInt? inboundAtMillis;
+
+ const RsStoredChannel({
+ required this.host,
+ required this.port,
+ required this.protocol,
+ required this.outbound,
+ this.inboundAtMillis,
+ });
+
+ @override
+ int get hashCode => host.hashCode ^ port.hashCode ^ protocol.hashCode ^ outbound.hashCode ^ inboundAtMillis.hashCode;
+
+ @override
+ bool operator ==(Object other) =>
+ identical(this, other) ||
+ other is RsStoredChannel &&
+ runtimeType == other.runtimeType &&
+ host == other.host &&
+ port == other.port &&
+ protocol == other.protocol &&
+ outbound == other.outbound &&
+ inboundAtMillis == other.inboundAtMillis;
+}
+
/// The merged stored state of a discovered device: one entry per fingerprint,
-/// carrying every address the device was confirmed on. A multi-homed device
+/// carrying every address the device was observed on. A multi-homed device
/// that is reachable over several network interfaces is still one
/// [RsStoredDevice].
-///
-/// Emitted on [RsDiscovery::listen] for every confirmation (answered
-/// announcements, scan results and devices fed in via
-/// [RsDiscovery::add_device]), so a device re-appears — with its channels
-/// accumulated so far — whenever it re-announces itself or is re-discovered.
class RsStoredDevice {
final String alias;
@@ -289,11 +405,11 @@ class RsStoredDevice {
/// Whether the device's download API is active.
final bool download;
- /// Every address the device was confirmed on, best first (available
- /// before not-reachable, IPv6 before IPv4, most recently confirmed
- /// first). Never empty: a device only enters the store through a
- /// confirmation.
- final List<RsDeviceChannel> channels;
+ /// Every address the device was observed on, in the order to dial them
+ /// (reachable before untested before failed, IPv6 before IPv4, most
+ /// recently confirmed first). Never empty: a device only enters the
+ /// store through an observation on one of its addresses.
+ final List<RsStoredChannel> channels;
const RsStoredDevice({
required this.alias,
diff --git a/packages/localsend_isolates/lib/rust/api/discovery.freezed.dart b/packages/localsend_isolates/lib/rust/api/discovery.freezed.dart
new file mode 100644
index 00000000..1fe4e0ac
--- /dev/null
+++ b/packages/localsend_isolates/lib/rust/api/discovery.freezed.dart
@@ -0,0 +1,751 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+// coverage:ignore-file
+// ignore_for_file: type=lint
+// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
+
+part of 'discovery.dart';
+
+// **************************************************************************
+// FreezedGenerator
+// **************************************************************************
+
+// dart format off
+T _$identity<T>(T value) => value;
+/// @nodoc
+mixin _$RsDeviceLogEvent {
+
+
+
+
+
+@override
+bool operator ==(Object other) {
+ return identical(this, other) || (other.runtimeType == runtimeType&&other is RsDeviceLogEvent);
+}
+
+
+@override
+int get hashCode => runtimeType.hashCode;
+
+@override
+String toString() {
+ return 'RsDeviceLogEvent()';
+}
+
+
+}
+
+/// @nodoc
+class $RsDeviceLogEventCopyWith<$Res> {
+$RsDeviceLogEventCopyWith(RsDeviceLogEvent _, $Res Function(RsDeviceLogEvent) __);
+}
+
+
+/// Adds pattern-matching-related methods to [RsDeviceLogEvent].
+extension RsDeviceLogEventPatterns on RsDeviceLogEvent {
+/// A variant of `map` that fallback to returning `orElse`.
+///
+/// It is equivalent to doing:
+/// ```dart
+/// switch (sealedClass) {
+/// case final Subclass value:
+/// return ...;
+/// case _:
+/// return orElse();
+/// }
+/// ```
+
+@optionalTypeArgs TResult maybeMap<TResult extends Object?>({TResult Function( RsDeviceLogEvent_Outbound value)? outbound,TResult Function( RsDeviceLogEvent_OutboundFailed value)? outboundFailed,TResult Function( RsDeviceLogEvent_Inbound value)? inbound,TResult Function( RsDeviceLogEvent_MulticastInbound value)? multicastInbound,required TResult orElse(),}){
+final _that = this;
+switch (_that) {
+case RsDeviceLogEvent_Outbound() when outbound != null:
+return outbound(_that);case RsDeviceLogEvent_OutboundFailed() when outboundFailed != null:
+return outboundFailed(_that);case RsDeviceLogEvent_Inbound() when inbound != null:
+return inbound(_that);case RsDeviceLogEvent_MulticastInbound() when multicastInbound != null:
+return multicastInbound(_that);case _:
+ return orElse();
+
+}
+}
+/// A `switch`-like method, using callbacks.
+///
+/// Callbacks receives the raw object, upcasted.
+/// It is equivalent to doing:
+/// ```dart
+/// switch (sealedClass) {
+/// case final Subclass value:
+/// return ...;
+/// case final Subclass2 value:
+/// return ...;
+/// }
+/// ```
+
+@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( RsDeviceLogEvent_Outbound value) outbound,required TResult Function( RsDeviceLogEvent_OutboundFailed value) outboundFailed,required TResult Function( RsDeviceLogEvent_Inbound value) inbound,required TResult Function( RsDeviceLogEvent_MulticastInbound value) multicastInbound,}){
+final _that = this;
+switch (_that) {
+case RsDeviceLogEvent_Outbound():
+return outbound(_that);case RsDeviceLogEvent_OutboundFailed():
+return outboundFailed(_that);case RsDeviceLogEvent_Inbound():
+return inbound(_that);case RsDeviceLogEvent_MulticastInbound():
+return multicastInbound(_that);}
+}
+/// A variant of `map` that fallback to returning `null`.
+///
+/// It is equivalent to doing:
+/// ```dart
+/// switch (sealedClass) {
+/// case final Subclass value:
+/// return ...;
+/// case _:
+/// return null;
+/// }
+/// ```
+
+@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( RsDeviceLogEvent_Outbound value)? outbound,TResult? Function( RsDeviceLogEvent_OutboundFailed value)? outboundFailed,TResult? Function( RsDeviceLogEvent_Inbound value)? inbound,TResult? Function( RsDeviceLogEvent_MulticastInbound value)? multicastInbound,}){
+final _that = this;
+switch (_that) {
+case RsDeviceLogEvent_Outbound() when outbound != null:
+return outbound(_that);case RsDeviceLogEvent_OutboundFailed() when outboundFailed != null:
+return outboundFailed(_that);case RsDeviceLogEvent_Inbound() when inbound != null:
+return inbound(_that);case RsDeviceLogEvent_MulticastInbound() when multicastInbound != null:
+return multicastInbound(_that);case _:
+ return null;
+
+}
+}
+/// A variant of `when` that fallback to an `orElse` callback.
+///
+/// It is equivalent to doing:
+/// ```dart
+/// switch (sealedClass) {
+/// case Subclass(:final field):
+/// return ...;
+/// case _:
+/// return orElse();
+/// }
+/// ```
+
+@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function( RsDeviceChannel channel)? outbound,TResult Function( RsDeviceChannel channel, String error)? outboundFailed,TResult Function( RsDeviceChannel channel)? inbound,TResult Function( String host)? multicastInbound,required TResult orElse(),}) {final _that = this;
+switch (_that) {
+case RsDeviceLogEvent_Outbound() when outbound != null:
+return outbound(_that.channel);case RsDeviceLogEvent_OutboundFailed() when outboundFailed != null:
+return outboundFailed(_that.channel,_that.error);case RsDeviceLogEvent_Inbound() when inbound != null:
+return inbound(_that.channel);case RsDeviceLogEvent_MulticastInbound() when multicastInbound != null:
+return multicastInbound(_that.host);case _:
+ return orElse();
+
+}
+}
+/// A `switch`-like method, using callbacks.
+///
+/// As opposed to `map`, this offers destructuring.
+/// It is equivalent to doing:
+/// ```dart
+/// switch (sealedClass) {
+/// case Subclass(:final field):
+/// return ...;
+/// case Subclass2(:final field2):
+/// return ...;
+/// }
+/// ```
+
+@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function( RsDeviceChannel channel) outbound,required TResult Function( RsDeviceChannel channel, String error) outboundFailed,required TResult Function( RsDeviceChannel channel) inbound,required TResult Function( String host) multicastInbound,}) {final _that = this;
+switch (_that) {
+case RsDeviceLogEvent_Outbound():
+return outbound(_that.channel);case RsDeviceLogEvent_OutboundFailed():
+return outboundFailed(_that.channel,_that.error);case RsDeviceLogEvent_Inbound():
+return inbound(_that.channel);case RsDeviceLogEvent_MulticastInbound():
+return multicastInbound(_that.host);}
+}
+/// A variant of `when` that fallback to returning `null`
+///
+/// It is equivalent to doing:
+/// ```dart
+/// switch (sealedClass) {
+/// case Subclass(:final field):
+/// return ...;
+/// case _:
+/// return null;
+/// }
+/// ```
+
+@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function( RsDeviceChannel channel)? outbound,TResult? Function( RsDeviceChannel channel, String error)? outboundFailed,TResult? Function( RsDeviceChannel channel)? inbound,TResult? Function( String host)? multicastInbound,}) {final _that = this;
+switch (_that) {
+case RsDeviceLogEvent_Outbound() when outbound != null:
+return outbound(_that.channel);case RsDeviceLogEvent_OutboundFailed() when outboundFailed != null:
+return outboundFailed(_that.channel,_that.error);case RsDeviceLogEvent_Inbound() when inbound != null:
+return inbound(_that.channel);case RsDeviceLogEvent_MulticastInbound() when multicastInbound != null:
+return multicastInbound(_that.host);case _:
+ return null;
+
+}
+}
+
+}
+
+/// @nodoc
+
+
+class RsDeviceLogEvent_Outbound extends RsDeviceLogEvent {
+ const RsDeviceLogEvent_Outbound({required this.channel}): super._();
+
+
+ final RsDeviceChannel channel;
+
+/// Create a copy of RsDeviceLogEvent
+/// with the given fields replaced by the non-null parameter values.
+@JsonKey(includeFromJson: false, includeToJson: false)
+@pragma('vm:prefer-inline')
+$RsDeviceLogEvent_OutboundCopyWith<RsDeviceLogEvent_Outbound> get copyWith => _$RsDeviceLogEvent_OutboundCopyWithImpl<RsDeviceLogEvent_Outbound>(this, _$identity);
+
+
+
+@override
+bool operator ==(Object other) {
+ return identical(this, other) || (other.runtimeType == runtimeType&&other is RsDeviceLogEvent_Outbound&&(identical(other.channel, channel) || other.channel == channel));
+}
+
+
+@override
+int get hashCode => Object.hash(runtimeType,channel);
+
+@override
+String toString() {
+ return 'RsDeviceLogEvent.outbound(channel: $channel)';
+}
+
+
+}
+
+/// @nodoc
+abstract mixin class $RsDeviceLogEvent_OutboundCopyWith<$Res> implements $RsDeviceLogEventCopyWith<$Res> {
+ factory $RsDeviceLogEvent_OutboundCopyWith(RsDeviceLogEvent_Outbound value, $Res Function(RsDeviceLogEvent_Outbound) _then) = _$RsDeviceLogEvent_OutboundCopyWithImpl;
+@useResult
+$Res call({
+ RsDeviceChannel channel
+});
+
+
+
+
+}
+/// @nodoc
+class _$RsDeviceLogEvent_OutboundCopyWithImpl<$Res>
+ implements $RsDeviceLogEvent_OutboundCopyWith<$Res> {
+ _$RsDeviceLogEvent_OutboundCopyWithImpl(this._self, this._then);
+
+ final RsDeviceLogEvent_Outbound _self;
+ final $Res Function(RsDeviceLogEvent_Outbound) _then;
+
+/// Create a copy of RsDeviceLogEvent
+/// with the given fields replaced by the non-null parameter values.
+@pragma('vm:prefer-inline') $Res call({Object? channel = null,}) {
+ return _then(RsDeviceLogEvent_Outbound(
+channel: null == channel ? _self.channel : channel // ignore: cast_nullable_to_non_nullable
+as RsDeviceChannel,
+ ));
+}
+
+
+}
+
+/// @nodoc
+
+
+class RsDeviceLogEvent_OutboundFailed extends RsDeviceLogEvent {
+ const RsDeviceLogEvent_OutboundFailed({required this.channel, required this.error}): super._();
+
+
+ final RsDeviceChannel channel;
+/// Why the request failed, for display.
+ final String error;
+
+/// Create a copy of RsDeviceLogEvent
+/// with the given fields replaced by the non-null parameter values.
+@JsonKey(includeFromJson: false, includeToJson: false)
+@pragma('vm:prefer-inline')
+$RsDeviceLogEvent_OutboundFailedCopyWith<RsDeviceLogEvent_OutboundFailed> get copyWith => _$RsDeviceLogEvent_OutboundFailedCopyWithImpl<RsDeviceLogEvent_OutboundFailed>(this, _$identity);
+
+
+
+@override
+bool operator ==(Object other) {
+ return identical(this, other) || (other.runtimeType == runtimeType&&other is RsDeviceLogEvent_OutboundFailed&&(identical(other.channel, channel) || other.channel == channel)&&(identical(other.error, error) || other.error == error));
+}
+
+
+@override
+int get hashCode => Object.hash(runtimeType,channel,error);
+
+@override
+String toString() {
+ return 'RsDeviceLogEvent.outboundFailed(channel: $channel, error: $error)';
+}
+
+
+}
+
+/// @nodoc
+abstract mixin class $RsDeviceLogEvent_OutboundFailedCopyWith<$Res> implements $RsDeviceLogEventCopyWith<$Res> {
+ factory $RsDeviceLogEvent_OutboundFailedCopyWith(RsDeviceLogEvent_OutboundFailed value, $Res Function(RsDeviceLogEvent_OutboundFailed) _then) = _$RsDeviceLogEvent_OutboundFailedCopyWithImpl;
+@useResult
+$Res call({
+ RsDeviceChannel channel, String error
+});
+
+
+
+
+}
+/// @nodoc
+class _$RsDeviceLogEvent_OutboundFailedCopyWithImpl<$Res>
+ implements $RsDeviceLogEvent_OutboundFailedCopyWith<$Res> {
+ _$RsDeviceLogEvent_OutboundFailedCopyWithImpl(this._self, this._then);
+
+ final RsDeviceLogEvent_OutboundFailed _self;
+ final $Res Function(RsDeviceLogEvent_OutboundFailed) _then;
+
+/// Create a copy of RsDeviceLogEvent
+/// with the given fields replaced by the non-null parameter values.
+@pragma('vm:prefer-inline') $Res call({Object? channel = null,Object? error = null,}) {
+ return _then(RsDeviceLogEvent_OutboundFailed(
+channel: null == channel ? _self.channel : channel // ignore: cast_nullable_to_non_nullable
+as RsDeviceChannel,error: null == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
+as String,
+ ));
+}
+
+
+}
+
+/// @nodoc
+
+
+class RsDeviceLogEvent_Inbound extends RsDeviceLogEvent {
+ const RsDeviceLogEvent_Inbound({required this.channel}): super._();
+
+
+ final RsDeviceChannel channel;
+
+/// Create a copy of RsDeviceLogEvent
+/// with the given fields replaced by the non-null parameter values.
+@JsonKey(includeFromJson: false, includeToJson: false)
+@pragma('vm:prefer-inline')
+$RsDeviceLogEvent_InboundCopyWith<RsDeviceLogEvent_Inbound> get copyWith => _$RsDeviceLogEvent_InboundCopyWithImpl<RsDeviceLogEvent_Inbound>(this, _$identity);
+
+
+
+@override
+bool operator ==(Object other) {
+ return identical(this, other) || (other.runtimeType == runtimeType&&other is RsDeviceLogEvent_Inbound&&(identical(other.channel, channel) || other.channel == channel));
+}
+
+
+@override
+int get hashCode => Object.hash(runtimeType,channel);
+
+@override
+String toString() {
+ return 'RsDeviceLogEvent.inbound(channel: $channel)';
+}
+
+
+}
+
+/// @nodoc
+abstract mixin class $RsDeviceLogEvent_InboundCopyWith<$Res> implements $RsDeviceLogEventCopyWith<$Res> {
+ factory $RsDeviceLogEvent_InboundCopyWith(RsDeviceLogEvent_Inbound value, $Res Function(RsDeviceLogEvent_Inbound) _then) = _$RsDeviceLogEvent_InboundCopyWithImpl;
+@useResult
+$Res call({
+ RsDeviceChannel channel
+});
+
+
+
+
+}
+/// @nodoc
+class _$RsDeviceLogEvent_InboundCopyWithImpl<$Res>
+ implements $RsDeviceLogEvent_InboundCopyWith<$Res> {
+ _$RsDeviceLogEvent_InboundCopyWithImpl(this._self, this._then);
+
+ final RsDeviceLogEvent_Inbound _self;
+ final $Res Function(RsDeviceLogEvent_Inbound) _then;
+
+/// Create a copy of RsDeviceLogEvent
+/// with the given fields replaced by the non-null parameter values.
+@pragma('vm:prefer-inline') $Res call({Object? channel = null,}) {
+ return _then(RsDeviceLogEvent_Inbound(
+channel: null == channel ? _self.channel : channel // ignore: cast_nullable_to_non_nullable
+as RsDeviceChannel,
+ ));
+}
+
+
+}
+
+/// @nodoc
+
+
+class RsDeviceLogEvent_MulticastInbound extends RsDeviceLogEvent {
+ const RsDeviceLogEvent_MulticastInbound({required this.host}): super._();
+
+
+/// The address the announcement came from, in the scoped form
+/// `fe80::1%3` for link-local IPv6.
+ final String host;
+
+/// Create a copy of RsDeviceLogEvent
+/// with the given fields replaced by the non-null parameter values.
+@JsonKey(includeFromJson: false, includeToJson: false)
+@pragma('vm:prefer-inline')
+$RsDeviceLogEvent_MulticastInboundCopyWith<RsDeviceLogEvent_MulticastInbound> get copyWith => _$RsDeviceLogEvent_MulticastInboundCopyWithImpl<RsDeviceLogEvent_MulticastInbound>(this, _$identity);
+
+
+
+@override
+bool operator ==(Object other) {
+ return identical(this, other) || (other.runtimeType == runtimeType&&other is RsDeviceLogEvent_MulticastInbound&&(identical(other.host, host) || other.host == host));
+}
+
+
+@override
+int get hashCode => Object.hash(runtimeType,host);
+
+@override
+String toString() {
+ return 'RsDeviceLogEvent.multicastInbound(host: $host)';
+}
+
+
+}
+
+/// @nodoc
+abstract mixin class $RsDeviceLogEvent_MulticastInboundCopyWith<$Res> implements $RsDeviceLogEventCopyWith<$Res> {
+ factory $RsDeviceLogEvent_MulticastInboundCopyWith(RsDeviceLogEvent_MulticastInbound value, $Res Function(RsDeviceLogEvent_MulticastInbound) _then) = _$RsDeviceLogEvent_MulticastInboundCopyWithImpl;
+@useResult
+$Res call({
+ String host
+});
+
+
+
+
+}
+/// @nodoc
+class _$RsDeviceLogEvent_MulticastInboundCopyWithImpl<$Res>
+ implements $RsDeviceLogEvent_MulticastInboundCopyWith<$Res> {
+ _$RsDeviceLogEvent_MulticastInboundCopyWithImpl(this._self, this._then);
+
+ final RsDeviceLogEvent_MulticastInbound _self;
+ final $Res Function(RsDeviceLogEvent_MulticastInbound) _then;
+
+/// Create a copy of RsDeviceLogEvent
+/// with the given fields replaced by the non-null parameter values.
+@pragma('vm:prefer-inline') $Res call({Object? host = null,}) {
+ return _then(RsDeviceLogEvent_MulticastInbound(
+host: null == host ? _self.host : host // ignore: cast_nullable_to_non_nullable
+as String,
+ ));
+}
+
+
+}
+
+/// @nodoc
+mixin _$RsDiscoveryEvent {
+
+
+
+
+
+@override
+bool operator ==(Object other) {
+ return identical(this, other) || (other.runtimeType == runtimeType&&other is RsDiscoveryEvent);
+}
+
+
+@override
+int get hashCode => runtimeType.hashCode;
+
+@override
+String toString() {
+ return 'RsDiscoveryEvent()';
+}
+
+
+}
+
+/// @nodoc
+class $RsDiscoveryEventCopyWith<$Res> {
+$RsDiscoveryEventCopyWith(RsDiscoveryEvent _, $Res Function(RsDiscoveryEvent) __);
+}
+
+
+/// Adds pattern-matching-related methods to [RsDiscoveryEvent].
+extension RsDiscoveryEventPatterns on RsDiscoveryEvent {
+/// A variant of `map` that fallback to returning `orElse`.
+///
+/// It is equivalent to doing:
+/// ```dart
+/// switch (sealedClass) {
+/// case final Subclass value:
+/// return ...;
+/// case _:
+/// return orElse();
+/// }
+/// ```
+
+@optionalTypeArgs TResult maybeMap<TResult extends Object?>({TResult Function( RsDiscoveryEvent_Device value)? device,TResult Function( RsDiscoveryEvent_Unreachable value)? unreachable,required TResult orElse(),}){
+final _that = this;
+switch (_that) {
+case RsDiscoveryEvent_Device() when device != null:
+return device(_that);case RsDiscoveryEvent_Unreachable() when unreachable != null:
+return unreachable(_that);case _:
+ return orElse();
+
+}
+}
+/// A `switch`-like method, using callbacks.
+///
+/// Callbacks receives the raw object, upcasted.
+/// It is equivalent to doing:
+/// ```dart
+/// switch (sealedClass) {
+/// case final Subclass value:
+/// return ...;
+/// case final Subclass2 value:
+/// return ...;
+/// }
+/// ```
+
+@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( RsDiscoveryEvent_Device value) device,required TResult Function( RsDiscoveryEvent_Unreachable value) unreachable,}){
+final _that = this;
+switch (_that) {
+case RsDiscoveryEvent_Device():
+return device(_that);case RsDiscoveryEvent_Unreachable():
+return unreachable(_that);}
+}
+/// A variant of `map` that fallback to returning `null`.
+///
+/// It is equivalent to doing:
+/// ```dart
+/// switch (sealedClass) {
+/// case final Subclass value:
+/// return ...;
+/// case _:
+/// return null;
+/// }
+/// ```
+
+@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( RsDiscoveryEvent_Device value)? device,TResult? Function( RsDiscoveryEvent_Unreachable value)? unreachable,}){
+final _that = this;
+switch (_that) {
+case RsDiscoveryEvent_Device() when device != null:
+return device(_that);case RsDiscoveryEvent_Unreachable() when unreachable != null:
+return unreachable(_that);case _:
+ return null;
+
+}
+}
+/// A variant of `when` that fallback to an `orElse` callback.
+///
+/// It is equivalent to doing:
+/// ```dart
+/// switch (sealedClass) {
+/// case Subclass(:final field):
+/// return ...;
+/// case _:
+/// return orElse();
+/// }
+/// ```
+
+@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function( RsStoredDevice field0)? device,TResult Function( RsStoredDevice device, String error)? unreachable,required TResult orElse(),}) {final _that = this;
+switch (_that) {
+case RsDiscoveryEvent_Device() when device != null:
+return device(_that.field0);case RsDiscoveryEvent_Unreachable() when unreachable != null:
+return unreachable(_that.device,_that.error);case _:
+ return orElse();
+
+}
+}
+/// A `switch`-like method, using callbacks.
+///
+/// As opposed to `map`, this offers destructuring.
+/// It is equivalent to doing:
+/// ```dart
+/// switch (sealedClass) {
+/// case Subclass(:final field):
+/// return ...;
+/// case Subclass2(:final field2):
+/// return ...;
+/// }
+/// ```
+
+@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function( RsStoredDevice field0) device,required TResult Function( RsStoredDevice device, String error) unreachable,}) {final _that = this;
+switch (_that) {
+case RsDiscoveryEvent_Device():
+return device(_that.field0);case RsDiscoveryEvent_Unreachable():
+return unreachable(_that.device,_that.error);}
+}
+/// A variant of `when` that fallback to returning `null`
+///
+/// It is equivalent to doing:
+/// ```dart
+/// switch (sealedClass) {
+/// case Subclass(:final field):
+/// return ...;
+/// case _:
+/// return null;
+/// }
+/// ```
+
+@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function( RsStoredDevice field0)? device,TResult? Function( RsStoredDevice device, String error)? unreachable,}) {final _that = this;
+switch (_that) {
+case RsDiscoveryEvent_Device() when device != null:
+return device(_that.field0);case RsDiscoveryEvent_Unreachable() when unreachable != null:
+return unreachable(_that.device,_that.error);case _:
+ return null;
+
+}
+}
+
+}
+
+/// @nodoc
+
+
+class RsDiscoveryEvent_Device extends RsDiscoveryEvent {
+ const RsDiscoveryEvent_Device(this.field0): super._();
+
+
+ final RsStoredDevice field0;
+
+/// Create a copy of RsDiscoveryEvent
+/// with the given fields replaced by the non-null parameter values.
+@JsonKey(includeFromJson: false, includeToJson: false)
+@pragma('vm:prefer-inline')
+$RsDiscoveryEvent_DeviceCopyWith<RsDiscoveryEvent_Device> get copyWith => _$RsDiscoveryEvent_DeviceCopyWithImpl<RsDiscoveryEvent_Device>(this, _$identity);
+
+
+
+@override
+bool operator ==(Object other) {
+ return identical(this, other) || (other.runtimeType == runtimeType&&other is RsDiscoveryEvent_Device&&(identical(other.field0, field0) || other.field0 == field0));
+}
+
+
+@override
+int get hashCode => Object.hash(runtimeType,field0);
+
+@override
+String toString() {
+ return 'RsDiscoveryEvent.device(field0: $field0)';
+}
+
+
+}
+
+/// @nodoc
+abstract mixin class $RsDiscoveryEvent_DeviceCopyWith<$Res> implements $RsDiscoveryEventCopyWith<$Res> {
+ factory $RsDiscoveryEvent_DeviceCopyWith(RsDiscoveryEvent_Device value, $Res Function(RsDiscoveryEvent_Device) _then) = _$RsDiscoveryEvent_DeviceCopyWithImpl;
+@useResult
+$Res call({
+ RsStoredDevice field0
+});
+
+
+
+
+}
+/// @nodoc
+class _$RsDiscoveryEvent_DeviceCopyWithImpl<$Res>
+ implements $RsDiscoveryEvent_DeviceCopyWith<$Res> {
+ _$RsDiscoveryEvent_DeviceCopyWithImpl(this._self, this._then);
+
+ final RsDiscoveryEvent_Device _self;
+ final $Res Function(RsDiscoveryEvent_Device) _then;
+
+/// Create a copy of RsDiscoveryEvent
+/// with the given fields replaced by the non-null parameter values.
+@pragma('vm:prefer-inline') $Res call({Object? field0 = null,}) {
+ return _then(RsDiscoveryEvent_Device(
+null == field0 ? _self.field0 : field0 // ignore: cast_nullable_to_non_nullable
+as RsStoredDevice,
+ ));
+}
+
+
+}
+
+/// @nodoc
+
+
+class RsDiscoveryEvent_Unreachable extends RsDiscoveryEvent {
+ const RsDiscoveryEvent_Unreachable({required this.device, required this.error}): super._();
+
+
+/// The merged state of the device, as its announcements claim it.
+ final RsStoredDevice device;
+/// Why the most recent register request failed, for display.
+ final String error;
+
+/// Create a copy of RsDiscoveryEvent
+/// with the given fields replaced by the non-null parameter values.
+@JsonKey(includeFromJson: false, includeToJson: false)
+@pragma('vm:prefer-inline')
+$RsDiscoveryEvent_UnreachableCopyWith<RsDiscoveryEvent_Unreachable> get copyWith => _$RsDiscoveryEvent_UnreachableCopyWithImpl<RsDiscoveryEvent_Unreachable>(this, _$identity);
+
+
+
+@override
+bool operator ==(Object other) {
+ return identical(this, other) || (other.runtimeType == runtimeType&&other is RsDiscoveryEvent_Unreachable&&(identical(other.device, device) || other.device == device)&&(identical(other.error, error) || other.error == error));
+}
+
+
+@override
+int get hashCode => Object.hash(runtimeType,device,error);
+
+@override
+String toString() {
+ return 'RsDiscoveryEvent.unreachable(device: $device, error: $error)';
+}
+
+
+}
+
+/// @nodoc
+abstract mixin class $RsDiscoveryEvent_UnreachableCopyWith<$Res> implements $RsDiscoveryEventCopyWith<$Res> {
+ factory $RsDiscoveryEvent_UnreachableCopyWith(RsDiscoveryEvent_Unreachable value, $Res Function(RsDiscoveryEvent_Unreachable) _then) = _$RsDiscoveryEvent_UnreachableCopyWithImpl;
+@useResult
+$Res call({
+ RsStoredDevice device, String error
+});
+
+
+
+
+}
+/// @nodoc
+class _$RsDiscoveryEvent_UnreachableCopyWithImpl<$Res>
+ implements $RsDiscoveryEvent_UnreachableCopyWith<$Res> {
+ _$RsDiscoveryEvent_UnreachableCopyWithImpl(this._self, this._then);
+
+ final RsDiscoveryEvent_Unreachable _self;
+ final $Res Function(RsDiscoveryEvent_Unreachable) _then;
+
+/// Create a copy of RsDiscoveryEvent
+/// with the given fields replaced by the non-null parameter values.
+@pragma('vm:prefer-inline') $Res call({Object? device = null,Object? error = null,}) {
+ return _then(RsDiscoveryEvent_Unreachable(
+device: null == device ? _self.device : device // ignore: cast_nullable_to_non_nullable
+as RsStoredDevice,error: null == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
+as String,
+ ));
+}
+
+
+}
+
+// dart format on
diff --git a/packages/localsend_isolates/lib/rust/api/http.dart b/packages/localsend_isolates/lib/rust/api/http.dart
index 5d34c8d6..e59db4b6 100644
--- a/packages/localsend_isolates/lib/rust/api/http.dart
+++ b/packages/localsend_isolates/lib/rust/api/http.dart
@@ -127,6 +127,16 @@ sealed class RsHttpClientError with _$RsHttpClientError implements FrbException
required int status,
String? message,
}) = RsHttpClientError_StatusCode;
+
+ /// The request got no response: the connection could not be established
+ /// (refused, timed out, failed TLS handshake) or broke before the peer
+ /// answered. Carries the reason, for display.
+ const factory RsHttpClientError.unreachable(
+ String field0,
+ ) = RsHttpClientError_Unreachable;
+
+ /// Another error of the transport: the peer answered, but its response
+ /// could not be read.
const factory RsHttpClientError.reqwest(
String field0,
) = RsHttpClientError_Reqwest;
diff --git a/packages/localsend_isolates/lib/rust/api/http.freezed.dart b/packages/localsend_isolates/lib/rust/api/http.freezed.dart
index 463f09e4..1e9e2329 100644
--- a/packages/localsend_isolates/lib/rust/api/http.freezed.dart
+++ b/packages/localsend_isolates/lib/rust/api/http.freezed.dart
@@ -55,11 +55,12 @@ extension RsHttpClientErrorPatterns on RsHttpClientError {
/// }
/// ```
-@optionalTypeArgs TResult maybeMap<TResult extends Object?>({TResult Function( RsHttpClientError_StatusCode value)? statusCode,TResult Function( RsHttpClientError_Reqwest value)? reqwest,TResult Function( RsHttpClientError_Json value)? json,TResult Function( RsHttpClientError_Io value)? io,TResult Function( RsHttpClientError_Other value)? other,required TResult orElse(),}){
+@optionalTypeArgs TResult maybeMap<TResult extends Object?>({TResult Function( RsHttpClientError_StatusCode value)? statusCode,TResult Function( RsHttpClientError_Unreachable value)? unreachable,TResult Function( RsHttpClientError_Reqwest value)? reqwest,TResult Function( RsHttpClientError_Json value)? json,TResult Function( RsHttpClientError_Io value)? io,TResult Function( RsHttpClientError_Other value)? other,required TResult orElse(),}){
final _that = this;
switch (_that) {
case RsHttpClientError_StatusCode() when statusCode != null:
-return statusCode(_that);case RsHttpClientError_Reqwest() when reqwest != null:
+return statusCode(_that);case RsHttpClientError_Unreachable() when unreachable != null:
+return unreachable(_that);case RsHttpClientError_Reqwest() when reqwest != null:
return reqwest(_that);case RsHttpClientError_Json() when json != null:
return json(_that);case RsHttpClientError_Io() when io != null:
return io(_that);case RsHttpClientError_Other() when other != null:
@@ -81,11 +82,12 @@ return other(_that);case _:
/// }
/// ```
-@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( RsHttpClientError_StatusCode value) statusCode,required TResult Function( RsHttpClientError_Reqwest value) reqwest,required TResult Function( RsHttpClientError_Json value) json,required TResult Function( RsHttpClientError_Io value) io,required TResult Function( RsHttpClientError_Other value) other,}){
+@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( RsHttpClientError_StatusCode value) statusCode,required TResult Function( RsHttpClientError_Unreachable value) unreachable,required TResult Function( RsHttpClientError_Reqwest value) reqwest,required TResult Function( RsHttpClientError_Json value) json,required TResult Function( RsHttpClientError_Io value) io,required TResult Function( RsHttpClientError_Other value) other,}){
final _that = this;
switch (_that) {
case RsHttpClientError_StatusCode():
-return statusCode(_that);case RsHttpClientError_Reqwest():
+return statusCode(_that);case RsHttpClientError_Unreachable():
+return unreachable(_that);case RsHttpClientError_Reqwest():
return reqwest(_that);case RsHttpClientError_Json():
return json(_that);case RsHttpClientError_Io():
return io(_that);case RsHttpClientError_Other():
@@ -103,11 +105,12 @@ return other(_that);}
/// }
/// ```
-@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( RsHttpClientError_StatusCode value)? statusCode,TResult? Function( RsHttpClientError_Reqwest value)? reqwest,TResult? Function( RsHttpClientError_Json value)? json,TResult? Function( RsHttpClientError_Io value)? io,TResult? Function( RsHttpClientError_Other value)? other,}){
+@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( RsHttpClientError_StatusCode value)? statusCode,TResult? Function( RsHttpClientError_Unreachable value)? unreachable,TResult? Function( RsHttpClientError_Reqwest value)? reqwest,TResult? Function( RsHttpClientError_Json value)? json,TResult? Function( RsHttpClientError_Io value)? io,TResult? Function( RsHttpClientError_Other value)? other,}){
final _that = this;
switch (_that) {
case RsHttpClientError_StatusCode() when statusCode != null:
-return statusCode(_that);case RsHttpClientError_Reqwest() when reqwest != null:
+return statusCode(_that);case RsHttpClientError_Unreachable() when unreachable != null:
+return unreachable(_that);case RsHttpClientError_Reqwest() when reqwest != null:
return reqwest(_that);case RsHttpClientError_Json() when json != null:
return json(_that);case RsHttpClientError_Io() when io != null:
return io(_that);case RsHttpClientError_Other() when other != null:
@@ -128,10 +131,11 @@ return other(_that);case _:
/// }
/// ```
-@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function( int status, String? message)? statusCode,TResult Function( String field0)? reqwest,TResult Function( String field0)? json,TResult Function( String field0)? io,TResult Function( String field0)? other,required TResult orElse(),}) {final _that = this;
+@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function( int status, String? message)? statusCode,TResult Function( String field0)? unreachable,TResult Function( String field0)? reqwest,TResult Function( String field0)? json,TResult Function( String field0)? io,TResult Function( String field0)? other,required TResult orElse(),}) {final _that = this;
switch (_that) {
case RsHttpClientError_StatusCode() when statusCode != null:
-return statusCode(_that.status,_that.message);case RsHttpClientError_Reqwest() when reqwest != null:
+return statusCode(_that.status,_that.message);case RsHttpClientError_Unreachable() when unreachable != null:
+return unreachable(_that.field0);case RsHttpClientError_Reqwest() when reqwest != null:
return reqwest(_that.field0);case RsHttpClientError_Json() when json != null:
return json(_that.field0);case RsHttpClientError_Io() when io != null:
return io(_that.field0);case RsHttpClientError_Other() when other != null:
@@ -153,10 +157,11 @@ return other(_that.field0);case _:
/// }
/// ```
-@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function( int status, String? message) statusCode,required TResult Function( String field0) reqwest,required TResult Function( String field0) json,required TResult Function( String field0) io,required TResult Function( String field0) other,}) {final _that = this;
+@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function( int status, String? message) statusCode,required TResult Function( String field0) unreachable,required TResult Function( String field0) reqwest,required TResult Function( String field0) json,required TResult Function( String field0) io,required TResult Function( String field0) other,}) {final _that = this;
switch (_that) {
case RsHttpClientError_StatusCode():
-return statusCode(_that.status,_that.message);case RsHttpClientError_Reqwest():
+return statusCode(_that.status,_that.message);case RsHttpClientError_Unreachable():
+return unreachable(_that.field0);case RsHttpClientError_Reqwest():
return reqwest(_that.field0);case RsHttpClientError_Json():
return json(_that.field0);case RsHttpClientError_Io():
return io(_that.field0);case RsHttpClientError_Other():
@@ -174,10 +179,11 @@ return other(_that.field0);}
/// }
/// ```
-@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function( int status, String? message)? statusCode,TResult? Function( String field0)? reqwest,TResult? Function( String field0)? json,TResult? Function( String field0)? io,TResult? Function( String field0)? other,}) {final _that = this;
+@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function( int status, String? message)? statusCode,TResult? Function( String field0)? unreachable,TResult? Function( String field0)? reqwest,TResult? Function( String field0)? json,TResult? Function( String field0)? io,TResult? Function( String field0)? other,}) {final _that = this;
switch (_that) {
case RsHttpClientError_StatusCode() when statusCode != null:
-return statusCode(_that.status,_that.message);case RsHttpClientError_Reqwest() when reqwest != null:
+return statusCode(_that.status,_that.message);case RsHttpClientError_Unreachable() when unreachable != null:
+return unreachable(_that.field0);case RsHttpClientError_Reqwest() when reqwest != null:
return reqwest(_that.field0);case RsHttpClientError_Json() when json != null:
return json(_that.field0);case RsHttpClientError_Io() when io != null:
return io(_that.field0);case RsHttpClientError_Other() when other != null:
@@ -260,6 +266,72 @@ as String?,
/// @nodoc
+class RsHttpClientError_Unreachable extends RsHttpClientError {
+ const RsHttpClientError_Unreachable(this.field0): super._();
+
+
+ final String field0;
+
+/// Create a copy of RsHttpClientError
+/// with the given fields replaced by the non-null parameter values.
+@JsonKey(includeFromJson: false, includeToJson: false)
+@pragma('vm:prefer-inline')
+$RsHttpClientError_UnreachableCopyWith<RsHttpClientError_Unreachable> get copyWith => _$RsHttpClientError_UnreachableCopyWithImpl<RsHttpClientError_Unreachable>(this, _$identity);
+
+
+
+@override
+bool operator ==(Object other) {
+ return identical(this, other) || (other.runtimeType == runtimeType&&other is RsHttpClientError_Unreachable&&(identical(other.field0, field0) || other.field0 == field0));
+}
+
+
+@override
+int get hashCode => Object.hash(runtimeType,field0);
+
+@override
+String toString() {
+ return 'RsHttpClientError.unreachable(field0: $field0)';
+}
+
+
+}
+
+/// @nodoc
+abstract mixin class $RsHttpClientError_UnreachableCopyWith<$Res> implements $RsHttpClientErrorCopyWith<$Res> {
+ factory $RsHttpClientError_UnreachableCopyWith(RsHttpClientError_Unreachable value, $Res Function(RsHttpClientError_Unreachable) _then) = _$RsHttpClientError_UnreachableCopyWithImpl;
+@useResult
+$Res call({
+ String field0
+});
+
+
+
+
+}
+/// @nodoc
+class _$RsHttpClientError_UnreachableCopyWithImpl<$Res>
+ implements $RsHttpClientError_UnreachableCopyWith<$Res> {
+ _$RsHttpClientError_UnreachableCopyWithImpl(this._self, this._then);
+
+ final RsHttpClientError_Unreachable _self;
+ final $Res Function(RsHttpClientError_Unreachable) _then;
+
+/// Create a copy of RsHttpClientError
+/// with the given fields replaced by the non-null parameter values.
+@pragma('vm:prefer-inline') $Res call({Object? field0 = null,}) {
+ return _then(RsHttpClientError_Unreachable(
+null == field0 ? _self.field0 : field0 // ignore: cast_nullable_to_non_nullable
+as String,
+ ));
+}
+
+
+}
+
+/// @nodoc
+
+
class RsHttpClientError_Reqwest extends RsHttpClientError {
const RsHttpClientError_Reqwest(this.field0): super._();
diff --git a/packages/localsend_isolates/lib/rust/frb_generated.dart b/packages/localsend_isolates/lib/rust/frb_generated.dart
index d30249bf..a7d25cca 100644
--- a/packages/localsend_isolates/lib/rust/frb_generated.dart
+++ b/packages/localsend_isolates/lib/rust/frb_generated.dart
@@ -76,7 +76,7 @@ class RustLib extends BaseEntrypoint<RustLibApi, RustLibApiImpl, RustLibWire> {
String get codegenVersion => '2.12.0';
@override
- int get rustContentHash => -1979579466;
+ int get rustContentHash => 1374796560;
static const kDefaultExternalLibraryLoaderConfig = ExternalLibraryLoaderConfig(
stem: 'rust_lib_localsend_app',
@@ -114,8 +114,6 @@ abstract class RustLibApi extends BaseApi {
void crateApiCancelRsCancellationTokenCancel({required RsCancellationToken that});
- Future<void> crateApiDiscoveryRsDiscoveryAddDevice({required RsDiscovery that, required RsDiscoveredDevice device});
-
Future<void> crateApiDiscoveryRsDiscoveryAnnounce({required RsDiscovery that});
Future<List<RsDeviceLog>> crateApiDiscoveryRsDiscoveryDeviceLogs({required RsDiscovery that, required String fingerprint});
@@ -129,10 +127,19 @@ abstract class RustLibApi extends BaseApi {
required BigInt graceMs,
});
- Stream<RsStoredDevice> crateApiDiscoveryRsDiscoveryListen({required RsDiscovery that});
+ Stream<RsDiscoveryEvent> crateApiDiscoveryRsDiscoveryListen({required RsDiscovery that});
Future<String?> crateApiDiscoveryRsDiscoveryMulticastError({required RsDiscovery that});
+ Future<void> crateApiDiscoveryRsDiscoveryObserveInbound({required RsDiscovery that, required RsDiscoveredDevice device});
+
+ Future<bool> crateApiDiscoveryRsDiscoveryReportOutbound({
+ required RsDiscovery that,
+ required String fingerprint,
+ required RsDeviceChannel channel,
+ String? error,
+ });
+
Future<void> crateApiDiscoveryRsDiscoveryScanSubnet({
required RsDiscovery that,
required String interfaceIp,
@@ -569,32 +576,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
argNames: ['that'],
);
- @override
- Future<void> crateApiDiscoveryRsDiscoveryAddDevice({required RsDiscovery that, required RsDiscoveredDevice device}) {
- return handler.executeNormal(
- NormalTask(
- callFfi: (port_) {
- final serializer = SseSerializer(generalizedFrbRustBinding);
- sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsDiscovery(that, serializer);
- sse_encode_box_autoadd_rs_discovered_device(device, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 7, port: port_);
- },
- codec: SseCodec(
- decodeSuccessData: sse_decode_unit,
- decodeErrorData: null,
- ),
- constMeta: kCrateApiDiscoveryRsDiscoveryAddDeviceConstMeta,
- argValues: [that, device],
- apiImpl: this,
- ),
- );
- }
-
- TaskConstMeta get kCrateApiDiscoveryRsDiscoveryAddDeviceConstMeta => const TaskConstMeta(
- debugName: 'RsDiscovery_add_device',
- argNames: ['that', 'device'],
- );
-
@override
Future<void> crateApiDiscoveryRsDiscoveryAnnounce({required RsDiscovery that}) {
return handler.executeNormal(
@@ -602,7 +583,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
callFfi: (port_) {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsDiscovery(that, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 8, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 7, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -628,7 +609,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsDiscovery(that, serializer);
sse_encode_String(fingerprint, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 9, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 8, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_list_rs_device_log,
@@ -665,7 +646,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_u_16(port, serializer);
sse_encode_protocol_type(protocol, serializer);
sse_encode_u_64(graceMs, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 10, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 9, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -684,16 +665,16 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
);
@override
- Stream<RsStoredDevice> crateApiDiscoveryRsDiscoveryListen({required RsDiscovery that}) {
- final sink = RustStreamSink<RsStoredDevice>();
+ Stream<RsDiscoveryEvent> crateApiDiscoveryRsDiscoveryListen({required RsDiscovery that}) {
+ final sink = RustStreamSink<RsDiscoveryEvent>();
unawaited(
handler.executeNormal(
NormalTask(
callFfi: (port_) {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsDiscovery(that, serializer);
- sse_encode_StreamSink_rs_stored_device_Sse(sink, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 11, port: port_);
+ sse_encode_StreamSink_rs_discovery_event_Sse(sink, serializer);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 10, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -720,7 +701,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
callFfi: (port_) {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsDiscovery(that, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 12, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 11, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_opt_String,
@@ -738,6 +719,65 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
argNames: ['that'],
);
+ @override
+ Future<void> crateApiDiscoveryRsDiscoveryObserveInbound({required RsDiscovery that, required RsDiscoveredDevice device}) {
+ return handler.executeNormal(
+ NormalTask(
+ callFfi: (port_) {
+ final serializer = SseSerializer(generalizedFrbRustBinding);
+ sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsDiscovery(that, serializer);
+ sse_encode_box_autoadd_rs_discovered_device(device, serializer);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 12, port: port_);
+ },
+ codec: SseCodec(
+ decodeSuccessData: sse_decode_unit,
+ decodeErrorData: null,
+ ),
+ constMeta: kCrateApiDiscoveryRsDiscoveryObserveInboundConstMeta,
+ argValues: [that, device],
+ apiImpl: this,
+ ),
+ );
+ }
+
+ TaskConstMeta get kCrateApiDiscoveryRsDiscoveryObserveInboundConstMeta => const TaskConstMeta(
+ debugName: 'RsDiscovery_observe_inbound',
+ argNames: ['that', 'device'],
+ );
+
+ @override
+ Future<bool> crateApiDiscoveryRsDiscoveryReportOutbound({
+ required RsDiscovery that,
+ required String fingerprint,
+ required RsDeviceChannel channel,
+ String? error,
+ }) {
+ return handler.executeNormal(
+ NormalTask(
+ callFfi: (port_) {
+ final serializer = SseSerializer(generalizedFrbRustBinding);
+ sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsDiscovery(that, serializer);
+ sse_encode_String(fingerprint, serializer);
+ sse_encode_box_autoadd_rs_device_channel(channel, serializer);
+ sse_encode_opt_String(error, serializer);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 13, port: port_);
+ },
+ codec: SseCodec(
+ decodeSuccessData: sse_decode_bool,
+ decodeErrorData: null,
+ ),
+ constMeta: kCrateApiDiscoveryRsDiscoveryReportOutboundConstMeta,
+ argValues: [that, fingerprint, channel, error],
+ apiImpl: this,
+ ),
+ );
+ }
+
+ TaskConstMeta get kCrateApiDiscoveryRsDiscoveryReportOutboundConstMeta => const TaskConstMeta(
+ debugName: 'RsDiscovery_report_outbound',
+ argNames: ['that', 'fingerprint', 'channel', 'error'],
+ );
+
@override
Future<void> crateApiDiscoveryRsDiscoveryScanSubnet({
required RsDiscovery that,
@@ -753,7 +793,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_String(interfaceIp, serializer);
sse_encode_u_16(port, serializer);
sse_encode_protocol_type(protocol, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 13, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 14, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -779,7 +819,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsDiscovery(that, serializer);
sse_encode_bool(answer, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 14, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 15, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -804,7 +844,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
callFfi: (port_) {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsDiscovery(that, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 15, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 16, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -839,7 +879,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_String(ip, serializer);
sse_encode_u_16(port, serializer);
sse_encode_String(sessionId, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 16, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 17, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -880,7 +920,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_opt_String(publicKey, serializer);
sse_encode_opt_String(pin, serializer);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsCancellationToken(cancelToken, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 17, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 18, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_prepare_upload_result,
@@ -915,7 +955,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_String(ip, serializer);
sse_encode_u_16(port, serializer);
sse_encode_box_autoadd_register_dto(payload, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 18, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 19, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_result_with_public_key_register_response_dto,
@@ -972,7 +1012,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_opt_box_autoadd_i_32(fileDescriptor, serializer);
sse_encode_u_64(contentLength, serializer);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsCancellationToken(cancelToken, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 19, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 20, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1015,7 +1055,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsHttpServer(that, serializer);
sse_encode_String(sessionId, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 20, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 21, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1042,7 +1082,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsHttpServer(that, serializer);
sse_encode_String(sessionId, serializer);
sse_encode_String(fileId, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 21, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 22, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1069,7 +1109,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsHttpServer(that, serializer);
sse_encode_String(sessionId, serializer);
sse_encode_String(fileId, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 22, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 23, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1097,7 +1137,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsHttpServer(that, serializer);
sse_encode_StreamSink_rs_server_event_Sse(sink, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 23, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 24, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1134,7 +1174,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_String(fileId, serializer);
sse_encode_opt_String(path, serializer);
sse_encode_opt_box_autoadd_i_32(fileDescriptor, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 24, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 25, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1174,7 +1214,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_opt_String(path, serializer);
sse_encode_opt_box_autoadd_i_32(fileDescriptor, serializer);
sse_encode_u_64(fileSize, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 25, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 26, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1203,7 +1243,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsHttpServer(that, serializer);
sse_encode_String(sessionId, serializer);
sse_encode_bool(accept, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 26, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 27, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1229,7 +1269,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsHttpServer(that, serializer);
sse_encode_opt_list_String(acceptedFileIds, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 27, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 28, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1254,7 +1294,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
callFfi: (port_) {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsHttpServer(that, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 28, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 29, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1279,7 +1319,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
callFfi: (port_) {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRTCFileReceiver(that, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 29, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 30, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_String,
@@ -1307,7 +1347,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRTCFileReceiver(that, serializer);
sse_encode_StreamSink_list_prim_u_8_strict_Sse(sink, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 30, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 31, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1335,7 +1375,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRTCFileSender(that, serializer);
sse_encode_list_prim_u_8_loose(data, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 31, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 32, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1360,7 +1400,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
callFfi: (port_) {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRTCReceiveController(that, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 32, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 33, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1388,7 +1428,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRTCReceiveController(that, serializer);
sse_encode_StreamSink_rtc_file_error_Sse(sink, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 33, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 34, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1415,7 +1455,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
callFfi: (port_) {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRTCReceiveController(that, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 34, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 35, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_list_file_dto,
@@ -1443,7 +1483,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRTCReceiveController(that, serializer);
sse_encode_StreamSink_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRTCFileReceiver_Sse(sink, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 35, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 36, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1473,7 +1513,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRTCReceiveController(that, serializer);
sse_encode_StreamSink_rtc_status_Sse(sink, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 36, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 37, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1501,7 +1541,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRTCReceiveController(that, serializer);
sse_encode_box_autoadd_rtc_send_file_response(status, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 37, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 38, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1527,7 +1567,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRTCReceiveController(that, serializer);
sse_encode_String(pin, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 38, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 39, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1553,7 +1593,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRTCReceiveController(that, serializer);
sse_encode_Set_String_None(selection, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 39, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 40, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1581,7 +1621,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRTCSendController(that, serializer);
sse_encode_StreamSink_rtc_file_error_Sse(sink, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 40, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 41, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1608,7 +1648,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
callFfi: (port_) {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRTCSendController(that, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 41, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 42, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_Set_String_None,
@@ -1636,7 +1676,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRTCSendController(that, serializer);
sse_encode_StreamSink_rtc_status_Sse(sink, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 42, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 43, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1664,7 +1704,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRTCSendController(that, serializer);
sse_encode_String(fileId, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 43, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 44, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRTCFileSender,
@@ -1690,7 +1730,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRTCSendController(that, serializer);
sse_encode_String(pin, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 44, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 45, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1729,7 +1769,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
onConnection,
serializer,
);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 45, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 46, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1755,7 +1795,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
SyncTask(
callFfi: () {
final serializer = SseSerializer(generalizedFrbRustBinding);
- return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 46)!;
+ return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 47)!;
},
codec: SseCodec(
decodeSuccessData: sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsCancellationToken,
@@ -1790,7 +1830,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_ls_http_client_version(version, serializer);
sse_encode_opt_String(expectedFingerprint, serializer);
sse_encode_opt_box_autoadd_u_32(timeoutMs, serializer);
- return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 47)!;
+ return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 48)!;
},
codec: SseCodec(
decodeSuccessData: sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsHttpClient,
@@ -1814,7 +1854,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
NormalTask(
callFfi: (port_) {
final serializer = SseSerializer(generalizedFrbRustBinding);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 48, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 49, port: port_);
},
codec: SseCodec(
decodeSuccessData:
@@ -1839,7 +1879,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
NormalTask(
callFfi: (port_) {
final serializer = SseSerializer(generalizedFrbRustBinding);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 49, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 50, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1863,7 +1903,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
NormalTask(
callFfi: (port_) {
final serializer = SseSerializer(generalizedFrbRustBinding);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 50, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 51, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_key_pair,
@@ -1887,7 +1927,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
NormalTask(
callFfi: (port_) {
final serializer = SseSerializer(generalizedFrbRustBinding);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 51, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 52, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_security_context,
@@ -1918,7 +1958,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_opt_box_autoadd_i_32(fileDescriptor, serializer);
sse_encode_opt_list_prim_u_8_strict(bytes, serializer);
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsCancellationToken(cancelToken, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 52, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 53, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -1945,7 +1985,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
callFfi: () {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_String(name, serializer);
- return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 53)!;
+ return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 54)!;
},
codec: SseCodec(
decodeSuccessData: sse_decode_bool,
@@ -1970,7 +2010,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
callFfi: (port_) {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_String(path, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 54, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 55, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_opt_box_autoadd_file_metadata,
@@ -1995,7 +2035,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
callFfi: () {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_String(name, serializer);
- return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 55)!;
+ return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 56)!;
},
codec: SseCodec(
decodeSuccessData: sse_decode_String,
@@ -2048,7 +2088,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_String(certPem, serializer);
sse_encode_String(privateKeyPem, serializer);
sse_encode_u_64(timeoutMs, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 56, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 57, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsDiscovery,
@@ -2125,7 +2165,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_bool(verifyChecksums, serializer);
sse_encode_box_autoadd_web_params(web, serializer);
sse_encode_opt_String(showToken, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 57, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 58, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRsHttpServer,
@@ -2151,7 +2191,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
final serializer = SseSerializer(generalizedFrbRustBinding);
sse_encode_String(cert, serializer);
sse_encode_String(publicKey, serializer);
- pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 58, port: port_);
+ pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 59, port: port_);
},
codec: SseCodec(
decodeSuccessData: sse_decode_unit,
@@ -2523,19 +2563,19 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
}
@protected
- RustStreamSink<RsHashFileEvent> dco_decode_StreamSink_rs_hash_file_event_Sse(dynamic raw) {
+ RustStreamSink<RsDiscoveryEvent> dco_decode_StreamSink_rs_discovery_event_Sse(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
throw UnimplementedError();
}
@protected
- RustStreamSink<RsServerEvent> dco_decode_StreamSink_rs_server_event_Sse(dynamic raw) {
+ RustStreamSink<RsHashFileEvent> dco_decode_StreamSink_rs_hash_file_event_Sse(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
throw UnimplementedError();
}
@protected
- RustStreamSink<RsStoredDevice> dco_decode_StreamSink_rs_stored_device_Sse(dynamic raw) {
+ RustStreamSink<RsServerEvent> dco_decode_StreamSink_rs_server_event_Sse(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
throw UnimplementedError();
}
@@ -2668,6 +2708,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return dco_decode_register_dto_v_2(raw);
}
+ @protected
+ RsDeviceChannel dco_decode_box_autoadd_rs_device_channel(dynamic raw) {
+ // Codec=Dco (DartCObject based), see doc to use other codecs
+ return dco_decode_rs_device_channel(raw);
+ }
+
@protected
RsDiscoveredDevice dco_decode_box_autoadd_rs_discovered_device(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
@@ -2680,6 +2726,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return dco_decode_rs_http_client_error(raw);
}
+ @protected
+ RsStoredDevice dco_decode_box_autoadd_rs_stored_device(dynamic raw) {
+ // Codec=Dco (DartCObject based), see doc to use other codecs
+ return dco_decode_rs_stored_device(raw);
+ }
+
@protected
RTCSendFileResponse dco_decode_box_autoadd_rtc_send_file_response(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
@@ -2698,6 +2750,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return raw as int;
}
+ @protected
+ BigInt dco_decode_box_autoadd_u_64(dynamic raw) {
+ // Codec=Dco (DartCObject based), see doc to use other codecs
+ return dco_decode_u_64(raw);
+ }
+
@protected
WebParams dco_decode_box_autoadd_web_params(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
@@ -2739,12 +2797,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
);
}
- @protected
- DeviceLogKind dco_decode_device_log_kind(dynamic raw) {
- // Codec=Dco (DartCObject based), see doc to use other codecs
- return DeviceLogKind.values[raw as int];
- }
-
@protected
DeviceType dco_decode_device_type(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
@@ -2872,6 +2924,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return (raw as List<dynamic>).map(dco_decode_rs_device_log).toList();
}
+ @protected
+ List<RsStoredChannel> dco_decode_list_rs_stored_channel(dynamic raw) {
+ // Codec=Dco (DartCObject based), see doc to use other codecs
+ return (raw as List<dynamic>).map(dco_decode_rs_stored_channel).toList();
+ }
+
@protected
LsHttpClientVersion dco_decode_ls_http_client_version(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
@@ -2941,6 +2999,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return raw == null ? null : dco_decode_box_autoadd_u_32(raw);
}
+ @protected
+ BigInt? dco_decode_opt_box_autoadd_u_64(dynamic raw) {
+ // Codec=Dco (DartCObject based), see doc to use other codecs
+ return raw == null ? null : dco_decode_box_autoadd_u_64(raw);
+ }
+
@protected
List<String>? dco_decode_opt_list_String(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
@@ -3134,14 +3198,39 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
RsDeviceLog dco_decode_rs_device_log(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
final arr = raw as List<dynamic>;
- if (arr.length != 3) throw Exception('unexpected arr length: expect 3 but see ${arr.length}');
+ if (arr.length != 2) throw Exception('unexpected arr length: expect 2 but see ${arr.length}');
return RsDeviceLog(
timestampMillis: dco_decode_u_64(arr[0]),
- kind: dco_decode_device_log_kind(arr[1]),
- channel: dco_decode_rs_device_channel(arr[2]),
+ event: dco_decode_rs_device_log_event(arr[1]),
);
}
+ @protected
+ RsDeviceLogEvent dco_decode_rs_device_log_event(dynamic raw) {
+ // Codec=Dco (DartCObject based), see doc to use other codecs
+ switch (raw[0]) {
+ case 0:
+ return RsDeviceLogEvent_Outbound(
+ channel: dco_decode_box_autoadd_rs_device_channel(raw[1]),
+ );
+ case 1:
+ return RsDeviceLogEvent_OutboundFailed(
+ channel: dco_decode_box_autoadd_rs_device_channel(raw[1]),
+ error: dco_decode_String(raw[2]),
+ );
+ case 2:
+ return RsDeviceLogEvent_Inbound(
+ channel: dco_decode_box_autoadd_rs_device_channel(raw[1]),
+ );
+ case 3:
+ return RsDeviceLogEvent_MulticastInbound(
+ host: dco_decode_String(raw[1]),
+ );
+ default:
+ throw Exception('unreachable');
+ }
+ }
+
@protected
RsDiscoveredDevice dco_decode_rs_discovered_device(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
@@ -3160,6 +3249,24 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
);
}
+ @protected
+ RsDiscoveryEvent dco_decode_rs_discovery_event(dynamic raw) {
+ // Codec=Dco (DartCObject based), see doc to use other codecs
+ switch (raw[0]) {
+ case 0:
+ return RsDiscoveryEvent_Device(
+ dco_decode_box_autoadd_rs_stored_device(raw[1]),
+ );
+ case 1:
+ return RsDiscoveryEvent_Unreachable(
+ device: dco_decode_box_autoadd_rs_stored_device(raw[1]),
+ error: dco_decode_String(raw[2]),
+ );
+ default:
+ throw Exception('unreachable');
+ }
+ }
+
@protected
RsHashFileEvent dco_decode_rs_hash_file_event(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
@@ -3187,18 +3294,22 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
message: dco_decode_opt_String(raw[2]),
);
case 1:
- return RsHttpClientError_Reqwest(
+ return RsHttpClientError_Unreachable(
dco_decode_String(raw[1]),
);
case 2:
- return RsHttpClientError_Json(
+ return RsHttpClientError_Reqwest(
dco_decode_String(raw[1]),
);
case 3:
- return RsHttpClientError_Io(
+ return RsHttpClientError_Json(
dco_decode_String(raw[1]),
);
case 4:
+ return RsHttpClientError_Io(
+ dco_decode_String(raw[1]),
+ );
+ case 5:
return RsHttpClientError_Other(
dco_decode_String(raw[1]),
);
@@ -3207,6 +3318,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
}
}
+ @protected
+ RsOutbound dco_decode_rs_outbound(dynamic raw) {
+ // Codec=Dco (DartCObject based), see doc to use other codecs
+ return RsOutbound.values[raw as int];
+ }
+
@protected
RsServerEvent dco_decode_rs_server_event(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
@@ -3269,6 +3386,20 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
}
}
+ @protected
+ RsStoredChannel dco_decode_rs_stored_channel(dynamic raw) {
+ // Codec=Dco (DartCObject based), see doc to use other codecs
+ final arr = raw as List<dynamic>;
+ if (arr.length != 5) throw Exception('unexpected arr length: expect 5 but see ${arr.length}');
+ return RsStoredChannel(
+ host: dco_decode_String(arr[0]),
+ port: dco_decode_u_16(arr[1]),
+ protocol: dco_decode_protocol_type(arr[2]),
+ outbound: dco_decode_rs_outbound(arr[3]),
+ inboundAtMillis: dco_decode_opt_box_autoadd_u_64(arr[4]),
+ );
+ }
+
@protected
RsStoredDevice dco_decode_rs_stored_device(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
@@ -3281,7 +3412,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
deviceType: dco_decode_opt_box_autoadd_device_type(arr[3]),
fingerprint: dco_decode_String(arr[4]),
download: dco_decode_bool(arr[5]),
- channels: dco_decode_list_rs_device_channel(arr[6]),
+ channels: dco_decode_list_rs_stored_channel(arr[6]),
);
}
@@ -3810,19 +3941,19 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
}
@protected
- RustStreamSink<RsHashFileEvent> sse_decode_StreamSink_rs_hash_file_event_Sse(SseDeserializer deserializer) {
+ RustStreamSink<RsDiscoveryEvent> sse_decode_StreamSink_rs_discovery_event_Sse(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
throw UnimplementedError('Unreachable ()');
}
@protected
- RustStreamSink<RsServerEvent> sse_decode_StreamSink_rs_server_event_Sse(SseDeserializer deserializer) {
+ RustStreamSink<RsHashFileEvent> sse_decode_StreamSink_rs_hash_file_event_Sse(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
throw UnimplementedError('Unreachable ()');
}
@protected
- RustStreamSink<RsStoredDevice> sse_decode_StreamSink_rs_stored_device_Sse(SseDeserializer deserializer) {
+ RustStreamSink<RsServerEvent> sse_decode_StreamSink_rs_server_event_Sse(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
throw UnimplementedError('Unreachable ()');
}
@@ -3957,6 +4088,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return (sse_decode_register_dto_v_2(deserializer));
}
+ @protected
+ RsDeviceChannel sse_decode_box_autoadd_rs_device_channel(SseDeserializer deserializer) {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ return (sse_decode_rs_device_channel(deserializer));
+ }
+
@protected
RsDiscoveredDevice sse_decode_box_autoadd_rs_discovered_device(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@@ -3969,6 +4106,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return (sse_decode_rs_http_client_error(deserializer));
}
+ @protected
+ RsStoredDevice sse_decode_box_autoadd_rs_stored_device(SseDeserializer deserializer) {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ return (sse_decode_rs_stored_device(deserializer));
+ }
+
@protected
RTCSendFileResponse sse_decode_box_autoadd_rtc_send_file_response(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@@ -3987,6 +4130,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return (sse_decode_u_32(deserializer));
}
+ @protected
+ BigInt sse_decode_box_autoadd_u_64(SseDeserializer deserializer) {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ return (sse_decode_u_64(deserializer));
+ }
+
@protected
WebParams sse_decode_box_autoadd_web_params(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@@ -4022,13 +4171,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return ClientInfoWithoutId(alias: var_alias, version: var_version, deviceModel: var_deviceModel, deviceType: var_deviceType, token: var_token);
}
- @protected
- DeviceLogKind sse_decode_device_log_kind(SseDeserializer deserializer) {
- // Codec=Sse (Serialization based), see doc to use other codecs
- var inner = sse_decode_i_32(deserializer);
- return DeviceLogKind.values[inner];
- }
-
@protected
DeviceType sse_decode_device_type(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@@ -4197,6 +4339,18 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return ans_;
}
+ @protected
+ List<RsStoredChannel> sse_decode_list_rs_stored_channel(SseDeserializer deserializer) {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+
+ var len_ = sse_decode_i_32(deserializer);
+ var ans_ = <RsStoredChannel>[];
+ for (var idx_ = 0; idx_ < len_; ++idx_) {
+ ans_.add(sse_decode_rs_stored_channel(deserializer));
+ }
+ return ans_;
+ }
+
@protected
LsHttpClientVersion sse_decode_ls_http_client_version(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@@ -4317,6 +4471,17 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
}
}
+ @protected
+ BigInt? sse_decode_opt_box_autoadd_u_64(SseDeserializer deserializer) {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+
+ if (sse_decode_bool(deserializer)) {
+ return (sse_decode_box_autoadd_u_64(deserializer));
+ } else {
+ return null;
+ }
+ }
+
@protected
List<String>? sse_decode_opt_list_String(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@@ -4501,9 +4666,32 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
RsDeviceLog sse_decode_rs_device_log(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
var var_timestampMillis = sse_decode_u_64(deserializer);
- var var_kind = sse_decode_device_log_kind(deserializer);
- var var_channel = sse_decode_rs_device_channel(deserializer);
- return RsDeviceLog(timestampMillis: var_timestampMillis, kind: var_kind, channel: var_channel);
+ var var_event = sse_decode_rs_device_log_event(deserializer);
+ return RsDeviceLog(timestampMillis: var_timestampMillis, event: var_event);
+ }
+
+ @protected
+ RsDeviceLogEvent sse_decode_rs_device_log_event(SseDeserializer deserializer) {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+
+ var tag_ = sse_decode_i_32(deserializer);
+ switch (tag_) {
+ case 0:
+ var var_channel = sse_decode_box_autoadd_rs_device_channel(deserializer);
+ return RsDeviceLogEvent_Outbound(channel: var_channel);
+ case 1:
+ var var_channel = sse_decode_box_autoadd_rs_device_channel(deserializer);
+ var var_error = sse_decode_String(deserializer);
+ return RsDeviceLogEvent_OutboundFailed(channel: var_channel, error: var_error);
+ case 2:
+ var var_channel = sse_decode_box_autoadd_rs_device_channel(deserializer);
+ return RsDeviceLogEvent_Inbound(channel: var_channel);
+ case 3:
+ var var_host = sse_decode_String(deserializer);
+ return RsDeviceLogEvent_MulticastInbound(host: var_host);
+ default:
+ throw UnimplementedError('');
+ }
}
@protected
@@ -4531,6 +4719,24 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
);
}
+ @protected
+ RsDiscoveryEvent sse_decode_rs_discovery_event(SseDeserializer deserializer) {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+
+ var tag_ = sse_decode_i_32(deserializer);
+ switch (tag_) {
+ case 0:
+ var var_field0 = sse_decode_box_autoadd_rs_stored_device(deserializer);
+ return RsDiscoveryEvent_Device(var_field0);
+ case 1:
+ var var_device = sse_decode_box_autoadd_rs_stored_device(deserializer);
+ var var_error = sse_decode_String(deserializer);
+ return RsDiscoveryEvent_Unreachable(device: var_device, error: var_error);
+ default:
+ throw UnimplementedError('');
+ }
+ }
+
@protected
RsHashFileEvent sse_decode_rs_hash_file_event(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@@ -4560,14 +4766,17 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return RsHttpClientError_StatusCode(status: var_status, message: var_message);
case 1:
var var_field0 = sse_decode_String(deserializer);
- return RsHttpClientError_Reqwest(var_field0);
+ return RsHttpClientError_Unreachable(var_field0);
case 2:
var var_field0 = sse_decode_String(deserializer);
- return RsHttpClientError_Json(var_field0);
+ return RsHttpClientError_Reqwest(var_field0);
case 3:
var var_field0 = sse_decode_String(deserializer);
- return RsHttpClientError_Io(var_field0);
+ return RsHttpClientError_Json(var_field0);
case 4:
+ var var_field0 = sse_decode_String(deserializer);
+ return RsHttpClientError_Io(var_field0);
+ case 5:
var var_field0 = sse_decode_String(deserializer);
return RsHttpClientError_Other(var_field0);
default:
@@ -4575,6 +4784,13 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
}
}
+ @protected
+ RsOutbound sse_decode_rs_outbound(SseDeserializer deserializer) {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ var inner = sse_decode_i_32(deserializer);
+ return RsOutbound.values[inner];
+ }
+
@protected
RsServerEvent sse_decode_rs_server_event(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@@ -4635,6 +4851,17 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
}
}
+ @protected
+ RsStoredChannel sse_decode_rs_stored_channel(SseDeserializer deserializer) {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ var var_host = sse_decode_String(deserializer);
+ var var_port = sse_decode_u_16(deserializer);
+ var var_protocol = sse_decode_protocol_type(deserializer);
+ var var_outbound = sse_decode_rs_outbound(deserializer);
+ var var_inboundAtMillis = sse_decode_opt_box_autoadd_u_64(deserializer);
+ return RsStoredChannel(host: var_host, port: var_port, protocol: var_protocol, outbound: var_outbound, inboundAtMillis: var_inboundAtMillis);
+ }
+
@protected
RsStoredDevice sse_decode_rs_stored_device(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@@ -4644,7 +4871,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
var var_deviceType = sse_decode_opt_box_autoadd_device_type(deserializer);
var var_fingerprint = sse_decode_String(deserializer);
var var_download = sse_decode_bool(deserializer);
- var var_channels = sse_decode_list_rs_device_channel(deserializer);
+ var var_channels = sse_decode_list_rs_stored_channel(deserializer);
return RsStoredDevice(
alias: var_alias,
version: var_version,
@@ -5238,12 +5465,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
}
@protected
- void sse_encode_StreamSink_rs_hash_file_event_Sse(RustStreamSink<RsHashFileEvent> self, SseSerializer serializer) {
+ void sse_encode_StreamSink_rs_discovery_event_Sse(RustStreamSink<RsDiscoveryEvent> self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_String(
self.setupAndSerialize(
codec: SseCodec(
- decodeSuccessData: sse_decode_rs_hash_file_event,
+ decodeSuccessData: sse_decode_rs_discovery_event,
decodeErrorData: sse_decode_AnyhowException,
),
),
@@ -5252,12 +5479,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
}
@protected
- void sse_encode_StreamSink_rs_server_event_Sse(RustStreamSink<RsServerEvent> self, SseSerializer serializer) {
+ void sse_encode_StreamSink_rs_hash_file_event_Sse(RustStreamSink<RsHashFileEvent> self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_String(
self.setupAndSerialize(
codec: SseCodec(
- decodeSuccessData: sse_decode_rs_server_event,
+ decodeSuccessData: sse_decode_rs_hash_file_event,
decodeErrorData: sse_decode_AnyhowException,
),
),
@@ -5266,12 +5493,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
}
@protected
- void sse_encode_StreamSink_rs_stored_device_Sse(RustStreamSink<RsStoredDevice> self, SseSerializer serializer) {
+ void sse_encode_StreamSink_rs_server_event_Sse(RustStreamSink<RsServerEvent> self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_String(
self.setupAndSerialize(
codec: SseCodec(
- decodeSuccessData: sse_decode_rs_stored_device,
+ decodeSuccessData: sse_decode_rs_server_event,
decodeErrorData: sse_decode_AnyhowException,
),
),
@@ -5440,6 +5667,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_register_dto_v_2(self, serializer);
}
+ @protected
+ void sse_encode_box_autoadd_rs_device_channel(RsDeviceChannel self, SseSerializer serializer) {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ sse_encode_rs_device_channel(self, serializer);
+ }
+
@protected
void sse_encode_box_autoadd_rs_discovered_device(RsDiscoveredDevice self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@@ -5452,6 +5685,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_rs_http_client_error(self, serializer);
}
+ @protected
+ void sse_encode_box_autoadd_rs_stored_device(RsStoredDevice self, SseSerializer serializer) {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ sse_encode_rs_stored_device(self, serializer);
+ }
+
@protected
void sse_encode_box_autoadd_rtc_send_file_response(RTCSendFileResponse self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@@ -5470,6 +5709,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_u_32(self, serializer);
}
+ @protected
+ void sse_encode_box_autoadd_u_64(BigInt self, SseSerializer serializer) {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ sse_encode_u_64(self, serializer);
+ }
+
@protected
void sse_encode_box_autoadd_web_params(WebParams self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@@ -5503,12 +5748,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_String(self.token, serializer);
}
- @protected
- void sse_encode_device_log_kind(DeviceLogKind self, SseSerializer serializer) {
- // Codec=Sse (Serialization based), see doc to use other codecs
- sse_encode_i_32(self.index, serializer);
- }
-
@protected
void sse_encode_device_type(DeviceType self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@@ -5643,6 +5882,15 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
}
}
+ @protected
+ void sse_encode_list_rs_stored_channel(List<RsStoredChannel> self, SseSerializer serializer) {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ sse_encode_i_32(self.length, serializer);
+ for (final item in self) {
+ sse_encode_rs_stored_channel(item, serializer);
+ }
+ }
+
@protected
void sse_encode_ls_http_client_version(LsHttpClientVersion self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@@ -5752,6 +6000,16 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
}
}
+ @protected
+ void sse_encode_opt_box_autoadd_u_64(BigInt? self, SseSerializer serializer) {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+
+ sse_encode_bool(self != null, serializer);
+ if (self != null) {
+ sse_encode_box_autoadd_u_64(self, serializer);
+ }
+ }
+
@protected
void sse_encode_opt_list_String(List<String>? self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@@ -5896,8 +6154,27 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
void sse_encode_rs_device_log(RsDeviceLog self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_u_64(self.timestampMillis, serializer);
- sse_encode_device_log_kind(self.kind, serializer);
- sse_encode_rs_device_channel(self.channel, serializer);
+ sse_encode_rs_device_log_event(self.event, serializer);
+ }
+
+ @protected
+ void sse_encode_rs_device_log_event(RsDeviceLogEvent self, SseSerializer serializer) {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ switch (self) {
+ case RsDeviceLogEvent_Outbound(channel: final channel):
+ sse_encode_i_32(0, serializer);
+ sse_encode_box_autoadd_rs_device_channel(channel, serializer);
+ case RsDeviceLogEvent_OutboundFailed(channel: final channel, error: final error):
+ sse_encode_i_32(1, serializer);
+ sse_encode_box_autoadd_rs_device_channel(channel, serializer);
+ sse_encode_String(error, serializer);
+ case RsDeviceLogEvent_Inbound(channel: final channel):
+ sse_encode_i_32(2, serializer);
+ sse_encode_box_autoadd_rs_device_channel(channel, serializer);
+ case RsDeviceLogEvent_MulticastInbound(host: final host):
+ sse_encode_i_32(3, serializer);
+ sse_encode_String(host, serializer);
+ }
}
@protected
@@ -5914,6 +6191,20 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_bool(self.download, serializer);
}
+ @protected
+ void sse_encode_rs_discovery_event(RsDiscoveryEvent self, SseSerializer serializer) {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ switch (self) {
+ case RsDiscoveryEvent_Device(field0: final field0):
+ sse_encode_i_32(0, serializer);
+ sse_encode_box_autoadd_rs_stored_device(field0, serializer);
+ case RsDiscoveryEvent_Unreachable(device: final device, error: final error):
+ sse_encode_i_32(1, serializer);
+ sse_encode_box_autoadd_rs_stored_device(device, serializer);
+ sse_encode_String(error, serializer);
+ }
+ }
+
@protected
void sse_encode_rs_hash_file_event(RsHashFileEvent self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@@ -5935,21 +6226,30 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_i_32(0, serializer);
sse_encode_u_16(status, serializer);
sse_encode_opt_String(message, serializer);
- case RsHttpClientError_Reqwest(field0: final field0):
+ case RsHttpClientError_Unreachable(field0: final field0):
sse_encode_i_32(1, serializer);
sse_encode_String(field0, serializer);
- case RsHttpClientError_Json(field0: final field0):
+ case RsHttpClientError_Reqwest(field0: final field0):
sse_encode_i_32(2, serializer);
sse_encode_String(field0, serializer);
- case RsHttpClientError_Io(field0: final field0):
+ case RsHttpClientError_Json(field0: final field0):
sse_encode_i_32(3, serializer);
sse_encode_String(field0, serializer);
- case RsHttpClientError_Other(field0: final field0):
+ case RsHttpClientError_Io(field0: final field0):
sse_encode_i_32(4, serializer);
sse_encode_String(field0, serializer);
+ case RsHttpClientError_Other(field0: final field0):
+ sse_encode_i_32(5, serializer);
+ sse_encode_String(field0, serializer);
}
}
+ @protected
+ void sse_encode_rs_outbound(RsOutbound self, SseSerializer serializer) {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ sse_encode_i_32(self.index, serializer);
+ }
+
@protected
void sse_encode_rs_server_event(RsServerEvent self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@@ -6006,6 +6306,16 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
}
}
+ @protected
+ void sse_encode_rs_stored_channel(RsStoredChannel self, SseSerializer serializer) {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ sse_encode_String(self.host, serializer);
+ sse_encode_u_16(self.port, serializer);
+ sse_encode_protocol_type(self.protocol, serializer);
+ sse_encode_rs_outbound(self.outbound, serializer);
+ sse_encode_opt_box_autoadd_u_64(self.inboundAtMillis, serializer);
+ }
+
@protected
void sse_encode_rs_stored_device(RsStoredDevice self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@@ -6015,7 +6325,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
sse_encode_opt_box_autoadd_device_type(self.deviceType, serializer);
sse_encode_String(self.fingerprint, serializer);
sse_encode_bool(self.download, serializer);
- sse_encode_list_rs_device_channel(self.channels, serializer);
+ sse_encode_list_rs_stored_channel(self.channels, serializer);
}
@protected
@@ -6336,17 +6646,11 @@ class RsDiscoveryImpl extends RustOpaque implements RsDiscovery {
rustArcDecrementStrongCountPtr: RustLib.instance.api.rust_arc_decrement_strong_count_RsDiscoveryPtr,
);
- /// Puts a device confirmed outside of the discovery into the store, e.g.
- /// one that answered an announcement by registering with this device's
- /// HTTP server. The device is emitted on [RsDiscovery::listen].
- Future<void> addDevice({required RsDiscoveredDevice device}) =>
- RustLib.instance.api.crateApiDiscoveryRsDiscoveryAddDevice(that: this, device: device);
-
/// Announces this device to the network, which makes every other LocalSend
/// device on it register with this device over HTTP.
///
/// Devices registering in response arrive at the application as server
- /// events, not here: feed them back via [RsDiscovery::add_device].
+ /// events, not here: feed them back via [RsDiscovery::observe_inbound].
///
/// Returns once the whole announcement burst has been sent, which takes a
/// few seconds, or immediately once the discovery has been stopped or
@@ -6355,7 +6659,7 @@ class RsDiscoveryImpl extends RustOpaque implements RsDiscovery {
that: this,
);
- /// The retained confirmations of a stored device, oldest first, capped at
+ /// The retained observations of a stored device, oldest first, capped at
/// the store's log limit. Empty when the fingerprint is unknown.
Future<List<RsDeviceLog>> deviceLogs({required String fingerprint}) =>
RustLib.instance.api.crateApiDiscoveryRsDiscoveryDeviceLogs(that: this, fingerprint: fingerprint);
@@ -6385,8 +6689,8 @@ class RsDiscoveryImpl extends RustOpaque implements RsDiscovery {
graceMs: graceMs,
);
- /// Emits a [RsStoredDevice] for every device confirmation until the
- /// discovery is stopped. Can only be listened to once.
+ /// Emits a [RsDiscoveryEvent] for every observation of a device until
+ /// the discovery is stopped. Can only be listened to once.
///
/// Also ends when the multicast sockets failed permanently (e.g. because
/// the OS invalidated them while the application was suspended): the
@@ -6395,7 +6699,7 @@ class RsDiscoveryImpl extends RustOpaque implements RsDiscovery {
///
/// Also returns when the Dart side of the stream is gone (e.g. after a
/// hot restart), so this call does not keep the discovery alive forever.
- Stream<RsStoredDevice> listen() => RustLib.instance.api.crateApiDiscoveryRsDiscoveryListen(
+ Stream<RsDiscoveryEvent> listen() => RustLib.instance.api.crateApiDiscoveryRsDiscoveryListen(
that: this,
);
@@ -6405,6 +6709,28 @@ class RsDiscoveryImpl extends RustOpaque implements RsDiscovery {
that: this,
);
+ /// Puts a device that reached this device's HTTP server into the store,
+ /// e.g. one that answered an announcement by registering. The device is
+ /// emitted on [RsDiscovery::listen].
+ ///
+ /// Only the inbound direction of the address is confirmed: an address
+ /// new to the device is stored with [RsOutbound::Untested].
+ Future<void> observeInbound({required RsDiscoveredDevice device}) =>
+ RustLib.instance.api.crateApiDiscoveryRsDiscoveryObserveInbound(that: this, device: device);
+
+ /// Records the outcome of a request the application sent to a stored
+ /// device over [channel], e.g. a transfer: without an [error] the channel
+ /// becomes [RsOutbound::Reachable], with one — the reason, for display —
+ /// it becomes [RsOutbound::Failed], which ranks it behind the device's
+ /// other channels. The device is emitted on [RsDiscovery::listen].
+ ///
+ /// Only report failures to reach the device at all, not requests that
+ /// the device answered with an error.
+ ///
+ /// Returns `false` when no device has the fingerprint.
+ Future<bool> reportOutbound({required String fingerprint, required RsDeviceChannel channel, String? error}) =>
+ RustLib.instance.api.crateApiDiscoveryRsDiscoveryReportOutbound(that: this, fingerprint: fingerprint, channel: channel, error: error);
+
/// Scans the `/24` subnet of the local interface address [interface_ip]
/// by sending every other host a register request, for networks that do
/// not carry multicast.
diff --git a/packages/localsend_isolates/lib/rust/frb_generated.io.dart b/packages/localsend_isolates/lib/rust/frb_generated.io.dart
index d0835297..2b1d1f57 100644
--- a/packages/localsend_isolates/lib/rust/frb_generated.io.dart
+++ b/packages/localsend_isolates/lib/rust/frb_generated.io.dart
@@ -195,13 +195,13 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
RustStreamSink<Uint8List> dco_decode_StreamSink_list_prim_u_8_strict_Sse(dynamic raw);
@protected
- RustStreamSink<RsHashFileEvent> dco_decode_StreamSink_rs_hash_file_event_Sse(dynamic raw);
+ RustStreamSink<RsDiscoveryEvent> dco_decode_StreamSink_rs_discovery_event_Sse(dynamic raw);
@protected
- RustStreamSink<RsServerEvent> dco_decode_StreamSink_rs_server_event_Sse(dynamic raw);
+ RustStreamSink<RsHashFileEvent> dco_decode_StreamSink_rs_hash_file_event_Sse(dynamic raw);
@protected
- RustStreamSink<RsStoredDevice> dco_decode_StreamSink_rs_stored_device_Sse(dynamic raw);
+ RustStreamSink<RsServerEvent> dco_decode_StreamSink_rs_server_event_Sse(dynamic raw);
@protected
RustStreamSink<RsUploadEvent> dco_decode_StreamSink_rs_upload_event_Sse(dynamic raw);
@@ -268,12 +268,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
RegisterDtoV2 dco_decode_box_autoadd_register_dto_v_2(dynamic raw);
+ @protected
+ RsDeviceChannel dco_decode_box_autoadd_rs_device_channel(dynamic raw);
+
@protected
RsDiscoveredDevice dco_decode_box_autoadd_rs_discovered_device(dynamic raw);
@protected
RsHttpClientError dco_decode_box_autoadd_rs_http_client_error(dynamic raw);
+ @protected
+ RsStoredDevice dco_decode_box_autoadd_rs_stored_device(dynamic raw);
+
@protected
RTCSendFileResponse dco_decode_box_autoadd_rtc_send_file_response(dynamic raw);
@@ -283,6 +289,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
int dco_decode_box_autoadd_u_32(dynamic raw);
+ @protected
+ BigInt dco_decode_box_autoadd_u_64(dynamic raw);
+
@protected
WebParams dco_decode_box_autoadd_web_params(dynamic raw);
@@ -295,9 +304,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
ClientInfoWithoutId dco_decode_client_info_without_id(dynamic raw);
- @protected
- DeviceLogKind dco_decode_device_log_kind(dynamic raw);
-
@protected
DeviceType dco_decode_device_type(dynamic raw);
@@ -349,6 +355,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
List<RsDeviceLog> dco_decode_list_rs_device_log(dynamic raw);
+ @protected
+ List<RsStoredChannel> dco_decode_list_rs_stored_channel(dynamic raw);
+
@protected
LsHttpClientVersion dco_decode_ls_http_client_version(dynamic raw);
@@ -383,6 +392,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
int? dco_decode_opt_box_autoadd_u_32(dynamic raw);
+ @protected
+ BigInt? dco_decode_opt_box_autoadd_u_64(dynamic raw);
+
@protected
List<String>? dco_decode_opt_list_String(dynamic raw);
@@ -437,18 +449,30 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
RsDeviceLog dco_decode_rs_device_log(dynamic raw);
+ @protected
+ RsDeviceLogEvent dco_decode_rs_device_log_event(dynamic raw);
+
@protected
RsDiscoveredDevice dco_decode_rs_discovered_device(dynamic raw);
+ @protected
+ RsDiscoveryEvent dco_decode_rs_discovery_event(dynamic raw);
+
@protected
RsHashFileEvent dco_decode_rs_hash_file_event(dynamic raw);
@protected
RsHttpClientError dco_decode_rs_http_client_error(dynamic raw);
+ @protected
+ RsOutbound dco_decode_rs_outbound(dynamic raw);
+
@protected
RsServerEvent dco_decode_rs_server_event(dynamic raw);
+ @protected
+ RsStoredChannel dco_decode_rs_stored_channel(dynamic raw);
+
@protected
RsStoredDevice dco_decode_rs_stored_device(dynamic raw);
@@ -659,13 +683,13 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
RustStreamSink<Uint8List> sse_decode_StreamSink_list_prim_u_8_strict_Sse(SseDeserializer deserializer);
@protected
- RustStreamSink<RsHashFileEvent> sse_decode_StreamSink_rs_hash_file_event_Sse(SseDeserializer deserializer);
+ RustStreamSink<RsDiscoveryEvent> sse_decode_StreamSink_rs_discovery_event_Sse(SseDeserializer deserializer);
@protected
- RustStreamSink<RsServerEvent> sse_decode_StreamSink_rs_server_event_Sse(SseDeserializer deserializer);
+ RustStreamSink<RsHashFileEvent> sse_decode_StreamSink_rs_hash_file_event_Sse(SseDeserializer deserializer);
@protected
- RustStreamSink<RsStoredDevice> sse_decode_StreamSink_rs_stored_device_Sse(SseDeserializer deserializer);
+ RustStreamSink<RsServerEvent> sse_decode_StreamSink_rs_server_event_Sse(SseDeserializer deserializer);
@protected
RustStreamSink<RsUploadEvent> sse_decode_StreamSink_rs_upload_event_Sse(SseDeserializer deserializer);
@@ -732,12 +756,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
RegisterDtoV2 sse_decode_box_autoadd_register_dto_v_2(SseDeserializer deserializer);
+ @protected
+ RsDeviceChannel sse_decode_box_autoadd_rs_device_channel(SseDeserializer deserializer);
+
@protected
RsDiscoveredDevice sse_decode_box_autoadd_rs_discovered_device(SseDeserializer deserializer);
@protected
RsHttpClientError sse_decode_box_autoadd_rs_http_client_error(SseDeserializer deserializer);
+ @protected
+ RsStoredDevice sse_decode_box_autoadd_rs_stored_device(SseDeserializer deserializer);
+
@protected
RTCSendFileResponse sse_decode_box_autoadd_rtc_send_file_response(SseDeserializer deserializer);
@@ -747,6 +777,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
int sse_decode_box_autoadd_u_32(SseDeserializer deserializer);
+ @protected
+ BigInt sse_decode_box_autoadd_u_64(SseDeserializer deserializer);
+
@protected
WebParams sse_decode_box_autoadd_web_params(SseDeserializer deserializer);
@@ -759,9 +792,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
ClientInfoWithoutId sse_decode_client_info_without_id(SseDeserializer deserializer);
- @protected
- DeviceLogKind sse_decode_device_log_kind(SseDeserializer deserializer);
-
@protected
DeviceType sse_decode_device_type(SseDeserializer deserializer);
@@ -813,6 +843,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
List<RsDeviceLog> sse_decode_list_rs_device_log(SseDeserializer deserializer);
+ @protected
+ List<RsStoredChannel> sse_decode_list_rs_stored_channel(SseDeserializer deserializer);
+
@protected
LsHttpClientVersion sse_decode_ls_http_client_version(SseDeserializer deserializer);
@@ -849,6 +882,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
int? sse_decode_opt_box_autoadd_u_32(SseDeserializer deserializer);
+ @protected
+ BigInt? sse_decode_opt_box_autoadd_u_64(SseDeserializer deserializer);
+
@protected
List<String>? sse_decode_opt_list_String(SseDeserializer deserializer);
@@ -903,18 +939,30 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
RsDeviceLog sse_decode_rs_device_log(SseDeserializer deserializer);
+ @protected
+ RsDeviceLogEvent sse_decode_rs_device_log_event(SseDeserializer deserializer);
+
@protected
RsDiscoveredDevice sse_decode_rs_discovered_device(SseDeserializer deserializer);
+ @protected
+ RsDiscoveryEvent sse_decode_rs_discovery_event(SseDeserializer deserializer);
+
@protected
RsHashFileEvent sse_decode_rs_hash_file_event(SseDeserializer deserializer);
@protected
RsHttpClientError sse_decode_rs_http_client_error(SseDeserializer deserializer);
+ @protected
+ RsOutbound sse_decode_rs_outbound(SseDeserializer deserializer);
+
@protected
RsServerEvent sse_decode_rs_server_event(SseDeserializer deserializer);
+ @protected
+ RsStoredChannel sse_decode_rs_stored_channel(SseDeserializer deserializer);
+
@protected
RsStoredDevice sse_decode_rs_stored_device(SseDeserializer deserializer);
@@ -1169,13 +1217,13 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
void sse_encode_StreamSink_list_prim_u_8_strict_Sse(RustStreamSink<Uint8List> self, SseSerializer serializer);
@protected
- void sse_encode_StreamSink_rs_hash_file_event_Sse(RustStreamSink<RsHashFileEvent> self, SseSerializer serializer);
+ void sse_encode_StreamSink_rs_discovery_event_Sse(RustStreamSink<RsDiscoveryEvent> self, SseSerializer serializer);
@protected
- void sse_encode_StreamSink_rs_server_event_Sse(RustStreamSink<RsServerEvent> self, SseSerializer serializer);
+ void sse_encode_StreamSink_rs_hash_file_event_Sse(RustStreamSink<RsHashFileEvent> self, SseSerializer serializer);
@protected
- void sse_encode_StreamSink_rs_stored_device_Sse(RustStreamSink<RsStoredDevice> self, SseSerializer serializer);
+ void sse_encode_StreamSink_rs_server_event_Sse(RustStreamSink<RsServerEvent> self, SseSerializer serializer);
@protected
void sse_encode_StreamSink_rs_upload_event_Sse(RustStreamSink<RsUploadEvent> self, SseSerializer serializer);
@@ -1243,12 +1291,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void sse_encode_box_autoadd_register_dto_v_2(RegisterDtoV2 self, SseSerializer serializer);
+ @protected
+ void sse_encode_box_autoadd_rs_device_channel(RsDeviceChannel self, SseSerializer serializer);
+
@protected
void sse_encode_box_autoadd_rs_discovered_device(RsDiscoveredDevice self, SseSerializer serializer);
@protected
void sse_encode_box_autoadd_rs_http_client_error(RsHttpClientError self, SseSerializer serializer);
+ @protected
+ void sse_encode_box_autoadd_rs_stored_device(RsStoredDevice self, SseSerializer serializer);
+
@protected
void sse_encode_box_autoadd_rtc_send_file_response(RTCSendFileResponse self, SseSerializer serializer);
@@ -1258,6 +1312,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void sse_encode_box_autoadd_u_32(int self, SseSerializer serializer);
+ @protected
+ void sse_encode_box_autoadd_u_64(BigInt self, SseSerializer serializer);
+
@protected
void sse_encode_box_autoadd_web_params(WebParams self, SseSerializer serializer);
@@ -1270,9 +1327,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void sse_encode_client_info_without_id(ClientInfoWithoutId self, SseSerializer serializer);
- @protected
- void sse_encode_device_log_kind(DeviceLogKind self, SseSerializer serializer);
-
@protected
void sse_encode_device_type(DeviceType self, SseSerializer serializer);
@@ -1324,6 +1378,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void sse_encode_list_rs_device_log(List<RsDeviceLog> self, SseSerializer serializer);
+ @protected
+ void sse_encode_list_rs_stored_channel(List<RsStoredChannel> self, SseSerializer serializer);
+
@protected
void sse_encode_ls_http_client_version(LsHttpClientVersion self, SseSerializer serializer);
@@ -1360,6 +1417,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void sse_encode_opt_box_autoadd_u_32(int? self, SseSerializer serializer);
+ @protected
+ void sse_encode_opt_box_autoadd_u_64(BigInt? self, SseSerializer serializer);
+
@protected
void sse_encode_opt_list_String(List<String>? self, SseSerializer serializer);
@@ -1415,18 +1475,30 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void sse_encode_rs_device_log(RsDeviceLog self, SseSerializer serializer);
+ @protected
+ void sse_encode_rs_device_log_event(RsDeviceLogEvent self, SseSerializer serializer);
+
@protected
void sse_encode_rs_discovered_device(RsDiscoveredDevice self, SseSerializer serializer);
+ @protected
+ void sse_encode_rs_discovery_event(RsDiscoveryEvent self, SseSerializer serializer);
+
@protected
void sse_encode_rs_hash_file_event(RsHashFileEvent self, SseSerializer serializer);
@protected
void sse_encode_rs_http_client_error(RsHttpClientError self, SseSerializer serializer);
+ @protected
+ void sse_encode_rs_outbound(RsOutbound self, SseSerializer serializer);
+
@protected
void sse_encode_rs_server_event(RsServerEvent self, SseSerializer serializer);
+ @protected
+ void sse_encode_rs_stored_channel(RsStoredChannel self, SseSerializer serializer);
+
@protected
void sse_encode_rs_stored_device(RsStoredDevice self, SseSerializer serializer);
diff --git a/packages/localsend_isolates/lib/rust/frb_generated.web.dart b/packages/localsend_isolates/lib/rust/frb_generated.web.dart
index d281d9e1..e790933f 100644
--- a/packages/localsend_isolates/lib/rust/frb_generated.web.dart
+++ b/packages/localsend_isolates/lib/rust/frb_generated.web.dart
@@ -197,13 +197,13 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
RustStreamSink<Uint8List> dco_decode_StreamSink_list_prim_u_8_strict_Sse(dynamic raw);
@protected
- RustStreamSink<RsHashFileEvent> dco_decode_StreamSink_rs_hash_file_event_Sse(dynamic raw);
+ RustStreamSink<RsDiscoveryEvent> dco_decode_StreamSink_rs_discovery_event_Sse(dynamic raw);
@protected
- RustStreamSink<RsServerEvent> dco_decode_StreamSink_rs_server_event_Sse(dynamic raw);
+ RustStreamSink<RsHashFileEvent> dco_decode_StreamSink_rs_hash_file_event_Sse(dynamic raw);
@protected
- RustStreamSink<RsStoredDevice> dco_decode_StreamSink_rs_stored_device_Sse(dynamic raw);
+ RustStreamSink<RsServerEvent> dco_decode_StreamSink_rs_server_event_Sse(dynamic raw);
@protected
RustStreamSink<RsUploadEvent> dco_decode_StreamSink_rs_upload_event_Sse(dynamic raw);
@@ -270,12 +270,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
RegisterDtoV2 dco_decode_box_autoadd_register_dto_v_2(dynamic raw);
+ @protected
+ RsDeviceChannel dco_decode_box_autoadd_rs_device_channel(dynamic raw);
+
@protected
RsDiscoveredDevice dco_decode_box_autoadd_rs_discovered_device(dynamic raw);
@protected
RsHttpClientError dco_decode_box_autoadd_rs_http_client_error(dynamic raw);
+ @protected
+ RsStoredDevice dco_decode_box_autoadd_rs_stored_device(dynamic raw);
+
@protected
RTCSendFileResponse dco_decode_box_autoadd_rtc_send_file_response(dynamic raw);
@@ -285,6 +291,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
int dco_decode_box_autoadd_u_32(dynamic raw);
+ @protected
+ BigInt dco_decode_box_autoadd_u_64(dynamic raw);
+
@protected
WebParams dco_decode_box_autoadd_web_params(dynamic raw);
@@ -297,9 +306,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
ClientInfoWithoutId dco_decode_client_info_without_id(dynamic raw);
- @protected
- DeviceLogKind dco_decode_device_log_kind(dynamic raw);
-
@protected
DeviceType dco_decode_device_type(dynamic raw);
@@ -351,6 +357,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
List<RsDeviceLog> dco_decode_list_rs_device_log(dynamic raw);
+ @protected
+ List<RsStoredChannel> dco_decode_list_rs_stored_channel(dynamic raw);
+
@protected
LsHttpClientVersion dco_decode_ls_http_client_version(dynamic raw);
@@ -385,6 +394,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
int? dco_decode_opt_box_autoadd_u_32(dynamic raw);
+ @protected
+ BigInt? dco_decode_opt_box_autoadd_u_64(dynamic raw);
+
@protected
List<String>? dco_decode_opt_list_String(dynamic raw);
@@ -439,18 +451,30 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
RsDeviceLog dco_decode_rs_device_log(dynamic raw);
+ @protected
+ RsDeviceLogEvent dco_decode_rs_device_log_event(dynamic raw);
+
@protected
RsDiscoveredDevice dco_decode_rs_discovered_device(dynamic raw);
+ @protected
+ RsDiscoveryEvent dco_decode_rs_discovery_event(dynamic raw);
+
@protected
RsHashFileEvent dco_decode_rs_hash_file_event(dynamic raw);
@protected
RsHttpClientError dco_decode_rs_http_client_error(dynamic raw);
+ @protected
+ RsOutbound dco_decode_rs_outbound(dynamic raw);
+
@protected
RsServerEvent dco_decode_rs_server_event(dynamic raw);
+ @protected
+ RsStoredChannel dco_decode_rs_stored_channel(dynamic raw);
+
@protected
RsStoredDevice dco_decode_rs_stored_device(dynamic raw);
@@ -661,13 +685,13 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
RustStreamSink<Uint8List> sse_decode_StreamSink_list_prim_u_8_strict_Sse(SseDeserializer deserializer);
@protected
- RustStreamSink<RsHashFileEvent> sse_decode_StreamSink_rs_hash_file_event_Sse(SseDeserializer deserializer);
+ RustStreamSink<RsDiscoveryEvent> sse_decode_StreamSink_rs_discovery_event_Sse(SseDeserializer deserializer);
@protected
- RustStreamSink<RsServerEvent> sse_decode_StreamSink_rs_server_event_Sse(SseDeserializer deserializer);
+ RustStreamSink<RsHashFileEvent> sse_decode_StreamSink_rs_hash_file_event_Sse(SseDeserializer deserializer);
@protected
- RustStreamSink<RsStoredDevice> sse_decode_StreamSink_rs_stored_device_Sse(SseDeserializer deserializer);
+ RustStreamSink<RsServerEvent> sse_decode_StreamSink_rs_server_event_Sse(SseDeserializer deserializer);
@protected
RustStreamSink<RsUploadEvent> sse_decode_StreamSink_rs_upload_event_Sse(SseDeserializer deserializer);
@@ -734,12 +758,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
RegisterDtoV2 sse_decode_box_autoadd_register_dto_v_2(SseDeserializer deserializer);
+ @protected
+ RsDeviceChannel sse_decode_box_autoadd_rs_device_channel(SseDeserializer deserializer);
+
@protected
RsDiscoveredDevice sse_decode_box_autoadd_rs_discovered_device(SseDeserializer deserializer);
@protected
RsHttpClientError sse_decode_box_autoadd_rs_http_client_error(SseDeserializer deserializer);
+ @protected
+ RsStoredDevice sse_decode_box_autoadd_rs_stored_device(SseDeserializer deserializer);
+
@protected
RTCSendFileResponse sse_decode_box_autoadd_rtc_send_file_response(SseDeserializer deserializer);
@@ -749,6 +779,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
int sse_decode_box_autoadd_u_32(SseDeserializer deserializer);
+ @protected
+ BigInt sse_decode_box_autoadd_u_64(SseDeserializer deserializer);
+
@protected
WebParams sse_decode_box_autoadd_web_params(SseDeserializer deserializer);
@@ -761,9 +794,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
ClientInfoWithoutId sse_decode_client_info_without_id(SseDeserializer deserializer);
- @protected
- DeviceLogKind sse_decode_device_log_kind(SseDeserializer deserializer);
-
@protected
DeviceType sse_decode_device_type(SseDeserializer deserializer);
@@ -815,6 +845,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
List<RsDeviceLog> sse_decode_list_rs_device_log(SseDeserializer deserializer);
+ @protected
+ List<RsStoredChannel> sse_decode_list_rs_stored_channel(SseDeserializer deserializer);
+
@protected
LsHttpClientVersion sse_decode_ls_http_client_version(SseDeserializer deserializer);
@@ -851,6 +884,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
int? sse_decode_opt_box_autoadd_u_32(SseDeserializer deserializer);
+ @protected
+ BigInt? sse_decode_opt_box_autoadd_u_64(SseDeserializer deserializer);
+
@protected
List<String>? sse_decode_opt_list_String(SseDeserializer deserializer);
@@ -905,18 +941,30 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
RsDeviceLog sse_decode_rs_device_log(SseDeserializer deserializer);
+ @protected
+ RsDeviceLogEvent sse_decode_rs_device_log_event(SseDeserializer deserializer);
+
@protected
RsDiscoveredDevice sse_decode_rs_discovered_device(SseDeserializer deserializer);
+ @protected
+ RsDiscoveryEvent sse_decode_rs_discovery_event(SseDeserializer deserializer);
+
@protected
RsHashFileEvent sse_decode_rs_hash_file_event(SseDeserializer deserializer);
@protected
RsHttpClientError sse_decode_rs_http_client_error(SseDeserializer deserializer);
+ @protected
+ RsOutbound sse_decode_rs_outbound(SseDeserializer deserializer);
+
@protected
RsServerEvent sse_decode_rs_server_event(SseDeserializer deserializer);
+ @protected
+ RsStoredChannel sse_decode_rs_stored_channel(SseDeserializer deserializer);
+
@protected
RsStoredDevice sse_decode_rs_stored_device(SseDeserializer deserializer);
@@ -1171,13 +1219,13 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
void sse_encode_StreamSink_list_prim_u_8_strict_Sse(RustStreamSink<Uint8List> self, SseSerializer serializer);
@protected
- void sse_encode_StreamSink_rs_hash_file_event_Sse(RustStreamSink<RsHashFileEvent> self, SseSerializer serializer);
+ void sse_encode_StreamSink_rs_discovery_event_Sse(RustStreamSink<RsDiscoveryEvent> self, SseSerializer serializer);
@protected
- void sse_encode_StreamSink_rs_server_event_Sse(RustStreamSink<RsServerEvent> self, SseSerializer serializer);
+ void sse_encode_StreamSink_rs_hash_file_event_Sse(RustStreamSink<RsHashFileEvent> self, SseSerializer serializer);
@protected
- void sse_encode_StreamSink_rs_stored_device_Sse(RustStreamSink<RsStoredDevice> self, SseSerializer serializer);
+ void sse_encode_StreamSink_rs_server_event_Sse(RustStreamSink<RsServerEvent> self, SseSerializer serializer);
@protected
void sse_encode_StreamSink_rs_upload_event_Sse(RustStreamSink<RsUploadEvent> self, SseSerializer serializer);
@@ -1245,12 +1293,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void sse_encode_box_autoadd_register_dto_v_2(RegisterDtoV2 self, SseSerializer serializer);
+ @protected
+ void sse_encode_box_autoadd_rs_device_channel(RsDeviceChannel self, SseSerializer serializer);
+
@protected
void sse_encode_box_autoadd_rs_discovered_device(RsDiscoveredDevice self, SseSerializer serializer);
@protected
void sse_encode_box_autoadd_rs_http_client_error(RsHttpClientError self, SseSerializer serializer);
+ @protected
+ void sse_encode_box_autoadd_rs_stored_device(RsStoredDevice self, SseSerializer serializer);
+
@protected
void sse_encode_box_autoadd_rtc_send_file_response(RTCSendFileResponse self, SseSerializer serializer);
@@ -1260,6 +1314,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void sse_encode_box_autoadd_u_32(int self, SseSerializer serializer);
+ @protected
+ void sse_encode_box_autoadd_u_64(BigInt self, SseSerializer serializer);
+
@protected
void sse_encode_box_autoadd_web_params(WebParams self, SseSerializer serializer);
@@ -1272,9 +1329,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void sse_encode_client_info_without_id(ClientInfoWithoutId self, SseSerializer serializer);
- @protected
- void sse_encode_device_log_kind(DeviceLogKind self, SseSerializer serializer);
-
@protected
void sse_encode_device_type(DeviceType self, SseSerializer serializer);
@@ -1326,6 +1380,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void sse_encode_list_rs_device_log(List<RsDeviceLog> self, SseSerializer serializer);
+ @protected
+ void sse_encode_list_rs_stored_channel(List<RsStoredChannel> self, SseSerializer serializer);
+
@protected
void sse_encode_ls_http_client_version(LsHttpClientVersion self, SseSerializer serializer);
@@ -1362,6 +1419,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void sse_encode_opt_box_autoadd_u_32(int? self, SseSerializer serializer);
+ @protected
+ void sse_encode_opt_box_autoadd_u_64(BigInt? self, SseSerializer serializer);
+
@protected
void sse_encode_opt_list_String(List<String>? self, SseSerializer serializer);
@@ -1417,18 +1477,30 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void sse_encode_rs_device_log(RsDeviceLog self, SseSerializer serializer);
+ @protected
+ void sse_encode_rs_device_log_event(RsDeviceLogEvent self, SseSerializer serializer);
+
@protected
void sse_encode_rs_discovered_device(RsDiscoveredDevice self, SseSerializer serializer);
+ @protected
+ void sse_encode_rs_discovery_event(RsDiscoveryEvent self, SseSerializer serializer);
+
@protected
void sse_encode_rs_hash_file_event(RsHashFileEvent self, SseSerializer serializer);
@protected
void sse_encode_rs_http_client_error(RsHttpClientError self, SseSerializer serializer);
+ @protected
+ void sse_encode_rs_outbound(RsOutbound self, SseSerializer serializer);
+
@protected
void sse_encode_rs_server_event(RsServerEvent self, SseSerializer serializer);
+ @protected
+ void sse_encode_rs_stored_channel(RsStoredChannel self, SseSerializer serializer);
+
@protected
void sse_encode_rs_stored_device(RsStoredDevice self, SseSerializer serializer);
diff --git a/packages/localsend_isolates/lib/src/isolate/child/discovery_isolate.dart b/packages/localsend_isolates/lib/src/isolate/child/discovery_isolate.dart
index a5725d26..58db484f 100644
--- a/packages/localsend_isolates/lib/src/isolate/child/discovery_isolate.dart
+++ b/packages/localsend_isolates/lib/src/isolate/child/discovery_isolate.dart
@@ -1,4 +1,5 @@
import 'package:localsend_isolates/model/device.dart';
+import 'package:localsend_isolates/model/discovery_event.dart';
import 'package:localsend_isolates/src/isolate/child/main.dart';
import 'package:localsend_isolates/src/isolate/dto/send_to_isolate_data.dart';
import 'package:localsend_isolates/src/task/discovery/discovery.dart';
@@ -10,16 +11,17 @@ sealed class DiscoveryTask {}
/// routed to the task that requested it.
sealed class DiscoveryResult {}
-/// A confirmed device, emitted on the [DiscoveryListenTask] stream.
-class DiscoveryDeviceResult implements DiscoveryResult {
- final Device device;
+/// An event of the running discovery, emitted on the [DiscoveryListenTask]
+/// stream.
+class DiscoveryEventResult implements DiscoveryResult {
+ final DiscoveryEvent event;
- DiscoveryDeviceResult({
- required this.device,
+ DiscoveryEventResult({
+ required this.event,
});
}
-/// The retained confirmations of one stored device, answering a
+/// The retained observations of one stored device, answering a
/// [DiscoveryDeviceLogsTask].
class DiscoveryDeviceLogsResult implements DiscoveryResult {
final List<DeviceLog> logs;
@@ -29,7 +31,8 @@ class DiscoveryDeviceLogsResult implements DiscoveryResult {
});
}
-/// Starts the discovery and streams every confirmed device.
+/// Starts the discovery and streams its events: every confirmed device whose
+/// state changed, and every device that was only heard announcing itself.
/// The stream never completes; it survives [DiscoveryRestartTask]s.
class DiscoveryListenTask implements DiscoveryTask {}
@@ -76,18 +79,34 @@ class DiscoveryStagedScanTask implements DiscoveryTask {
});
}
-/// Feeds a device confirmed outside of the discovery into the store, e.g. one
-/// that registered with this device's HTTP server. The device comes back on
-/// the [DiscoveryListenTask] stream.
-class DiscoveryAddDeviceTask implements DiscoveryTask {
+/// Feeds a device that reached this device's HTTP server into the store, e.g.
+/// one that registered. Only the inbound direction of its address is
+/// confirmed. The device comes back on the [DiscoveryListenTask] stream.
+class DiscoveryObserveInboundTask implements DiscoveryTask {
final Device device;
- DiscoveryAddDeviceTask({
+ DiscoveryObserveInboundTask({
required this.device,
});
}
-/// Fetches the retained confirmations of a stored device, oldest first.
+/// Records the outcome of a request the application itself sent to a stored
+/// device over [channel]: without an [error] the device was reached, with one
+/// it could not be reached at all. The device comes back on the
+/// [DiscoveryListenTask] stream.
+class DiscoveryReportOutboundTask implements DiscoveryTask {
+ final String fingerprint;
+ final HttpChannel channel;
+ final String? error;
+
+ DiscoveryReportOutboundTask({
+ required this.fingerprint,
+ required this.channel,
+ required this.error,
+ });
+}
+
+/// Fetches the retained observations of a stored device, oldest first.
/// Answered with one [DiscoveryDeviceLogsResult]; the logs are empty when
/// the fingerprint is unknown.
class DiscoveryDeviceLogsTask implements DiscoveryTask {
@@ -111,11 +130,11 @@ Future<void> setupDiscoveryIsolate(
handler: (ref, task) async {
switch (task.data) {
case DiscoveryListenTask():
- await for (final device in ref.read(discoveryProvider).startListener()) {
+ await for (final event in ref.read(discoveryProvider).startListener()) {
sendToMain(
IsolateTaskStreamResult.event(
id: task.id,
- data: DiscoveryDeviceResult(device: device),
+ data: DiscoveryEventResult(event: event),
),
);
}
@@ -146,8 +165,11 @@ Future<void> setupDiscoveryIsolate(
grace: data.grace,
);
break;
- case DiscoveryAddDeviceTask data:
- await ref.read(discoveryProvider).addDevice(data.device);
+ case DiscoveryObserveInboundTask data:
+ await ref.read(discoveryProvider).observeInbound(data.device);
+ break;
+ case DiscoveryReportOutboundTask data:
+ await ref.read(discoveryProvider).reportOutbound(data.fingerprint, data.channel, error: data.error);
break;
case DiscoveryDeviceLogsTask data:
final logs = await ref.read(discoveryProvider).deviceLogs(data.fingerprint);
diff --git a/packages/localsend_isolates/lib/src/isolate/parent/actions.dart b/packages/localsend_isolates/lib/src/isolate/parent/actions.dart
index 2a97fc73..689b210a 100644
--- a/packages/localsend_isolates/lib/src/isolate/parent/actions.dart
+++ b/packages/localsend_isolates/lib/src/isolate/parent/actions.dart
@@ -1,6 +1,7 @@
import 'dart:async';
import 'package:localsend_isolates/model/device.dart';
+import 'package:localsend_isolates/model/discovery_event.dart';
import 'package:localsend_isolates/rust/api/server.dart' show WebParams;
import 'package:localsend_isolates/src/isolate/child/discovery_isolate.dart';
import 'package:localsend_isolates/src/isolate/child/server_isolate.dart';
@@ -11,13 +12,19 @@ import 'package:refena_flutter/refena_flutter.dart';
import 'package:typed_isolates/id.dart';
import 'package:typed_isolates/typed_isolates.dart';
-/// Starts the discovery and returns the stream of confirmed devices:
-/// answered announcements, scan results and devices fed in via
-/// [IsolateDiscoveryAddDeviceAction] all arrive on this one stream.
+/// Starts the discovery and returns the stream of its events.
+///
+/// A [DiscoveryDeviceEvent] carries a confirmed device whose state changed:
+/// answered announcements, scan results, devices fed in via
+/// [IsolateDiscoveryObserveInboundAction] and outcomes reported via
+/// [IsolateDiscoveryReportOutboundAction] all arrive on this one stream.
+/// A [DiscoveryUnreachableEvent] carries a device that was only heard
+/// announcing itself and did not answer: it is not a transfer target.
+///
/// The stream never completes; it survives [IsolateDiscoveryRestartAction]s.
-class IsolateDiscoveryListenAction extends ReduxActionWithResult<IsolateController, ParentIsolateState, Stream<Device>> {
+class IsolateDiscoveryListenAction extends ReduxActionWithResult<IsolateController, ParentIsolateState, Stream<DiscoveryEvent>> {
@override
- (ParentIsolateState, Stream<Device>) reduce() {
+ (ParentIsolateState, Stream<DiscoveryEvent>) reduce() {
final connection = state.discovery;
if (connection == null) {
throw StateError('discovery is not initialized');
@@ -29,7 +36,7 @@ class IsolateDiscoveryListenAction extends ReduxActionWithResult<IsolateControll
.sendWrappedTaskAndListenStream(
task: DiscoveryListenTask(),
)
- .toDeviceStream(),
+ .toEventStream(),
);
}
}
@@ -38,7 +45,7 @@ class IsolateDiscoveryListenAction extends ReduxActionWithResult<IsolateControll
/// for networks that do not carry multicast.
/// The returned stream completes (without events) when the scan is finished;
/// the found devices arrive on the [IsolateDiscoveryListenAction] stream.
-class IsolateDiscoverySubnetScanAction extends ReduxActionWithResult<IsolateController, ParentIsolateState, Stream<Device>> {
+class IsolateDiscoverySubnetScanAction extends ReduxActionWithResult<IsolateController, ParentIsolateState, Stream<void>> {
final String networkInterface;
final int port;
final bool https;
@@ -50,7 +57,7 @@ class IsolateDiscoverySubnetScanAction extends ReduxActionWithResult<IsolateCont
});
@override
- (ParentIsolateState, Stream<Device>) reduce() {
+ (ParentIsolateState, Stream<void>) reduce() {
final connection = state.discovery;
if (connection == null) {
throw StateError('discovery is not initialized');
@@ -58,15 +65,13 @@ class IsolateDiscoverySubnetScanAction extends ReduxActionWithResult<IsolateCont
return (
state,
- connection
- .sendWrappedTaskAndListenStream(
- task: DiscoverySubnetScanTask(
- networkInterface: networkInterface,
- port: port,
- https: https,
- ),
- )
- .toDeviceStream(),
+ connection.sendWrappedTaskAndListenStream(
+ task: DiscoverySubnetScanTask(
+ networkInterface: networkInterface,
+ port: port,
+ https: https,
+ ),
+ ),
);
}
}
@@ -77,7 +82,7 @@ class IsolateDiscoverySubnetScanAction extends ReduxActionWithResult<IsolateCont
/// The returned stream completes (without events) when every stage has
/// finished; the found devices arrive on the [IsolateDiscoveryListenAction]
/// stream.
-class IsolateDiscoveryStagedScanAction extends ReduxActionWithResult<IsolateController, ParentIsolateState, Stream<Device>> {
+class IsolateDiscoveryStagedScanAction extends ReduxActionWithResult<IsolateController, ParentIsolateState, Stream<void>> {
final List<(String, int)> favorites;
final List<String> networkInterfaces;
final int port;
@@ -93,7 +98,7 @@ class IsolateDiscoveryStagedScanAction extends ReduxActionWithResult<IsolateCont
});
@override
- (ParentIsolateState, Stream<Device>) reduce() {
+ (ParentIsolateState, Stream<void>) reduce() {
final connection = state.discovery;
if (connection == null) {
throw StateError('discovery is not initialized');
@@ -101,22 +106,21 @@ class IsolateDiscoveryStagedScanAction extends ReduxActionWithResult<IsolateCont
return (
state,
- connection
- .sendWrappedTaskAndListenStream(
- task: DiscoveryStagedScanTask(
- favorites: favorites,
- networkInterfaces: networkInterfaces,
- port: port,
- https: https,
- grace: grace,
- ),
- )
- .toDeviceStream(),
+ connection.sendWrappedTaskAndListenStream(
+ task: DiscoveryStagedScanTask(
+ favorites: favorites,
+ networkInterfaces: networkInterfaces,
+ port: port,
+ https: https,
+ grace: grace,
+ ),
+ ),
);
}
}
-/// Fetches the retained confirmations of a stored device, oldest first.
+/// Fetches the retained observations of a stored device, oldest first,
+/// including a device that was only heard announcing itself.
/// The logs are empty when the fingerprint is unknown or the discovery is
/// not running.
class IsolateDiscoveryDeviceLogsAction extends AsyncReduxActionWithResult<IsolateController, ParentIsolateState, List<DeviceLog>> {
@@ -188,13 +192,16 @@ class IsolateDiscoveryRestartAction extends ReduxAction<IsolateController, Paren
}
}
-/// Feeds a device confirmed outside of the discovery into the discovery store,
-/// e.g. one that registered with this device's HTTP server. The device comes
-/// back on the [IsolateDiscoveryListenAction] stream.
-class IsolateDiscoveryAddDeviceAction extends ReduxAction<IsolateController, ParentIsolateState> {
+/// Feeds a device that reached this device's HTTP server into the discovery
+/// store, e.g. one that registered. Only the inbound direction of its address
+/// is confirmed: whether the device can be dialed back there is then tested
+/// by the discovery in the background.
+/// The device comes back on the [IsolateDiscoveryListenAction] stream, and
+/// again with the outcome of that test.
+class IsolateDiscoveryObserveInboundAction extends ReduxAction<IsolateController, ParentIsolateState> {
final Device device;
- IsolateDiscoveryAddDeviceAction({
+ IsolateDiscoveryObserveInboundAction({
required this.device,
});
@@ -209,7 +216,7 @@ class IsolateDiscoveryAddDeviceAction extends ReduxAction<IsolateController, Par
SendToIsolateData(
syncState: null,
data: IsolateTask(
- data: DiscoveryAddDeviceTask(
+ data: DiscoveryObserveInboundTask(
device: device,
),
),
@@ -220,6 +227,50 @@ class IsolateDiscoveryAddDeviceAction extends ReduxAction<IsolateController, Par
}
}
+/// Records the outcome of a request the application itself sent to the
+/// stored device with the given [fingerprint] over [channel], e.g. a
+/// transfer: without an [error] the device was reached, with one (the
+/// reason, for display) it could not be reached at all.
+/// The device comes back on the [IsolateDiscoveryListenAction] stream;
+/// nothing happens when no stored device has the fingerprint.
+///
+/// Only report failures to reach the device, not requests that the device
+/// answered with an error.
+class IsolateDiscoveryReportOutboundAction extends ReduxAction<IsolateController, ParentIsolateState> {
+ final String fingerprint;
+ final HttpChannel channel;
+ final String? error;
+
+ IsolateDiscoveryReportOutboundAction({
+ required this.fingerprint,
+ required this.channel,
+ this.error,
+ });
+
+ @override
+ ParentIsolateState reduce() {
+ final connection = state.discovery;
+ if (connection == null) {
+ throw StateError('discovery is not initialized');
+ }
+
+ connection.sendToIsolate(
+ SendToIsolateData(
+ syncState: null,
+ data: IsolateTask(
+ data: DiscoveryReportOutboundTask(
+ fingerprint: fingerprint,
+ channel: channel,
+ error: error,
+ ),
+ ),
+ ),
+ );
+
+ return state;
+ }
+}
+
class IsolateHttpUploadActionResult {
final int taskId;
final Stream<HttpUploadEvent> events;
@@ -541,10 +592,10 @@ class IsolateHttpServerFailFileDownloadAction extends ReduxAction<IsolateControl
}
}
-extension _DeviceStreamExt on Stream<DiscoveryResult> {
- /// Unwraps the [DiscoveryDeviceResult]s of a device stream.
- Stream<Device> toDeviceStream() {
- return map((result) => (result as DiscoveryDeviceResult).device);
+extension _DiscoveryStreamExt on Stream<DiscoveryResult> {
+ /// Unwraps the [DiscoveryEventResult]s of the listen stream.
+ Stream<DiscoveryEvent> toEventStream() {
+ return map((result) => (result as DiscoveryEventResult).event);
}
}
diff --git a/packages/localsend_isolates/lib/src/task/discovery/discovery.dart b/packages/localsend_isolates/lib/src/task/discovery/discovery.dart
index d448719f..deea0020 100644
--- a/packages/localsend_isolates/lib/src/task/discovery/discovery.dart
+++ b/packages/localsend_isolates/lib/src/task/discovery/discovery.dart
@@ -2,6 +2,7 @@ import 'dart:async';
import 'package:localsend_isolates/constants.dart';
import 'package:localsend_isolates/model/device.dart';
+import 'package:localsend_isolates/model/discovery_event.dart';
import 'package:localsend_isolates/rust/api/discovery.dart';
import 'package:localsend_isolates/rust/api/model.dart' as rust_model;
import 'package:localsend_isolates/src/isolate/child/sync_provider.dart';
@@ -17,8 +18,8 @@ final discoveryProvider = Provider((ref) {
/// Owns the Rust discovery (`core/discovery`): the multicast sockets, the
/// register requests answering announcements, the subnet scans and the store
-/// of confirmed devices all live on the Rust side. This service configures it
-/// from the [syncProvider] state and maps every confirmation to a [Device].
+/// of devices all live on the Rust side. This service configures it from the
+/// [syncProvider] state and maps every observation to a [DiscoveryEvent].
class DiscoveryService {
DiscoveryService(this._ref);
@@ -31,10 +32,14 @@ class DiscoveryService {
/// opposed to stopping itself because the multicast sockets failed.
bool _restartRequested = false;
- /// Starts the discovery and emits every device confirmation:
- /// answered announcements, scan results and devices fed in
- /// via [addDevice] all arrive on this one stream.
- Stream<Device> startListener() {
+ /// Starts the discovery and emits its events on this one stream.
+ ///
+ /// A [DiscoveryDeviceEvent] carries a confirmed device whose state changed:
+ /// answered announcements, scan results, devices fed in via
+ /// [observeInbound] and outcomes reported via [reportOutbound].
+ /// A [DiscoveryUnreachableEvent] carries a device that was only heard
+ /// announcing itself and did not answer.
+ Stream<DiscoveryEvent> startListener() {
if (_listening) {
_logger.info('Already listening to discovery');
return const Stream.empty();
@@ -42,12 +47,12 @@ class DiscoveryService {
_listening = true;
- final devices = StreamController<Device>();
- unawaited(_runListener(devices));
- return devices.stream;
+ final events = StreamController<DiscoveryEvent>();
+ unawaited(_runListener(events));
+ return events.stream;
}
- Future<void> _runListener(StreamController<Device> devices) async {
+ Future<void> _runListener(StreamController<DiscoveryEvent> events) async {
// Announcements are only answered while the server runs: the answer would
// advertise an HTTP port that nobody listens on otherwise.
_ref.stream(syncProvider).listen((event) {
@@ -99,9 +104,9 @@ class DiscoveryService {
// Tell everyone in the network that I am online.
unawaited(discovery.announce());
- await for (final device in discovery.listen()) {
- if (!devices.isClosed) {
- devices.add(device.toDevice());
+ await for (final event in discovery.listen()) {
+ if (!events.isClosed) {
+ events.add(event.toDiscoveryEvent());
}
}
@@ -195,7 +200,8 @@ class DiscoveryService {
);
}
- /// The retained confirmations of a stored device, oldest first.
+ /// The retained observations of a stored device, oldest first, including a
+ /// device that was only heard announcing itself.
/// Empty when the fingerprint is unknown or the discovery is not running.
Future<List<DeviceLog>> deviceLogs(String fingerprint) async {
final discovery = _discovery;
@@ -208,10 +214,13 @@ class DiscoveryService {
return logs.map((log) => log.toDeviceLog()).toList();
}
- /// Feeds a device confirmed outside of the discovery into the store, e.g.
- /// one that registered with this device's HTTP server.
- /// The device comes back on the [startListener] stream.
- Future<void> addDevice(Device device) async {
+ /// Feeds a device that reached this device's HTTP server into the store,
+ /// e.g. one that registered. Only the inbound direction of its address is
+ /// confirmed: whether the device can be dialed back there is then tested by
+ /// the discovery in the background.
+ /// The device comes back on the [startListener] stream, and again with the
+ /// outcome of that test.
+ Future<void> observeInbound(Device device) async {
final discovery = _discovery;
final ip = device.ip;
if (discovery == null || ip == null) {
@@ -221,6 +230,27 @@ class DiscoveryService {
return;
}
- await discovery.addDevice(device: device.toRsDiscoveredDevice(ip));
+ await discovery.observeInbound(device: device.toRsDiscoveredDevice(ip));
+ }
+
+ /// Records the outcome of a request the application itself sent to the
+ /// stored device with the given [fingerprint] over [channel], e.g. a
+ /// transfer: without an [error] the device was reached, with one (the
+ /// reason, for display) it could not be reached at all.
+ /// The device comes back on the [startListener] stream.
+ ///
+ /// Only report failures to reach the device, not requests that the device
+ /// answered with an error.
+ Future<void> reportOutbound(String fingerprint, HttpChannel channel, {String? error}) async {
+ final discovery = _discovery;
+ if (discovery == null) {
+ _logger.info('Discovery is not running, skipping outcome of ${channel.host}:${channel.port}');
+ return;
+ }
+
+ final known = await discovery.reportOutbound(fingerprint: fingerprint, channel: channel.toRsDeviceChannel(), error: error);
+ if (!known) {
+ _logger.info('Unknown device, skipping outcome of ${channel.host}:${channel.port}');
+ }
}
}
diff --git a/packages/localsend_isolates/lib/util/rust.dart b/packages/localsend_isolates/lib/util/rust.dart
index 06dfb991..c16b96b5 100644
--- a/packages/localsend_isolates/lib/util/rust.dart
+++ b/packages/localsend_isolates/lib/util/rust.dart
@@ -1,6 +1,7 @@
import 'package:flutter_rust_bridge/flutter_rust_bridge.dart' show AnyhowException;
import 'package:localsend_isolates/constants.dart';
import 'package:localsend_isolates/model/device.dart';
+import 'package:localsend_isolates/model/discovery_event.dart';
import 'package:localsend_isolates/model/dto/file_dto.dart';
import 'package:localsend_isolates/model/dto/multicast_dto.dart';
import 'package:localsend_isolates/rust/api/discovery.dart' as rust_discovery;
@@ -106,6 +107,7 @@ extension HumanErrorMessageExt on Object {
final e = this;
return switch (e) {
rust_http.RsHttpClientError_StatusCode(:final status, :final message) when message != null => '[$status] $message',
+ rust_http.RsHttpClientError_Unreachable(:final field0) => field0,
AnyhowException(:final message) => message,
_ => e.toString(),
};
@@ -133,7 +135,8 @@ extension RustFileDtoExt on rust_model.FileDto {
extension RsStoredDeviceExt on rust_discovery.RsStoredDevice {
/// Maps the merged stored state to a [Device]: the best channel becomes the
- /// dialed address, every channel is kept as a [HttpChannel], best first.
+ /// dialed address, every channel is kept as a [HttpChannel] with its state
+ /// per direction, best first.
Device toDevice() {
final best = channels.first;
return Device(
@@ -148,35 +151,81 @@ extension RsStoredDeviceExt on rust_discovery.RsStoredDevice {
deviceType: deviceType?.toDart() ?? DeviceType.desktop,
download: download,
channels: [
- for (final channel in channels)
- HttpChannel(
- host: channel.host,
- port: channel.port,
- https: channel.protocol == rust_model.ProtocolType.https,
- ),
+ for (final channel in channels) channel.toHttpChannel(),
],
);
}
}
+extension RsStoredChannelExt on rust_discovery.RsStoredChannel {
+ HttpChannel toHttpChannel() {
+ final inboundAtMillis = this.inboundAtMillis;
+ return HttpChannel(
+ host: host,
+ port: port,
+ https: protocol == rust_model.ProtocolType.https,
+ outbound: switch (outbound) {
+ rust_discovery.RsOutbound.untested => ChannelOutbound.untested,
+ rust_discovery.RsOutbound.reachable => ChannelOutbound.reachable,
+ rust_discovery.RsOutbound.failed => ChannelOutbound.failed,
+ },
+ inbound: inboundAtMillis != null ? DateTime.fromMillisecondsSinceEpoch(inboundAtMillis.toInt()) : null,
+ );
+ }
+}
+
+extension RsDeviceChannelExt on rust_discovery.RsDeviceChannel {
+ /// Maps the address to a [HttpChannel] without any state per direction.
+ HttpChannel toHttpChannel() {
+ return HttpChannel(
+ host: host,
+ port: port,
+ https: protocol == rust_model.ProtocolType.https,
+ );
+ }
+}
+
+extension HttpChannelToRsDeviceChannelExt on HttpChannel {
+ /// Maps the address of the channel; the state per direction is dropped.
+ rust_discovery.RsDeviceChannel toRsDeviceChannel() {
+ return rust_discovery.RsDeviceChannel(
+ host: host,
+ port: port,
+ protocol: https ? rust_model.ProtocolType.https : rust_model.ProtocolType.http,
+ );
+ }
+}
+
+extension RsDiscoveryEventExt on rust_discovery.RsDiscoveryEvent {
+ DiscoveryEvent toDiscoveryEvent() {
+ return switch (this) {
+ rust_discovery.RsDiscoveryEvent_Device(:final field0) => DiscoveryDeviceEvent(device: field0.toDevice()),
+ rust_discovery.RsDiscoveryEvent_Unreachable(:final device, :final error) => DiscoveryUnreachableEvent(device: device.toDevice(), error: error),
+ };
+ }
+}
+
extension RsDeviceLogExt on rust_discovery.RsDeviceLog {
DeviceLog toDeviceLog() {
return DeviceLog(
timestamp: DateTime.fromMillisecondsSinceEpoch(timestampMillis.toInt()),
- kind: switch (kind) {
- rust_discovery.DeviceLogKind.discovered => DeviceLogKind.discovered,
- rust_discovery.DeviceLogKind.updated => DeviceLogKind.updated,
+ event: switch (event) {
+ rust_discovery.RsDeviceLogEvent_Outbound(:final channel) => DeviceLogOutbound(channel: channel.toHttpChannel()),
+ rust_discovery.RsDeviceLogEvent_OutboundFailed(:final channel, :final error) => DeviceLogOutboundFailed(
+ channel: channel.toHttpChannel(),
+ error: error,
+ ),
+ rust_discovery.RsDeviceLogEvent_Inbound(:final channel) => DeviceLogInbound(channel: channel.toHttpChannel()),
+ rust_discovery.RsDeviceLogEvent_MulticastInbound(:final host) => DeviceLogMulticastInbound(host: host),
},
- channel: HttpChannel(
- host: channel.host,
- port: channel.port,
- https: channel.protocol == rust_model.ProtocolType.https,
- ),
);
}
}
extension DeviceToRsDiscoveredDeviceExt on Device {
+ /// Maps a device that reached this device's HTTP server from [ip], as fed
+ /// into the discovery store via `observeInbound`. Only [ip] and the claimed
+ /// port and protocol are passed on: the [channels] play no role here.
rust_discovery.RsDiscoveredDevice toRsDiscoveredDevice(String ip) {
return rust_discovery.RsDiscoveredDevice(
alias: alias,
diff --git a/packages/localsend_isolates/rust/src/api/discovery.rs b/packages/localsend_isolates/rust/src/api/discovery.rs
index e153c221..9a9c2211 100644
--- a/packages/localsend_isolates/rust/src/api/discovery.rs
+++ b/packages/localsend_isolates/rust/src/api/discovery.rs
@@ -1,21 +1,20 @@
use crate::frb_generated::StreamSink;
-use flutter_rust_bridge::frb;
-pub use localsend::discovery::DeviceLogKind;
use localsend::discovery::{
- DeviceChannel, DeviceIdentity, DeviceLog, DiscoveredDevice, DiscoveryConfig, DiscoveryEvent,
- DiscoveryHandle, HttpChannel, StatefulDevice,
+ ChannelState, DeviceChannel, DeviceIdentity, DeviceLog, DeviceLogEvent, DiscoveredDevice,
+ DiscoveryConfig, DiscoveryEvent, DiscoveryHandle, HttpChannel, Outbound, StatefulDevice,
};
use localsend::model::discovery::{DeviceType, ProtocolType};
use localsend::multicast::{DEFAULT_MULTICAST_GROUP_V6, MulticastDevice};
use localsend::util::interface::InterfaceFilter;
use std::sync::Arc;
-use std::time::Duration;
+use std::time::{Duration, SystemTime};
use tokio::sync::{Mutex, mpsc, oneshot};
use tokio_util::sync::CancellationToken;
-/// A single device confirmation over HTTP, fed into the store via
-/// [RsDiscovery::add_device]: the device's register request was accepted by
-/// our server, so it is known to be reachable at [RsDiscoveredDevice::host].
+/// A device that reached this device's HTTP server, fed into the store via
+/// [RsDiscovery::observe_inbound]: its request arrived from
+/// [RsDiscoveredDevice::host], which says nothing about whether it can be
+/// dialed back there.
pub struct RsDiscoveredDevice {
pub alias: String,
@@ -29,12 +28,12 @@ pub struct RsDiscoveredDevice {
/// Fingerprint identifying the device; devices are deduplicated by it.
pub fingerprint: String,
- /// The host the device was confirmed on: an IP address, or the scoped
- /// form `fe80::1%3` for link-local IPv6 (the Rust HTTP client accepts
- /// both back as a host).
+ /// The host the request came from: an IP address, or the scoped form
+ /// `fe80::1%3` for link-local IPv6 (the Rust HTTP client accepts both
+ /// back as a host).
pub host: String,
- /// The port of the device's HTTP server.
+ /// The port the device claims its HTTP server listens on.
pub port: u16,
pub protocol: ProtocolType,
@@ -43,7 +42,7 @@ pub struct RsDiscoveredDevice {
pub download: bool,
}
-/// An address a stored device was confirmed on and is dialed at.
+/// The address of a device's HTTP server.
pub struct RsDeviceChannel {
/// The host to dial: an IP address, or the scoped form `fe80::1%3` for
/// link-local IPv6 (the Rust HTTP client accepts both back as a host).
@@ -55,15 +54,45 @@ pub struct RsDeviceChannel {
pub protocol: ProtocolType,
}
+/// An address of a stored device with what is known about each direction: a
+/// channel that works one way does not have to work the other way (e.g.
+/// because of a firewall on one of the devices).
+pub struct RsStoredChannel {
+ /// The host to dial: an IP address, or the scoped form `fe80::1%3` for
+ /// link-local IPv6 (the Rust HTTP client accepts both back as a host).
+ pub host: String,
+
+ /// The port of the device's HTTP server at this address.
+ pub port: u16,
+
+ pub protocol: ProtocolType,
+
+ /// This device → the peer: whether the peer can be dialed at this address.
+ pub outbound: RsOutbound,
+
+ /// The peer → this device: when the peer last reached this device's
+ /// server from this address, in milliseconds since the Unix epoch.
+ /// `None` when it never did.
+ pub inbound_at_millis: Option<u64>,
+}
+
+/// Whether a peer can be dialed on a channel.
+pub enum RsOutbound {
+ /// No request was sent over the channel yet: the peer reached this
+ /// device from it, which says nothing about the way back.
+ Untested,
+
+ /// The last request over the channel was answered.
+ Reachable,
+
+ /// The last request over the channel failed.
+ Failed,
+}
+
/// The merged stored state of a discovered device: one entry per fingerprint,
-/// carrying every address the device was confirmed on. A multi-homed device
+/// carrying every address the device was observed on. A multi-homed device
/// that is reachable over several network interfaces is still one
/// [RsStoredDevice].
-///
-/// Emitted on [RsDiscovery::listen] for every confirmation (answered
-/// announcements, scan results and devices fed in via
-/// [RsDiscovery::add_device]), so a device re-appears — with its channels
-/// accumulated so far — whenever it re-announces itself or is re-discovered.
pub struct RsStoredDevice {
pub alias: String,
@@ -80,29 +109,69 @@ pub struct RsStoredDevice {
/// Whether the device's download API is active.
pub download: bool,
- /// Every address the device was confirmed on, best first (available
- /// before not-reachable, IPv6 before IPv4, most recently confirmed
- /// first). Never empty: a device only enters the store through a
- /// confirmation.
- pub channels: Vec<RsDeviceChannel>,
+ /// Every address the device was observed on, in the order to dial them
+ /// (reachable before untested before failed, IPv6 before IPv4, most
+ /// recently confirmed first). Never empty: a device only enters the
+ /// store through an observation on one of its addresses.
+ pub channels: Vec<RsStoredChannel>,
}
-/// One retained confirmation of a stored device, for the device details UI.
+/// An event emitted on [RsDiscovery::listen].
+pub enum RsDiscoveryEvent {
+ /// The state of a confirmed device changed: it was discovered or
+ /// confirmed again (answered announcements, scan results and devices fed
+ /// in via [RsDiscovery::observe_inbound]), or a request to it failed.
+ /// Carries the merged state, so the device re-appears with everything
+ /// known about its channels so far.
+ Device(RsStoredDevice),
+
+ /// A device was heard announcing itself but did not answer the register
+ /// request, typically because a firewall blocks its server.
+ ///
+ /// Nothing about such a device is verified (announcements are
+ /// unauthenticated): it is for diagnostics only and must not be offered
+ /// as a transfer target.
+ Unreachable {
+ /// The merged state of the device, as its announcements claim it.
+ device: RsStoredDevice,
+
+ /// Why the most recent register request failed, for display.
+ error: String,
+ },
+}
+
+/// One retained observation of a stored device, for the device details UI.
pub struct RsDeviceLog {
- /// When the confirmation happened, in milliseconds since the Unix epoch.
+ /// When the observation happened, in milliseconds since the Unix epoch.
pub timestamp_millis: u64,
- /// Whether the confirmation discovered the device or re-confirmed it.
- pub kind: DeviceLogKind,
-
- /// The channel the confirmation happened on.
- pub channel: RsDeviceChannel,
+ pub event: RsDeviceLogEvent,
}
-#[frb(mirror(DeviceLogKind))]
-pub enum _DeviceLogKind {
- Discovered,
- Updated,
+/// What was observed about a device, and in which direction.
+pub enum RsDeviceLogEvent {
+ /// This device → the peer: a request over the channel was answered.
+ Outbound { channel: RsDeviceChannel },
+
+ /// This device → the peer: a request over the channel failed.
+ OutboundFailed {
+ channel: RsDeviceChannel,
+
+ /// Why the request failed, for display.
+ error: String,
+ },
+
+ /// The peer → this device: the peer sent a request to this device's
+ /// server. The channel is the address the request came from, with the
+ /// port the peer claims to serve on.
+ Inbound { channel: RsDeviceChannel },
+
+ /// The peer → this device: an announcement of the peer was heard.
+ MulticastInbound {
+ /// The address the announcement came from, in the scoped form
+ /// `fe80::1%3` for link-local IPv6.
+ host: String,
+ },
}
pub struct RsDiscovery {
@@ -160,8 +229,8 @@ static RUNNING_DISCOVERY: Mutex<Option<Arc<DiscoveryInstance>>> = Mutex::const_n
/// Cannot fail besides an invalid [group]: when no multicast socket could be
/// bound (e.g. the port is taken by another process), discovery still runs
/// without multicast — see [RsDiscovery::multicast_error] — and still learns
-/// about devices through [RsDiscovery::discover], [RsDiscovery::scan_subnet]
-/// and [RsDiscovery::add_device].
+/// about devices through [RsDiscovery::discover_staged],
+/// [RsDiscovery::scan_subnet] and [RsDiscovery::observe_inbound].
pub async fn start_discovery(
group: String,
port: u16,
@@ -237,8 +306,8 @@ pub async fn start_discovery(
}
impl RsDiscovery {
- /// Emits a [RsStoredDevice] for every device confirmation until the
- /// discovery is stopped. Can only be listened to once.
+ /// Emits a [RsDiscoveryEvent] for every observation of a device until
+ /// the discovery is stopped. Can only be listened to once.
///
/// Also ends when the multicast sockets failed permanently (e.g. because
/// the OS invalidated them while the application was suspended): the
@@ -247,7 +316,7 @@ impl RsDiscovery {
///
/// Also returns when the Dart side of the stream is gone (e.g. after a
/// hot restart), so this call does not keep the discovery alive forever.
- pub async fn listen(&self, sink: StreamSink<RsStoredDevice>) {
+ pub async fn listen(&self, sink: StreamSink<RsDiscoveryEvent>) {
let Some(mut event_rx) = self.event_rx.lock().await.take() else {
let _ = sink.add_error(anyhow::anyhow!("Discovery events already listened to"));
return;
@@ -261,25 +330,44 @@ impl RsDiscovery {
// the end explicitly.
_ = self.instance.cancel.cancelled() => break,
};
- let device = match event {
+ // The store is updated before the event is emitted, so the merged
+ // state is at least as new as the observation. It is missing when
+ // the device changed between confirmed and unconfirmed since; the
+ // event about that change follows.
+ let handle = &self.instance.handle;
+ let event = match event {
Some(
DiscoveryEvent::Discovered { device } | DiscoveryEvent::Updated { device },
- ) => device,
+ ) => handle
+ .device_by_fingerprint(&device.fingerprint)
+ .map(|stored| RsDiscoveryEvent::Device(rs_stored_device(stored))),
+ Some(DiscoveryEvent::Unreachable { device, error }) => {
+ unconfirmed_device(handle, &device.fingerprint).map(|stored| {
+ // The stored state may include a later failure than
+ // the event; its reason must match that state.
+ let error = stored
+ .logs
+ .iter()
+ .rev()
+ .find_map(|log| match &log.event {
+ DeviceLogEvent::OutboundFailed { error, .. } => Some(error.clone()),
+ _ => None,
+ })
+ .unwrap_or(error);
+ RsDiscoveryEvent::Unreachable {
+ device: rs_stored_device(stored),
+ error,
+ }
+ })
+ }
Some(DiscoveryEvent::MulticastFailed) => {
- tracing::error!(
- "Multicast sockets failed, ending the discovery event stream"
- );
+ tracing::error!("Multicast sockets failed, ending the discovery event stream");
break;
}
None => break,
};
- // The store is updated before the event is emitted, so the merged
- // state is at least as new as the confirmation.
- if let Some(stored) = self
- .instance
- .handle
- .device_by_fingerprint(&device.fingerprint)
- && sink.add(rs_stored_device(stored)).is_err()
+ if let Some(event) = event
+ && sink.add(event).is_err()
{
// The Dart listener is gone; the remaining events have no receiver.
break;
@@ -300,7 +388,7 @@ impl RsDiscovery {
/// device on it register with this device over HTTP.
///
/// Devices registering in response arrive at the application as server
- /// events, not here: feed them back via [RsDiscovery::add_device].
+ /// events, not here: feed them back via [RsDiscovery::observe_inbound].
///
/// Returns once the whole announcement burst has been sent, which takes a
/// few seconds, or immediately once the discovery has been stopped or
@@ -390,13 +478,17 @@ impl RsDiscovery {
Ok(())
}
- /// Puts a device confirmed outside of the discovery into the store, e.g.
- /// one that answered an announcement by registering with this device's
- /// HTTP server. The device is emitted on [RsDiscovery::listen].
- pub async fn add_device(&self, device: RsDiscoveredDevice) {
+ /// Puts a device that reached this device's HTTP server into the store,
+ /// e.g. one that answered an announcement by registering. The device is
+ /// emitted on [RsDiscovery::listen].
+ ///
+ /// Only the inbound direction of the address is confirmed: an address
+ /// new to the device is stored with [RsOutbound::Untested] and dialed
+ /// back in the background, whose outcome is emitted as well.
+ pub async fn observe_inbound(&self, device: RsDiscoveredDevice) {
self.instance
.handle
- .add_device(DiscoveredDevice {
+ .observe_inbound(DiscoveredDevice {
alias: device.alias,
version: device.version,
device_model: device.device_model,
@@ -412,12 +504,43 @@ impl RsDiscovery {
.await;
}
- /// The retained confirmations of a stored device, oldest first, capped at
+ /// Records the outcome of a request the application sent to a stored
+ /// device over [channel], e.g. a transfer: without an [error] the channel
+ /// becomes [RsOutbound::Reachable], with one — the reason, for display —
+ /// it becomes [RsOutbound::Failed], which ranks it behind the device's
+ /// other channels. The device is emitted on [RsDiscovery::listen].
+ ///
+ /// Only report failures to reach the device at all, not requests that
+ /// the device answered with an error.
+ ///
+ /// Returns `false` when no device has the fingerprint.
+ pub fn report_outbound(
+ &self,
+ fingerprint: String,
+ channel: RsDeviceChannel,
+ error: Option<String>,
+ ) -> bool {
+ self.instance.handle.report_outbound(
+ &fingerprint,
+ DeviceChannel::Http(HttpChannel {
+ host: channel.host,
+ port: channel.port,
+ protocol: channel.protocol,
+ }),
+ match error {
+ Some(error) => Err(error),
+ None => Ok(()),
+ },
+ )
+ }
+
+ /// The retained observations of a stored device, oldest first, capped at
/// the store's log limit. Empty when the fingerprint is unknown.
pub fn device_logs(&self, fingerprint: String) -> Vec<RsDeviceLog> {
- self.instance
- .handle
+ let handle = &self.instance.handle;
+ handle
.device_by_fingerprint(&fingerprint)
+ .or_else(|| unconfirmed_device(handle, &fingerprint))
.map(|stored| stored.logs.into_iter().map(rs_device_log).collect())
.unwrap_or_default()
}
@@ -437,37 +560,73 @@ impl RsDiscovery {
}
}
+/// The device with the given fingerprint that was heard announcing itself
+/// but never confirmed.
+fn unconfirmed_device(handle: &DiscoveryHandle, fingerprint: &str) -> Option<StatefulDevice> {
+ handle
+ .unconfirmed_devices()
+ .into_iter()
+ .find(|stored| stored.device.fingerprint == fingerprint)
+}
+
fn rs_device_log(log: DeviceLog) -> RsDeviceLog {
- let DeviceChannel::Http(http) = log.channel;
RsDeviceLog {
- timestamp_millis: log
- .timestamp
- .duration_since(std::time::UNIX_EPOCH)
- .map(|elapsed| elapsed.as_millis() as u64)
- .unwrap_or(0),
- kind: log.kind,
- channel: RsDeviceChannel {
- host: http.host,
- port: http.port,
- protocol: http.protocol,
+ timestamp_millis: millis_since_epoch(log.timestamp),
+ event: match log.event {
+ DeviceLogEvent::Outbound { channel } => RsDeviceLogEvent::Outbound {
+ channel: rs_device_channel(&channel),
+ },
+ DeviceLogEvent::OutboundFailed { channel, error } => RsDeviceLogEvent::OutboundFailed {
+ channel: rs_device_channel(&channel),
+ error,
+ },
+ DeviceLogEvent::Inbound { channel } => RsDeviceLogEvent::Inbound {
+ channel: rs_device_channel(&channel),
+ },
+ DeviceLogEvent::MulticastInbound { ip } => RsDeviceLogEvent::MulticastInbound {
+ host: ip.to_string(),
+ },
},
}
}
-/// The merged stored device flattened for the Dart side, its channels ranked
-/// best first.
+fn rs_device_channel(channel: &DeviceChannel) -> RsDeviceChannel {
+ let DeviceChannel::Http(http) = channel;
+ RsDeviceChannel {
+ host: http.host.clone(),
+ port: http.port,
+ protocol: http.protocol,
+ }
+}
+
+fn rs_stored_channel(channel: &DeviceChannel, state: &ChannelState) -> RsStoredChannel {
+ let DeviceChannel::Http(http) = channel;
+ RsStoredChannel {
+ host: http.host.clone(),
+ port: http.port,
+ protocol: http.protocol,
+ outbound: match state.outbound {
+ Outbound::Untested => RsOutbound::Untested,
+ Outbound::Reachable(_) => RsOutbound::Reachable,
+ Outbound::Failed(_) => RsOutbound::Failed,
+ },
+ inbound_at_millis: state.inbound.map(millis_since_epoch),
+ }
+}
+
+fn millis_since_epoch(time: SystemTime) -> u64 {
+ time.duration_since(std::time::UNIX_EPOCH)
+ .map(|elapsed| elapsed.as_millis() as u64)
+ .unwrap_or(0)
+}
+
+/// The merged stored device flattened for the Dart side, its channels in the
+/// order to dial them.
fn rs_stored_device(stored: StatefulDevice) -> RsStoredDevice {
let channels = stored
.get_ranked_channels()
.into_iter()
- .map(|channel| {
- let DeviceChannel::Http(http) = channel;
- RsDeviceChannel {
- host: http.host.clone(),
- port: http.port,
- protocol: http.protocol,
- }
- })
+ .map(|channel| rs_stored_channel(channel, &stored.channels[channel]))
.collect();
let device = stored.device;
diff --git a/packages/localsend_isolates/rust/src/api/http.rs b/packages/localsend_isolates/rust/src/api/http.rs
index 62e4a1e8..fac6e498 100644
--- a/packages/localsend_isolates/rust/src/api/http.rs
+++ b/packages/localsend_isolates/rust/src/api/http.rs
@@ -218,6 +218,14 @@ pub enum RsHttpClientError {
status: u16,
message: Option<String>,
},
+
+ /// The request got no response: the connection could not be established
+ /// (refused, timed out, failed TLS handshake) or broke before the peer
+ /// answered. Carries the reason, for display.
+ Unreachable(String),
+
+ /// Another error of the transport: the peer answered, but its response
+ /// could not be read.
Reqwest(String),
Json(String),
Io(String),
@@ -226,6 +234,9 @@ pub enum RsHttpClientError {
impl From<ClientError> for RsHttpClientError {
fn from(e: ClientError) -> Self {
+ if e.is_unreachable() {
+ return RsHttpClientError::Unreachable(ErrorChain(&e).to_string());
+ }
match e {
ClientError::StatusCode(e) => RsHttpClientError::StatusCode {
status: e.status,
diff --git a/packages/localsend_isolates/rust/src/frb_generated.rs b/packages/localsend_isolates/rust/src/frb_generated.rs
index f311cd47..d821146e 100644
--- a/packages/localsend_isolates/rust/src/frb_generated.rs
+++ b/packages/localsend_isolates/rust/src/frb_generated.rs
@@ -44,7 +44,7 @@ flutter_rust_bridge::frb_generated_boilerplate!(
default_rust_auto_opaque = RustAutoOpaqueMoi,
);
pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_VERSION: &str = "2.12.0";
-pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = -1979579466;
+pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = 1374796560;
// Section: executor
@@ -408,69 +408,6 @@ fn wire__crate__api__cancel__RsCancellationToken_cancel_impl(
},
)
}
-fn wire__crate__api__discovery__RsDiscovery_add_device_impl(
- port_: flutter_rust_bridge::for_generated::MessagePort,
- ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
- rust_vec_len_: i32,
- data_len_: i32,
-) {
- FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::<flutter_rust_bridge::for_generated::SseCodec, _, _, _>(
- flutter_rust_bridge::for_generated::TaskInfo {
- debug_name: "RsDiscovery_add_device",
- port: Some(port_),
- mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal,
- },
- move || {
- let message = unsafe {
- flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(
- ptr_,
- rust_vec_len_,
- data_len_,
- )
- };
- let mut deserializer =
- flutter_rust_bridge::for_generated::SseDeserializer::new(message);
- let api_that = <RustOpaqueMoi<
- flutter_rust_bridge::for_generated::RustAutoOpaqueInner<RsDiscovery>,
- >>::sse_decode(&mut deserializer);
- let api_device =
- <crate::api::discovery::RsDiscoveredDevice>::sse_decode(&mut deserializer);
- deserializer.end();
- move |context| async move {
- transform_result_sse::<_, ()>(
- (move || async move {
- let mut api_that_guard = None;
- let decode_indices_ =
- flutter_rust_bridge::for_generated::lockable_compute_decode_order(
- vec![flutter_rust_bridge::for_generated::LockableOrderInfo::new(
- &api_that, 0, false,
- )],
- );
- for i in decode_indices_ {
- match i {
- 0 => {
- api_that_guard =
- Some(api_that.lockable_decode_async_ref().await)
- }
- _ => unreachable!(),
- }
- }
- let api_that_guard = api_that_guard.unwrap();
- let output_ok = Result::<_, ()>::Ok({
- crate::api::discovery::RsDiscovery::add_device(
- &*api_that_guard,
- api_device,
- )
- .await;
- })?;
- Ok(output_ok)
- })()
- .await,
- )
- }
- },
- )
-}
fn wire__crate__api__discovery__RsDiscovery_announce_impl(
port_: flutter_rust_bridge::for_generated::MessagePort,
ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
@@ -677,7 +614,7 @@ fn wire__crate__api__discovery__RsDiscovery_listen_impl(
flutter_rust_bridge::for_generated::RustAutoOpaqueInner<RsDiscovery>,
>>::sse_decode(&mut deserializer);
let api_sink = <StreamSink<
- crate::api::discovery::RsStoredDevice,
+ crate::api::discovery::RsDiscoveryEvent,
flutter_rust_bridge::for_generated::SseCodec,
>>::sse_decode(&mut deserializer);
deserializer.end();
@@ -764,6 +701,128 @@ fn wire__crate__api__discovery__RsDiscovery_multicast_error_impl(
},
)
}
+fn wire__crate__api__discovery__RsDiscovery_observe_inbound_impl(
+ port_: flutter_rust_bridge::for_generated::MessagePort,
+ ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
+ rust_vec_len_: i32,
+ data_len_: i32,
+) {
+ FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::<flutter_rust_bridge::for_generated::SseCodec, _, _, _>(
+ flutter_rust_bridge::for_generated::TaskInfo {
+ debug_name: "RsDiscovery_observe_inbound",
+ port: Some(port_),
+ mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal,
+ },
+ move || {
+ let message = unsafe {
+ flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(
+ ptr_,
+ rust_vec_len_,
+ data_len_,
+ )
+ };
+ let mut deserializer =
+ flutter_rust_bridge::for_generated::SseDeserializer::new(message);
+ let api_that = <RustOpaqueMoi<
+ flutter_rust_bridge::for_generated::RustAutoOpaqueInner<RsDiscovery>,
+ >>::sse_decode(&mut deserializer);
+ let api_device =
+ <crate::api::discovery::RsDiscoveredDevice>::sse_decode(&mut deserializer);
+ deserializer.end();
+ move |context| async move {
+ transform_result_sse::<_, ()>(
+ (move || async move {
+ let mut api_that_guard = None;
+ let decode_indices_ =
+ flutter_rust_bridge::for_generated::lockable_compute_decode_order(
+ vec![flutter_rust_bridge::for_generated::LockableOrderInfo::new(
+ &api_that, 0, false,
+ )],
+ );
+ for i in decode_indices_ {
+ match i {
+ 0 => {
+ api_that_guard =
+ Some(api_that.lockable_decode_async_ref().await)
+ }
+ _ => unreachable!(),
+ }
+ }
+ let api_that_guard = api_that_guard.unwrap();
+ let output_ok = Result::<_, ()>::Ok({
+ crate::api::discovery::RsDiscovery::observe_inbound(
+ &*api_that_guard,
+ api_device,
+ )
+ .await;
+ })?;
+ Ok(output_ok)
+ })()
+ .await,
+ )
+ }
+ },
+ )
+}
+fn wire__crate__api__discovery__RsDiscovery_report_outbound_impl(
+ port_: flutter_rust_bridge::for_generated::MessagePort,
+ ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
+ rust_vec_len_: i32,
+ data_len_: i32,
+) {
+ FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::<flutter_rust_bridge::for_generated::SseCodec, _, _>(
+ flutter_rust_bridge::for_generated::TaskInfo {
+ debug_name: "RsDiscovery_report_outbound",
+ port: Some(port_),
+ mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal,
+ },
+ move || {
+ let message = unsafe {
+ flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(
+ ptr_,
+ rust_vec_len_,
+ data_len_,
+ )
+ };
+ let mut deserializer =
+ flutter_rust_bridge::for_generated::SseDeserializer::new(message);
+ let api_that = <RustOpaqueMoi<
+ flutter_rust_bridge::for_generated::RustAutoOpaqueInner<RsDiscovery>,
+ >>::sse_decode(&mut deserializer);
+ let api_fingerprint = <String>::sse_decode(&mut deserializer);
+ let api_channel =
+ <crate::api::discovery::RsDeviceChannel>::sse_decode(&mut deserializer);
+ let api_error = <Option<String>>::sse_decode(&mut deserializer);
+ deserializer.end();
+ move |context| {
+ transform_result_sse::<_, ()>((move || {
+ let mut api_that_guard = None;
+ let decode_indices_ =
+ flutter_rust_bridge::for_generated::lockable_compute_decode_order(vec![
+ flutter_rust_bridge::for_generated::LockableOrderInfo::new(
+ &api_that, 0, false,
+ ),
+ ]);
+ for i in decode_indices_ {
+ match i {
+ 0 => api_that_guard = Some(api_that.lockable_decode_sync_ref()),
+ _ => unreachable!(),
+ }
+ }
+ let api_that_guard = api_that_guard.unwrap();
+ let output_ok =
+ Result::<_, ()>::Ok(crate::api::discovery::RsDiscovery::report_outbound(
+ &*api_that_guard,
+ api_fingerprint,
+ api_channel,
+ api_error,
+ ))?;
+ Ok(output_ok)
+ })())
+ }
+ },
+ )
+}
fn wire__crate__api__discovery__RsDiscovery_scan_subnet_impl(
port_: flutter_rust_bridge::for_generated::MessagePort,
ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
@@ -3896,7 +3955,7 @@ impl SseDecode for StreamSink<Vec<u8>, flutter_rust_bridge::for_generated::SseCo
impl SseDecode
for StreamSink<
- crate::api::crypto::RsHashFileEvent,
+ crate::api::discovery::RsDiscoveryEvent,
flutter_rust_bridge::for_generated::SseCodec,
>
{
@@ -3908,7 +3967,10 @@ impl SseDecode
}
impl SseDecode
- for StreamSink<crate::api::server::RsServerEvent, flutter_rust_bridge::for_generated::SseCodec>
+ for StreamSink<
+ crate::api::crypto::RsHashFileEvent,
+ flutter_rust_bridge::for_generated::SseCodec,
+ >
{
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
@@ -3918,10 +3980,7 @@ impl SseDecode
}
impl SseDecode
- for StreamSink<
- crate::api::discovery::RsStoredDevice,
- flutter_rust_bridge::for_generated::SseCodec,
- >
+ for StreamSink<crate::api::server::RsServerEvent, flutter_rust_bridge::for_generated::SseCodec>
{
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
@@ -4034,18 +4093,6 @@ impl SseDecode for crate::api::webrtc::ClientInfoWithoutId {
}
}
-impl SseDecode for crate::api::discovery::DeviceLogKind {
- // Codec=Sse (Serialization based), see doc to use other codecs
- fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
- let mut inner = <i32>::sse_decode(deserializer);
- return match inner {
- 0 => crate::api::discovery::DeviceLogKind::Discovered,
- 1 => crate::api::discovery::DeviceLogKind::Updated,
- _ => unreachable!("Invalid variant for DeviceLogKind: {}", inner),
- };
- }
-}
-
impl SseDecode for crate::api::model::DeviceType {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
@@ -4242,6 +4289,20 @@ impl SseDecode for Vec<crate::api::discovery::RsDeviceLog> {
}
}
+impl SseDecode for Vec<crate::api::discovery::RsStoredChannel> {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
+ let mut len_ = <i32>::sse_decode(deserializer);
+ let mut ans_ = Vec::with_capacity(len_ as usize);
+ for idx_ in 0..len_ {
+ ans_.push(<crate::api::discovery::RsStoredChannel>::sse_decode(
+ deserializer,
+ ));
+ }
+ return ans_;
+ }
+}
+
impl SseDecode for crate::api::http::LsHttpClientVersion {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
@@ -4368,6 +4429,17 @@ impl SseDecode for Option<u32> {
}
}
+impl SseDecode for Option<u64> {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
+ if (<bool>::sse_decode(deserializer)) {
+ return Some(<u64>::sse_decode(deserializer));
+ } else {
+ return None;
+ }
+ }
+}
+
impl SseDecode for Option<Vec<String>> {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
@@ -4595,16 +4667,55 @@ impl SseDecode for crate::api::discovery::RsDeviceLog {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
let mut var_timestampMillis = <u64>::sse_decode(deserializer);
- let mut var_kind = <crate::api::discovery::DeviceLogKind>::sse_decode(deserializer);
- let mut var_channel = <crate::api::discovery::RsDeviceChannel>::sse_decode(deserializer);
+ let mut var_event = <crate::api::discovery::RsDeviceLogEvent>::sse_decode(deserializer);
return crate::api::discovery::RsDeviceLog {
timestamp_millis: var_timestampMillis,
- kind: var_kind,
- channel: var_channel,
+ event: var_event,
};
}
}
+impl SseDecode for crate::api::discovery::RsDeviceLogEvent {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
+ let mut tag_ = <i32>::sse_decode(deserializer);
+ match tag_ {
+ 0 => {
+ let mut var_channel =
+ <crate::api::discovery::RsDeviceChannel>::sse_decode(deserializer);
+ return crate::api::discovery::RsDeviceLogEvent::Outbound {
+ channel: var_channel,
+ };
+ }
+ 1 => {
+ let mut var_channel =
+ <crate::api::discovery::RsDeviceChannel>::sse_decode(deserializer);
+ let mut var_error = <String>::sse_decode(deserializer);
+ return crate::api::discovery::RsDeviceLogEvent::OutboundFailed {
+ channel: var_channel,
+ error: var_error,
+ };
+ }
+ 2 => {
+ let mut var_channel =
+ <crate::api::discovery::RsDeviceChannel>::sse_decode(deserializer);
+ return crate::api::discovery::RsDeviceLogEvent::Inbound {
+ channel: var_channel,
+ };
+ }
+ 3 => {
+ let mut var_host = <String>::sse_decode(deserializer);
+ return crate::api::discovery::RsDeviceLogEvent::MulticastInbound {
+ host: var_host,
+ };
+ }
+ _ => {
+ unimplemented!("");
+ }
+ }
+ }
+}
+
impl SseDecode for crate::api::discovery::RsDiscoveredDevice {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
@@ -4631,6 +4742,32 @@ impl SseDecode for crate::api::discovery::RsDiscoveredDevice {
}
}
+impl SseDecode for crate::api::discovery::RsDiscoveryEvent {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
+ let mut tag_ = <i32>::sse_decode(deserializer);
+ match tag_ {
+ 0 => {
+ let mut var_field0 =
+ <crate::api::discovery::RsStoredDevice>::sse_decode(deserializer);
+ return crate::api::discovery::RsDiscoveryEvent::Device(var_field0);
+ }
+ 1 => {
+ let mut var_device =
+ <crate::api::discovery::RsStoredDevice>::sse_decode(deserializer);
+ let mut var_error = <String>::sse_decode(deserializer);
+ return crate::api::discovery::RsDiscoveryEvent::Unreachable {
+ device: var_device,
+ error: var_error,
+ };
+ }
+ _ => {
+ unimplemented!("");
+ }
+ }
+ }
+}
+
impl SseDecode for crate::api::crypto::RsHashFileEvent {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
@@ -4666,17 +4803,21 @@ impl SseDecode for crate::api::http::RsHttpClientError {
}
1 => {
let mut var_field0 = <String>::sse_decode(deserializer);
- return crate::api::http::RsHttpClientError::Reqwest(var_field0);
+ return crate::api::http::RsHttpClientError::Unreachable(var_field0);
}
2 => {
let mut var_field0 = <String>::sse_decode(deserializer);
- return crate::api::http::RsHttpClientError::Json(var_field0);
+ return crate::api::http::RsHttpClientError::Reqwest(var_field0);
}
3 => {
let mut var_field0 = <String>::sse_decode(deserializer);
- return crate::api::http::RsHttpClientError::Io(var_field0);
+ return crate::api::http::RsHttpClientError::Json(var_field0);
}
4 => {
+ let mut var_field0 = <String>::sse_decode(deserializer);
+ return crate::api::http::RsHttpClientError::Io(var_field0);
+ }
+ 5 => {
let mut var_field0 = <String>::sse_decode(deserializer);
return crate::api::http::RsHttpClientError::Other(var_field0);
}
@@ -4687,6 +4828,19 @@ impl SseDecode for crate::api::http::RsHttpClientError {
}
}
+impl SseDecode for crate::api::discovery::RsOutbound {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
+ let mut inner = <i32>::sse_decode(deserializer);
+ return match inner {
+ 0 => crate::api::discovery::RsOutbound::Untested,
+ 1 => crate::api::discovery::RsOutbound::Reachable,
+ 2 => crate::api::discovery::RsOutbound::Failed,
+ _ => unreachable!("Invalid variant for RsOutbound: {}", inner),
+ };
+ }
+}
+
impl SseDecode for crate::api::server::RsServerEvent {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
@@ -4785,6 +4939,24 @@ impl SseDecode for crate::api::server::RsServerEvent {
}
}
+impl SseDecode for crate::api::discovery::RsStoredChannel {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
+ let mut var_host = <String>::sse_decode(deserializer);
+ let mut var_port = <u16>::sse_decode(deserializer);
+ let mut var_protocol = <crate::api::model::ProtocolType>::sse_decode(deserializer);
+ let mut var_outbound = <crate::api::discovery::RsOutbound>::sse_decode(deserializer);
+ let mut var_inboundAtMillis = <Option<u64>>::sse_decode(deserializer);
+ return crate::api::discovery::RsStoredChannel {
+ host: var_host,
+ port: var_port,
+ protocol: var_protocol,
+ outbound: var_outbound,
+ inbound_at_millis: var_inboundAtMillis,
+ };
+ }
+}
+
impl SseDecode for crate::api::discovery::RsStoredDevice {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
@@ -4795,7 +4967,7 @@ impl SseDecode for crate::api::discovery::RsStoredDevice {
let mut var_fingerprint = <String>::sse_decode(deserializer);
let mut var_download = <bool>::sse_decode(deserializer);
let mut var_channels =
- <Vec<crate::api::discovery::RsDeviceChannel>>::sse_decode(deserializer);
+ <Vec<crate::api::discovery::RsStoredChannel>>::sse_decode(deserializer);
return crate::api::discovery::RsStoredDevice {
alias: var_alias,
version: var_version,
@@ -5155,215 +5327,221 @@ fn pde_ffi_dispatcher_primary_impl(
rust_vec_len,
data_len,
),
- 7 => wire__crate__api__discovery__RsDiscovery_add_device_impl(
+ 7 => wire__crate__api__discovery__RsDiscovery_announce_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 8 => wire__crate__api__discovery__RsDiscovery_announce_impl(
+ 8 => wire__crate__api__discovery__RsDiscovery_device_logs_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 9 => wire__crate__api__discovery__RsDiscovery_device_logs_impl(
+ 9 => wire__crate__api__discovery__RsDiscovery_discover_staged_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 10 => wire__crate__api__discovery__RsDiscovery_discover_staged_impl(
+ 10 => {
+ wire__crate__api__discovery__RsDiscovery_listen_impl(port, ptr, rust_vec_len, data_len)
+ }
+ 11 => wire__crate__api__discovery__RsDiscovery_multicast_error_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 11 => {
- wire__crate__api__discovery__RsDiscovery_listen_impl(port, ptr, rust_vec_len, data_len)
- }
- 12 => wire__crate__api__discovery__RsDiscovery_multicast_error_impl(
+ 12 => wire__crate__api__discovery__RsDiscovery_observe_inbound_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 13 => wire__crate__api__discovery__RsDiscovery_scan_subnet_impl(
+ 13 => wire__crate__api__discovery__RsDiscovery_report_outbound_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 14 => wire__crate__api__discovery__RsDiscovery_set_answer_announcements_impl(
+ 14 => wire__crate__api__discovery__RsDiscovery_scan_subnet_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 15 => wire__crate__api__discovery__RsDiscovery_stop_impl(port, ptr, rust_vec_len, data_len),
- 16 => wire__crate__api__http__RsHttpClient_cancel_impl(port, ptr, rust_vec_len, data_len),
- 17 => wire__crate__api__http__RsHttpClient_prepare_upload_impl(
+ 15 => wire__crate__api__discovery__RsDiscovery_set_answer_announcements_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 18 => wire__crate__api__http__RsHttpClient_register_impl(port, ptr, rust_vec_len, data_len),
- 19 => wire__crate__api__http__RsHttpClient_upload_impl(port, ptr, rust_vec_len, data_len),
- 20 => wire__crate__api__server__RsHttpServer_cancel_session_impl(
+ 16 => wire__crate__api__discovery__RsDiscovery_stop_impl(port, ptr, rust_vec_len, data_len),
+ 17 => wire__crate__api__http__RsHttpClient_cancel_impl(port, ptr, rust_vec_len, data_len),
+ 18 => wire__crate__api__http__RsHttpClient_prepare_upload_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 21 => wire__crate__api__server__RsHttpServer_fail_file_download_impl(
+ 19 => wire__crate__api__http__RsHttpClient_register_impl(port, ptr, rust_vec_len, data_len),
+ 20 => wire__crate__api__http__RsHttpClient_upload_impl(port, ptr, rust_vec_len, data_len),
+ 21 => wire__crate__api__server__RsHttpServer_cancel_session_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 22 => wire__crate__api__server__RsHttpServer_fail_file_upload_impl(
+ 22 => wire__crate__api__server__RsHttpServer_fail_file_download_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 23 => wire__crate__api__server__RsHttpServer_listen_impl(port, ptr, rust_vec_len, data_len),
- 24 => wire__crate__api__server__RsHttpServer_respond_file_download_impl(
+ 23 => wire__crate__api__server__RsHttpServer_fail_file_upload_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 25 => wire__crate__api__server__RsHttpServer_respond_file_upload_impl(
+ 24 => wire__crate__api__server__RsHttpServer_listen_impl(port, ptr, rust_vec_len, data_len),
+ 25 => wire__crate__api__server__RsHttpServer_respond_file_download_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 26 => wire__crate__api__server__RsHttpServer_respond_prepare_download_impl(
+ 26 => wire__crate__api__server__RsHttpServer_respond_file_upload_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 27 => wire__crate__api__server__RsHttpServer_respond_prepare_upload_impl(
+ 27 => wire__crate__api__server__RsHttpServer_respond_prepare_download_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 28 => wire__crate__api__server__RsHttpServer_stop_impl(port, ptr, rust_vec_len, data_len),
- 29 => wire__crate__api__webrtc__RtcFileReceiver_get_file_id_impl(
+ 28 => wire__crate__api__server__RsHttpServer_respond_prepare_upload_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 30 => wire__crate__api__webrtc__RtcFileReceiver_receive_impl(
+ 29 => wire__crate__api__server__RsHttpServer_stop_impl(port, ptr, rust_vec_len, data_len),
+ 30 => wire__crate__api__webrtc__RtcFileReceiver_get_file_id_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 31 => wire__crate__api__webrtc__RtcFileSender_send_impl(port, ptr, rust_vec_len, data_len),
- 32 => wire__crate__api__webrtc__RtcReceiveController_decline_impl(
+ 31 => wire__crate__api__webrtc__RtcFileReceiver_receive_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 33 => wire__crate__api__webrtc__RtcReceiveController_listen_error_impl(
+ 32 => wire__crate__api__webrtc__RtcFileSender_send_impl(port, ptr, rust_vec_len, data_len),
+ 33 => wire__crate__api__webrtc__RtcReceiveController_decline_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 34 => wire__crate__api__webrtc__RtcReceiveController_listen_files_impl(
+ 34 => wire__crate__api__webrtc__RtcReceiveController_listen_error_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 35 => wire__crate__api__webrtc__RtcReceiveController_listen_receiving_impl(
+ 35 => wire__crate__api__webrtc__RtcReceiveController_listen_files_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 36 => wire__crate__api__webrtc__RtcReceiveController_listen_status_impl(
+ 36 => wire__crate__api__webrtc__RtcReceiveController_listen_receiving_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 37 => wire__crate__api__webrtc__RtcReceiveController_send_file_status_impl(
+ 37 => wire__crate__api__webrtc__RtcReceiveController_listen_status_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 38 => wire__crate__api__webrtc__RtcReceiveController_send_pin_impl(
+ 38 => wire__crate__api__webrtc__RtcReceiveController_send_file_status_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 39 => wire__crate__api__webrtc__RtcReceiveController_send_selection_impl(
+ 39 => wire__crate__api__webrtc__RtcReceiveController_send_pin_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 40 => wire__crate__api__webrtc__RtcSendController_listen_error_impl(
+ 40 => wire__crate__api__webrtc__RtcReceiveController_send_selection_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 41 => wire__crate__api__webrtc__RtcSendController_listen_selected_files_impl(
+ 41 => wire__crate__api__webrtc__RtcSendController_listen_error_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 42 => wire__crate__api__webrtc__RtcSendController_listen_status_impl(
+ 42 => wire__crate__api__webrtc__RtcSendController_listen_selected_files_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 43 => wire__crate__api__webrtc__RtcSendController_send_file_impl(
+ 43 => wire__crate__api__webrtc__RtcSendController_listen_status_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 44 => wire__crate__api__webrtc__RtcSendController_send_pin_impl(
+ 44 => wire__crate__api__webrtc__RtcSendController_send_file_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 45 => wire__crate__api__webrtc__connect_impl(port, ptr, rust_vec_len, data_len),
- 48 => wire__crate__api__stream__create_stream_impl(port, ptr, rust_vec_len, data_len),
- 49 => {
+ 45 => wire__crate__api__webrtc__RtcSendController_send_pin_impl(
+ port,
+ ptr,
+ rust_vec_len,
+ data_len,
+ ),
+ 46 => wire__crate__api__webrtc__connect_impl(port, ptr, rust_vec_len, data_len),
+ 49 => wire__crate__api__stream__create_stream_impl(port, ptr, rust_vec_len, data_len),
+ 50 => {
wire__crate__api__logging__enable_debug_logging_impl(port, ptr, rust_vec_len, data_len)
}
- 50 => wire__crate__api__crypto__generate_key_pair_impl(port, ptr, rust_vec_len, data_len),
- 51 => wire__crate__api__crypto__generate_security_context_impl(
+ 51 => wire__crate__api__crypto__generate_key_pair_impl(port, ptr, rust_vec_len, data_len),
+ 52 => wire__crate__api__crypto__generate_security_context_impl(
port,
ptr,
rust_vec_len,
data_len,
),
- 52 => wire__crate__api__crypto__hash_file_impl(port, ptr, rust_vec_len, data_len),
- 54 => {
+ 53 => wire__crate__api__crypto__hash_file_impl(port, ptr, rust_vec_len, data_len),
+ 55 => {
wire__crate__api__metadata__read_file_metadata_impl(port, ptr, rust_vec_len, data_len)
}
- 56 => wire__crate__api__discovery__start_discovery_impl(port, ptr, rust_vec_len, data_len),
- 57 => wire__crate__api__server__start_server_impl(port, ptr, rust_vec_len, data_len),
- 58 => wire__crate__api__crypto__verify_cert_impl(port, ptr, rust_vec_len, data_len),
+ 57 => wire__crate__api__discovery__start_discovery_impl(port, ptr, rust_vec_len, data_len),
+ 58 => wire__crate__api__server__start_server_impl(port, ptr, rust_vec_len, data_len),
+ 59 => wire__crate__api__crypto__verify_cert_impl(port, ptr, rust_vec_len, data_len),
_ => unreachable!(),
}
}
@@ -5378,10 +5556,10 @@ fn pde_ffi_dispatcher_sync_impl(
match func_id {
2 => wire__crate__api__stream__Dart2RustStreamSink_close_impl(ptr, rust_vec_len, data_len),
6 => wire__crate__api__cancel__RsCancellationToken_cancel_impl(ptr, rust_vec_len, data_len),
- 46 => wire__crate__api__cancel__create_cancellation_token_impl(ptr, rust_vec_len, data_len),
- 47 => wire__crate__api__http__create_client_impl(ptr, rust_vec_len, data_len),
- 53 => wire__crate__api__filename__is_valid_file_name_impl(ptr, rust_vec_len, data_len),
- 55 => wire__crate__api__filename__sanitize_file_name_impl(ptr, rust_vec_len, data_len),
+ 47 => wire__crate__api__cancel__create_cancellation_token_impl(ptr, rust_vec_len, data_len),
+ 48 => wire__crate__api__http__create_client_impl(ptr, rust_vec_len, data_len),
+ 54 => wire__crate__api__filename__is_valid_file_name_impl(ptr, rust_vec_len, data_len),
+ 56 => wire__crate__api__filename__sanitize_file_name_impl(ptr, rust_vec_len, data_len),
_ => unreachable!(),
}
}
@@ -5622,27 +5800,6 @@ impl flutter_rust_bridge::IntoIntoDart<FrbWrapper<crate::api::webrtc::ClientInfo
}
}
// Codec=Dco (DartCObject based), see doc to use other codecs
-impl flutter_rust_bridge::IntoDart for FrbWrapper<crate::api::discovery::DeviceLogKind> {
- fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
- match self.0 {
- crate::api::discovery::DeviceLogKind::Discovered => 0.into_dart(),
- crate::api::discovery::DeviceLogKind::Updated => 1.into_dart(),
- _ => unreachable!(),
- }
- }
-}
-impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive
- for FrbWrapper<crate::api::discovery::DeviceLogKind>
-{
-}
-impl flutter_rust_bridge::IntoIntoDart<FrbWrapper<crate::api::discovery::DeviceLogKind>>
- for crate::api::discovery::DeviceLogKind
-{
- fn into_into_dart(self) -> FrbWrapper<crate::api::discovery::DeviceLogKind> {
- self.into()
- }
-}
-// Codec=Dco (DartCObject based), see doc to use other codecs
impl flutter_rust_bridge::IntoDart for FrbWrapper<crate::api::model::DeviceType> {
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
match self.0 {
@@ -6028,8 +6185,7 @@ impl flutter_rust_bridge::IntoDart for crate::api::discovery::RsDeviceLog {
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
[
self.timestamp_millis.into_into_dart().into_dart(),
- self.kind.into_into_dart().into_dart(),
- self.channel.into_into_dart().into_dart(),
+ self.event.into_into_dart().into_dart(),
]
.into_dart()
}
@@ -6046,6 +6202,42 @@ impl flutter_rust_bridge::IntoIntoDart<crate::api::discovery::RsDeviceLog>
}
}
// Codec=Dco (DartCObject based), see doc to use other codecs
+impl flutter_rust_bridge::IntoDart for crate::api::discovery::RsDeviceLogEvent {
+ fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
+ match self {
+ crate::api::discovery::RsDeviceLogEvent::Outbound { channel } => {
+ [0.into_dart(), channel.into_into_dart().into_dart()].into_dart()
+ }
+ crate::api::discovery::RsDeviceLogEvent::OutboundFailed { channel, error } => [
+ 1.into_dart(),
+ channel.into_into_dart().into_dart(),
+ error.into_into_dart().into_dart(),
+ ]
+ .into_dart(),
+ crate::api::discovery::RsDeviceLogEvent::Inbound { channel } => {
+ [2.into_dart(), channel.into_into_dart().into_dart()].into_dart()
+ }
+ crate::api::discovery::RsDeviceLogEvent::MulticastInbound { host } => {
+ [3.into_dart(), host.into_into_dart().into_dart()].into_dart()
+ }
+ _ => {
+ unimplemented!("");
+ }
+ }
+ }
+}
+impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive
+ for crate::api::discovery::RsDeviceLogEvent
+{
+}
+impl flutter_rust_bridge::IntoIntoDart<crate::api::discovery::RsDeviceLogEvent>
+ for crate::api::discovery::RsDeviceLogEvent
+{
+ fn into_into_dart(self) -> crate::api::discovery::RsDeviceLogEvent {
+ self
+ }
+}
+// Codec=Dco (DartCObject based), see doc to use other codecs
impl flutter_rust_bridge::IntoDart for crate::api::discovery::RsDiscoveredDevice {
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
[
@@ -6074,6 +6266,36 @@ impl flutter_rust_bridge::IntoIntoDart<crate::api::discovery::RsDiscoveredDevice
}
}
// Codec=Dco (DartCObject based), see doc to use other codecs
+impl flutter_rust_bridge::IntoDart for crate::api::discovery::RsDiscoveryEvent {
+ fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
+ match self {
+ crate::api::discovery::RsDiscoveryEvent::Device(field0) => {
+ [0.into_dart(), field0.into_into_dart().into_dart()].into_dart()
+ }
+ crate::api::discovery::RsDiscoveryEvent::Unreachable { device, error } => [
+ 1.into_dart(),
+ device.into_into_dart().into_dart(),
+ error.into_into_dart().into_dart(),
+ ]
+ .into_dart(),
+ _ => {
+ unimplemented!("");
+ }
+ }
+ }
+}
+impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive
+ for crate::api::discovery::RsDiscoveryEvent
+{
+}
+impl flutter_rust_bridge::IntoIntoDart<crate::api::discovery::RsDiscoveryEvent>
+ for crate::api::discovery::RsDiscoveryEvent
+{
+ fn into_into_dart(self) -> crate::api::discovery::RsDiscoveryEvent {
+ self
+ }
+}
+// Codec=Dco (DartCObject based), see doc to use other codecs
impl flutter_rust_bridge::IntoDart for crate::api::crypto::RsHashFileEvent {
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
match self {
@@ -6110,18 +6332,21 @@ impl flutter_rust_bridge::IntoDart for crate::api::http::RsHttpClientError {
message.into_into_dart().into_dart(),
]
.into_dart(),
- crate::api::http::RsHttpClientError::Reqwest(field0) => {
+ crate::api::http::RsHttpClientError::Unreachable(field0) => {
[1.into_dart(), field0.into_into_dart().into_dart()].into_dart()
}
- crate::api::http::RsHttpClientError::Json(field0) => {
+ crate::api::http::RsHttpClientError::Reqwest(field0) => {
[2.into_dart(), field0.into_into_dart().into_dart()].into_dart()
}
- crate::api::http::RsHttpClientError::Io(field0) => {
+ crate::api::http::RsHttpClientError::Json(field0) => {
[3.into_dart(), field0.into_into_dart().into_dart()].into_dart()
}
- crate::api::http::RsHttpClientError::Other(field0) => {
+ crate::api::http::RsHttpClientError::Io(field0) => {
[4.into_dart(), field0.into_into_dart().into_dart()].into_dart()
}
+ crate::api::http::RsHttpClientError::Other(field0) => {
+ [5.into_dart(), field0.into_into_dart().into_dart()].into_dart()
+ }
_ => {
unimplemented!("");
}
@@ -6140,6 +6365,28 @@ impl flutter_rust_bridge::IntoIntoDart<crate::api::http::RsHttpClientError>
}
}
// Codec=Dco (DartCObject based), see doc to use other codecs
+impl flutter_rust_bridge::IntoDart for crate::api::discovery::RsOutbound {
+ fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
+ match self {
+ Self::Untested => 0.into_dart(),
+ Self::Reachable => 1.into_dart(),
+ Self::Failed => 2.into_dart(),
+ _ => unreachable!(),
+ }
+ }
+}
+impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive
+ for crate::api::discovery::RsOutbound
+{
+}
+impl flutter_rust_bridge::IntoIntoDart<crate::api::discovery::RsOutbound>
+ for crate::api::discovery::RsOutbound
+{
+ fn into_into_dart(self) -> crate::api::discovery::RsOutbound {
+ self
+ }
+}
+// Codec=Dco (DartCObject based), see doc to use other codecs
impl flutter_rust_bridge::IntoDart for crate::api::server::RsServerEvent {
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
match self {
@@ -6236,6 +6483,30 @@ impl flutter_rust_bridge::IntoIntoDart<crate::api::server::RsServerEvent>
}
}
// Codec=Dco (DartCObject based), see doc to use other codecs
+impl flutter_rust_bridge::IntoDart for crate::api::discovery::RsStoredChannel {
+ fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
+ [
+ self.host.into_into_dart().into_dart(),
+ self.port.into_into_dart().into_dart(),
+ self.protocol.into_into_dart().into_dart(),
+ self.outbound.into_into_dart().into_dart(),
+ self.inbound_at_millis.into_into_dart().into_dart(),
+ ]
+ .into_dart()
+ }
+}
+impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive
+ for crate::api::discovery::RsStoredChannel
+{
+}
+impl flutter_rust_bridge::IntoIntoDart<crate::api::discovery::RsStoredChannel>
+ for crate::api::discovery::RsStoredChannel
+{
+ fn into_into_dart(self) -> crate::api::discovery::RsStoredChannel {
+ self
+ }
+}
+// Codec=Dco (DartCObject based), see doc to use other codecs
impl flutter_rust_bridge::IntoDart for crate::api::discovery::RsStoredDevice {
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
[
@@ -6870,7 +7141,7 @@ impl SseEncode for StreamSink<Vec<u8>, flutter_rust_bridge::for_generated::SseCo
impl SseEncode
for StreamSink<
- crate::api::crypto::RsHashFileEvent,
+ crate::api::discovery::RsDiscoveryEvent,
flutter_rust_bridge::for_generated::SseCodec,
>
{
@@ -6881,7 +7152,10 @@ impl SseEncode
}
impl SseEncode
- for StreamSink<crate::api::server::RsServerEvent, flutter_rust_bridge::for_generated::SseCodec>
+ for StreamSink<
+ crate::api::crypto::RsHashFileEvent,
+ flutter_rust_bridge::for_generated::SseCodec,
+ >
{
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
@@ -6890,10 +7164,7 @@ impl SseEncode
}
impl SseEncode
- for StreamSink<
- crate::api::discovery::RsStoredDevice,
- flutter_rust_bridge::for_generated::SseCodec,
- >
+ for StreamSink<crate::api::server::RsServerEvent, flutter_rust_bridge::for_generated::SseCodec>
{
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
@@ -6984,22 +7255,6 @@ impl SseEncode for crate::api::webrtc::ClientInfoWithoutId {
}
}
-impl SseEncode for crate::api::discovery::DeviceLogKind {
- // Codec=Sse (Serialization based), see doc to use other codecs
- fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
- <i32>::sse_encode(
- match self {
- crate::api::discovery::DeviceLogKind::Discovered => 0,
- crate::api::discovery::DeviceLogKind::Updated => 1,
- _ => {
- unimplemented!("");
- }
- },
- serializer,
- );
- }
-}
-
impl SseEncode for crate::api::model::DeviceType {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
@@ -7160,6 +7415,16 @@ impl SseEncode for Vec<crate::api::discovery::RsDeviceLog> {
}
}
+impl SseEncode for Vec<crate::api::discovery::RsStoredChannel> {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
+ <i32>::sse_encode(self.len() as _, serializer);
+ for item in self {
+ <crate::api::discovery::RsStoredChannel>::sse_encode(item, serializer);
+ }
+ }
+}
+
impl SseEncode for crate::api::http::LsHttpClientVersion {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
@@ -7276,6 +7541,16 @@ impl SseEncode for Option<u32> {
}
}
+impl SseEncode for Option<u64> {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
+ <bool>::sse_encode(self.is_some(), serializer);
+ if let Some(value) = self {
+ <u64>::sse_encode(value, serializer);
+ }
+ }
+}
+
impl SseEncode for Option<Vec<String>> {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
@@ -7444,8 +7719,35 @@ impl SseEncode for crate::api::discovery::RsDeviceLog {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
<u64>::sse_encode(self.timestamp_millis, serializer);
- <crate::api::discovery::DeviceLogKind>::sse_encode(self.kind, serializer);
- <crate::api::discovery::RsDeviceChannel>::sse_encode(self.channel, serializer);
+ <crate::api::discovery::RsDeviceLogEvent>::sse_encode(self.event, serializer);
+ }
+}
+
+impl SseEncode for crate::api::discovery::RsDeviceLogEvent {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
+ match self {
+ crate::api::discovery::RsDeviceLogEvent::Outbound { channel } => {
+ <i32>::sse_encode(0, serializer);
+ <crate::api::discovery::RsDeviceChannel>::sse_encode(channel, serializer);
+ }
+ crate::api::discovery::RsDeviceLogEvent::OutboundFailed { channel, error } => {
+ <i32>::sse_encode(1, serializer);
+ <crate::api::discovery::RsDeviceChannel>::sse_encode(channel, serializer);
+ <String>::sse_encode(error, serializer);
+ }
+ crate::api::discovery::RsDeviceLogEvent::Inbound { channel } => {
+ <i32>::sse_encode(2, serializer);
+ <crate::api::discovery::RsDeviceChannel>::sse_encode(channel, serializer);
+ }
+ crate::api::discovery::RsDeviceLogEvent::MulticastInbound { host } => {
+ <i32>::sse_encode(3, serializer);
+ <String>::sse_encode(host, serializer);
+ }
+ _ => {
+ unimplemented!("");
+ }
+ }
}
}
@@ -7464,6 +7766,26 @@ impl SseEncode for crate::api::discovery::RsDiscoveredDevice {
}
}
+impl SseEncode for crate::api::discovery::RsDiscoveryEvent {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
+ match self {
+ crate::api::discovery::RsDiscoveryEvent::Device(field0) => {
+ <i32>::sse_encode(0, serializer);
+ <crate::api::discovery::RsStoredDevice>::sse_encode(field0, serializer);
+ }
+ crate::api::discovery::RsDiscoveryEvent::Unreachable { device, error } => {
+ <i32>::sse_encode(1, serializer);
+ <crate::api::discovery::RsStoredDevice>::sse_encode(device, serializer);
+ <String>::sse_encode(error, serializer);
+ }
+ _ => {
+ unimplemented!("");
+ }
+ }
+ }
+}
+
impl SseEncode for crate::api::crypto::RsHashFileEvent {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
@@ -7492,22 +7814,26 @@ impl SseEncode for crate::api::http::RsHttpClientError {
<u16>::sse_encode(status, serializer);
<Option<String>>::sse_encode(message, serializer);
}
- crate::api::http::RsHttpClientError::Reqwest(field0) => {
+ crate::api::http::RsHttpClientError::Unreachable(field0) => {
<i32>::sse_encode(1, serializer);
<String>::sse_encode(field0, serializer);
}
- crate::api::http::RsHttpClientError::Json(field0) => {
+ crate::api::http::RsHttpClientError::Reqwest(field0) => {
<i32>::sse_encode(2, serializer);
<String>::sse_encode(field0, serializer);
}
- crate::api::http::RsHttpClientError::Io(field0) => {
+ crate::api::http::RsHttpClientError::Json(field0) => {
<i32>::sse_encode(3, serializer);
<String>::sse_encode(field0, serializer);
}
- crate::api::http::RsHttpClientError::Other(field0) => {
+ crate::api::http::RsHttpClientError::Io(field0) => {
<i32>::sse_encode(4, serializer);
<String>::sse_encode(field0, serializer);
}
+ crate::api::http::RsHttpClientError::Other(field0) => {
+ <i32>::sse_encode(5, serializer);
+ <String>::sse_encode(field0, serializer);
+ }
_ => {
unimplemented!("");
}
@@ -7515,6 +7841,23 @@ impl SseEncode for crate::api::http::RsHttpClientError {
}
}
+impl SseEncode for crate::api::discovery::RsOutbound {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
+ <i32>::sse_encode(
+ match self {
+ crate::api::discovery::RsOutbound::Untested => 0,
+ crate::api::discovery::RsOutbound::Reachable => 1,
+ crate::api::discovery::RsOutbound::Failed => 2,
+ _ => {
+ unimplemented!("");
+ }
+ },
+ serializer,
+ );
+ }
+}
+
impl SseEncode for crate::api::server::RsServerEvent {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
@@ -7599,6 +7942,17 @@ impl SseEncode for crate::api::server::RsServerEvent {
}
}
+impl SseEncode for crate::api::discovery::RsStoredChannel {
+ // Codec=Sse (Serialization based), see doc to use other codecs
+ fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
+ <String>::sse_encode(self.host, serializer);
+ <u16>::sse_encode(self.port, serializer);
+ <crate::api::model::ProtocolType>::sse_encode(self.protocol, serializer);
+ <crate::api::discovery::RsOutbound>::sse_encode(self.outbound, serializer);
+ <Option<u64>>::sse_encode(self.inbound_at_millis, serializer);
+ }
+}
+
impl SseEncode for crate::api::discovery::RsStoredDevice {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
@@ -7608,7 +7962,7 @@ impl SseEncode for crate::api::discovery::RsStoredDevice {
<Option<crate::api::model::DeviceType>>::sse_encode(self.device_type, serializer);
<String>::sse_encode(self.fingerprint, serializer);
<bool>::sse_encode(self.download, serializer);
- <Vec<crate::api::discovery::RsDeviceChannel>>::sse_encode(self.channels, serializer);
+ <Vec<crate::api::discovery::RsStoredChannel>>::sse_encode(self.channels, serializer);
}
}
diff --git a/packages/localsend_isolates/test/util/rust_test.dart b/packages/localsend_isolates/test/util/rust_test.dart
new file mode 100644
index 00000000..08f95e61
--- /dev/null
+++ b/packages/localsend_isolates/test/util/rust_test.dart
@@ -0,0 +1,173 @@
+import 'package:flutter_test/flutter_test.dart';
+import 'package:localsend_isolates/model/device.dart';
+import 'package:localsend_isolates/model/discovery_event.dart';
+import 'package:localsend_isolates/rust/api/discovery.dart';
+import 'package:localsend_isolates/rust/api/model.dart' as rust_model;
+import 'package:localsend_isolates/util/rust.dart';
+
+void main() {
+ group('RsStoredDevice.toDevice', () {
+ test('Should dial the best channel and keep the state of every channel in order', () {
+ final device = _storedDevice(
+ channels: [
+ RsStoredChannel(
+ host: 'fe80::1%3',
+ port: 53317,
+ protocol: rust_model.ProtocolType.https,
+ outbound: RsOutbound.reachable,
+ inboundAtMillis: BigInt.from(1700000000000),
+ ),
+ const RsStoredChannel(
+ host: '192.168.1.2',
+ port: 53318,
+ protocol: rust_model.ProtocolType.http,
+ outbound: RsOutbound.untested,
+ ),
+ const RsStoredChannel(
+ host: '10.0.0.2',
+ port: 53317,
+ protocol: rust_model.ProtocolType.https,
+ outbound: RsOutbound.failed,
+ ),
+ ],
+ ).toDevice();
+
+ expect(device.ip, 'fe80::1%3');
+ expect(device.port, 53317);
+ expect(device.https, true);
+ expect(device.fingerprint, 'FINGERPRINT');
+ expect(device.alias, 'Nice Banana');
+ expect(device.channels, [
+ HttpChannel(
+ host: 'fe80::1%3',
+ port: 53317,
+ https: true,
+ outbound: ChannelOutbound.reachable,
+ inbound: DateTime.fromMillisecondsSinceEpoch(1700000000000),
+ ),
+ const HttpChannel(host: '192.168.1.2', port: 53318, https: false, outbound: ChannelOutbound.untested, inbound: null),
+ const HttpChannel(host: '10.0.0.2', port: 53317, https: true, outbound: ChannelOutbound.failed, inbound: null),
+ ]);
+ });
+ });
+
+ group('RsDiscoveryEvent.toDiscoveryEvent', () {
+ test('Should map a confirmed device', () {
+ final event = RsDiscoveryEvent.device(_storedDevice()).toDiscoveryEvent();
+
+ expect(event, isA<DiscoveryDeviceEvent>().having((e) => e.device, 'device', _storedDevice().toDevice()));
+ });
+
+ test('Should map an unreachable device with its error', () {
+ final event = RsDiscoveryEvent.unreachable(device: _storedDevice(), error: 'connection refused').toDiscoveryEvent();
+
+ expect(
+ event,
+ isA<DiscoveryUnreachableEvent>()
+ .having((e) => e.device, 'device', _storedDevice().toDevice())
+ .having((e) => e.error, 'error', 'connection refused'),
+ );
+ });
+ });
+
+ group('RsDeviceLog.toDeviceLog', () {
+ const rsChannel = RsDeviceChannel(host: '192.168.1.2', port: 53317, protocol: rust_model.ProtocolType.https);
+ const channel = HttpChannel(host: '192.168.1.2', port: 53317, https: true);
+
+ DeviceLog map(RsDeviceLogEvent event) {
+ return RsDeviceLog(timestampMillis: BigInt.from(1700000000000), event: event).toDeviceLog();
+ }
+
+ test('Should map the timestamp', () {
+ final log = map(const RsDeviceLogEvent.outbound(channel: rsChannel));
+
+ expect(log.timestamp, DateTime.fromMillisecondsSinceEpoch(1700000000000));
+ });
+
+ test('Should map an answered request', () {
+ final log = map(const RsDeviceLogEvent.outbound(channel: rsChannel));
+
+ expect(log.event, isA<DeviceLogOutbound>().having((e) => e.channel, 'channel', channel));
+ });
+
+ test('Should map a failed request with its error', () {
+ final log = map(const RsDeviceLogEvent.outboundFailed(channel: rsChannel, error: 'timed out'));
+
+ expect(
+ log.event,
+ isA<DeviceLogOutboundFailed>().having((e) => e.channel, 'channel', channel).having((e) => e.error, 'error', 'timed out'),
+ );
+ });
+
+ test('Should map a request of the peer', () {
+ final log = map(const RsDeviceLogEvent.inbound(channel: rsChannel));
+
+ expect(log.event, isA<DeviceLogInbound>().having((e) => e.channel, 'channel', channel));
+ });
+
+ test('Should map a heard announcement', () {
+ final log = map(const RsDeviceLogEvent.multicastInbound(host: 'fe80::1%3'));
+
+ expect(log.event, isA<DeviceLogMulticastInbound>().having((e) => e.host, 'host', 'fe80::1%3'));
+ });
+ });
+
+ group('HttpChannel.toRsDeviceChannel', () {
+ test('Should map only the address', () {
+ final channel = HttpChannel(
+ host: '192.168.1.2',
+ port: 53317,
+ https: false,
+ outbound: ChannelOutbound.failed,
+ inbound: DateTime.fromMillisecondsSinceEpoch(1700000000000),
+ );
+
+ expect(
+ channel.toRsDeviceChannel(),
+ const RsDeviceChannel(host: '192.168.1.2', port: 53317, protocol: rust_model.ProtocolType.http),
+ );
+ });
+ });
+
+ group('Device.toRsDiscoveredDevice', () {
+ test('Should use the address the request came from and the claimed port and protocol', () {
+ final device = _storedDevice().toDevice().toRsDiscoveredDevice('192.168.1.77');
+
+ expect(
+ device,
+ const RsDiscoveredDevice(
+ alias: 'Nice Banana',
+ version: '2.1',
+ deviceModel: 'Pixel',
+ deviceType: rust_model.DeviceType.mobile,
+ fingerprint: 'FINGERPRINT',
+ host: '192.168.1.77',
+ port: 53317,
+ protocol: rust_model.ProtocolType.https,
+ download: true,
+ ),
+ );
+ });
+ });
+}
+
+RsStoredDevice _storedDevice({List<RsStoredChannel>? channels}) {
+ return RsStoredDevice(
+ alias: 'Nice Banana',
+ version: '2.1',
+ deviceModel: 'Pixel',
+ deviceType: rust_model.DeviceType.mobile,
+ fingerprint: 'FINGERPRINT',
+ download: true,
+ channels:
+ channels ??
+ const [
+ RsStoredChannel(
+ host: '192.168.1.2',
+ port: 53317,
+ protocol: rust_model.ProtocolType.https,
+ outbound: RsOutbound.reachable,
+ ),
+ ],
+ );
+}