You need to enable JavaScript to run this app.
导航

DNS

最近更新时间2023.12.20 19:16:23

首次发布时间2023.02.15 19:04:53

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

resolveV4

介绍

解析一个ipv4的域名。

示例

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

// {
//.  ttl: 1200
//.  "address" : ["1.2.3.1", ...]
//.}
//
console.log("%s", JSON.stringify(data));

resolveV6

介绍

解析一个ipv6的域名。

示例

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

// {
//.  ttl: 1200
//.  "address" : ["A::B::::0", ...]
//.}
//
console.log("%s", JSON.stringify(data));

resolveMx

介绍

解析一个邮件记录。

示例

const data = await net.dns.resolveMx("www.gmail.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.gmail.com");

// {
//.  ttl: 1200
//.  "name" : record name
//.  "cname": canonical MX name
//.  "srv" : [ {"hostname": ..., "priority": 1, "weight" : 2, "port" : 23} ... ]
//.}
//
console.log("%s", JSON.stringify(data));

resolveTXT

介绍

解析一个TXT记录。

示例

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

// {
//.  ttl: 1200
//.  "name" : record name
//.  "cname": canonical MX name
//.  "txt" : [ "a", "bbb", "ccc" ]
//.}
//
console.log("%s", JSON.stringify(data));

resolveNaptr/resolvePtr

介绍

解析Naptr/Ptr。

示例

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