mirror of
https://github.com/certd/certd.git
synced 2026-04-24 12:27:25 +08:00
fix: 修复ipv6未开启情况下,请求带有ipv6地址域名报ETIMEDOUT的bug
This commit is contained in:
@@ -207,6 +207,14 @@ export type CreateAgentOptions = {
|
|||||||
httpsProxy?: string;
|
httpsProxy?: string;
|
||||||
} & nodeHttp.AgentOptions;
|
} & nodeHttp.AgentOptions;
|
||||||
export function createAgent(opts: CreateAgentOptions = {}) {
|
export function createAgent(opts: CreateAgentOptions = {}) {
|
||||||
|
opts = merge(
|
||||||
|
{
|
||||||
|
autoSelectFamily: true,
|
||||||
|
autoSelectFamilyAttemptTimeout: 2000,
|
||||||
|
},
|
||||||
|
opts
|
||||||
|
);
|
||||||
|
|
||||||
let httpAgent, httpsAgent;
|
let httpAgent, httpsAgent;
|
||||||
const httpProxy = opts.httpProxy || process.env.HTTP_PROXY || process.env.http_proxy;
|
const httpProxy = opts.httpProxy || process.env.HTTP_PROXY || process.env.http_proxy;
|
||||||
if (httpProxy) {
|
if (httpProxy) {
|
||||||
|
|||||||
@@ -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)
|
|
||||||
})
|
|
||||||
Reference in New Issue
Block a user