View Source MyspaceIPFS.Swarm (Myspace IPFS v0.2.0-alpha.1)

MyspaceIPFS.Swarm is where the swarm commands of the IPFS API reside.

Link to this section Summary

Types

A struct that represents a peer in the swarm.

A struct that represents a stream for a peer in the swarm.

A list of peers in the swarm.

Functions

List the addresses of known peers.

List the interfaces swarm is listening on.

List the local addresses.

Open a connection to a given address.

Close a connection to a given address.

Manipulate address filters.

Multiaddress filter to add.

Multiaddress filter to remove.

Add peers to the peering service.

List peers in the peering service.

Remove peers from the peering service.

List peers with open connections.

Link to this section Types

@type peer() :: %MyspaceIPFS.SwarmPeer{
  addr: binary(),
  direction: binary(),
  latency: binary(),
  muxer: binary(),
  peer: binary(),
  streams: list()
}

A struct that represents a peer in the swarm.

@type peer_stream() :: %MyspaceIPFS.SwarmPeerStream{protocol: binary()}

A struct that represents a stream for a peer in the swarm.

@type peers() :: [peer()]

A list of peers in the swarm.

Link to this section Functions

@spec addrs() :: {:ok, any()} | MyspaceIPFS.Api.error_response()

List the addresses of known peers.

@spec addrs_listen() :: {:ok, any()} | MyspaceIPFS.Api.error_response()

List the interfaces swarm is listening on.

@spec addrs_local() :: {:ok, any()} | MyspaceIPFS.Api.error_response()

List the local addresses.

@spec addrs_local(MyspaceIPFS.peer_id()) ::
  {:ok, any()} | MyspaceIPFS.Api.error_response()
@spec connect(MyspaceIPFS.peer_id()) ::
  {:ok, any()} | MyspaceIPFS.Api.error_response()

Open a connection to a given address.

parameters

Parameters

https://docs.ipfs.io/reference/http/api/#api-v0-swarm-connect peer_id - The address to connect to.

@spec disconnect(MyspaceIPFS.peer_id()) ::
  {:ok, any()} | MyspaceIPFS.Api.error_response()

Close a connection to a given address.

parameters

Parameters

https://docs.ipfs.io/reference/http/api/#api-v0-swarm-disconnect peer_id - The address to disconnect from.

@spec filters() :: {:ok, any()} | MyspaceIPFS.Api.error_response()

Manipulate address filters.

@spec filters_add(MyspaceIPFS.peer_id()) ::
  {:ok, any()} | MyspaceIPFS.Api.error_response()

Multiaddress filter to add.

parameters

Parameters

https://docs.ipfs.io/reference/http/api/#api-v0-swarm-filters-add peer_id - The multiaddress to add to the filter.

@spec filters_rm(MyspaceIPFS.peer_id()) ::
  {:ok, any()} | MyspaceIPFS.Api.error_response()

Multiaddress filter to remove.

parameters

Parameters

https://docs.ipfs.io/reference/http/api/#api-v0-swarm-filters-rm peer_id - The multiaddress to remove from the filter.

@spec peering_add(MyspaceIPFS.peer_id()) ::
  {:ok, any()} | MyspaceIPFS.Api.error_response()

Add peers to the peering service.

parameters

Parameters

https://docs.ipfs.io/reference/http/api/#api-v0-swarm-peering-add peer_id - The peer ID of the peer to add.

@spec peering_ls() :: {:ok, any()} | MyspaceIPFS.Api.error_response()

List peers in the peering service.

@spec peering_rm(MyspaceIPFS.peer_id()) ::
  {:ok, any()} | MyspaceIPFS.Api.error_response()

Remove peers from the peering service.

parameters

Parameters

https://docs.ipfs.io/reference/http/api/#api-v0-swarm-peering-rm peer_id - The multihash of the peer to remove.

@spec peers() :: {:ok, any()} | MyspaceIPFS.Api.error_response()

List peers with open connections.

options

Options

https://docs.ipfs.io/reference/http/api/#api-v0-swarm-peers verbose - Write extra information. streams - Also list information about open streams for each connection. latency - Also list information about latency to each peer. direction - Also list information about direction of connection.