Module config

Module config 

Source
Expand description

§Configuration Management

Centralized configuration for the network protocol library.

This module provides structured configuration for servers and clients, including connection parameters, timeouts, compression settings, and security options.

§Configuration Sources

  • TOML files via from_toml_file()
  • Direct instantiation with defaults
  • Environment-specific overrides

§Security Considerations

  • Default compression threshold (512 bytes) balances performance and CPU
  • Recommended timeout values prevent slowloris attacks
  • TLS settings enforce modern cryptography (TLS 1.2+)

Structs§

ClientConfig
Client-specific configuration
LoggingConfig
Logging configuration
NetworkConfig
Main network configuration structure that contains all configurable settings
ServerConfig
Server-specific configuration
TransportConfig
Transport configuration

Constants§

ENABLE_COMPRESSION
Whether to enable compression by default
ENABLE_ENCRYPTION
Whether to enable encryption by default
MAGIC_BYTES
Magic bytes to identify protocol packets (e.g., 0x4E50524F → “NPRO”)
MAX_PAYLOAD_SIZE
Max allowed payload size (e.g. 16 MB)
PROTOCOL_VERSION
Current supported protocol version