@wiajs/agent
Advanced tools
Comparing version 1.0.19 to 1.0.20
@@ -1,1 +0,1 @@ | ||
export {default, HttpAgent, HttpsAgent} from './lib/index.js' | ||
export {Agent, HttpAgent, HttpsAgent} from './lib/index.js' |
@@ -5,3 +5,11 @@ import http from 'node:http'; | ||
import HttpAgent from './httpAgent.js'; | ||
/** @typedef {import('./tunnel.js').Proxy} Proxy */ /** @typedef {http.AgentOptions & https.AgentOptions & {proxy: string|Proxy, proxyOpts?: *, tunnel?: boolean}} AgentOpts */ export default class Agent { | ||
/** @typedef {import('./tunnel.js').Proxy} Proxy */ /** @typedef {http.AgentOptions & https.AgentOptions & {proxy: string|Proxy, proxyOpts?: *, tunnel?: boolean}} AgentOpts */ // export default 和 named 混合包转换为cjs后,将缺省变成default,cjs require时,需带default | ||
// 被其他库引用时,需设置 interop: 'auto', 自动生成适配 default 和 named | ||
// 因此,不推荐混合包 | ||
/** | ||
* 同时生成HttpAgent 和 HttpsAgent 代理,自动设置 tunnel(隧道) | ||
* 仅在代理协议、目标协议均为 http时,不走 tunnel(隧道),使用简单的数据透明转发(不安全) | ||
* 需注意:Http、Https 针对目标服务器访问协议,而不是代理服务器的代理协议 | ||
* 代理服务器支持 http、socks协议,socks协议时,无论http、https,都走tunnel(隧道) | ||
*/ let Agent = class Agent { | ||
/** | ||
@@ -21,3 +29,3 @@ * @param {AgentOpts} options | ||
} | ||
} | ||
export { HttpAgent, HttpsAgent }; | ||
}; | ||
export { Agent, HttpAgent, HttpsAgent }; |
{ | ||
"name": "@wiajs/agent", | ||
"description": "http/https/socks/tunnel/transfer's proxy agent", | ||
"version": "1.0.19", | ||
"version": "1.0.20", | ||
"type": "module", | ||
@@ -10,7 +10,2 @@ "main": "index.js", | ||
".": { | ||
"node": { | ||
"import": "./index.js", | ||
"require": "./dist/agent.cjs", | ||
"types": "./types/index.d.ts" | ||
}, | ||
"default": { | ||
@@ -17,0 +12,0 @@ "import": "./index.js", |
@@ -1,6 +0,1 @@ | ||
export default class Agent { | ||
constructor(options: AgentOpts); | ||
http: HttpAgent; | ||
https: HttpsAgent; | ||
} | ||
export type Proxy = import("./tunnel.js").Proxy; | ||
@@ -12,2 +7,7 @@ export type AgentOpts = http.AgentOptions & https.AgentOptions & { | ||
}; | ||
export class Agent { | ||
constructor(options: AgentOpts); | ||
http: HttpAgent; | ||
https: HttpsAgent; | ||
} | ||
import HttpAgent from './httpAgent.js'; | ||
@@ -14,0 +14,0 @@ import HttpsAgent from './httpsAgent.js'; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67171
1525