amqplib 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -0
- package/README.md +0 -5
- package/lib/connect.js +6 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Change log for amqplib
|
|
2
2
|
|
|
3
|
+
## v1.0.1
|
|
4
|
+
- Fix TLS connection failure when connecting to an AMQPS broker using an IP address (IPv4 or IPv6) — setting servername to an IP is not permitted by TLS SNI and throws ERR_INVALID_ARG_VALUE in Node.js 25+
|
|
5
|
+
|
|
3
6
|
## v1.0.0
|
|
4
7
|
- **BREAKING**: Update minimum Node.js requirement to v18
|
|
5
8
|
- Introduce Biome formatter for consistent code formatting
|
package/README.md
CHANGED
|
@@ -9,11 +9,6 @@ A library for making AMQP 0-9-1 clients for Node.JS, and an AMQP 0-9-1 client fo
|
|
|
9
9
|
|
|
10
10
|
npm install amqplib
|
|
11
11
|
|
|
12
|
-
## ❤️ Help Support Jack
|
|
13
|
-
One of my close friends, Jack, was recently diagnosed with terminal brain cancer (grade 4 astrocytoma). He’s a young father facing an unimaginably tough road with remarkable courage. Thanks to chemotherapy, radiotherapy, and your support, two of his tumours have stopped showing activity. Donations help Jack continue accessing promising complementary therapies, attend hospital appointments, and spend meaningful time with his children.
|
|
14
|
-
|
|
15
|
-
If you’ve benefited from amqplib, please consider supporting Jack’s journey through his [J Crushing Cancer](https://www.gofundme.com/f/j-crushing-cancer) gofundme page. Thank you - @cressie176
|
|
16
|
-
|
|
17
12
|
## RabbitMQ Compatibility
|
|
18
13
|
|
|
19
14
|
Only `0.10.7` and later versions of this library are compatible with RabbitMQ 4.1.0 (and later releases).
|
package/lib/connect.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const URL = require('url-parse');
|
|
2
2
|
const QS = require('node:querystring');
|
|
3
|
+
const net = require('node:net');
|
|
4
|
+
const tls = require('node:tls');
|
|
3
5
|
const Connection = require('./connection').Connection;
|
|
4
6
|
const fmt = require('node:util').format;
|
|
5
7
|
const credentials = require('./credentials');
|
|
@@ -98,7 +100,7 @@ function connect(url, socketOptions, openCallback) {
|
|
|
98
100
|
if (typeof url === 'object') {
|
|
99
101
|
protocol = `${url.protocol || 'amqp'}:`;
|
|
100
102
|
sockopts.host = url.hostname;
|
|
101
|
-
sockopts.servername
|
|
103
|
+
if (!sockopts.servername && !net.isIP(url.hostname)) sockopts.servername = url.hostname;
|
|
102
104
|
sockopts.port = url.port || (protocol === 'amqp:' ? 5672 : 5671);
|
|
103
105
|
|
|
104
106
|
let user;
|
|
@@ -126,7 +128,7 @@ function connect(url, socketOptions, openCallback) {
|
|
|
126
128
|
const host = parts.hostname.replace(/^\[|\]$/g, '');
|
|
127
129
|
protocol = parts.protocol;
|
|
128
130
|
sockopts.host = host;
|
|
129
|
-
sockopts.servername
|
|
131
|
+
if (!sockopts.servername && !net.isIP(host)) sockopts.servername = host;
|
|
130
132
|
sockopts.port = parseInt(parts.port, 10) || (protocol === 'amqp:' ? 5672 : 5671);
|
|
131
133
|
const vhost = parts.pathname ? parts.pathname.substr(1) : null;
|
|
132
134
|
fields = openFrames(vhost, parts.query, sockopts.credentials || credentialsFromUrl(parts), extraClientProperties);
|
|
@@ -157,9 +159,9 @@ function connect(url, socketOptions, openCallback) {
|
|
|
157
159
|
}
|
|
158
160
|
|
|
159
161
|
if (protocol === 'amqp:') {
|
|
160
|
-
sock =
|
|
162
|
+
sock = net.connect(sockopts, onConnect);
|
|
161
163
|
} else if (protocol === 'amqps:') {
|
|
162
|
-
sock =
|
|
164
|
+
sock = tls.connect(sockopts, onConnect);
|
|
163
165
|
} else {
|
|
164
166
|
throw new Error(`Expected amqp: or amqps: as the protocol; got ${protocol}`);
|
|
165
167
|
}
|
package/package.json
CHANGED