mirror of
https://github.com/certd/certd.git
synced 2026-04-27 23:37:29 +08:00
chore: 代理初步
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user