0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 07:27:22 +01:00
nodejs/test/common/quic.js
James M Snell 55360443ce
quic: initial QUIC implementation
Co-authored-by: Anna Henningsen <anna@addaleax.net>
Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com>
Co-authored-by: gengjiawen <technicalcute@gmail.com>
Co-authored-by: James M Snell <jasnell@gmail.com>
Co-authored-by: Lucas Pardue <lucaspardue.24.7@gmail.com>
Co-authored-by: Ouyang Yadong <oyydoibh@gmail.com>
Co-authored-by: Juan Jos<C3><A9> Arboleda <soyjuanarbol@gmail.com>
Co-authored-by: Trivikram Kamat <trivikr.dev@gmail.com>
Co-authored-by: Denys Otrishko <shishugi@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/32379
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-06-16 09:23:34 -07:00

39 lines
869 B
JavaScript

/* eslint-disable node-core/require-common-first, node-core/required-modules */
'use strict';
// Common bits for all QUIC-related tests
const { debuglog } = require('util');
const { readKeys } = require('./fixtures');
const { createWriteStream } = require('fs');
const kHttp3Alpn = 'h3-27';
const [ key, cert, ca ] =
readKeys(
'binary',
'agent1-key.pem',
'agent1-cert.pem',
'ca1-cert.pem');
const debug = debuglog('test');
const kServerPort = process.env.NODE_DEBUG_KEYLOG ? 5678 : 0;
const kClientPort = process.env.NODE_DEBUG_KEYLOG ? 5679 : 0;
function setupKeylog(session) {
if (process.env.NODE_DEBUG_KEYLOG) {
const kl = createWriteStream(process.env.NODE_DEBUG_KEYLOG);
session.on('keylog', kl.write.bind(kl));
}
}
module.exports = {
key,
cert,
ca,
debug,
kServerPort,
kClientPort,
setupKeylog,
kHttp3Alpn,
};