32{
33 std::cout << "=== QUIC Facade Example ===" << std::endl;
34
35
37 srv_config.
port = 4433;
38 srv_config.
server_id =
"quic-demo-server";
41 srv_config.
alpn =
"h3";
45
46 std::cout << "\n1. QUIC Server Configuration:" << std::endl;
47 std::cout <<
" Port: " << srv_config.
port << std::endl;
48 std::cout <<
" ALPN: " << srv_config.
alpn << std::endl;
50 std::cout <<
" Max connections: " << srv_config.
max_connections << std::endl;
51 std::cout << " Client cert required: "
53
54
56 cli_config.
host =
"localhost";
57 cli_config.port = 4433;
58 cli_config.client_id = "quic-demo-client";
59 cli_config.alpn = "h3";
60 cli_config.verify_server = true;
61 cli_config.enable_0rtt = false;
62
63 std::cout << "\n2. QUIC Client Configuration:" << std::endl;
64 std::cout << " Host: " << cli_config.host << ":" << cli_config.port << std::endl;
65 std::cout << " ALPN: " << cli_config.alpn << std::endl;
66 std::cout << " Verify server: " << (cli_config.verify_server ? "yes" : "no") << std::endl;
67 std::cout << " 0-RTT: " << (cli_config.enable_0rtt ? "enabled" : "disabled") << std::endl;
68
69
70 std::cout << "\n3. Creating QUIC endpoints..." << std::endl;
73
74 std::cout <<
" Server: " << (
server ?
"created" :
"null (certs needed)") << std::endl;
75 std::cout <<
" Client: " << (
client ?
"created" :
"null (server needed)") << std::endl;
76
77 std::cout << "\nDone." << std::endl;
78 return 0;
79}
auto create_client(const client_config &config) const -> Result< std::shared_ptr< interfaces::i_protocol_client > >
Creates a QUIC client with the specified configuration.
auto create_server(const server_config &config) const -> Result< std::shared_ptr< interfaces::i_protocol_server > >
Creates a QUIC server with the specified configuration.
@ client
Client-side request.
@ server
Server-side handling of a request.
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.