Interface INetworkProtector
Provides access to a private network of peers.
Namespace: PeerTalk
Assembly: PeerTalk.dll
Syntax
public interface INetworkProtector
Remarks
The Swarm calls the network protector whenever a connection is being established with another peer.
Methods
| Improve this Doc View SourceProtectAsync(PeerConnection, CancellationToken)
Creates a protected stream for the connection.
Declaration
Task<Stream> ProtectAsync(PeerConnection connection, CancellationToken cancel = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
PeerConnection | connection | A connection between two peers. |
CancellationToken | cancel | Is used to stop the task. When cancelled, the TaskCanceledException is raised. |
Returns
Type | Description |
---|---|
Task<Stream> | A task that represents the asynchronous operation. The task's result is the protected stream. |
Remarks
ProtectAsync is called after the transport level has established the connection.
An exception is thrown if the remote peer is not a member of the private network.