From 852d9a28ef7a4a1bc722e1b60584fa265d2f1a94 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Wed, 5 Aug 2020 14:08:40 +0200 Subject: add verifyAlpnId() hook --- client.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'client.js') diff --git a/client.js b/client.js index ebb2b66..e4a3427 100644 --- a/client.js +++ b/client.js @@ -16,10 +16,17 @@ const HOUR = 60 * 60 * 1000 const _request = (pathOrUrl, opt, cb) => { debug('_request', pathOrUrl, opt) + const { + verifyAlpnId, + } = { + verifyAlpnId: alpnId => alpnId === ALPN_ID, + ...opt, + } + connect(opt, (err, socket) => { if (err) return cb(err) - if (socket.alpnProtocol !== ALPN_ID) { + if (verifyAlpnId(socket.alpnProtocol) !== true) { socket.destroy() return cb(new Error('invalid or missing ALPN protocol')) } -- cgit v1.3