chore: 代理初步

pull/189/head
xiaojunnuo 2024-09-14 10:29:47 +08:00
parent d5956072f0
commit 830de90317
1 changed files with 2 additions and 2 deletions

View File

@ -1,7 +1,7 @@
import axios, { AxiosRequestConfig } from "axios"; import axios, { AxiosRequestConfig } from "axios";
import { logger } from "./util.log.js"; import { logger } from "./util.log.js";
import { Logger } from "log4js"; import { Logger } from "log4js";
import { ProxyAgent } from "proxy-agent"; import { ProxyAgent, ProxyAgentOptions } from "proxy-agent";
export class HttpError extends Error { export class HttpError extends Error {
status?: number; status?: number;
statusText?: string; statusText?: string;
@ -136,7 +136,7 @@ export type HttpClient = {
request<D = any, R = any>(config: HttpRequestConfig<D>): Promise<HttpClientResponse<R>>; request<D = any, R = any>(config: HttpRequestConfig<D>): Promise<HttpClientResponse<R>>;
}; };
export function createAgent(opts: any = {}) { export function createAgent(opts: ProxyAgentOptions = {}) {
const httpAgent = new ProxyAgent(opts); const httpAgent = new ProxyAgent(opts);
return { return {
httpAgent, httpAgent,