aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-12-05 23:18:19 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-12-05 23:18:19 -0800
commitf3c0199e4c59e357dccbc289c687155905fc28e4 (patch)
treecbf9af4dff1e43a791cb03d9a4294f26825b191c /src/bin
parent5e844aca2081ef6d2e9615eea24b8a9d56f41c19 (diff)
downloadgeniza-f3c0199e4c59e357dccbc289c687155905fc28e4.tar.gz
geniza-f3c0199e4c59e357dccbc289c687155905fc28e4.zip
basic centralized DNS discovery
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();