# Deno.resolveDns

### What is DNS?

請參考[什麼是 DNS？ | DNS 的工作方式](https://www.cloudflare.com/zh-tw/learning/dns/what-is-dns/)。

### Deno.resolveDns

了解什麼是 DNS 後，一起來看看這個全新的 API 要如何使用吧!

Deno.resolveDns 可以讓開發者查詢 DNS 紀錄，參考以下程式碼:

```
const domainName = Deno.args[0];
if (!domainName) {
  throw new Error("Domain name not specified in first argument");
}

const records = await Deno.resolveDns(domainName, "A");
for (const ip of records) {
  console.log(ip);
}
```

執行結果:

```
$ deno run --allow-net --unstable https://deno.land/posts/v1.7/dig.ts deno.land
104.21.18.123
172.67.181.211
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ianchen0119.gitbook.io/deno/deno-cli/xiang-guan-gong-ju-ji-ce-shi/quan-xin-api-deno.resolvedns.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
