aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/geniza-net.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/bin/geniza-net.rs b/src/bin/geniza-net.rs
index dd80c4f..e6fa448 100644
--- a/src/bin/geniza-net.rs
+++ b/src/bin/geniza-net.rs
@@ -56,6 +56,11 @@ fn run() -> Result<()> {
.arg_from_usage("<dat_key> 'dat key (public key) to convert (in hex)'"),
)
.subcommand(
+ SubCommand::with_name("discover-dns")
+ .about("Does a centralized DNS lookup for peers with the given key")
+ .arg_from_usage("<dat_key> 'dat key (public key) to lookup"),
+ )
+ .subcommand(
SubCommand::with_name("naive-clone")
.about("Pulls a drive from a single (known) peer, using a naive algorithm")
.arg(Arg::with_name("dat-dir")
@@ -126,6 +131,18 @@ fn run() -> Result<()> {
}
println!(".dat.local");
}
+ ("discover-dns", Some(subm)) => {
+ let dat_key = subm.value_of("dat_key").unwrap();
+ let key_bytes = parse_dat_key(&dat_key)?;
+ let peers = discover_peers_dns(&key_bytes)?;
+ if peers.len() == 0 {
+ println!("No peers found!");
+ } else {
+ for p in peers {
+ println!("{}", p);
+ }
+ }
+ }
("naive-clone", Some(subm)) => {
let host_port = subm.value_of("host_port").unwrap();
let dat_key = subm.value_of("dat_key").unwrap();