mirror of https://github.com/certd/certd
fix: 修复ipv6未开启情况下,请求带有ipv6地址域名报ETIMEDOUT的bug
parent
7bbaa3806b
commit
a9a0967a6f
|
@ -207,6 +207,14 @@ export type CreateAgentOptions = {
|
|||
httpsProxy?: string;
|
||||
} & nodeHttp.AgentOptions;
|
||||
export function createAgent(opts: CreateAgentOptions = {}) {
|
||||
opts = merge(
|
||||
{
|
||||
autoSelectFamily: true,
|
||||
autoSelectFamilyAttemptTimeout: 2000,
|
||||
},
|
||||
opts
|
||||
);
|
||||
|
||||
let httpAgent, httpsAgent;
|
||||
const httpProxy = opts.httpProxy || process.env.HTTP_PROXY || process.env.http_proxy;
|
||||
if (httpProxy) {
|
||||
|
|
20
test.js
20
test.js
|
@ -1,20 +0,0 @@
|
|||
import axios from 'axios'
|
||||
|
||||
import dns from "dns";
|
||||
|
||||
// axios.request({
|
||||
// url:"http://[2407:3740:0:301::c]/"
|
||||
// }).then(res=>{
|
||||
// console.log(res)
|
||||
// })
|
||||
//
|
||||
// dns.resolve("api.cloudflare.com", (err, address) => {
|
||||
// console.log(address);
|
||||
// })
|
||||
|
||||
import {http} from '@certd/basic'
|
||||
http.request({
|
||||
url:"https://api.cloudflare.com"
|
||||
}).then(res=>{
|
||||
console.log(res)
|
||||
})
|
Loading…
Reference in New Issue