Git Product home page Git Product logo

radiustar's Introduction

RADIUSTAR

Pretend this is ascii art of the “the more you know” star thing —=====*

by pjdavis github.com/pjdavis/radiustar

DESCRIPTION:

Ruby Radius Library

FEATURES

  • Import your own radius dictionaries

  • Authentication

  • Accounting

SYNOPSIS:

require 'rubygems'
require 'radiustar'

# Load dictionaries from freeradius directory
# NOTICE: here the Dictionary.new() only accept a parameter of "folder name" but not the dictionary file
dict = Radiustar::Dictionary.new('/usr/share/freeradius/')

# Lets get authenticated
auth_custom_attr = {
  'Framed-Address'  => '127.0.0.1',
  'NAS-Port'        => 0,
  'NAS-Port-Type'   => 'Ethernet'
}

req = Radiustar::Request.new('127.0.0.1', { :dict => dict })
reply = req.authenticate('John Doe', 'hello', 'testing123', auth_custom_attr)

if reply[:code] == 'Access-Accept'
  req = Radiustar::Request.new('127.0.0.1:1813', { :dict => dict })

  acct_custom_attr = {
    'Framed-Address'  => '127.0.0.1',
    'NAS-Port'        => 0,
    'NAS-Port-Type'   => 'Ethernet',
    'Acct-Session-Time' => 0
  }

  timings = Time.now
  reply = req.accounting_start('John Doe', 'testing123', '123456', acct_custom_attr)

  sleep(rand 5)
  acct_custom_attr['Acct-Session-Time'] = Time.now - timings
  reply = req.accounting_update('John Doe', 'testing123', '123456', acct_custom_attr)

  sleep(rand 5)
  acct_custom_attr['Acct-Session-Time'] = Time.now - timings
  reply = req.accounting_stop('John Doe', 'testing123', '123456', acct_custom_attr)

end

REQUIREMENTS:

  • Ruby 1.8

INSTALL:

gem install radiustar

Thanks:

Thanks to everyone who has contributed to this project. Without your help and support, this would not have been possible.

  • charl

  • Mark Bryars

  • jamesotron

  • dguerri

  • gderosa

  • mkocher

  • bwlang

  • cbascom

LICENSE:

Copyright © 2010 [PJ Davis], released under the CC0 1.0 Universal license.

radiustar's People

Contributors

pjdavis avatar jimsynz avatar dguerri avatar charl avatar gderosa avatar bwlang avatar cbascom avatar darkskiez avatar mkocher avatar youkugems avatar kotay avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.