Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # `resolve-alpn`
  2. [![Node CI](https://github.com/szmarczak/resolve-alpn/workflows/Node%20CI/badge.svg)](https://github.com/szmarczak/resolve-alpn/actions)
  3. [![codecov](https://codecov.io/gh/szmarczak/resolve-alpn/branch/master/graph/badge.svg)](https://codecov.io/gh/szmarczak/resolve-alpn)
  4. ## API
  5. ### resolveALPN(options)
  6. Returns an object with an `alpnProtocol` property. The `socket` property may be also present.
  7. ```js
  8. const result = await resolveALPN({
  9. host: 'nghttp2.org',
  10. port: 443,
  11. ALPNProtocols: ['h2', 'http/1.1'],
  12. servername: 'nghttp2.org'
  13. });
  14. console.log(result); // {alpnProtocol: 'h2'}
  15. ```
  16. **Note:** While the `servername` option is not required in this case, many other servers do. It's best practice to set it anyway.
  17. **Note:** If the socket times out, the promise will resolve and `result.timeout` will be set to `true`.
  18. #### options
  19. Same as [TLS options](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback).
  20. ##### options.resolveSocket
  21. By default, the socket gets destroyed and the promise resolves.<br>
  22. If you set this to true, it will return the socket in a `socket` property.
  23. ```js
  24. const result = await resolveALPN({
  25. host: 'nghttp2.org',
  26. port: 443,
  27. ALPNProtocols: ['h2', 'http/1.1'],
  28. servername: 'nghttp2.org',
  29. resolveSocket: true
  30. });
  31. console.log(result); // {alpnProtocol: 'h2', socket: tls.TLSSocket}
  32. // Remember to destroy the socket if you don't use it!
  33. result.socket.destroy();
  34. ```
  35. ## License
  36. MIT