【发布时间】:2019-06-04 01:03:57
【问题描述】:
我已经在运行 express 的 Raspberry Pi 上建立了一个 Node.Js 网站。
我想通过 Node.JS/Express 使用动态 DNS 更新我的 google DNS 域
我的尝试:
function domainUpdate() {
console.log(`[SERVER] Posting to Google's Servers...`)
let username = process.env.USERNAME || ``;
let password = process.env.PASSWORD || ``;
let hostname = process.env.HOSTNAME || ``;
let url = `https://${username}:${password}@domains.google.com/nic/update?hostname=${hostname}`;
https.request(url, (res) => {
console.log(`status - ${res.statusCode}`);
console.log(`output - ${res.complete}`)
}).on("error", (e) => {
if (e) throw e
})
使用 curl 命令,它看起来像这样:
curl https://$USERNAME:$PASSWORD@domains.google.com/nic/update?hostname=$HOSTNAME&myip=$IP_ADDRESS
除了“[SERVER] Posting to Google's Servers...”之外没有任何输出
【问题讨论】: