event-driven radius server supporting node 4, 5, and 6
JavaScript
Latest commit 4467456 Nov 1, 2016 @skibz skibz committed on GitHub add up to date node versions

README.md

tephra Build Status Code Climate Test Coverage Issue Count

tephra, n: rock fragments and particles ejected by a volcanic eruption

an evented radius server based on node-radius supporting node >=4.0.0 - this is radius for humans!

example
var users = {'joe-bloggs': 'secret-password'};
var tephra = require('tephra');
var server = new tephra(
  'shared_secret',
  1812, // authentication port
  1813, // accounting port
  1814 // change of authorisation port
);

server.on('Access-Request', function(packet, rinfo, accept, reject) {
  var username = packet.attributes['User-Name'],
      password = packet.attributes['User-Password'];
  if (username in users && users[username] === password) {
    accept(
      [/* attributes */],
      [/* vendor attributes */],
      console.log.bind(console)
    );
  } else {
    reject(
      [/* attributes */],
      [/* vendor attributes */],
      console.log.bind(console)
    );
  }
}).on('Accounting-Request', function(packet, rinfo, respond) {
  // catch all accounting-requests
  respond(
    [/* attributes */],
    [/* vendor attributes */],
    console.log.bind(console)
  );
}).on('Accounting-Request-Start', function(packet, rinfo, respond) {
  // or just catch specific accounting-request status types...
  respond(
    [/* attributes */],
    [/* vendor attributes */],
    console.log.bind(console)
  );
}).on('Accounting-Request-Interim-Update', function(packet, rinfo, respond) {
  respond(
    [/* attributes */],
    [/* vendor attributes */],
    console.log.bind(console)
  );
}).on('Accounting-Request-Stop', function(packet, rinfo, respond) {
  respond(
    [/* attributes */],
    [/* vendor attributes */],
    console.log.bind(console)
  );
}).bind();