From f3c0199e4c59e357dccbc289c687155905fc28e4 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 5 Dec 2017 23:18:19 -0800 Subject: basic centralized DNS discovery --- src/bin/geniza-net.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/bin') 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 @@ -55,6 +55,11 @@ fn run() -> Result<()> { .about("Prints the DNS name to query (mDNS or centrally) for peers") .arg_from_usage(" '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 (public key) to lookup"), + ) .subcommand( SubCommand::with_name("naive-clone") .about("Pulls a drive from a single (known) peer, using a naive algorithm") @@ -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(); -- cgit v1.2.3