ab: read respectively and sync when set

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2022-11-28 18:16:29 +08:00
parent 5616b20879
commit 6f7eb17c48
6 changed files with 165 additions and 112 deletions

View File

@@ -685,6 +685,19 @@ pub fn discover() {
});
}
pub fn peer_to_map(id: String, p: PeerConfig) -> HashMap<&'static str, String> {
HashMap::<&str, String>::from_iter([
("id", id),
("username", p.info.username.clone()),
("hostname", p.info.hostname.clone()),
("platform", p.info.platform.clone()),
(
"alias",
p.options.get("alias").unwrap_or(&"".to_owned()).to_owned(),
),
])
}
#[inline]
pub fn get_lan_peers() -> Vec<HashMap<&'static str, String>> {
config::LanPeers::load()