Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: James Sumners <321201+jsumners@users.noreply.github.com>
Signed-off-by: Matteo Collina <matteo.collina@gmail.com>
  • Loading branch information
mcollina and jsumners committed May 21, 2024
1 parent ea80e53 commit 0ff5254
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 0 additions & 1 deletion fastify.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

const VERSION = '5.0.0-alpha.1'


const Avvio = require('avvio')
const http = require('node:http')
let lightMyRequest
Expand Down
14 changes: 13 additions & 1 deletion lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,19 @@ function getServerInstance (options, httpHandler) {
}
return server
}

/**
* Inspects the provided `server.address` object and returns a
* normalized list of IP address strings. Normalization in this
* case refers to mapping wildcard `0.0.0.0` to the list of IP
* addresses the wildcard refers to.
*
* @see https://nodejs.org/docs/latest/api/net.html#serveraddress
*
* @param {object} A server address object as described in the
* linked docs.
*
* @returns {string[]}
*/
function getAddresses (address) {
if (address.address === '0.0.0.0') {
return Object.values(os.networkInterfaces()).flatMap((iface) => {
Expand Down

0 comments on commit 0ff5254

Please sign in to comment.