샘플
socks-proxy-agent 7.0.0: SocksProxyAgent
검증된 샘플 — npm socks-proxy-agent 7.0.0: SocksProxyAgent. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: SocksProxyAgent is exported as a…
sha256:e4a256a4b8567b57773ea09728c6ddbc198427c7361764872a5e473a8914dfb0
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 npm
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| 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-28 |
케이스
HOW- 목표
- verify SocksProxyAgent in pkg:npm/socks-proxy-agent@7.0.0
- 심벌
-
- SocksProxyAgent
- 생성일
- 2026-08-28T07:44:30Z
컨트랙트
- SocksProxyAgent is exported as a constructor class
- SocksProxyAgent constructor initializes agent instance with SOCKS5 URI string and port
- 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 options object with hostname, port, and timeout
- SocksProxyAgent throws TypeError when initialized without host or with unsupported protocol
- SocksProxyAgent connects through SOCKS5 proxy server and routes HTTP client request offline
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
소스
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 SocksProxyAgent in pkg:npm/socks-proxy-agent@7.0.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/socks-proxy-agent@7.0.0
Demonstrate these symbols/APIs:
- 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:be64a593a1a71b623959da82a5e7c80bb7a714284cceb889ffa59bac022d1ee6","contract":["SocksProxyAgent is exported as a constructor class","SocksProxyAgent constructor initializes agent instance with SOCKS5 URI string and port","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 options object with hostname, port, and timeout","SocksProxyAgent throws TypeError when initialized without host or with unsupported protocol","SocksProxyAgent connects through SOCKS5 proxy server and routes HTTP client request offline"],"goal":"verify SocksProxyAgent in pkg:npm/socks-proxy-agent@7.0.0","kind":"HOW","packages":["pkg:npm/socks-proxy-agent@7.0.0"],"schemaVersion":1,"symbols":["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@7.0.0"],"schemaVersion":1,"subject":"pkg:npm/socks-proxy-agent@7.0.0","symbols":["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": "7.0.0"
}
},
"node_modules/agent-base": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
"integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
"license": "MIT",
"dependencies": {
"debug": "4"
},
"engines": {
"node": ">= 6.0.0"
}
},
"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": "7.0.0",
"resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-7.0.0.tgz",
"integrity": "sha512-Fgl0YPZ902wEsAyiQ+idGd1A7rSFx/ayC1CQVMw5P+EQx2V0SgpGtf6OKFhVjPflPUl9YMmEOnmfjCdMUsygww==",
"license": "MIT",
"dependencies": {
"agent-base": "^6.0.2",
"debug": "^4.3.3",
"socks": "^2.6.2"
},
"engines": {
"node": ">= 10"
}
}
}
}
{
"name": "sample-socks-proxy-agent",
"version": "1.0.0",
"type": "module",
"private": true,
"dependencies": {
"socks-proxy-agent": "7.0.0"
}
}
{
"schemaVersion": 1,
"goal": "verify SocksProxyAgent in pkg:npm/socks-proxy-agent@7.0.0",
"kind": "HOW",
"packages": [
"pkg:npm/socks-proxy-agent@7.0.0"
],
"symbols": [
"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 is exported as a constructor class
assert.equal(typeof SocksProxyAgent, 'function');
// 2. SocksProxyAgent constructor initializes agent instance with SOCKS5 URI string and port
const agentSocks5 = new SocksProxyAgent('socks5://localhost:1080');
assert.ok(agentSocks5 instanceof SocksProxyAgent);
assert.equal(agentSocks5.proxy.host, 'localhost');
assert.equal(agentSocks5.proxy.port, 1080);
assert.equal(agentSocks5.proxy.type, 5);
assert.equal(agentSocks5.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 options object with hostname, port, and timeout
const agentWithOptions = new SocksProxyAgent({ hostname: 'localhost', port: 1080 }, { timeout: 5000 });
assert.equal(agentWithOptions.proxy.host, 'localhost');
assert.equal(agentWithOptions.proxy.port, 1080);
assert.equal(agentWithOptions.timeout, 5000);
// 6. SocksProxyAgent throws TypeError when initialized without host or with unsupported protocol
assert.throws(
() => new SocksProxyAgent('http://localhost:8080'),
TypeError
);
assert.throws(
() => new SocksProxyAgent({ port: 1080 }),
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;
// Reply success: VER=05, REP=00, RSV=00, ATYP=01 (IPv4), BND.ADDR=127.0.0.1, BND.PORT=1080
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));
}
오리진 시더
익명