You need to enable JavaScript to run this app.
导航
DNS
最近更新时间:2024.07.19 10:54:49首次发布时间:2023.02.15 19:04:53

边缘函数的运行时支持针对域名的相关解析操作。

resolveV4

介绍

该接口用于解析域名对应的 IPv4 地址(A记录)。

示例

const data = await net.dns.resolveV4("www.example.com");

// {
//   ttl: 1200
//   "address" : ["1.2.3.1", ...]
// }

console.log("%s", JSON.stringify(data));

resolveV6

介绍

该接口用于解析域名对应的IPv6地址(AAAA记录)。

示例

const data = await net.dns.resolveV6("www.example.com");

// {
//  ttl: 1200
//  "address" : ["A::B::::0", ...]
// }
//

console.log("%s", JSON.stringify(data));

resolveMx

介绍

该接口用于解析域名对应的邮件服务器地址(MX记录)。

示例

const data = await net.dns.resolveMx("www.example.com");

// {
//   ttl: 1200
//   "name" : record name
//   "cname": canonical MX name
//   "mx" : [ {"name": ..., "priority": 1} ... ]
// }

console.log("%s", JSON.stringify(data));

resolveSrv

介绍

该接口用于解析域名的SRV记录。

示例

const data = await net.dns.resolveSrv("www.example.com");

// {
//   "ttl": 1200,
//   "name": "record name",
//   "srv": [
//     {
//       "hostname": "example.com",
//       "priority": 1,
//       "weight": 2,
//       "port": 23
//     }
//   ]
// }

console.log("%s", JSON.stringify(data));

resolveTXT

介绍

该接口用于解析域名的TXT记录。

示例

const data = await net.dns.resolveTXT("www.example.com");

// {
//  ttl: 1200
//  "name" : record name
//  "txt" : [ "a", "bbb", "ccc" ]
// }

console.log("%s", JSON.stringify(data));

resolveNaptr/resolvePtr

介绍

该接口用于解析域名的NAPTR记录和PTR记录。

示例

const data1 = await net.dns.resolveNaptr("www.example.com");
const data2 = await net.dns.resolvePtr("www.example.com");