citadel_sdk

Module prefabs

Source
Expand description

The prefabs module contains pre-built kernels for common use cases. Pre-built Network Components

This module provides a collection of pre-built network components for both client and server implementations in the Citadel Protocol. These components offer ready-to-use functionality for common networking patterns and use cases.

§Features

  • Client-side networking components
  • Server-side networking components
  • Remote connection management
  • File transfer handling
  • Signal and event processing
  • Connection security management
  • Peer discovery and listing

§Example

use citadel_sdk::prelude::*;
use citadel_sdk::prefabs::client::single_connection::SingleClientServerConnectionKernel;

    let settings = DefaultServerConnectionSettingsBuilder::transient("127.0.0.1:25021")
        .with_udp_mode(UdpMode::Enabled)
        .build()?;

    let kernel = SingleClientServerConnectionKernel::new(
        settings,
        |conn| async move {
            println!("Connected to server!");
            Ok(())
        },
    );

    let client = DefaultNodeBuilder::default().build(kernel)?;

    let _result = client.await?;
    Ok(())
}

§Important Notes

  • File transfer handlers can only be obtained once
  • Signal receivers are single-use
  • Remote shutdown is graceful and asynchronous
  • Connection types determine available operations
  • client: Client-side networking implementations
  • server: Server-side networking implementations

Modules§

  • Kernels for clients Client-Side Network Components
  • Kernels for servers Server-Side Network Components
  • Shared utilities between client and server kernels Shared Network Components

Structs§

  • A limited version of the NodeRemote designed to only allow shutdown calls to the protocol as well as several other functions

Functions§