#server-client #async #async-await

radius

An async/await native implementation of the RADIUS server and client for Rust

9 unstable releases

0.4.0 Jan 15, 2024
0.3.1 May 18, 2022
0.2.1 May 31, 2021
0.2.0 Feb 3, 2021
0.0.3 Dec 12, 2020

#1190 in Network programming

Download history 22/week @ 2024-01-01 96/week @ 2024-01-08 149/week @ 2024-01-15 52/week @ 2024-01-22 37/week @ 2024-01-29 15/week @ 2024-02-05 65/week @ 2024-02-12 133/week @ 2024-02-19 104/week @ 2024-02-26 54/week @ 2024-03-04 87/week @ 2024-03-11 48/week @ 2024-03-18 27/week @ 2024-03-25 63/week @ 2024-04-01 39/week @ 2024-04-08 28/week @ 2024-04-15

162 downloads per month

MIT license

325KB
5.5K SLoC

radius-rs Check crates.io

An async/await native implementation of the RADIUS server and client for Rust. And this also can be used for parsing/constructing (i.e. decoding/encoding) purposes as a RADIUS library.

Description

This RADIUS server and client implementation use tokio to support asynchronous operations natively. This implementation satisfies basic functions that are described in RFC2865.

Usage

Simple example implementations are here:

Those examples implement a quite simple Access-Request processor. You can try those with the following commands.

$ RUST_LOG=debug cargo run --example server
$ RUST_LOG=debug cargo run --example client # in another shell

Supported Dictionaries

This supports the following RFC dictionaries at the moment:

Implementation guide for your RADIUS application

Common

  • Packet struct represents request packet and response one.
    • This struct has a list of AVPs.
    • You can get a specific AVP by RFC dictionary module.
      • e.g. rfc2865::lookup_user_name(packet)
        • This method returns Some(Result<String, AVPError>) if the packet contains User-Name attribute.
        • On the other hand, if the package doesn't have that attribute, it returns None.
    • You can construct a packet with RFC dictionary module.
      • e.g. rfc2865::add_user_name(&mut packet, "user")
        • This method adds a User-Name AVP to the packet.
    • Please refer to the rustdoc for each RFC dictionary module in detail.

Server

  • Must implement RequestHandler<T, E> interface.
    • This interface method is the core function of the server application what you need.
  • Please refer also to the example implementation: server

Client

  • Please refer also to the example implementation: client

Roadmap

  • Support the following RFC dictionaries:
    • rfc4679
    • rfc5447
    • rfc5580
    • rfc6929
    • rfc6930
    • rfc7268
    • rfc7499
    • rfc7930
    • rfc8045
    • rfc8559

Development guide for this library

How to generate code from dictionary

$ make gen

code-generator sub project has the responsibility to generate the Rust code according to given RFC dictionary files. The dictionary files are in dicts directory.

The format of the dictionary files respect the FreeRADIUS project's ones.

Note

The original implementation and design of this are inspired by layeh/radius.

Author

moznion (moznion@gmail.com)

Dependencies

~4–12MB
~108K SLoC