summaryrefslogtreecommitdiffstats
path: root/ipfs-api/examples
diff options
context:
space:
mode:
authorFerris Tseng <ferristseng@fastmail.fm>2017-10-25 23:00:48 -0400
committerFerris Tseng <ferristseng@fastmail.fm>2017-10-25 23:00:48 -0400
commit8b055e583721b833d8528323dc0ad93ec9f5bc00 (patch)
treea94e87003828c265165e481b483fbfbcf5e34b46 /ipfs-api/examples
parentec44a1db8ba7973386bca7fca7b51f1a5647f69e (diff)
add license
Diffstat (limited to 'ipfs-api/examples')
-rw-r--r--ipfs-api/examples/add_file.rs8
-rw-r--r--ipfs-api/examples/bootstrap_default.rs8
-rw-r--r--ipfs-api/examples/dns.rs8
-rw-r--r--ipfs-api/examples/get_commands.rs8
-rw-r--r--ipfs-api/examples/get_stats.rs8
-rw-r--r--ipfs-api/examples/get_swarm.rs8
-rw-r--r--ipfs-api/examples/get_version.rs34
-rw-r--r--ipfs-api/examples/ping_peer.rs8
-rw-r--r--ipfs-api/examples/pubsub.rs8
9 files changed, 98 insertions, 0 deletions
diff --git a/ipfs-api/examples/add_file.rs b/ipfs-api/examples/add_file.rs
index da991cf..66775f4 100644
--- a/ipfs-api/examples/add_file.rs
+++ b/ipfs-api/examples/add_file.rs
@@ -1,3 +1,11 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
extern crate ipfs_api;
extern crate tokio_core;
diff --git a/ipfs-api/examples/bootstrap_default.rs b/ipfs-api/examples/bootstrap_default.rs
index 90126b5..739167d 100644
--- a/ipfs-api/examples/bootstrap_default.rs
+++ b/ipfs-api/examples/bootstrap_default.rs
@@ -1,3 +1,11 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
extern crate ipfs_api;
extern crate tokio_core;
diff --git a/ipfs-api/examples/dns.rs b/ipfs-api/examples/dns.rs
index 20c47e7..a4e0450 100644
--- a/ipfs-api/examples/dns.rs
+++ b/ipfs-api/examples/dns.rs
@@ -1,3 +1,11 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
extern crate ipfs_api;
extern crate tokio_core;
diff --git a/ipfs-api/examples/get_commands.rs b/ipfs-api/examples/get_commands.rs
index ecf5b0e..d3f9852 100644
--- a/ipfs-api/examples/get_commands.rs
+++ b/ipfs-api/examples/get_commands.rs
@@ -1,3 +1,11 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
extern crate ipfs_api;
extern crate tokio_core;
diff --git a/ipfs-api/examples/get_stats.rs b/ipfs-api/examples/get_stats.rs
index d3c7ea1..3895de6 100644
--- a/ipfs-api/examples/get_stats.rs
+++ b/ipfs-api/examples/get_stats.rs
@@ -1,3 +1,11 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
extern crate ipfs_api;
extern crate tokio_core;
diff --git a/ipfs-api/examples/get_swarm.rs b/ipfs-api/examples/get_swarm.rs
index 34a4096..207642b 100644
--- a/ipfs-api/examples/get_swarm.rs
+++ b/ipfs-api/examples/get_swarm.rs
@@ -1,3 +1,11 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
extern crate ipfs_api;
extern crate tokio_core;
diff --git a/ipfs-api/examples/get_version.rs b/ipfs-api/examples/get_version.rs
index 4eaf7cc..257d1c7 100644
--- a/ipfs-api/examples/get_version.rs
+++ b/ipfs-api/examples/get_version.rs
@@ -1,6 +1,16 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
+extern crate futures;
extern crate ipfs_api;
extern crate tokio_core;
+use futures::stream::Stream;
use ipfs_api::IpfsClient;
use tokio_core::reactor::Core;
@@ -15,4 +25,28 @@ fn main() {
let version = core.run(req).expect("expected a valid response");
println!("version: {:?}", version.version);
+
+ let req = client.refs_local();
+ println!(
+ "{:?}",
+ core.run(req.for_each(|res| Ok(println!("{:?}", res))))
+ );
+
+ let req = client.diag_sys();
+ println!("{}", core.run(req).expect("response"));
+
+ let req = client.dns("ipfs.io", false);
+ let dns = core.run(req).expect("response");
+ println!("{:?}", dns);
+
+ let req = client.file_ls(&dns.path[..]);
+ println!("{:?}", core.run(req).expect("response"));
+
+ /*
+ let req = client.dht_get("QmRJijhiMxQgn7bFP4cBsarHsGMM8g9fLDEE3WtkTXr4Hr");
+ println!(
+ "{:?}",
+ core.run(req.for_each(|res| Ok(println!("{:?}", res))))
+ );
+ */
}
diff --git a/ipfs-api/examples/ping_peer.rs b/ipfs-api/examples/ping_peer.rs
index a4d5f5a..0e802a5 100644
--- a/ipfs-api/examples/ping_peer.rs
+++ b/ipfs-api/examples/ping_peer.rs
@@ -1,3 +1,11 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
extern crate futures;
extern crate ipfs_api;
extern crate tokio_core;
diff --git a/ipfs-api/examples/pubsub.rs b/ipfs-api/examples/pubsub.rs
index 23b1dc6..ad88b0b 100644
--- a/ipfs-api/examples/pubsub.rs
+++ b/ipfs-api/examples/pubsub.rs
@@ -1,3 +1,11 @@
+// Copyright 2017 rust-ipfs-api Developers
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+//
+
extern crate futures;
extern crate ipfs_api;
extern crate tokio_core;