Show / Hide Table of Contents

Class Dht1

DHT Protocol version 1.0

Inheritance
Object
Dht1
Implements
IPeerProtocol
IService
IPeerRouting
IContentRouting
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Namespace: PeerTalk.Routing
Assembly: PeerTalk.dll
Syntax
public class Dht1 : IPeerProtocol, IService, IPeerRouting, IContentRouting

Fields

| Improve this Doc View Source

ContentRouter

Peers that can provide some content.

Declaration
public ContentRouter ContentRouter
Field Value
Type Description
ContentRouter
| Improve this Doc View Source

RoutingTable

Routing information on peers.

Declaration
public RoutingTable RoutingTable
Field Value
Type Description
RoutingTable

Properties

| Improve this Doc View Source

CloserPeerCount

The number of closer peers to return.

Declaration
public int CloserPeerCount { get; set; }
Property Value
Type Description
Int32

Defaults to 20.

| Improve this Doc View Source

Name

The name of the protocol.

Declaration
public string Name { get; }
Property Value
Type Description
String
| Improve this Doc View Source

Swarm

Provides access to other peers.

Declaration
public Swarm Swarm { get; set; }
Property Value
Type Description
Swarm
| Improve this Doc View Source

Version

The version of the protocol.

Declaration
public SemVersion Version { get; }
Property Value
Type Description
Semver.SemVersion

Methods

| Improve this Doc View Source

Advertise(Cid)

Advertise that we can provide the CID to the X closest peers of the CID.

Declaration
public void Advertise(Cid cid)
Parameters
Type Name Description
Cid cid

The CID to advertise.

Remarks

This starts a background process to send the AddProvider message to the 4 closest peers to the cid.

| Improve this Doc View Source

FindPeerAsync(MultiHash, CancellationToken)

Declaration
public Task<Peer> FindPeerAsync(MultiHash id, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
MultiHash id
CancellationToken cancel
Returns
Type Description
Task<Peer>
| Improve this Doc View Source

FindProvidersAsync(Cid, Int32, Action<Peer>, CancellationToken)

Declaration
public Task<IEnumerable<Peer>> FindProvidersAsync(Cid id, int limit = 20, Action<Peer> action = null, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
Cid id
Int32 limit
Action<Peer> action
CancellationToken cancel
Returns
Type Description
Task<IEnumerable<Peer>>
| Improve this Doc View Source

ProcessAddProvider(Peer, DhtMessage, DhtMessage)

Process an add provider request.

Declaration
public DhtMessage ProcessAddProvider(Peer remotePeer, DhtMessage request, DhtMessage response)
Parameters
Type Name Description
Peer remotePeer
DhtMessage request
DhtMessage response
Returns
Type Description
DhtMessage
| Improve this Doc View Source

ProcessFindNode(DhtMessage, DhtMessage)

Process a find node request.

Declaration
public DhtMessage ProcessFindNode(DhtMessage request, DhtMessage response)
Parameters
Type Name Description
DhtMessage request
DhtMessage response
Returns
Type Description
DhtMessage
| Improve this Doc View Source

ProcessGetProviders(DhtMessage, DhtMessage)

Process a get provider request.

Declaration
public DhtMessage ProcessGetProviders(DhtMessage request, DhtMessage response)
Parameters
Type Name Description
DhtMessage request
DhtMessage response
Returns
Type Description
DhtMessage
| Improve this Doc View Source

ProcessMessageAsync(PeerConnection, Stream, CancellationToken)

Process a message for the protocol.

Declaration
public Task ProcessMessageAsync(PeerConnection connection, Stream stream, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
PeerConnection connection

A connection between two peers.

Stream stream

The message source.

CancellationToken cancel

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

Returns
Type Description
Task

A task that represents the asynchronous operation.

| Improve this Doc View Source

ProvideAsync(Cid, Boolean, CancellationToken)

Declaration
public Task ProvideAsync(Cid cid, bool advertise = true, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
Cid cid
Boolean advertise
CancellationToken cancel
Returns
Type Description
Task
| Improve this Doc View Source

StartAsync()

Start the service.

Declaration
public Task StartAsync()
Returns
Type Description
Task
| Improve this Doc View Source

StopAsync()

Stop the service.

Declaration
public Task StopAsync()
Returns
Type Description
Task
| Improve this Doc View Source

ToString()

Declaration
public override string ToString()
Returns
Type Description
String
Overrides
Object.ToString()

Events

| Improve this Doc View Source

Stopped

Raised when the DHT is stopped.

Declaration
public event EventHandler Stopped
Event Type
Type Description
EventHandler
See Also
StopAsync()

Implements

IPeerProtocol
IService
IPeerRouting
IContentRouting
  • Improve this Doc
  • View Source
Back to top Generated by DocFX