Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bearice/elixir-radius
RADIUS Protocol on Elixir
https://github.com/bearice/elixir-radius
Last synced: about 1 month ago
JSON representation
RADIUS Protocol on Elixir
- Host: GitHub
- URL: https://github.com/bearice/elixir-radius
- Owner: bearice
- License: mit
- Created: 2014-10-27T13:29:22.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2023-06-14T13:46:05.000Z (over 1 year ago)
- Last Synced: 2024-08-09T23:48:42.002Z (4 months ago)
- Language: Elixir
- Homepage:
- Size: 254 KB
- Stars: 15
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - RADIUS Protocol on Elixir. (Protocols)
- fucking-awesome-elixir - elixir_radius - RADIUS Protocol on Elixir. (Protocols)
- awesome-elixir - elixir_radius - RADIUS Protocol on Elixir. (Protocols)
README
elixir-radius
=============[![CI](https://github.com/bearice/elixir-radius/actions/workflows/elixir.yml/badge.svg)](https://github.com/bearice/elixir-radius/actions/workflows/elixir.yml) [![Hex.pm version](https://img.shields.io/hexpm/v/elixir_radius.svg?style=flat)](https://hex.pm/packages/elixir_radius)
RADIUS protocol encoding and decoding
Example
-------
```Elixir
#wrapper of gen_udp
{:ok,sk} = Radius.listen 1812loop = fn(loop)->
#secret can be a string or a function returning a string
#{:ok,host,p} = Radius.recv sk,"123"
{:ok,host,p} = Radius.recv sk,fn(_host) -> secret endIO.puts "From #{inspect host} : \n#{inspect p, pretty: true}"
resp = %Radius.Packet{code: "Access-Reject", id: p.id, secret: p.secret}
Radius.send_reply(sk, host, resp, p.auth)loop.(loop)
end
loop.(loop)
```Dictionary configuration
--------------------Vendor specific dictionaries are compiled into a specific vendor module. Generic attributes and values
are compiled into `Radius.Dict`. If you add the "cisco" dictionary you will get the module `Radius.Dict.VendorCisco`.```Elixir
config :elixir_radius,
included_dictionaries: ["rfc2865", "rfc2868", "rfc2869", "cisco"]
```NOTE: By default, this library will compile all known vendors, which is quite slow, but had maxium compatibility with old versions. If you dont need them, please use above config to select what to be compiled.
You can also add your own dictionaries by providing the paths to `:elixir_radius` in `:extra_dictionaries`
```Elixir
config :elixir_radius,
extra_dictionaries: ["path_to_your_dictionary"]
```Macros
------`Radius.Dict` exposes a set of macro's so you can construct AVPs and let the compiler confirm the
attributes and save time during runtime.