You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The net module in node allows you to create a TCP or IPC server, AF_UNIX sockets on *nix and named pipes on Windows. Using an AF_UNIX socket is generally easier to secure as connecting to a stream socket requires write permission to the socket. In comparison a loopback TCP server can be connected to by any process on the server.
Sample code snippet on how to bind to an AF_UNIX socket:
constSOCKET_PATH='/tmp/vscode-socket';// Check if the socket file already exists and delete it if it doesif(fs.existsSync(SOCKET_PATH)){fs.unlinkSync(SOCKET_PATH);}// Listen on Unix socketserver.listen(SOCKET_PATH,()=>{console.log(`HTTP server listening on ${SOCKET_PATH}`);});
And you can make a request against it using something like this:
curl --unix-socket /tmp/vscode-socket -X GET http://localhost/api/editor
Would you consider adding support for AF_UNIX sockets? Or be willing to accept a contribution?
The text was updated successfully, but these errors were encountered:
The
net
module in node allows you to create a TCP or IPC server, AF_UNIX sockets on *nix and named pipes on Windows. Using an AF_UNIX socket is generally easier to secure as connecting to a stream socket requires write permission to the socket. In comparison a loopback TCP server can be connected to by any process on the server.Sample code snippet on how to bind to an AF_UNIX socket:
And you can make a request against it using something like this:
Would you consider adding support for AF_UNIX sockets? Or be willing to accept a contribution?
The text was updated successfully, but these errors were encountered: