#include <iostream>
#include <string>
{
std::cout << "=== QUIC Facade Example ===" << std::endl;
std::cout << "\n1. QUIC Server Configuration:" << std::endl;
std::cout <<
" Port: " << srv_config.
port << std::endl;
std::cout <<
" ALPN: " << srv_config.
alpn << std::endl;
std::cout <<
" Max connections: " << srv_config.
max_connections << std::endl;
std::cout << " Client cert required: "
cli_config.
host =
"localhost";
cli_config.port = 4433;
cli_config.client_id = "quic-demo-client";
cli_config.alpn = "h3";
cli_config.verify_server = true;
cli_config.enable_0rtt = false;
std::cout << "\n2. QUIC Client Configuration:" << std::endl;
std::cout << " Host: " << cli_config.host << ":" << cli_config.port << std::endl;
std::cout << " ALPN: " << cli_config.alpn << std::endl;
std::cout << " Verify server: " << (cli_config.verify_server ? "yes" : "no") << std::endl;
std::cout << " 0-RTT: " << (cli_config.enable_0rtt ? "enabled" : "disabled") << std::endl;
std::cout << "\n3. Creating QUIC endpoints..." << std::endl;
auto server = facade::quic_facade::create_server(srv_config);
auto client = facade::quic_facade::create_client(cli_config);
std::cout << " Server: " << (server ? "created" : "null (certs needed)") << std::endl;
std::cout << " Client: " << (client ? "created" : "null (server needed)") << std::endl;
std::cout << "\nDone." << std::endl;
return 0;
}
Main namespace for all Network System components.
Simplified facade for creating QUIC clients and servers.
Configuration for creating a QUIC client.
std::string host
Server hostname or IP address.
Configuration for creating a QUIC server.
uint64_t max_idle_timeout_ms
Maximum idle timeout in milliseconds (default: 30 seconds)
std::string key_path
Path to server private key file (PEM format, required)
bool require_client_cert
Whether to require client certificate (mutual TLS)
size_t max_connections
Maximum number of concurrent connections (default: 10000)
std::string alpn
ALPN protocol identifier (e.g., "h3", "hq-29")
std::string cert_path
Path to server certificate file (PEM format, required)
std::string server_id
Server identifier (optional, auto-generated if not provided)
uint16_t port
Port number to listen on.