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 SourceAddAddressFilterAsync(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
| Improve this Doc View SourceAddressesAsync(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. |
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
|
CancellationToken | cancel | Is used to stop the task. When cancelled, the TaskCanceledException is raised. |
Returns
Type | Description |
---|---|
Task |
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
|
CancellationToken | cancel | Is used to stop the task. When cancelled, the TaskCanceledException is raised. |
Returns
Type | Description |
---|---|
Task |
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
| Improve this Doc View SourcePeersAsync(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. |
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. |