amqplib 0.4.2 → 0.5.3
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 +88 -0
- package/Makefile +2 -1
- package/README.md +4 -4
- package/callback_api.js +1 -0
- package/channel_api.js +7 -6
- package/examples/headers.js +2 -2
- package/examples/receive_generator.js +39 -0
- package/examples/send_generators.js +42 -0
- package/examples/ssl.js +1 -1
- package/examples/tutorials/README.md +1 -1
- package/examples/tutorials/callback_api/emit_log.js +1 -1
- package/examples/tutorials/callback_api/emit_log_direct.js +1 -1
- package/examples/tutorials/callback_api/emit_log_topic.js +1 -1
- package/examples/tutorials/callback_api/new_task.js +1 -1
- package/examples/tutorials/callback_api/rpc_client.js +1 -1
- package/examples/tutorials/callback_api/rpc_server.js +1 -1
- package/examples/tutorials/callback_api/send.js +1 -1
- package/examples/tutorials/emit_log.js +4 -5
- package/examples/tutorials/emit_log_direct.js +4 -5
- package/examples/tutorials/emit_log_topic.js +4 -5
- package/examples/tutorials/new_task.js +5 -6
- package/examples/tutorials/package.json +2 -3
- package/examples/tutorials/receive.js +4 -4
- package/examples/tutorials/receive_logs.js +1 -1
- package/examples/tutorials/receive_logs_direct.js +2 -2
- package/examples/tutorials/receive_logs_topic.js +6 -6
- package/examples/tutorials/rpc_client.js +25 -26
- package/examples/tutorials/rpc_server.js +2 -2
- package/examples/tutorials/send.js +4 -5
- package/examples/tutorials/worker.js +1 -1
- package/examples/waitForConfirms.js +2 -2
- package/lib/api_args.js +2 -0
- package/lib/callback_model.js +11 -10
- package/lib/channel.js +24 -12
- package/lib/channel_model.js +57 -65
- package/lib/codec.js +64 -38
- package/lib/connect.js +26 -15
- package/lib/connection.js +6 -4
- package/lib/credentials.js +20 -3
- package/lib/defs.js +203 -75
- package/lib/frame.js +2 -1
- package/lib/heartbeat.js +1 -1
- package/package.json +10 -8
- package/test/callback_api.js +6 -5
- package/test/channel.js +125 -107
- package/test/channel_api.js +125 -136
- package/test/codec.js +48 -9
- package/test/connect.js +88 -3
- package/test/connection.js +57 -56
- package/test/data.js +32 -9
- package/test/frame.js +4 -4
- package/test/mux.js +10 -6
- package/test/util.js +35 -21
- package/.npmignore +0 -9
package/lib/credentials.js
CHANGED
|
@@ -8,19 +8,36 @@
|
|
|
8
8
|
// * PLAIN (send username and password in the plain)
|
|
9
9
|
// * EXTERNAL (assume the server will figure out who you are from
|
|
10
10
|
// context, i.e., your SSL certificate)
|
|
11
|
+
var Buffer = require('safe-buffer').Buffer
|
|
12
|
+
var codec = require('./codec')
|
|
11
13
|
|
|
12
14
|
module.exports.plain = function(user, passwd) {
|
|
13
15
|
return {
|
|
14
16
|
mechanism: 'PLAIN',
|
|
15
17
|
response: function() {
|
|
16
|
-
return
|
|
17
|
-
}
|
|
18
|
+
return Buffer.from(['', user, passwd].join(String.fromCharCode(0)))
|
|
19
|
+
},
|
|
20
|
+
username: user,
|
|
21
|
+
password: passwd
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports.amqplain = function(user, passwd) {
|
|
26
|
+
return {
|
|
27
|
+
mechanism: 'AMQPLAIN',
|
|
28
|
+
response: function() {
|
|
29
|
+
const buffer = Buffer.alloc(16384);
|
|
30
|
+
const size = codec.encodeTable(buffer, { LOGIN: user, PASSWORD: passwd}, 0);
|
|
31
|
+
return buffer.slice(4, size);
|
|
32
|
+
},
|
|
33
|
+
username: user,
|
|
34
|
+
password: passwd
|
|
18
35
|
}
|
|
19
36
|
}
|
|
20
37
|
|
|
21
38
|
module.exports.external = function() {
|
|
22
39
|
return {
|
|
23
40
|
mechanism: 'EXTERNAL',
|
|
24
|
-
response: function() { return
|
|
41
|
+
response: function() { return Buffer.from(''); }
|
|
25
42
|
}
|
|
26
43
|
}
|