Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gar/deps updates #6882

Merged
merged 9 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ class HttpsProxyAgent extends agent_base_1.Agent {
let socket;
if (proxy.protocol === 'https:') {
debug('Creating `tls.Socket`: %o', this.connectOpts);
socket = tls.connect(this.connectOpts);
const servername = this.connectOpts.servername || this.connectOpts.host;
socket = tls.connect({
...this.connectOpts,
servername: servername && net.isIP(servername) ? undefined : servername
});
}
else {
debug('Creating `net.Socket`: %o', this.connectOpts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ function parseProxyResponse(socket) {
read();
return;
}
const headerParts = buffered.slice(0, endOfHeaders).toString('ascii').split('\r\n');
const headerParts = buffered
.slice(0, endOfHeaders)
.toString('ascii')
.split('\r\n');
const firstLine = headerParts.shift();
if (!firstLine) {
socket.destroy();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "https-proxy-agent",
"version": "7.0.1",
"version": "7.0.2",
"description": "An HTTP(s) proxy `http.Agent` implementation for HTTPS",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const debug_1 = __importDefault(require("debug"));
const dns = __importStar(require("dns"));
const net = __importStar(require("net"));
const tls = __importStar(require("tls"));
const url_1 = require("url");
const debug = (0, debug_1.default)('socks-proxy-agent');
function parseSocksURL(url) {
let lookup = false;
Expand Down Expand Up @@ -88,7 +89,7 @@ function parseSocksURL(url) {
class SocksProxyAgent extends agent_base_1.Agent {
constructor(uri, opts) {
super(opts);
const url = typeof uri === 'string' ? new URL(uri) : uri;
const url = typeof uri === 'string' ? new url_1.URL(uri) : uri;
const { proxy, lookup } = parseSocksURL(url);
this.shouldLookup = lookup;
this.proxy = proxy;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "socks-proxy-agent",
"version": "8.0.1",
"version": "8.0.2",
"description": "A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down Expand Up @@ -107,7 +107,7 @@
"socks5h"
],
"dependencies": {
"agent-base": "^7.0.1",
"agent-base": "^7.0.2",
"debug": "^4.3.4",
"socks": "^2.7.1"
},
Expand All @@ -117,16 +117,16 @@
"@types/dns2": "^2.0.3",
"@types/jest": "^29.5.1",
"@types/node": "^14.18.45",
"async-listen": "^2.1.0",
"async-listen": "^3.0.0",
"async-retry": "^1.3.3",
"cacheable-lookup": "^6.1.0",
"dns2": "^2.1.0",
"jest": "^29.5.0",
"socksv5": "github:TooTallNate/socksv5#fix/dstSock-close-event",
"ts-jest": "^29.1.0",
"typescript": "^5.0.4",
"tsconfig": "0.0.0",
"proxy": "2.0.1"
"proxy": "2.1.1",
"tsconfig": "0.0.0"
},
"engines": {
"node": ">= 14"
Expand Down
18 changes: 10 additions & 8 deletions node_modules/are-we-there-yet/lib/tracker-base.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
'use strict'
var EventEmitter = require('events').EventEmitter
var util = require('util')
const EventEmitter = require('events')

var trackerId = 0
var TrackerBase = module.exports = function (name) {
EventEmitter.call(this)
this.id = ++trackerId
this.name = name
let trackerId = 0
class TrackerBase extends EventEmitter {
constructor (name) {
super()
this.id = ++trackerId
this.name = name
}
}
util.inherits(TrackerBase, EventEmitter)

module.exports = TrackerBase
184 changes: 90 additions & 94 deletions node_modules/are-we-there-yet/lib/tracker-group.js
Original file line number Diff line number Diff line change
@@ -1,116 +1,112 @@
'use strict'
var util = require('util')
var TrackerBase = require('./tracker-base.js')
var Tracker = require('./tracker.js')
var TrackerStream = require('./tracker-stream.js')
const TrackerBase = require('./tracker-base.js')
const Tracker = require('./tracker.js')
const TrackerStream = require('./tracker-stream.js')

var TrackerGroup = module.exports = function (name) {
TrackerBase.call(this, name)
this.parentGroup = null
this.trackers = []
this.completion = {}
this.weight = {}
this.totalWeight = 0
this.finished = false
this.bubbleChange = bubbleChange(this)
}
util.inherits(TrackerGroup, TrackerBase)
class TrackerGroup extends TrackerBase {
parentGroup = null
trackers = []
completion = {}
weight = {}
totalWeight = 0
finished = false
bubbleChange = bubbleChange(this)

function bubbleChange (trackerGroup) {
return function (name, completed, tracker) {
trackerGroup.completion[tracker.id] = completed
if (trackerGroup.finished) {
return
nameInTree () {
var names = []
var from = this
while (from) {
names.unshift(from.name)
from = from.parentGroup
}
trackerGroup.emit('change', name || trackerGroup.name, trackerGroup.completed(), trackerGroup)
return names.join('/')
}
}

TrackerGroup.prototype.nameInTree = function () {
var names = []
var from = this
while (from) {
names.unshift(from.name)
from = from.parentGroup
}
return names.join('/')
}

TrackerGroup.prototype.addUnit = function (unit, weight) {
if (unit.addUnit) {
var toTest = this
while (toTest) {
if (unit === toTest) {
throw new Error(
'Attempted to add tracker group ' +
unit.name + ' to tree that already includes it ' +
this.nameInTree(this))
addUnit (unit, weight) {
if (unit.addUnit) {
var toTest = this
while (toTest) {
if (unit === toTest) {
throw new Error(
'Attempted to add tracker group ' +
unit.name + ' to tree that already includes it ' +
this.nameInTree(this))
}
toTest = toTest.parentGroup
}
toTest = toTest.parentGroup
unit.parentGroup = this
}
unit.parentGroup = this
this.weight[unit.id] = weight || 1
this.totalWeight += this.weight[unit.id]
this.trackers.push(unit)
this.completion[unit.id] = unit.completed()
unit.on('change', this.bubbleChange)
if (!this.finished) {
this.emit('change', unit.name, this.completion[unit.id], unit)
}
return unit
}
this.weight[unit.id] = weight || 1
this.totalWeight += this.weight[unit.id]
this.trackers.push(unit)
this.completion[unit.id] = unit.completed()
unit.on('change', this.bubbleChange)
if (!this.finished) {
this.emit('change', unit.name, this.completion[unit.id], unit)

completed () {
if (this.trackers.length === 0) {
return 0
}
var valPerWeight = 1 / this.totalWeight
var completed = 0
for (var ii = 0; ii < this.trackers.length; ii++) {
var trackerId = this.trackers[ii].id
completed +=
valPerWeight * this.weight[trackerId] * this.completion[trackerId]
}
return completed
}
return unit
}

TrackerGroup.prototype.completed = function () {
if (this.trackers.length === 0) {
return 0
newGroup (name, weight) {
return this.addUnit(new TrackerGroup(name), weight)
}
var valPerWeight = 1 / this.totalWeight
var completed = 0
for (var ii = 0; ii < this.trackers.length; ii++) {
var trackerId = this.trackers[ii].id
completed +=
valPerWeight * this.weight[trackerId] * this.completion[trackerId]

newItem (name, todo, weight) {
return this.addUnit(new Tracker(name, todo), weight)
}
return completed
}

TrackerGroup.prototype.newGroup = function (name, weight) {
return this.addUnit(new TrackerGroup(name), weight)
}
newStream (name, todo, weight) {
return this.addUnit(new TrackerStream(name, todo), weight)
}

TrackerGroup.prototype.newItem = function (name, todo, weight) {
return this.addUnit(new Tracker(name, todo), weight)
}
finish () {
this.finished = true
if (!this.trackers.length) {
this.addUnit(new Tracker(), 1, true)
}
for (var ii = 0; ii < this.trackers.length; ii++) {
var tracker = this.trackers[ii]
tracker.finish()
tracker.removeListener('change', this.bubbleChange)
}
this.emit('change', this.name, 1, this)
}

TrackerGroup.prototype.newStream = function (name, todo, weight) {
return this.addUnit(new TrackerStream(name, todo), weight)
}
debug (depth = 0) {
const indent = ' '.repeat(depth)
let output = `${indent}${this.name || 'top'}: ${this.completed()}\n`

TrackerGroup.prototype.finish = function () {
this.finished = true
if (!this.trackers.length) {
this.addUnit(new Tracker(), 1, true)
}
for (var ii = 0; ii < this.trackers.length; ii++) {
var tracker = this.trackers[ii]
tracker.finish()
tracker.removeListener('change', this.bubbleChange)
this.trackers.forEach(function (tracker) {
output += tracker instanceof TrackerGroup
? tracker.debug(depth + 1)
: `${indent} ${tracker.name}: ${tracker.completed()}\n`
})
return output
}
this.emit('change', this.name, 1, this)
}

var buffer = ' '
TrackerGroup.prototype.debug = function (depth) {
depth = depth || 0
var indent = depth ? buffer.slice(0, depth) : ''
var output = indent + (this.name || 'top') + ': ' + this.completed() + '\n'
this.trackers.forEach(function (tracker) {
if (tracker instanceof TrackerGroup) {
output += tracker.debug(depth + 1)
} else {
output += indent + ' ' + tracker.name + ': ' + tracker.completed() + '\n'
function bubbleChange (trackerGroup) {
return function (name, completed, tracker) {
trackerGroup.completion[tracker.id] = completed
if (trackerGroup.finished) {
return
}
})
return output
trackerGroup.emit('change', name || trackerGroup.name, trackerGroup.completed(), trackerGroup)
}
}

module.exports = TrackerGroup
46 changes: 24 additions & 22 deletions node_modules/are-we-there-yet/lib/tracker-stream.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
'use strict'
var util = require('util')
var stream = require('readable-stream')
var delegate = require('delegates')
var Tracker = require('./tracker.js')
const stream = require('readable-stream')
const delegate = require('delegates')
const Tracker = require('./tracker.js')

var TrackerStream = module.exports = function (name, size, options) {
stream.Transform.call(this, options)
this.tracker = new Tracker(name, size)
this.name = name
this.id = this.tracker.id
this.tracker.on('change', delegateChange(this))
class TrackerStream extends stream.Transform {
constructor (name, size, options) {
super(options)
this.tracker = new Tracker(name, size)
this.name = name
this.id = this.tracker.id
this.tracker.on('change', delegateChange(this))
}

_transform (data, encoding, cb) {
this.tracker.completeWork(data.length ? data.length : 1)
this.push(data)
cb()
}

_flush (cb) {
this.tracker.finish()
cb()
}
}
util.inherits(TrackerStream, stream.Transform)

function delegateChange (trackerStream) {
return function (name, completion, tracker) {
trackerStream.emit('change', name, completion, trackerStream)
}
}

TrackerStream.prototype._transform = function (data, encoding, cb) {
this.tracker.completeWork(data.length ? data.length : 1)
this.push(data)
cb()
}

TrackerStream.prototype._flush = function (cb) {
this.tracker.finish()
cb()
}

delegate(TrackerStream.prototype, 'tracker')
.method('completed')
.method('addWork')
.method('finish')

module.exports = TrackerStream
Loading
Loading