{"_id":"resolve-alpn","_rev":"680569","name":"resolve-alpn","description":"Detects the ALPN protocol","dist-tags":{"latest":"1.2.1"},"maintainers":[{"name":"szmarczak","email":"sz.marczak@gmail.com"}],"time":{"modified":"2021-08-30T08:15:53.000Z","created":"2018-12-23T15:16:20.138Z","1.2.1":"2021-08-30T08:12:36.687Z","1.2.0":"2021-07-21T15:55:19.534Z","1.1.2":"2021-04-15T17:05:42.944Z","1.1.1":"2021-04-11T19:57:48.924Z","1.1.0":"2021-04-11T19:48:27.215Z","1.0.1":"2021-04-11T18:57:36.181Z","1.0.0":"2018-12-23T15:16:20.138Z"},"users":{},"author":{"name":"Szymon Marczak"},"repository":{"type":"git","url":"git+https://github.com/szmarczak/resolve-alpn.git"},"versions":{"1.2.1":{"name":"resolve-alpn","version":"1.2.1","description":"Detects the ALPN protocol","main":"index.js","scripts":{"test":"xo && nyc --reporter=lcovonly --reporter=text --reporter=html ava"},"repository":{"type":"git","url":"git+https://github.com/szmarczak/resolve-alpn.git"},"keywords":["alpn","tls","socket","http2"],"author":{"name":"Szymon Marczak"},"license":"MIT","bugs":{"url":"https://github.com/szmarczak/resolve-alpn/issues"},"homepage":"https://github.com/szmarczak/resolve-alpn#readme","devDependencies":{"ava":"^3.15.0","nyc":"^15.1.0","pem":"1.14.3","xo":"^0.38.2"},"gitHead":"778781a0521c713ca7605fc3ba31fb8e4be37d6b","_id":"resolve-alpn@1.2.1","_nodeVersion":"16.8.0","_npmVersion":"7.21.0","dist":{"shasum":"b7adbdac3546aaaec20b45e7d8265927072726f9","size":2231,"noattachment":false,"key":"/resolve-alpn/-/resolve-alpn-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/resolve-alpn/download/resolve-alpn-1.2.1.tgz"},"_npmUser":{"name":"szmarczak","email":"sz.marczak@gmail.com"},"directories":{},"maintainers":[{"name":"szmarczak","email":"sz.marczak@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/resolve-alpn_1.2.1_1630311156553_0.3874047205312978"},"_hasShrinkwrap":false,"publish_time":1630311156687,"_cnpm_publish_time":1630311156687},"1.2.0":{"name":"resolve-alpn","version":"1.2.0","description":"Detects the ALPN protocol","main":"index.js","scripts":{"test":"xo && nyc --reporter=lcovonly --reporter=text --reporter=html ava"},"repository":{"type":"git","url":"git+https://github.com/szmarczak/resolve-alpn.git"},"keywords":["alpn","tls","socket","http2"],"author":{"name":"Szymon Marczak"},"license":"MIT","bugs":{"url":"https://github.com/szmarczak/resolve-alpn/issues"},"homepage":"https://github.com/szmarczak/resolve-alpn#readme","devDependencies":{"ava":"^3.15.0","nyc":"^15.1.0","pem":"1.14.3","xo":"^0.38.2"},"gitHead":"5fb9af9ac11c7fab34f980e531d98d3b08f4800c","_id":"resolve-alpn@1.2.0","_nodeVersion":"16.5.0","_npmVersion":"7.19.1","dist":{"shasum":"058bb0888d1cd4d12474e9a4b6eb17bdd5addc44","size":2220,"noattachment":false,"key":"/resolve-alpn/-/resolve-alpn-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/resolve-alpn/download/resolve-alpn-1.2.0.tgz"},"_npmUser":{"name":"szmarczak","email":"sz.marczak@gmail.com"},"directories":{},"maintainers":[{"name":"szmarczak","email":"sz.marczak@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/resolve-alpn_1.2.0_1626882919273_0.021926971397304262"},"_hasShrinkwrap":false,"publish_time":1626882919534,"_cnpm_publish_time":1626882919534},"1.1.2":{"name":"resolve-alpn","version":"1.1.2","description":"Detects the ALPN protocol","main":"index.js","scripts":{"test":"xo && nyc --reporter=lcovonly --reporter=text --reporter=html ava"},"repository":{"type":"git","url":"git+https://github.com/szmarczak/resolve-alpn.git"},"keywords":["alpn","tls","socket","http2"],"author":{"name":"Szymon Marczak"},"license":"MIT","bugs":{"url":"https://github.com/szmarczak/resolve-alpn/issues"},"homepage":"https://github.com/szmarczak/resolve-alpn#readme","devDependencies":{"ava":"^3.15.0","nyc":"^15.1.0","pem":"1.14.3","xo":"^0.38.2"},"gitHead":"43a065f747bc32728af4e2529d1ee5a61a29c63e","_id":"resolve-alpn@1.1.2","_nodeVersion":"15.10.0","_npmVersion":"7.5.3","dist":{"shasum":"30b60cfbb0c0b8dc897940fe13fe255afcdd4d28","size":2040,"noattachment":false,"key":"/resolve-alpn/-/resolve-alpn-1.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/resolve-alpn/download/resolve-alpn-1.1.2.tgz"},"_npmUser":{"name":"szmarczak","email":"sz.marczak@gmail.com"},"directories":{},"maintainers":[{"name":"szmarczak","email":"sz.marczak@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/resolve-alpn_1.1.2_1618506342776_0.3621364652688188"},"_hasShrinkwrap":false,"publish_time":1618506342944,"_cnpm_publish_time":1618506342944},"1.1.1":{"name":"resolve-alpn","version":"1.1.1","description":"Detects the ALPN protocol","main":"index.js","scripts":{"test":"xo && nyc --reporter=lcovonly --reporter=text --reporter=html ava"},"repository":{"type":"git","url":"git+https://github.com/szmarczak/resolve-alpn.git"},"keywords":["alpn","tls","socket","http2"],"author":{"name":"Szymon Marczak"},"license":"MIT","bugs":{"url":"https://github.com/szmarczak/resolve-alpn/issues"},"homepage":"https://github.com/szmarczak/resolve-alpn#readme","devDependencies":{"ava":"^3.15.0","nyc":"^15.1.0","pem":"1.14.3","xo":"^0.38.2"},"gitHead":"fe0b71e244e23dfb043a7cb73dbf06b77910994a","_id":"resolve-alpn@1.1.1","_nodeVersion":"15.12.0","_npmVersion":"7.6.3","dist":{"shasum":"4a006a7d533c81a5dd04681612090fde227cd6e1","size":3179,"noattachment":false,"key":"/resolve-alpn/-/resolve-alpn-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/resolve-alpn/download/resolve-alpn-1.1.1.tgz"},"_npmUser":{"name":"szmarczak","email":"sz.marczak@gmail.com"},"directories":{},"maintainers":[{"name":"szmarczak","email":"sz.marczak@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/resolve-alpn_1.1.1_1618171068542_0.963122534139432"},"_hasShrinkwrap":false,"publish_time":1618171068924,"_cnpm_publish_time":1618171068924},"1.1.0":{"name":"resolve-alpn","version":"1.1.0","description":"Detects the ALPN protocol","main":"index.js","scripts":{"test":"xo && nyc --reporter=lcovonly --reporter=text --reporter=html ava"},"repository":{"type":"git","url":"git+https://github.com/szmarczak/resolve-alpn.git"},"keywords":["alpn","tls","socket","http2"],"author":{"name":"Szymon Marczak"},"license":"MIT","bugs":{"url":"https://github.com/szmarczak/resolve-alpn/issues"},"homepage":"https://github.com/szmarczak/resolve-alpn#readme","devDependencies":{"ava":"^3.15.0","nyc":"^15.1.0","pem":"1.14.3","xo":"^0.38.2"},"gitHead":"fe0b71e244e23dfb043a7cb73dbf06b77910994a","_id":"resolve-alpn@1.1.0","_nodeVersion":"15.12.0","_npmVersion":"7.6.3","dist":{"shasum":"82cc1f4d367cbd484a06065a9f53fb1811a60aec","size":3165,"noattachment":false,"key":"/resolve-alpn/-/resolve-alpn-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/resolve-alpn/download/resolve-alpn-1.1.0.tgz"},"_npmUser":{"name":"szmarczak","email":"sz.marczak@gmail.com"},"directories":{},"maintainers":[{"name":"szmarczak","email":"sz.marczak@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/resolve-alpn_1.1.0_1618170507098_0.8120324421676954"},"_hasShrinkwrap":false,"publish_time":1618170507215,"_cnpm_publish_time":1618170507215},"1.0.1":{"name":"resolve-alpn","version":"1.0.1","description":"Detects the ALPN protocol","main":"index.js","scripts":{"test":"xo && nyc --reporter=lcovonly --reporter=text --reporter=html ava"},"repository":{"type":"git","url":"git+https://github.com/szmarczak/resolve-alpn.git"},"keywords":["alpn","tls","socket","http2"],"author":{"name":"Szymon Marczak"},"license":"MIT","bugs":{"url":"https://github.com/szmarczak/resolve-alpn/issues"},"homepage":"https://github.com/szmarczak/resolve-alpn#readme","devDependencies":{"ava":"^3.15.0","nyc":"^15.1.0","pem":"1.14.3","xo":"^0.38.2"},"gitHead":"7df04693f0dad4cd6e2f810cb34ea9a8e1a94bc5","_id":"resolve-alpn@1.0.1","_nodeVersion":"15.12.0","_npmVersion":"7.6.3","dist":{"shasum":"77b1d41c16dd506af90358037d1b2e1ccba98049","size":3093,"noattachment":false,"key":"/resolve-alpn/-/resolve-alpn-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/resolve-alpn/download/resolve-alpn-1.0.1.tgz"},"_npmUser":{"name":"szmarczak","email":"sz.marczak@gmail.com"},"directories":{},"maintainers":[{"name":"szmarczak","email":"sz.marczak@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/resolve-alpn_1.0.1_1618167456049_0.6222278121713505"},"_hasShrinkwrap":false,"publish_time":1618167456181,"_cnpm_publish_time":1618167456181},"1.0.0":{"name":"resolve-alpn","version":"1.0.0","description":"Detects the ALPN protocol","main":"index.js","scripts":{"test":"xo && nyc ava","coveralls":"nyc report --reporter=text-lcov | coveralls"},"repository":{"type":"git","url":"git+https://github.com/szmarczak/resolve-alpn.git"},"keywords":["alpn","http2"],"author":{"name":"Szymon Marczak"},"license":"MIT","bugs":{"url":"https://github.com/szmarczak/resolve-alpn/issues"},"homepage":"https://github.com/szmarczak/resolve-alpn#readme","devDependencies":{"ava":"^1.0.1","coveralls":"^3.0.2","nyc":"^13.1.0","pem":"^1.13.2","xo":"^0.23.0"},"gitHead":"64c69e4917328cdcbdef85d677409c4fe3c835d9","_id":"resolve-alpn@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"11.1.0","_npmUser":{"name":"szmarczak","email":"sz.marczak@gmail.com"},"dist":{"shasum":"745ad60b3d6aff4b4a48e01b8c0bdc70959e0e8c","size":2636,"noattachment":false,"key":"/resolve-alpn/-/resolve-alpn-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/resolve-alpn/download/resolve-alpn-1.0.0.tgz"},"maintainers":[{"name":"szmarczak","email":"sz.marczak@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/resolve-alpn_1.0.0_1545578180000_0.5579683285245283"},"_hasShrinkwrap":false,"publish_time":1545578180138,"_cnpm_publish_time":1545578180138}},"readme":"# `resolve-alpn`\n\n[![Node CI](https://github.com/szmarczak/resolve-alpn/workflows/Node%20CI/badge.svg)](https://github.com/szmarczak/resolve-alpn/actions)\n[![codecov](https://codecov.io/gh/szmarczak/resolve-alpn/branch/master/graph/badge.svg)](https://codecov.io/gh/szmarczak/resolve-alpn)\n\n## API\n\n### resolveALPN(options, connect = tls.connect)\n\nReturns an object with an `alpnProtocol` property. The `socket` property may be also present.\n\n```js\nconst result = await resolveALPN({\n\thost: 'nghttp2.org',\n\tport: 443,\n\tALPNProtocols: ['h2', 'http/1.1'],\n\tservername: 'nghttp2.org'\n});\n\nconsole.log(result); // {alpnProtocol: 'h2'}\n```\n\n**Note:** While the `servername` option is not required in this case, many other servers do. It's best practice to set it anyway.\n\n**Note:** If the socket times out, the promise will resolve and `result.timeout` will be set to `true`.\n\n#### options\n\nSame as [TLS options](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback).\n\n##### options.resolveSocket\n\nBy default, the socket gets destroyed and the promise resolves.<br>\nIf you set this to true, it will return the socket in a `socket` property.\n\n```js\nconst result = await resolveALPN({\n\thost: 'nghttp2.org',\n\tport: 443,\n\tALPNProtocols: ['h2', 'http/1.1'],\n\tservername: 'nghttp2.org',\n\tresolveSocket: true\n});\n\nconsole.log(result); // {alpnProtocol: 'h2', socket: tls.TLSSocket}\n\n// Remember to destroy the socket if you don't use it!\nresult.socket.destroy();\n```\n\n#### connect\n\nType: `Function<TLSSocket> | AsyncFunction<TLSSocket>`\\\nDefault: [`tls.connect`](https://nodejs.org/dist/latest-v16.x/docs/api/tls.html#tls_tls_connect_options_callback)\n\n**Note:** No matter which function is used (synchronous or asynchronous), it **must** accept a `callback` function as a second argument. The `callback` function gets executed when the socket has successfully connected.\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/szmarczak/resolve-alpn#readme","bugs":{"url":"https://github.com/szmarczak/resolve-alpn/issues"},"license":"MIT"}