@flun/mailer 2.1.5 → 2.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -2
- package/lib/shared.js +7 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/lib/shared.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import dns from 'dns';
|
|
2
2
|
import { format } from 'util';
|
|
3
3
|
import { isIP, connect as netConnect } from 'net';
|
|
4
4
|
import { createReadStream as fsReadStream } from 'fs';
|
|
@@ -13,7 +13,11 @@ import pkg from '../package.json' with { type: 'json' };
|
|
|
13
13
|
* >查看定义:@see {@link PK}、{@link dnsLookup}、{@link dnsResolve}
|
|
14
14
|
*/
|
|
15
15
|
const PK = (({ name, version, homepage }) => ({ name, version, homepage }))(pkg),
|
|
16
|
-
DNS_TTL = 5 * 60 * 1000, DNS_MAP = new Map()
|
|
16
|
+
DNS_TTL = 5 * 60 * 1000, DNS_MAP = new Map();
|
|
17
|
+
/** @type {Function} DNS 查找函数 */
|
|
18
|
+
const dnsLookup = dns.lookup;
|
|
19
|
+
/** @type {Function} DNS 解析函数 */
|
|
20
|
+
const dnsResolve = dns.resolve,
|
|
17
21
|
/**
|
|
18
22
|
* @param {number} family - IP地址族(4=IPv4, 6=IPv6)
|
|
19
23
|
* @param {boolean} allowInternal - 是否允许内部网络接口
|
|
@@ -206,7 +210,7 @@ const resolveHostname = (options = {}, callback) => {
|
|
|
206
210
|
if (err) return handleError(err);
|
|
207
211
|
if (addrV6?.length) return handleSuccess(addrV6); // 如果IPv6解析成功,同理...
|
|
208
212
|
|
|
209
|
-
// 如果DNS解析都失败,尝试使用
|
|
213
|
+
// 如果DNS解析都失败,尝试使用dnsLookup
|
|
210
214
|
try {
|
|
211
215
|
dnsLookup(newHost, { all: true }, (err, lookupAddr) => {
|
|
212
216
|
if (err) return handleError(err);
|
package/package.json
CHANGED