Show / Hide Table of Contents

Interface ISwarmApi

Manages the swarm of peers.

Namespace: Ipfs.CoreApi
Assembly: Ipfs.Core.dll
Syntax
public interface ISwarmApi
Remarks

The swarm is a sequence of connected peer nodes.

Methods

| Improve this Doc View Source

AddAddressFilterAsync(MultiAddress, Boolean, CancellationToken)

Adds a new address filter.

Declaration
Task<MultiAddress> AddAddressFilterAsync(MultiAddress address, bool persist = false, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
MultiAddress address

An allowed address. For example "/ip4/104.131.131.82" or "/ip4/192.168.0.0/ipcidr/16".

Boolean persist

If true the filter will persist across daemon reboots.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<MultiAddress>

A task that represents the asynchronous operation. The task's result is the address filter that was added.

See Also
https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing
| Improve this Doc View Source

AddressesAsync(CancellationToken)

Get the peers in the current swarm.

Declaration
Task<IEnumerable<Peer>> AddressesAsync(CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<IEnumerable<Peer>>

A task that represents the asynchronous operation. The task's value is a sequence of peer nodes.

| Improve this Doc View Source

ConnectAsync(MultiAddress, CancellationToken)

Connect to a peer.

Declaration
Task ConnectAsync(MultiAddress address, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
MultiAddress address

An ipfs MultiAddress, such as /ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task
| Improve this Doc View Source

DisconnectAsync(MultiAddress, CancellationToken)

Disconnect from a peer.

Declaration
Task DisconnectAsync(MultiAddress address, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
MultiAddress address

An ipfs MultiAddress, such as /ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task
| Improve this Doc View Source

ListAddressFiltersAsync(Boolean, CancellationToken)

List all the address filters.

Declaration
Task<IEnumerable<MultiAddress>> ListAddressFiltersAsync(bool persist = false, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
Boolean persist

If true only persisted filters are listed.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<IEnumerable<MultiAddress>>

A task that represents the asynchronous operation. The task's result is a sequence of addresses filters.

See Also
https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing
| Improve this Doc View Source

PeersAsync(CancellationToken)

Get the peers that are connected to this node.

Declaration
Task<IEnumerable<Peer>> PeersAsync(CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<IEnumerable<Peer>>

A task that represents the asynchronous operation. The task's value is a sequence of Peer.

| Improve this Doc View Source

RemoveAddressFilterAsync(MultiAddress, Boolean, CancellationToken)

Delete the specified address filter.

Declaration
Task<MultiAddress> RemoveAddressFilterAsync(MultiAddress address, bool persist = false, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
MultiAddress address

For example "/ip4/104.131.131.82" or "/ip4/192.168.0.0/ipcidr/16".

Boolean persist

If true the filter is also removed from the persistent store.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<MultiAddress>

A task that represents the asynchronous operation. The task's result is the address filter that was removed.

See Also
https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing

See Also

Swarm API spec
  • Improve this Doc
  • View Source
Back to top Generated by DocFX