use ipfs_api::IpfsClient;
#[cfg_attr(feature = "with-actix", actix_rt::main)]
#[cfg_attr(feature = "with-hyper", tokio::main)]
async fn main() {
eprintln!("connecting to localhost:5001...");
let client = IpfsClient::default();
let dns = match client.dns("ipfs.io", true).await {
Ok(dns) => {
eprintln!("dns resolves to ({})", &dns.path);
eprintln!();
dns
}
Err(e) => {
eprintln!("error resolving dns: {}", e);
return;
}
};
match client.object_get(&dns.path[..]).await {
Ok(contents) => {
eprintln!("found contents:");
for link in contents.links.iter() {
eprintln!("[{}] ({} bytes)", link.name, link.size);
}
}
Err(e) => eprintln!("error listing path: {}", e),
}
}