This repository has been archived on 2020-11-02. You can view files and clone it, but cannot push or open issues or pull requests.
TripSit_Suite/node_modules/resolve-alpn
cranberry ed23347e56 Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
..
.editorconfig Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
.travis.yml Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
LICENSE Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
README.md Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
index.js Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
package.json Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
test.js Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00

README.md

resolve-alpn

Build Status Coverage Status

API

resolveALPN(options)

Returns an object with an alpnProtocol property. The socket property may be also present.

const result = await resolveALPN({
    host: 'nghttp2.org',
    ALPNProtocols: ['h2', 'http/1.1']
});

console.log(result); // {alpnProtocol: 'h2'}

options

Same as TLS options.

options.resolveSocket

By default, the socket gets destroyed and the promise resolves.
If you set this to true, it will return the socket in a socket property.

const result = await resolveALPN({
    host: 'nghttp2.org',
    ALPNProtocols: ['h2', 'http/1.1'],
    resolveSocket: true
});

console.log(result); // {alpnProtocol: 'h2', socket: tls.TLSSocket}

// Remember to close the socket!
result.socket.end();

License

MIT