moznion 88e01fc828 Separate server bootstrap sequence between listen() and run()
Initially it uses a channel that given through the `run()` parameter to notify when a server becomes ready,
but that doesn't work because it never run the procedure until `await` called.
This means if it calls `await`, it blocks the procedure so it cannot consume a channel simultaneously.
Thus, it separates bootstrap sequence between `listen()` and `run()`.
`listen()`: Start UDP listening. After this function call is finished, the RADIUS server is ready.
`run()`: Start a loop to handle the RADIUS requests.
2021-01-03 11:19:28 +09:00
2020-12-22 09:41:08 +09:00
2020-12-12 13:38:40 +09:00
2020-11-24 02:04:54 +09:00
2020-12-12 13:38:40 +09:00
2020-11-24 02:22:53 +09:00
2020-12-10 01:31:09 +09:00
2020-12-12 14:03:16 +09:00
2020-11-27 19:56:00 +00:00

radius-rs Check crates.io

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

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)

Description
An async/await native implementation of the RADIUS server and client for Rust.
Readme MIT 443 KiB
Languages
Rust 99.8%
Shell 0.2%