summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFerris Tseng <ferristseng@fastmail.fm>2021-04-04 18:47:07 -0400
committerFerris Tseng <ferristseng@fastmail.fm>2021-04-04 18:47:07 -0400
commit61d05b2128c681287ac5ecb8e7b87dabde4e1d51 (patch)
treed479706461e7e110fec02237d33a2c55882c87cd
parentfc3cd21efe52b0575617bcd249b30e8846ad2278 (diff)
deleting everything in ipfs-api
-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/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
117 files changed, 0 insertions, 8590 deletions
diff --git a/ipfs-api/src/client/from_uri.rs b/ipfs-api/src/client/from_uri.rs
deleted file mode 100644
index be51cd8..0000000
--- a/ipfs-api/src/client/from_uri.rs
+++ /dev/null
@@ -1,202 +0,0 @@
-// Copyright 2020 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 http::uri::{Builder, InvalidUri, PathAndQuery, Scheme, Uri};
-use parity_multiaddr::{self as multiaddr, Multiaddr, Protocol};
-use std::{
- fs,
- net::{SocketAddr, SocketAddrV4, SocketAddrV6},
- str::FromStr,
-};
-
-const VERSION_PATH_V0: &str = "/api/v0";
-
-/// Builds the base url path for the Ipfs api.
-///
-fn build_base_path(builder: Builder) -> Result<Uri, http::Error> {
- builder.path_and_query(VERSION_PATH_V0).build()
-}
-
-pub trait TryFromUri: Sized {
- /// Builds a new client from a base URI to the IPFS API.
- ///
- fn build_with_base_uri(uri: Uri) -> Self;
-
- /// Creates a new client from a str.
- ///
- /// Note: This constructor will overwrite the path/query part of the URI.
- ///
- fn from_str(uri: &str) -> Result<Self, InvalidUri> {
- let uri: Uri = uri.parse()?;
- let mut parts = uri.into_parts();
-
- parts.path_and_query = Some(PathAndQuery::from_static(VERSION_PATH_V0));
-
- Ok(Self::build_with_base_uri(Uri::from_parts(parts).unwrap()))
- }
-
- /// Creates a new client from a host name and port.
- ///
- fn from_host_and_port(scheme: Scheme, host: &str, port: u16) -> Result<Self, http::Error> {
- let authority = format!("{}:{}", host, port);
- let builder = Builder::new().scheme(scheme).authority(&authority[..]);
-
- build_base_path(builder).map(Self::build_with_base_uri)
- }
-
- /// Creates a new client from an IPV4 address and port number.
- ///
- fn from_ipv4(scheme: Scheme, addr: SocketAddrV4) -> Result<Self, http::Error> {
- let authority = format!("{}", addr);
- let builder = Builder::new().scheme(scheme).authority(&authority[..]);
-
- build_base_path(builder).map(Self::build_with_base_uri)
- }
-
- /// Creates a new client from an IPV6 addr and port number.
- ///
- fn from_ipv6(scheme: Scheme, addr: SocketAddrV6) -> Result<Self, http::Error> {
- let authority = format!("{}", addr);
- let builder = Builder::new().scheme(scheme).authority(&authority[..]);
-
- build_base_path(builder).map(Self::build_with_base_uri)
- }
-
- /// Creates a new client from an IP address and port number.
- ///
- fn from_socket(scheme: Scheme, socket_addr: SocketAddr) -> Result<Self, http::Error> {
- match socket_addr {
- SocketAddr::V4(addr) => Self::from_ipv4(scheme, addr),
- SocketAddr::V6(addr) => Self::from_ipv6(scheme, addr),
- }
- }
-
- /// Creates a new client from a multiaddr.
- ///
- fn from_multiaddr(multiaddr: Multiaddr) -> Result<Self, multiaddr::Error> {
- let mut scheme: Option<Scheme> = None;
- let mut port: Option<u16> = None;
-
- for addr_component in multiaddr.iter() {
- match addr_component {
- Protocol::Tcp(tcpport) => port = Some(tcpport),
- Protocol::Http => scheme = Some(Scheme::HTTP),
- Protocol::Https => scheme = Some(Scheme::HTTPS),
- _ => (),
- }
- }
-
- let scheme = scheme.unwrap_or(Scheme::HTTP);
-
- if let Some(port) = port {
- for addr_component in multiaddr.iter() {
- match addr_component {
- Protocol::Tcp(_) | Protocol::Http | Protocol::Https => (),
- Protocol::Ip4(v4addr) => {
- return Ok(Self::from_ipv4(scheme, SocketAddrV4::new(v4addr, port)).unwrap())
- }
- Protocol::Ip6(v6addr) => {
- return Ok(
- Self::from_ipv6(scheme, SocketAddrV6::new(v6addr, port, 0, 0)).unwrap(),
- )
- }
- Protocol::Dns(ref hostname) => {
- return Ok(Self::from_host_and_port(scheme, hostname, port).unwrap())
- }
- Protocol::Dns4(ref v4host) => {
- return Ok(Self::from_host_and_port(scheme, v4host, port).unwrap())
- }
- Protocol::Dns6(ref v6host) => {
- return Ok(Self::from_host_and_port(scheme, v6host, port).unwrap())
- }
- _ => {
- return Err(multiaddr::Error::InvalidMultiaddr);
- }
- }
- }
- }
-
- Err(multiaddr::Error::InvalidMultiaddr)
- }
-
- /// Creates a new client from a multiaddr.
- ///
- fn from_multiaddr_str(multiaddr: &str) -> Result<Self, multiaddr::Error> {
- parity_multiaddr::from_url(multiaddr)
- .map_err(|e| multiaddr::Error::ParsingError(Box::new(e)))
- .or_else(|_| Multiaddr::from_str(multiaddr))
- .and_then(Self::from_multia