DNSResolver
Git Source (opens in a new tab)
Inherits: IDNSRecordResolver, IDNSZoneResolver, BaseResolver
State Variables
versionable_zonehashes
mapping(uint256 => mapping(bytes32 => bytes)) private versionable_zonehashes;
versionable_records
mapping(uint256 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes)))) private versionable_records;
versionable_nameEntriesCount
mapping(uint256 => mapping(bytes32 => mapping(bytes32 => uint16))) private versionable_nameEntriesCount;
Functions
setDNSRecords
Set one or more DNS records. Records are supplied in wire-format. Records with the same node/name/resource must be supplied one after the other to ensure the data is updated correctly. For example, if the data was supplied: a.example.com IN A 1.2.3.4 a.example.com IN A 5.6.7.8 www.example.com (opens in a new tab) IN CNAME a.example.com. then this would store the two A records for a.example.com correctly as a single RRSET, however if the data was supplied: a.example.com IN A 1.2.3.4 www.example.com (opens in a new tab) IN CNAME a.example.com. a.example.com IN A 5.6.7.8 then this would store the first A record, the CNAME, then the second A record which would overwrite the first.
function setDNSRecords(bytes32 node, bytes calldata data) external virtual authorised(node);
Parameters
Name | Type | Description |
---|---|---|
node | bytes32 | the namehash of the node for which to set the records |
data | bytes | the DNS wire format records to set |
dnsRecord
Obtain a DNS record.
function dnsRecord(bytes32 node, bytes32 name, uint16 resource) public view virtual override returns (bytes memory);
Parameters
Name | Type | Description |
---|---|---|
node | bytes32 | the namehash of the node for which to fetch the record |
name | bytes32 | the keccak-256 hash of the fully-qualified name for which to fetch the record |
resource | uint16 | the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types (opens in a new tab) |
Returns
Name | Type | Description |
---|---|---|
<none> | bytes | the DNS record in wire format if present, otherwise empty |
hasDNSRecords
Check if a given node has records.
function hasDNSRecords(bytes32 node, bytes32 name) public view virtual returns (bool);
Parameters
Name | Type | Description |
---|---|---|
node | bytes32 | the namehash of the node for which to check the records |
name | bytes32 | the namehash of the node for which to check the records |
setZonehash
setZonehash sets the hash for the zone. May only be called by the owner of that node.
function setZonehash(bytes32 _node, bytes calldata _hash) external virtual authorised(_node);
Parameters
Name | Type | Description |
---|---|---|
_node | bytes32 | The node to update. |
_hash | bytes | The zonehash to set |
zonehash
zonehash obtains the hash for the zone.
function zonehash(bytes32 _node) public view virtual override returns (bytes memory);
Parameters
Name | Type | Description |
---|---|---|
_node | bytes32 | The node to query. |
Returns
Name | Type | Description |
---|---|---|
<none> | bytes | The associated contenthash. |
supportsInterface
function supportsInterface(bytes4 interfaceID) public view virtual override returns (bool);
setDNSRRSet
function setDNSRRSet(
bytes32 node,
bytes memory name,
uint16 resource,
bytes memory data,
uint256 offset,
uint256 size,
bool deleteRecord,
uint256 version
) private;
incrementVersion
function incrementVersion(bytes32 node) public virtual override authorised(node);