RADIUS protocol encoding and decoding
#wrapper of gen_udp {:ok,sk} = Radius.listen 1812 loop = 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 end IO.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)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.
config :elixir_radius, included_dictionaries: ["rfc2865", "rfc2868", "rfc2869", "cisco"]You can also add your own dictionaries by providing the paths to :elixir_radius in :extra_dictionaries
config :elixir_radius, extra_dictionaries: ["path_to_your_dictionary"]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.