Skip to content

Commit

Permalink
feat(): define DNS API #38
Browse files Browse the repository at this point in the history
  • Loading branch information
richardschneider committed May 4, 2018
1 parent ee281ba commit fce1343
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/CoreApi/ICoreApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public interface ICoreApi
IConfigApi Config { get; }

/// <summary>
/// Provides access to the Daglock API.
/// Provides access to the Dag API.
/// </summary>
/// <value>
/// An object that implements <see cref="IDagApi"/>.
Expand All @@ -61,6 +61,14 @@ public interface ICoreApi
/// </value>
IDhtApi Dht { get; }

/// <summary>
/// Provides access to the DNS API.
/// </summary>
/// <value>
/// An object that implements <see cref="IDnsApi"/>.
/// </value>
IDnsApi Dns { get; }

/// <summary>
/// Provides access to the File System API.
/// </summary>
Expand Down
43 changes: 43 additions & 0 deletions src/CoreApi/IDnsApi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Ipfs.CoreApi
{
/// <summary>
/// DNS mapping to IPFS.
/// </summary>
/// <remarks>
/// Multihashes are hard to remember, but domain names are usually easy to
/// remember. To create memorable aliases for multihashes, DNS TXT
/// records can point to other DNS links, IPFS objects, IPNS keys, etc.
/// </remarks>
public interface IDnsApi
{

/// <summary>
/// Resolve a domain name to an IPFS path.
/// </summary>
/// <param name="name">
/// An domain name, such as "ipfs.io".
/// </param>
/// <param name="recursive">
/// Resolve until the result is not a DNS link. Defaults to <b>false</b>.
/// </param>
/// <param name="cancel">
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
/// </param>
/// <returns>
/// A task that represents the asynchronous operation. The task's value is
/// the resolved IPFS path as a <see cref="string"/>, such as
/// <c>/ipfs/QmYNQJoKGNHTpPxCBPh9KkDpaExgd2duMa3aF6ytMpHdao</c>.
/// </returns>
Task<string> ResolveAsync(
string name,
bool recursive = false,
CancellationToken cancel = default(CancellationToken)
);
}
}

0 comments on commit fce1343

Please sign in to comment.