Server

Struct Server 

Source
pub struct Server<S, H, R>
where S: SecretProvider, H: Handler, R: Runtime,
{ /* private fields */ }
Expand description

A high-performance RADIUS server instance.

The Server acts as the central orchestrator of the RADIUS stack, managing the network lifecycle, request deduplication, and task execution. It is generic over the secret retrieval logic, the request handler, and the underlying async runtime.

§Type Parameters

  • S: Implements SecretProvider to look up shared secrets for incoming packets.
  • H: Implements Handler to define how the server responds to RADIUS requests.
  • R: Implements Runtime to abstract over different async executors (e.g., Tokio or Smol).

Implementations§

Source§

impl<S, H, R> Server<S, H, R>
where S: SecretProvider + 'static, H: Handler + 'static, R: Runtime + 'static,

Source

pub fn new( runtime: R, socket: R::Socket, secret_provider: S, handler: H, ) -> Self

Source

pub fn local_addr(&self) -> Result<SocketAddr>

Source

pub fn with_graceful_shutdown<F>(self, shutdown: F) -> Self
where F: Future<Output = ()> + Send + 'static,

Source

pub async fn listen_and_serve(self) -> Result<()>

Starts the RADIUS server and begins listening for incoming packets.

This is the main entry point of the server. It will run indefinitely until:

  1. An unrecoverable network error occurs.
  2. The shutdown_signal (if provided) is triggered.
§Graceful Shutdown

When a shutdown signal is received, the server stops accepting new packets immediately but waits for all currently processing requests (active tasks) to finish before returning. This ensures no client requests are “dropped” mid-processing.

§Errors

Returns an error if the server fails to retrieve the local address or if the internal run loop encounters a fatal exception.

Auto Trait Implementations§

§

impl<S, H, R> Freeze for Server<S, H, R>

§

impl<S, H, R> !RefUnwindSafe for Server<S, H, R>

§

impl<S, H, R> Send for Server<S, H, R>

§

impl<S, H, R> !Sync for Server<S, H, R>

§

impl<S, H, R> Unpin for Server<S, H, R>

§

impl<S, H, R> !UnwindSafe for Server<S, H, R>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V