Skip to content

spion/node-unix-socket-credentials

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-unix-socket-credentials

Get the uid, gid and pid of a client that connects to your node.js unix socket server

Writing multi-user system services in node has suddenly become much easier!

install

From npm

npm install unix-socket-credentials

usage

Sync and async methods are provided:

Full async example:

var uscred = require('unix-socket-credentials');
var net = require('net');

net.createServer(function(cli) {
    uscred.getCredentials(cli, function(err, res) {
        // You can now use the uid/gid/pid of the client process
        console.log(res.uid, res.gid, res.pid);
    });
}).listen('/tmp/test.sock');

Shortened sync example:

var res = uscred.getCredentialsSync(cli);
console.log(res.uid, res.gid, res.pid);

licence

MIT

About

Get the uid, gid and pid of a client that connects to your node.js unix socket server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published