summaryrefslogtreecommitdiffstats
path: root/ipfs-api
diff options
context:
space:
mode:
Diffstat (limited to 'ipfs-api')
-rw-r--r--ipfs-api/Cargo.toml51
-rw-r--r--ipfs-api/examples/add_file.rs29
-rw-r--r--ipfs-api/examples/add_tar.rs70
-rw-r--r--ipfs-api/examples/bootstrap_default.rs63
-rw-r--r--ipfs-api/examples/config.rs70
-rw-r--r--ipfs-api/examples/dag.rs47
-rw-r--r--ipfs-api/examples/default_config.json121
-rw-r--r--ipfs-api/examples/dns.rs44
-rw-r--r--ipfs-api/examples/get_commands.rs48
-rw-r--r--ipfs-api/examples/get_stats.rs64
-rw-r--r--ipfs-api/examples/get_swarm.rs49
-rw-r--r--ipfs-api/examples/get_version.rs26
-rw-r--r--ipfs-api/examples/log_tail.rs34
-rw-r--r--ipfs-api/examples/mfs.rs89
-rw-r--r--ipfs-api/examples/ping_peer.rs71
-rw-r--r--ipfs-api/examples/pubsub.rs86
-rw-r--r--ipfs-api/examples/replace_config.rs29
-rw-r--r--ipfs-api/examples/resolve_name.rs52
-rw-r--r--ipfs-api/src/client/from_uri.rs202
-rw-r--r--ipfs-api/src/client/internal.rs2546
-rw-r--r--ipfs-api/src/client/mod.rs12
-rw-r--r--ipfs-api/src/header.rs11
-rw-r--r--ipfs-api/src/lib.rs81
-rw-r--r--ipfs-api/src/read.rs226
-rw-r--r--ipfs-api/src/request/add.rs61
-rw-r--r--ipfs-api/src/request/bitswap.rs55
-rw-r--r--ipfs-api/src/request/block.rs48
-rw-r--r--ipfs-api/src/request/bootstrap.rs33
-rw-r--r--ipfs-api/src/request/cat.rs20
-rw-r--r--ipfs-api/src/request/commands.rs17
-rw-r--r--ipfs-api/src/request/config.rs53
-rw-r--r--ipfs-api/src/request/dag.rs28
-rw-r--r--ipfs-api/src/request/dht.rs73
-rw-r--r--ipfs-api/src/request/diag.rs36
-rw-r--r--ipfs-api/src/request/dns.rs22
-rw-r--r--ipfs-api/src/request/file.rs20
-rw-r--r--ipfs-api/src/request/files.rs201
-rw-r--r--ipfs-api/src/request/filestore.rs38
-rw-r--r--ipfs-api/src/request/get.rs20
-rw-r--r--ipfs-api/src/request/id.rs20
-rw-r--r--ipfs-api/src/request/key.rs78
-rw-r--r--ipfs-api/src/request/log.rs85
-rw-r--r--ipfs-api/src/request/ls.rs55
-rw-r--r--ipfs-api/src/request/mod.rs109
-rw-r--r--ipfs-api/src/request/name.rs42
-rw-r--r--ipfs-api/src/request/object.rs105
-rw-r--r--ipfs-api/src/request/pin.rs48
-rw-r--r--ipfs-api/src/request/ping.rs22
-rw-r--r--ipfs-api/src/request/pubsub.rs53
-rw-r--r--ipfs-api/src/request/refs.rs17
-rw-r--r--ipfs-api/src/request/shutdown.rs17
-rw-r--r--ipfs-api/src/request/stats.rs33
-rw-r--r--ipfs-api/src/request/swarm.rs25
-rw-r--r--ipfs-api/src/request/tar.rs28
-rw-r--r--ipfs-api/src/request/version.rs17
-rw-r--r--ipfs-api/src/response/add.rs17
-rw-r--r--ipfs-api/src/response/bitswap.rs55
-rw-r--r--ipfs-api/src/response/block.rs35
-rw-r--r--ipfs-api/src/response/bootstrap.rs36
-rw-r--r--ipfs-api/src/response/commands.rs34
-rw-r--r--ipfs-api/src/response/config.rs23
-rw-r--r--ipfs-api/src/response/dag.rs46
-rw-r--r--ipfs-api/src/response/dht.rs85
-rw-r--r--ipfs-api/src/response/diag.rs13
-rw-r--r--ipfs-api/src/response/dns.rs15
-rw-r--r--ipfs-api/src/response/error.rs161
-rw-r--r--ipfs-api/src/response/file.rs40
-rw-r--r--ipfs-api/src/response/files.rs68
-rw-r--r--ipfs-api/src/response/filestore.rs33
-rw-r--r--ipfs-api/src/response/id.rs30
-rw-r--r--ipfs-api/src/response/key.rs46
-rw-r--r--ipfs-api/src/response/log.rs28
-rw-r--r--ipfs-api/src/response/ls.rs43
-rw-r--r--ipfs-api/src/response/mod.rs106
-rw-r--r--ipfs-api/src/response/mount.rs26
-rw-r--r--ipfs-api/src/response/name.rs27
-rw-r--r--ipfs-api/src/response/object.rs123
-rw-r--r--ipfs-api/src/response/pin.rs47
-rw-r--r--ipfs-api/src/response/ping.rs24
-rw-r--r--ipfs-api/src/response/pubsub.rs48
-rw-r--r--ipfs-api/src/response/refs.rs23
-rw-r--r--ipfs-api/src/response/repo.rs58
-rw-r--r--ipfs-api/src/response/resolve.rs20
-rw-r--r--ipfs-api/src/response/serde.rs171
-rw-r--r--ipfs-api/src/response/shutdown.rs9
-rw-r--r--ipfs-api/src/response/stats.rs28
-rw-r--r--ipfs-api/src/response/swarm.rs78
-rw-r--r--ipfs-api/src/response/tar.rs21
-rw-r--r--ipfs-api/src/response/tests/v0_bitswap_stat_0.json352
-rw-r--r--ipfs-api/src/response/tests/v0_block_stat_0.json4
-rw-r--r--ipfs-api/src/response/tests/v0_bootstrap_list_0.json22
-rw-r--r--ipfs-api/src/response/tests/v0_commands_0.json1465
-rw-r--r--ipfs-api/src/response/tests/v0_dag_get_0.json19
-rw-r--r--ipfs-api/src/response/tests/v0_file_ls_0.json50
-rw-r--r--ipfs-api/src/response/tests/v0_file_ls_1.json4
-rw-r--r--ipfs-api/src/response/tests/v0_files_ls_0.json3
-rw-r--r--ipfs-api/src/response/tests/v0_files_stat_0.json7
-rw-r--r--ipfs-api/src/response/tests/v0_id_0.json9
-rw-r--r--ipfs-api/src/response/tests/v0_key_gen_0.json4
-rw-r--r--ipfs-api/src/response/tests/v0_key_list_0.json16
-rw-r--r--ipfs-api/src/response/tests/v0_key_rename_0.json6
-rw-r--r--ipfs-api/src/response/tests/v0_key_rm_0.json8
-rw-r--r--ipfs-api/src/response/tests/v0_log_ls_0.json71
-rw-r--r--ipfs-api/src/response/tests/v0_ls_0.json75
-rw-r--r--ipfs-api/src/response/tests/v0_ls_1.json45
-rw-r--r--ipfs-api/src/response/tests/v0_mount_0.json5
-rw-r--r--ipfs-api/src/response/tests/v0_name_resolve_0.json3
-rw-r--r--ipfs-api/src/response/tests/v0_object_diff_0.json14
-rw-r--r--ipfs-api/src/response/tests/v0_object_links_0.json40
-rw-r--r--ipfs-api/src/response/tests/v0_object_stat_0.json8
-rw-r--r--ipfs-api/src/response/tests/v0_pin_add_0.json5
-rw-r--r--ipfs-api/src/response/tests/v0_pin_ls_0.json7
-rw-r--r--ipfs-api/src/response/tests/v0_ping_0.json5
-rw-r--r--ipfs-api/src/response/tests/v0_ping_1.json5
-rw-r--r--ipfs-api/src/response/tests/v0_ping_2.json5
-rw-r--r--ipfs-api/src/response/tests/v0_pubsub_ls_0.json3
-rw-r--r--ipfs-api/src/response/tests/v0_pubsub_ls_1.json5
-rw-r--r--ipfs-api/src/response/tests/v0_pubsub_peers_0.json1
-rw-r--r--ipfs-api/src/response/tests/v0_pubsub_sub_0.json8
-rw-r--r--ipfs-api/src/response/tests/v0_pubsub_sub_1.json1
-rw-r--r--ipfs-api/src/response/tests/v0_refs_local_0.json4
-rw-r--r--ipfs-api/src/response/tests/v0_repo_gc_0.json5
-rw-r--r--ipfs-api/src/response/tests/v0_repo_stat_0.json1
-rw-r--r--ipfs-api/src/response/tests/v0_repo_verify_0.json4
-rw-r--r--ipfs-api/src/response/tests/v0_repo_verify_1.json4
-rw-r--r--ipfs-api/src/response/tests/v0_repo_version_0.json3
-rw-r--r--ipfs-api/src/response/tests/v0_resolve_0.json3
-rw-r--r--ipfs-api/src/response/tests/v0_stats_bw_0.json6
-rw-r--r--ipfs-api/src/response/tests/v0_swarm_addrs_local_0.json8
-rw-r--r--ipfs-api/src/response/tests/v0_swarm_peers_0.json88
-rw-r--r--ipfs-api/src/response/tests/v0_swarm_peers_1.json18
-rw-r--r--ipfs-api/src/response/tests/v0_swarm_peers_2.json32
-rw-r--r--ipfs-api/src/response/tests/v0_tar_add_0.json5
-rw-r--r--ipfs-api/src/response/tests/v0_version_0.json7
-rw-r--r--ipfs-api/src/response/tests/v0_version_1.json5
-rw-r--r--ipfs-api/src/response/version.rs29
136 files changed, 19 insertions, 9695 deletions
diff --git a/ipfs-api/Cargo.toml b/ipfs-api/Cargo.toml
index 253d99d..92b16cc 100644
--- a/ipfs-api/Cargo.toml
+++ b/ipfs-api/Cargo.toml
@@ -7,52 +7,27 @@ documentation = "https://docs.rs/ipfs-api"
repository = "https://github.com/ferristseng/rust-ipfs-api"
keywords = ["ipfs"]
categories = ["filesystem", "web-programming"]
-version = "0.11.0"
+version = "0.12.0"
readme = "../README.md"
license = "MIT OR Apache-2.0"
[features]
-default = ["with-hyper-tls", "with-builder"]
-with-hyper-tls = ["with-hyper", "hyper-tls"]
-with-hyper-rustls = ["with-hyper", "hyper-rustls"]
-with-hyper = ["hyper", "hyper-multipart-rfc7578", "failure"]
-with-actix = ["actix-http", "actix-multipart-rfc7578", "awc", "derive_more"]
-with-builder = ["typed-builder"]
+default = ["with-hyper", "with-builder"]
+with-hyper-tls = ["with-hyper", "ipfs-api-backend-hyper/with-hyper-tls"]
+with-hyper-rustls = ["with-hyper", "ipfs-api-backend-hyper/with-hyper-rustls"]
+with-hyper = ["ipfs-api-backend-hyper"]
+with-actix = ["ipfs-api-backend-actix"]
+with-builder = ["ipfs-api-prelude/with-builder"]
# Old features, kept for compatibility
actix = ["with-actix"]
builder = ["with-builder"]
[dependencies]
-actix-http = { version = "2.2", optional = true }
-actix-multipart-rfc7578 = { version = "0.4", optional = true }
-awc = { version = "2.0", optional = true }
-bytes = "1.0"
-derive_more = { version = "0.99", optional = true }
-failure = { version = "0.1", optional = true }
-futures = "0.3"
-http = "0.2"
-hyper = { version = "0.14", features = ["http1", "http2", "client"], optional = true }
-hyper-tls = { version = "0.5", optional = true }
-hyper-rustls = { version = "0.22", optional = true }
-hyper-multipart-rfc7578 = { version = "0.5", optional = true }
-serde = { version = "1.0", features = ["derive"] }
-serde_json = "1.0"
-serde_urlencoded = "0.7"
-tokio = "1.2"
-tokio-util = { version = "0.6", features = ["codec"] }
-tracing = "0.1"
-walkdir = "2.3"
-dirs = "3.0"
-parity-multiaddr = "0.11"
-typed-builder = { version = "0.9", optional = true }
+ipfs-api-prelude = { version = "0.1", path = "../ipfs-api-prelude" }
+ipfs-api-backend-actix = { version = "0.1", path = "../ipfs-api-backend-actix", optional = true }
+ipfs-api-backend-hyper = { version = "0.1", path = "../ipfs-api-backend-hyper", optional = true }
[dev-dependencies]
-actix-http = "2.2"
-actix-rt = "1.0"
-awc = "2.0"
-hyper = "0.14"
-hyper-tls = "0.5"
-tar = "0.4"
-tokio = { version = "1.2", features = ["rt-multi-thread", "macros", "time"] }
-tokio-stream = { version = "0.1", features = ["time"] }
-tracing-subscriber = { version = "0.2", features = ["fmt"] }
+actix-rt = "2.0"
+futures = "0.3"
+tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
diff --git a/ipfs-api/examples/add_file.rs b/ipfs-api/examples/add_file.rs
deleted file mode 100644
index a19e4a2..0000000
--- a/ipfs-api/examples/add_file.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-// 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.
-//
-
-use ipfs_api::IpfsClient;
-use std::fs::File;
-
-// Creates an Ipfs client, and adds this source file to Ipfs.
-//
-#[cfg_attr(feature = "with-actix", actix_rt::main)]
-#[cfg_attr(feature = "with-hyper", tokio::main)]
-async fn main() {
- tracing_subscriber::fmt::init();
-
- eprintln!("note: this must be run in the root of the project repository");
- eprintln!("connecting to localhost:5001...");
-
- let client = IpfsClient::default();
- let file = File::open(file!()).expect("could not read source file");
-
- match client.add(file).await {
- Ok(file) => eprintln!("added file: {:?}", file),
- Err(e) => eprintln!("error adding file: {}", e),
- }
-}
diff --git a/ipfs-api/examples/add_tar.rs b/ipfs-api/examples/add_tar.rs
deleted file mode 100644
index e20cb1e..0000000
--- a/ipfs-api/examples/add_tar.rs
+++ /dev/null
@@ -1,70 +0,0 @@
-// 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