Interface IDnsApi
DNS mapping to IPFS.
Namespace: Ipfs.CoreApi
Assembly: Ipfs.Core.dll
Syntax
public interface IDnsApi
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.
Methods
| Improve this Doc View SourceResolveAsync(String, Boolean, CancellationToken)
Resolve a domain name to an IPFS path.
Declaration
Task<string> ResolveAsync(string name, bool recursive = false, CancellationToken cancel = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
String | name | An domain name, such as "ipfs.io". |
Boolean | recursive | Resolve until the result is not a DNS link. Defaults to false. |
CancellationToken | cancel | Is used to stop the task. When cancelled, the TaskCanceledException is raised. |
Returns
Type | Description |
---|---|
Task<String> | A task that represents the asynchronous operation. The task's value is
the resolved IPFS path as a String, such as
|
Remarks
A DNS TXT record with a "dnslink=..." entry is expected to exist. The value of the "dnslink" is an IPFS path to another IPFS object.
A DNS query is generated for both name
and
_dnslink.name
.
Examples
ResolveAsync("ipfs.io", recursive: false)
produces "/ipns/website.ipfs.io". Whereas,
ResolveAsync("ipfs.io", recursive: true)
produces "/ipfs/QmXZz6vQTMiu6UyGxVgpLB6xJdHvvUbhdWagJQNnxXAjpn".