@ekhein/http-request 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ import { ProxyAgent } from 'proxy-agent';
2
+ export declare class Phone4GProxy extends ProxyAgent {
3
+ constructor(opts: {
4
+ clientIp: string;
5
+ });
6
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Phone4GProxy = void 0;
4
+ const proxy_agent_1 = require("proxy-agent");
5
+ class Phone4GProxy extends proxy_agent_1.ProxyAgent {
6
+ constructor(opts) {
7
+ super({
8
+ getProxyForUrl: () => {
9
+ const subnet = String(opts.clientIp).split(".").at(-2);
10
+ const usbcom = String(opts.clientIp).split(".").at(-1);
11
+ return ("http://172.16.1.1:3".concat(subnet, usbcom));
12
+ },
13
+ });
14
+ }
15
+ }
16
+ exports.Phone4GProxy = Phone4GProxy;
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@ekhein/http-request",
3
+ "version": "1.0.0",
4
+ "license": "MIT",
5
+ "author": "ekhein",
6
+ "main": "./dist/main.js",
7
+ "files": [
8
+ "dist",
9
+ "types"
10
+ ],
11
+ "scripts": {
12
+ "build": "tsc"
13
+ },
14
+ "engines": {
15
+ "node": ">=18.0.0"
16
+ },
17
+ "devDependencies": {
18
+ "@types/jsdom": "^27.0.0",
19
+ "@types/lodash": "^4.17.20",
20
+ "@types/node": "^22.15.18",
21
+ "tsx": "^4.19.4",
22
+ "typescript": "^5.8.3"
23
+ },
24
+ "dependencies": {
25
+ "@nestjs/common": "^11.1.6",
26
+ "axios": "^1.12.2",
27
+ "cookie": "^1.0.2",
28
+ "http-cookie-agent": "^7.0.2",
29
+ "jsdom": "^27.0.0",
30
+ "lodash": "^4.17.21",
31
+ "proxy-agent": "^6.5.0",
32
+ "tldts": "^7.0.16",
33
+ "tough-cookie": "^6.0.0"
34
+ },
35
+ "publishConfig": {
36
+ "access": "public"
37
+ }
38
+ }
@@ -0,0 +1,42 @@
1
+ import { AxiosRequestConfig, AxiosResponse } from "axios"
2
+ import { CookieJar } from "tough-cookie"
3
+
4
+ declare module "axios" {
5
+
6
+ interface AxiosRequestAnyConfig {
7
+ [key: string]: any
8
+ }
9
+
10
+ interface LiuGuanProxyOptions {
11
+ adcode?: string
12
+ visitorId?: string
13
+ unbindTime?: string
14
+ }
15
+
16
+ interface Phone4GProxyOptions {
17
+ clientIp: string
18
+ }
19
+
20
+ interface AxiosServiceTypes {
21
+ NATIVE: 1
22
+ SEKIRO: 2
23
+ }
24
+
25
+ interface AxiosRequestConfig extends AxiosRequestAnyConfig{
26
+ form?: any
27
+ body?: any
28
+ html?: boolean
29
+ resolveBodyOnly?: boolean
30
+ retryLimit?: number
31
+ serviceType?: AxiosServiceTypes[keyof AxiosServiceTypes]
32
+ useProxy?: boolean | LiuGuanProxyOptions | Phone4GProxyOptions
33
+ jar?: CookieJar
34
+ interceptorHooks?: {
35
+ requestInterceptor?: (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig | Promise<InternalAxiosRequestConfig>
36
+ requestInterceptorCatch?: (error: any) => any
37
+ respondInterceptor?: (response: AxiosResponse) => AxiosResponse | Promise<AxiosResponse | any>
38
+ respondInterceptorCatch?: (error: any) => any
39
+ }
40
+ }
41
+
42
+ }