This commit is contained in:
Luk 2026-01-21 14:12:56 +08:00
parent c22b8d6b73
commit dcf554806b

View File

@ -1,7 +1,10 @@
// 使用Node.js实现Shell脚本逻辑获取公网IP并检查是否以.172结尾
const https = require('https')
const { execFileSync } = require('child_process')
//https.get('https://api.ipify.org', (res) => {
// `curl -s https://ifconfig.me` returns the IP address only, but open the url in browser or https.get() returns the HTML content
// `https://api.ipify.org` returns the IP address only with curl, browser or nodejs. But it seems it doesn't work in China.
// https.get 没有同步版本,使用 child_process.execFileSync 同步获取公网 IP
let ip
try {