Class Mdns
Base class to discover peers using Multicast DNS.
Inherited Members
Namespace: PeerTalk.Discovery
Assembly: PeerTalk.dll
Syntax
public abstract class Mdns : IPeerDiscovery, IService
Properties
| Improve this Doc View SourceBroadcast
Determines if the local peer responds to a query.
Declaration
public bool Broadcast { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean | true to answer queries. Defaults to true. |
LocalPeer
The local peer.
Declaration
public Peer LocalPeer { get; set; }
Property Value
| Type | Description |
|---|---|
| Peer |
MulticastService
The Muticast Domain Name Service to use.
Declaration
public MulticastService MulticastService { get; set; }
Property Value
| Type | Description |
|---|---|
| MulticastService |
ServiceName
The service name for our peers.
Declaration
public string ServiceName { get; set; }
Property Value
| Type | Description |
|---|---|
| String | Defaults to "ipfs". |
Methods
| Improve this Doc View SourceBuildProfile()
Build the profile which contains the DNS records that are needed to locate and connect to the local peer.
Declaration
public abstract ServiceProfile BuildProfile()
Returns
| Type | Description |
|---|---|
| ServiceProfile | Describes the service. |
GetAddresses(Message)
Get the addresses of the peer in the DNS message.
Declaration
public abstract IEnumerable<MultiAddress> GetAddresses(Message message)
Parameters
| Type | Name | Description |
|---|---|---|
| Makaretu.Dns.Message | message | An answer describing a peer. |
Returns
| Type | Description |
|---|---|
| IEnumerable<MultiAddress> | All the addresses of the peer. |
OnServiceDiscovery(ServiceDiscovery)
Allows derived class to modify the service discovery behavior.
Declaration
protected virtual void OnServiceDiscovery(ServiceDiscovery discovery)
Parameters
| Type | Name | Description |
|---|---|---|
| ServiceDiscovery | discovery |
StartAsync()
Start the service.
Declaration
public Task StartAsync()
Returns
| Type | Description |
|---|---|
| Task |
StopAsync()
Stop the service.
Declaration
public Task StopAsync()
Returns
| Type | Description |
|---|---|
| Task |
Events
| Improve this Doc View SourcePeerDiscovered
Raised when a peer is discovered.
Declaration
public event EventHandler<Peer> PeerDiscovered
Event Type
| Type | Description |
|---|---|
| EventHandler<Peer> |
Remarks
The peer must contain at least one MultiAddress. The address must end with the ipfs protocol and the public ID of the peer. For example "/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"