Exemplo
socks-proxy-agent 8.0.5: SocksProxyAgent
Amostra verificada para npm socks-proxy-agent 8.0.5: SocksProxyAgent. O contrato rodou em node 22 · linux alpine/x64 · docker e passou.
sha256:60b500a40bda83f4d547fed19f8b807e43c2f8c1db7d401f628397a080c5c5c3
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
linux 24 · ubuntu · glibc 2.39 x64 npm
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-27 |
Caso
HOW- Objetivo
- verify socks-proxy-agent.SocksProxyAgent in pkg:npm/socks-proxy-agent@8.0.5
- Pacotes
- Símbolos
-
- socks-proxy-agent.SocksProxyAgent
- Criado
- 2026-08-27T10:25:14Z
Contrato
- SocksProxyAgent static protocols property includes supported SOCKS protocol schemes
- SocksProxyAgent constructor initializes agent instance with SOCKS5 URI string and defaults port to 1080
- SocksProxyAgent constructor accepts WHATWG URL instance and configures DNS resolution based on protocol variant
- SocksProxyAgent parses URL credentials into non-enumerable userId and password properties on proxy configuration
- SocksProxyAgent constructor accepts agent options including timeout and socketOptions
- SocksProxyAgent throws TypeError when initialized with unsupported protocol
- SocksProxyAgent connects through SOCKS5 proxy server and routes HTTP client request offline
Arquivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Código-fonte
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify socks-proxy-agent.SocksProxyAgent in pkg:npm/socks-proxy-agent@8.0.5
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/socks-proxy-agent@8.0.5
Demonstrate these symbols/APIs:
- socks-proxy-agent.SocksProxyAgent
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:2f57e63681a9a966cf106c03382d2c56c61f73c443161ac8817106be703f4084","contract":["SocksProxyAgent static protocols property includes supported SOCKS protocol schemes","SocksProxyAgent constructor initializes agent instance with SOCKS5 URI string and defaults port to 1080","SocksProxyAgent constructor accepts WHATWG URL instance and configures DNS resolution based on protocol variant","SocksProxyAgent parses URL credentials into non-enumerable userId and password properties on proxy configuration","SocksProxyAgent constructor accepts agent options including timeout and socketOptions","SocksProxyAgent throws TypeError when initialized with unsupported protocol","SocksProxyAgent connects through SOCKS5 proxy server and routes HTTP client request offline"],"goal":"verify socks-proxy-agent.SocksProxyAgent in pkg:npm/socks-proxy-agent@8.0.5","kind":"HOW","packages":["pkg:npm/socks-proxy-agent@8.0.5"],"schemaVersion":1,"symbols":["socks-proxy-agent.SocksProxyAgent"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/socks-proxy-agent@8.0.5"],"schemaVersion":1,"subject":"pkg:npm/socks-proxy-agent@8.0.5","symbols":["socks-proxy-agent.SocksProxyAgent"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-socks-proxy-agent",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-socks-proxy-agent",
"version": "1.0.0",
"dependencies": {
"socks-proxy-agent": "8.0.5"
}
},
"node_modules/agent-base": {
"version": "7.1.4",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz",
"integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==",
"license": "MIT",
"engines": {
"node": ">= 14"
}
},
"node_modules/debug": {
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
"license": "MIT",
"dependencies": {
"ms": "^2.1.3"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/ip-address": {
"version": "10.5.0",
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.5.0.tgz",
"integrity": "sha512-R5SnVLJmgYYvf2F2ZgwSBnelz5G4q5AxIC277GDfUaNbrZKNANcBC7RHqYYePlszf4kBolVkJauG0ZjHHFh55g==",
"license": "MIT",
"engines": {
"node": ">= 12"
}
},
"node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT"
},
"node_modules/smart-buffer": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
"integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
"license": "MIT",
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0"
}
},
"node_modules/socks": {
"version": "2.8.9",
"resolved": "https://registry.npmjs.org/socks/-/socks-2.8.9.tgz",
"integrity": "sha512-LJhUYUvItdQ0LkJTmPeaEObWXAqFyfmP85x0tch/ez9cahmhlBBLbIqDFnvBnUJGagb0JbIQrkBs1wJ+yRYpEw==",
"license": "MIT",
"dependencies": {
"ip-address": "^10.1.1",
"smart-buffer": "^4.2.0"
},
"engines": {
"node": ">= 10.0.0",
"npm": ">= 3.0.0"
}
},
"node_modules/socks-proxy-agent": {
"version": "8.0.5",
"resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz",
"integrity": "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==",
"license": "MIT",
"dependencies": {
"agent-base": "^7.1.2",
"debug": "^4.3.4",
"socks": "^2.8.3"
},
"engines": {
"node": ">= 14"
}
}
}
}
{
"name": "sample-socks-proxy-agent",
"version": "1.0.0",
"type": "module",
"private": true,
"dependencies": {
"socks-proxy-agent": "8.0.5"
}
}
{
"schemaVersion": 1,
"goal": "verify socks-proxy-agent.SocksProxyAgent in pkg:npm/socks-proxy-agent@8.0.5",
"kind": "HOW",
"packages": [
"pkg:npm/socks-proxy-agent@8.0.5"
],
"symbols": [
"socks-proxy-agent.SocksProxyAgent"
]
}
import assert from 'node:assert/strict';
import net from 'node:net';
import http from 'node:http';
import { SocksProxyAgent } from 'socks-proxy-agent';
// 1. SocksProxyAgent static protocols property includes supported SOCKS protocol schemes
assert.ok(Array.isArray(SocksProxyAgent.protocols));
assert.deepEqual([...SocksProxyAgent.protocols], ['socks', 'socks4', 'socks4a', 'socks5', 'socks5h']);
// 2. SocksProxyAgent constructor initializes agent instance with SOCKS5 URI string and defaults port to 1080
const agentDefaultPort = new SocksProxyAgent('socks5://localhost');
assert.ok(agentDefaultPort instanceof SocksProxyAgent);
assert.equal(agentDefaultPort.proxy.host, 'localhost');
assert.equal(agentDefaultPort.proxy.port, 1080);
assert.equal(agentDefaultPort.proxy.type, 5);
assert.equal(agentDefaultPort.shouldLookup, true);
// 3. SocksProxyAgent constructor accepts WHATWG URL instance and configures DNS resolution based on protocol variant
const urlSocks5h = new URL('socks5h://proxy.example.com:9050');
const agentSocks5h = new SocksProxyAgent(urlSocks5h);
assert.equal(agentSocks5h.proxy.host, 'proxy.example.com');
assert.equal(agentSocks5h.proxy.port, 9050);
assert.equal(agentSocks5h.proxy.type, 5);
assert.equal(agentSocks5h.shouldLookup, false);
const agentSocks4 = new SocksProxyAgent('socks4://proxy.example.com:1080');
assert.equal(agentSocks4.proxy.type, 4);
assert.equal(agentSocks4.shouldLookup, true);
const agentSocks4a = new SocksProxyAgent('socks4a://proxy.example.com:1080');
assert.equal(agentSocks4a.proxy.type, 4);
assert.equal(agentSocks4a.shouldLookup, false);
// 4. SocksProxyAgent parses URL credentials into non-enumerable userId and password properties on proxy configuration
const agentWithAuth = new SocksProxyAgent('socks5://myuser:mypassword@proxy.example.com:1080');
assert.equal(agentWithAuth.proxy.userId, 'myuser');
assert.equal(agentWithAuth.proxy.password, 'mypassword');
assert.equal(Object.keys(agentWithAuth.proxy).includes('userId'), false);
assert.equal(Object.keys(agentWithAuth.proxy).includes('password'), false);
// 5. SocksProxyAgent constructor accepts agent options including timeout and socketOptions
const agentWithOptions = new SocksProxyAgent('socks5://localhost:1080', {
timeout: 5000,
socketOptions: {
keepAlive: true,
},
keepAlive: true,
});
assert.equal(agentWithOptions.timeout, 5000);
assert.deepEqual(agentWithOptions.socketOptions, { keepAlive: true });
// 6. SocksProxyAgent throws TypeError when initialized with unsupported protocol
assert.throws(
() => new SocksProxyAgent('http://localhost:8080'),
TypeError
);
// 7. SocksProxyAgent connects through SOCKS5 proxy server and routes HTTP client request offline
const mockSocksServer = net.createServer((socket) => {
let state = 0;
socket.on('data', (data) => {
if (state === 0) {
if (data[0] === 0x05) {
state = 1;
socket.write(Buffer.from([0x05, 0x00])); // NO_AUTH
}
} else if (state === 1) {
if (data[0] === 0x05 && data[1] === 0x01) {
state = 2;
socket.write(Buffer.from([0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x04, 0x38]));
}
} else if (state === 2) {
socket.write('HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nContent-Length: 13\r\n\r\nHello, SOCKS!');
}
});
});
await new Promise((resolve) => mockSocksServer.listen(0, '127.0.0.1', resolve));
const { port: proxyPort } = mockSocksServer.address();
try {
const agent = new SocksProxyAgent(`socks5h://127.0.0.1:${proxyPort}`);
const resBody = await new Promise((resolve, reject) => {
http.get('http://example.com/test', { agent }, (res) => {
let body = '';
res.on('data', (chunk) => {
body += chunk;
});
res.on('end', () => resolve(body));
}).on('error', reject);
});
assert.equal(resBody, 'Hello, SOCKS!');
} finally {
await new Promise((resolve) => mockSocksServer.close(resolve));
}
Seeder de origem
anônimo