Skip to content

Create connection via file descriptor instead of port #3204

Closed
@sholladay

Description

@sholladay

Node's Server#listen() method accepts a fd option and I am wondering if hapi could support something like that.

The reason this would be useful to me is that I want to use substack's tcp-bind and sindresorhus' root-check to drop privileges as soon as possible.

As a simplified example, I wish something like this worked when run with sudo:

const fd = require('tcp-bind')(80);
require('root-check')();

const { Server } = require('hapi'),
const server = new Server();

server.connection({ fd });
server.start((err) => {
    if (err) {
        throw err;
    }

    console.log('Server is ready.');
});

The benefit here is that I can drop privileges as soon as possible, without waiting for the start callback, etc.

Metadata

Metadata

Assignees

Labels

featureNew functionality or improvement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions