How bilibili/quiche works
Main Components
• Base Layer: Represent the “base” directory, which includes basic platform functions, logging (bvc-qlog), file utilities, POSIX wrappers, string utilities, etc.
• URL Processing: Mark “googleurl” as the module responsible for URL manipulation and related helper functions.
• QUIC & HTTP/3 Core: Represent “gquiche” (the integrated Google quiche source) as the heart of the QUIC protocol implementation.
• Networking and Platform Layers: Include “net” for low-level network functions and the various platform-specific implementations under “platform/…” (such as:
– platform/epoll_platform_impl (epoll-based I/O and event loop functionality),
– platform/http2_platform_impl (HTTP/2 stack implementation),
– platform/quic_platform_impl (adapter and implementation of QUIC-related functionalities),
– platform/quiche_platform_impl (further integration support for Google quiche),
– platform/spdy_platform_impl (supporting SPDY/HTTP2 features)).
• Third-Party Dependencies: Mark third-party libraries (in “third_party”) such as boringssl, abseil, rapidjson, etc.
• Utility Scripts / Tools: Use “utils” and parts of “gquiche” which contain sample server/client binaries (simple_quic_server, simple_quic_client) to illustrate how one can run this QUIC implementation in production.
Interactions and Relationships
• Application Examples ⇨ QUIC Core:
The simple_quic_server and simple_quic_client (built via cmake using the tools provided) sit atop the QUIC core. They are the entry points that utilize the underlying platform implementations.
• QUIC Core ⇨ Platform Abstractions:
The QUIC part (gquiche and components in platform/quic_platform_impl) interacts with the epoll (platform/epoll_platform_impl) and network (net) layers for I/O and event processing.
• QUIC Core ⇨ Cryptography and Logging:
The cryptographic operations, critical to QUIC’s TLS-like handshake and encryption, are handled through platform/quiche_platform_impl and third-party dependencies. Similarly, logging (Qlog) resides in the “base” layer.
• Supporting Libraries:
googleurl provides URL parsing and related services used by the client and server, while “base” also supplies file and string utilities that are widely used across the project.
• External Dependencies:
These include the support libraries from “third_party” (like boringssl) that provide underlying cryptographic and utility functions.
Architectural Patterns and Design Principles
• Modular layering: The project is clearly separated into low-level utility and OS adaptation (base, net), protocol and core implementation (gquiche, quic_platform_impl), and frontend interfaces (client/server examples).
• Loose coupling, where each “platform” layer abstracts away OS-dependent code.
• Clear separation of concerns: Each directory (base, googleurl, gquiche, platform/*, third_party, utils) corresponds to a different functional aspect of the QUIC implementation.
• Extensibility: The architecture supports easy upgrading of Google quiche, with separate modules for platform-specific changes, making it easier to integrate changes from the upstream project.