Socket
Socket
Sign inDemoInstall

socks-proxy-agent

Package Overview
Dependencies
8
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.2.0-beta.0 to 6.2.0-beta.1

5

dist/index.d.ts
/// <reference types="node" />
import { SocksProxy } from 'socks';
import { Agent, ClientRequest, RequestOptions } from 'agent-base';
import CacheableLookup from 'cacheable-lookup';
import { AgentOptions } from 'agent-base';

@@ -16,3 +15,2 @@ import { Url } from 'url';

interface SocksProxyAgentOptionsExtra {
dnsCache?: CacheableLookup;
timeout?: number;

@@ -23,6 +21,5 @@ }

export declare class SocksProxyAgent extends Agent {
private readonly lookup;
private readonly shouldLookup;
private readonly proxy;
private readonly tlsConnectionOptions;
private readonly dnsCache;
timeout: number | null;

@@ -29,0 +26,0 @@ constructor(input: string | SocksProxyAgentOptions, options?: SocksProxyAgentOptionsExtra);

29

dist/index.js

@@ -18,4 +18,4 @@ "use strict";

const agent_base_1 = require("agent-base");
const cacheable_lookup_1 = __importDefault(require("cacheable-lookup"));
const debug_1 = __importDefault(require("debug"));
const dns_1 = __importDefault(require("dns"));
const tls_1 = __importDefault(require("tls"));

@@ -113,11 +113,10 @@ const debug = (0, debug_1.default)('socks-proxy-agent');

constructor(input, options) {
var _a, _b;
var _a;
const proxyOptions = normalizeProxyOptions(input);
super(proxyOptions);
const parsedProxy = parseSocksProxy(proxyOptions);
this.lookup = parsedProxy.lookup;
this.shouldLookup = parsedProxy.lookup;
this.proxy = parsedProxy.proxy;
this.tlsConnectionOptions = proxyOptions.tls != null ? proxyOptions.tls : {};
this.dnsCache = (_a = options === null || options === void 0 ? void 0 : options.dnsCache) !== null && _a !== void 0 ? _a : new cacheable_lookup_1.default();
this.timeout = (_b = options === null || options === void 0 ? void 0 : options.timeout) !== null && _b !== void 0 ? _b : null;
this.timeout = (_a = options === null || options === void 0 ? void 0 : options.timeout) !== null && _a !== void 0 ? _a : null;
}

@@ -133,11 +132,21 @@ /**

return __awaiter(this, void 0, void 0, function* () {
const { lookup, proxy, timeout } = this;
let { host, port } = opts;
const { shouldLookup, proxy, timeout } = this;
let { host, port, lookup: lookupCallback } = opts;
if (host == null) {
throw new Error('No `host` defined!');
}
if (lookup) {
if (shouldLookup) {
// Client-side DNS resolution for "4" and "5" socks proxy versions.
const res = yield this.dnsCache.lookupAsync(host);
host = res.address;
host = yield new Promise((resolve, reject) => {
// Use the request's custom lookup, if one was configured:
const lookupFn = lookupCallback !== null && lookupCallback !== void 0 ? lookupCallback : dns_1.default.lookup;
lookupFn(host, {}, (err, res) => {
if (err) {
reject(err);
}
else {
resolve(res);
}
});
});
}

@@ -144,0 +153,0 @@ const socksOpts = {

@@ -5,3 +5,3 @@ {

"homepage": "https://github.com/TooTallNate/node-socks-proxy-agent#readme",
"version": "6.2.0-beta.0",
"version": "6.2.0-beta.1",
"main": "dist/index.js",

@@ -87,3 +87,2 @@ "author": {

"agent-base": "^6.0.2",
"cacheable-lookup": "~6.0.4",
"debug": "^4.3.3",

@@ -97,3 +96,5 @@ "socks": "^2.6.2"

"@types/node": "latest",
"cacheable-lookup": "^6.0.4",
"conventional-github-releaser": "latest",
"dns2": "^2.0.1",
"finepack": "latest",

@@ -100,0 +101,0 @@ "git-authors-cli": "latest",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc