@xyz17711/proxy-pool 0.1.0 → 0.1.1
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.
- package/README.md +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/langchain.js +1 -1
- package/package.json +30 -2
- package/src/index.ts +0 -39
- package/src/langchain.ts +0 -28
- package/test/index.test.mjs +0 -24
- package/test/langchain.test.mjs +0 -16
- package/tsconfig.json +0 -16
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ npm install @xyz17711/proxy-pool
|
|
|
18
18
|
|
|
19
19
|
| Method | Description |
|
|
20
20
|
| --- | --- |
|
|
21
|
-
| `getBestProxy` |
|
|
21
|
+
| `getBestProxy` | Free proxy API: get one fast, verified-alive proxy (HTTP, SOCKS) filtered by country, protocol and anonymity, for scraping ($0.010, x402) |
|
|
22
22
|
|
|
23
23
|
## Quickstart
|
|
24
24
|
|
package/dist/index.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export interface GetBestProxyResponse {
|
|
|
26
26
|
}
|
|
27
27
|
/** Typed client for proxy-pool, e.g. `client.getBestProxy(...)`. */
|
|
28
28
|
export declare class Client extends BaseClient {
|
|
29
|
-
/**
|
|
29
|
+
/** Free proxy API: get one fast, verified-alive proxy (HTTP, SOCKS) filtered by country, protocol and anonymity, for scraping ($0.010, x402) */
|
|
30
30
|
getBestProxy(params: {
|
|
31
31
|
anonymity?: string | null;
|
|
32
32
|
city?: string | null;
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { Client as BaseClient } from "@xyz17711/core";
|
|
5
5
|
/** Typed client for proxy-pool, e.g. `client.getBestProxy(...)`. */
|
|
6
6
|
export class Client extends BaseClient {
|
|
7
|
-
/**
|
|
7
|
+
/** Free proxy API: get one fast, verified-alive proxy (HTTP, SOCKS) filtered by country, protocol and anonymity, for scraping ($0.010, x402) */
|
|
8
8
|
async getBestProxy(params) {
|
|
9
9
|
return this.get("/v1/proxy-pool/get_best_proxy", { anonymity: params.anonymity, city: params.city, country: params.country, protocol: params.protocol });
|
|
10
10
|
}
|
package/dist/langchain.js
CHANGED
|
@@ -11,7 +11,7 @@ export class ProxyPoolToolkit {
|
|
|
11
11
|
return [
|
|
12
12
|
tool(async (input) => this.client.getBestProxy(input), {
|
|
13
13
|
name: "getBestProxy",
|
|
14
|
-
description: "
|
|
14
|
+
description: "Free proxy API: get one fast, verified-alive proxy (HTTP, SOCKS) filtered by country, protocol and anonymity, for scraping ($0.010, x402)",
|
|
15
15
|
schema: z.object({ anonymity: z.string().nullable().optional(), city: z.string().nullable().optional(), country: z.string().nullable().optional(), protocol: z.string().nullable().optional() }),
|
|
16
16
|
}),
|
|
17
17
|
];
|
package/package.json
CHANGED
|
@@ -1,7 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyz17711/proxy-pool",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Typed TypeScript client for the 17711.xyz Proxy Pool API: pay-per-call, settled in USDC via x402.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "17711 Services",
|
|
7
|
+
"homepage": "https://api.17711.xyz",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/17711-services/clients.git",
|
|
11
|
+
"directory": "node/packages/proxy-pool"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/17711-services/clients/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"x402",
|
|
18
|
+
"usdc",
|
|
19
|
+
"api-client",
|
|
20
|
+
"pay-per-call",
|
|
21
|
+
"ai-agents",
|
|
22
|
+
"mcp",
|
|
23
|
+
"langchain",
|
|
24
|
+
"proxy-pool"
|
|
25
|
+
],
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"README.md"
|
|
29
|
+
],
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
5
33
|
"type": "module",
|
|
6
34
|
"main": "dist/index.js",
|
|
7
35
|
"types": "dist/index.d.ts",
|
package/src/index.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typed HTTP client and request/response interfaces for proxy-pool.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { Client as BaseClient, type ClientOptions } from "@xyz17711/core";
|
|
6
|
-
|
|
7
|
-
/** A `SourceProxy` joined with its `CheckedProxy` result, if it has been checked at least once -- what every read tool actually filters/returns. */
|
|
8
|
-
export interface ProxyView {
|
|
9
|
-
anonymity: string;
|
|
10
|
-
/** `None` if this service has never checked this proxy yet. */
|
|
11
|
-
checked_alive?: boolean | null;
|
|
12
|
-
checked_at?: number | null;
|
|
13
|
-
/** See `CheckedProxy::consecutive_successes`'s own doc comment. `0` if never checked. */
|
|
14
|
-
checked_consecutive_successes: number;
|
|
15
|
-
/** See `CheckedProxy::ema_latency_ms`'s own doc comment. */
|
|
16
|
-
checked_ema_latency_ms?: number | null;
|
|
17
|
-
checked_latency_ms?: number | null;
|
|
18
|
-
checked_protocol?: string | null;
|
|
19
|
-
city: string;
|
|
20
|
-
country: string;
|
|
21
|
-
id: string;
|
|
22
|
-
ip: string;
|
|
23
|
-
port: number;
|
|
24
|
-
protocols: string[];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface GetBestProxyResponse {
|
|
28
|
-
proxy: ProxyView;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** Typed client for proxy-pool, e.g. `client.getBestProxy(...)`. */
|
|
32
|
-
export class Client extends BaseClient {
|
|
33
|
-
/** Returns one of the fastest verified-alive proxies matching the filter, randomized to spread load ($0.001, x402) */
|
|
34
|
-
async getBestProxy(params: { anonymity?: string | null; city?: string | null; country?: string | null; protocol?: string | null }): Promise<GetBestProxyResponse> {
|
|
35
|
-
return this.get<GetBestProxyResponse>("/v1/proxy-pool/get_best_proxy", { anonymity: params.anonymity, city: params.city, country: params.country, protocol: params.protocol });
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export { ClientOptions };
|
package/src/langchain.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LangChain.js tools for proxy-pool, grouped in one Toolkit -- one tool per operation, each just an async function (JS has no separate sync form to generate). Requires the `@langchain/core`+`zod` peer dependencies declared in this package's own package.json -- imported from `proxy-pool/langchain`, never from the package root, so importing the base client never requires them installed.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { tool } from "@langchain/core/tools";
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
import { Client } from "./index.js";
|
|
8
|
-
|
|
9
|
-
export class ProxyPoolToolkit {
|
|
10
|
-
private client: Client;
|
|
11
|
-
|
|
12
|
-
constructor(client: Client) {
|
|
13
|
-
this.client = client;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
getTools() {
|
|
17
|
-
return [
|
|
18
|
-
tool(
|
|
19
|
-
async (input) => this.client.getBestProxy(input),
|
|
20
|
-
{
|
|
21
|
-
name: "getBestProxy",
|
|
22
|
-
description: "Returns one of the fastest verified-alive proxies matching the filter, randomized to spread load ($0.001, x402)",
|
|
23
|
-
schema: z.object({ anonymity: z.string().nullable().optional(), city: z.string().nullable().optional(), country: z.string().nullable().optional(), protocol: z.string().nullable().optional() }),
|
|
24
|
-
},
|
|
25
|
-
),
|
|
26
|
-
];
|
|
27
|
-
}
|
|
28
|
-
}
|
package/test/index.test.mjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Verifies every proxy-pool client method sends a request to the expected path/HTTP verb and parses a well-formed response -- one test per operation, real fetch mocked via a plain reassignment of `globalThis.fetch` (no extra test/mocking dependency). Runs against the COMPILED package (`../dist/index.js`) -- build before testing.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { test } from "node:test";
|
|
6
|
-
import assert from "node:assert/strict";
|
|
7
|
-
import { Client } from "../dist/index.js";
|
|
8
|
-
|
|
9
|
-
test("getBestProxy calls the expected path", async () => {
|
|
10
|
-
const originalFetch = globalThis.fetch;
|
|
11
|
-
globalThis.fetch = async (url, init = {}) => {
|
|
12
|
-
const parsed = new URL(url);
|
|
13
|
-
assert.equal((init.method ?? "GET").toUpperCase(), "GET");
|
|
14
|
-
assert.equal(parsed.pathname, "/v1/proxy-pool/get_best_proxy");
|
|
15
|
-
return new Response(JSON.stringify({ proxy: { anonymity: "test", checked_alive: null, checked_at: null, checked_consecutive_successes: 0, checked_ema_latency_ms: null, checked_latency_ms: null, checked_protocol: null, city: "test", country: "test", id: "test", ip: "test", port: 0, protocols: [] } }), { status: 200 });
|
|
16
|
-
};
|
|
17
|
-
try {
|
|
18
|
-
const client = new Client("https://example.test");
|
|
19
|
-
const result = await client.getBestProxy({ anonymity: null, city: null, country: null, protocol: null });
|
|
20
|
-
assert.ok(result !== undefined);
|
|
21
|
-
} finally {
|
|
22
|
-
globalThis.fetch = originalFetch;
|
|
23
|
-
}
|
|
24
|
-
});
|
package/test/langchain.test.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Verifies every proxy-pool LangChain tool through the real StructuredTool (`.invoke()`), not just the underlying client method -- catches schema-shape bugs a plain client-method test would miss. Requires the `langchain`/`zod` dev dependencies.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { test } from "node:test";
|
|
6
|
-
import assert from "node:assert/strict";
|
|
7
|
-
import { Client } from "../dist/index.js";
|
|
8
|
-
import { ProxyPoolToolkit } from "../dist/langchain.js";
|
|
9
|
-
|
|
10
|
-
test("getBestProxy tool invoke", async () => {
|
|
11
|
-
globalThis.fetch = async () => new Response(JSON.stringify({ proxy: { anonymity: "test", checked_alive: null, checked_at: null, checked_consecutive_successes: 0, checked_ema_latency_ms: null, checked_latency_ms: null, checked_protocol: null, city: "test", country: "test", id: "test", ip: "test", port: 0, protocols: [] } }), { status: 200 });
|
|
12
|
-
const toolkit = new ProxyPoolToolkit(new Client("https://example.test"));
|
|
13
|
-
const t = toolkit.getTools().find((x) => x.name === "getBestProxy");
|
|
14
|
-
const result = await t.invoke({ anonymity: "test", city: "test", country: "test", protocol: "test" });
|
|
15
|
-
assert.ok(result !== undefined);
|
|
16
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"module": "ES2020",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"outDir": "dist",
|
|
8
|
-
"rootDir": "src",
|
|
9
|
-
"strict": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"skipLibCheck": true
|
|
12
|
-
},
|
|
13
|
-
"include": [
|
|
14
|
-
"src"
|
|
15
|
-
]
|
|
16
|
-
}
|