Node.js – dns.resolveSoa() 方法\n


dns.resolveSoa() 方法使用 DNS 協議解析主機名的權威記錄的開始。傳遞給回撥函式的地址引數將是一個將包含以下屬性的物件 −

  • nsname
  • hostmaster
  • serial
  • refresh
  • entry
  • expire

語法

dns.resolveSoa(hostname, callback)

引數

它接受以下引數 −

  • hostname – 該引數獲取要解析的主機名的輸入。

  • callback – 如果有任何錯誤,該函式將捕獲錯誤。

    • records – 返回主機名的權威記錄的開始。

示例

建立一個名為“resolveSoa.js”的檔案,並將以下程式碼段複製其中。建立檔案後,使用命令節點“resolveSoa.js”以執行此程式碼,如下例所示 −

// dns.resolveSoa() Demo Example

// Importing the dns module
const dns = require('dns');

// Passing the argument below
dns.resolveSoa('tutorialspoint.com', (err, records) => console.log('SOA Records: %j', records));

輸出

C:\home
ode>> node resolveSoa.js SOA Records: {    "nsname":"ns-1033.awsdns-01.org",    "hostmaster":"awsdns-hostmaster.amazon.com",    "serial":1,    "refresh":7200,    "retry":900,    "expire":1209600,    "minttl":86400 }

更新日期: 17-01-2022

64 人瀏覽

開啟你的 職業 生涯

透過完成課程獲得認證

開始
廣告
© . All rights reserved.