-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat(NODE-5409)!: allow socks to be installed optionally #3782
Conversation
b123d76
to
1c6fdcb
Compare
|
||
/** @type {import('../deps').SocksLib | null} */ | ||
let socks = null; | ||
function loadSocks() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this necessary? makeModuleError
returns a proxy that throws whenever a key that isn't kModuleError
is accessed. So I'd expect we would just do the following (where it's used):
const socks = loadSocks();
await socks.SocksClient(...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm alinging with the approach taken for kerberos, zstd, snappy. The goal is to not invoke the import operation more than once, determined by the nullishness of the socks
variable.
let socks: SocksLib | null = null; | ||
function loadSocks() { | ||
if (socks == null) { | ||
const socksImport = getSocks(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as in stateMachine.js.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto response
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
questions about how we're importing socks
410510a
to
ac1316e
Compare
Description
What is changing?
Is there new documentation needed for these changes?
No
What is the motivation for this change?
See highlight
Release Highlight
Allow socks to be installed optionally
The driver uses the
socks
dependency to connect tomongod
ormongos
through a SOCKS5 proxy.socks
used to be a required dependency of the driver and was installed automatically. Now,socks
is apeerDependency
that must be installed to enablesocks
proxy support.Double check the following
npm run check:lint
scripttype(NODE-xxxx)[!]: description
feat(NODE-1234)!: rewriting everything in coffeescript