Skip to main content

libcfd_rpc/
lib.rs

1#![warn(missing_docs)]
2
3//! Cap'n Proto wire schemas and a minimal RPC client for Cloudflare Tunnel
4//! registration.
5//!
6//! This crate is the only crate allowed to depend on the `capnp` crates. The
7//! main `libcfd` crate interacts with tunnel registration exclusively through
8//! the typed [`tunnel::TunnelClient`] facade.
9
10/// Server side of the edge's `CloudflaredServer` calls.
11pub mod cloudflared;
12/// RPC errors.
13pub mod error;
14/// Stream framing and message I/O.
15pub mod io;
16/// Plain-Rust types for the QUIC per-stream metadata protocol.
17pub mod quic;
18/// The minimal Cap'n Proto RPC client.
19pub mod rpc;
20/// The typed tunnel registration facade.
21pub mod tunnel;
22
23pub mod rpc_capnp {
24    #![allow(clippy::all)]
25    #![allow(unused_imports)]
26    #![allow(missing_docs)]
27    include!(concat!(env!("OUT_DIR"), "/rpc_capnp.rs"));
28}
29
30pub mod tunnelrpc_capnp {
31    #![allow(clippy::all)]
32    #![allow(unused_imports)]
33    #![allow(missing_docs)]
34    include!(concat!(env!("OUT_DIR"), "/tunnelrpc_capnp.rs"));
35}
36
37pub mod quic_metadata_protocol_capnp {
38    #![allow(clippy::all)]
39    #![allow(unused_imports)]
40    #![allow(missing_docs)]
41    include!(concat!(env!("OUT_DIR"), "/quic_metadata_protocol_capnp.rs"));
42}
43
44pub use cloudflared::{
45    CloudflaredHandler, RegisterUdpSessionResponse, UpdateConfigurationResponse, serve_cloudflared,
46};
47pub use error::RpcError;
48pub use io::AsyncStream;
49pub use quic::{
50    ConnectRequest, ConnectResponse, ConnectionType, DATA_STREAM_PROTOCOL_SIGNATURE,
51    HTTP_HEADER_KEY, HTTP_HOST_KEY, HTTP_METHOD_KEY, HTTP_STATUS_KEY, PROTOCOL_V1,
52    RPC_STREAM_PROTOCOL_SIGNATURE,
53};
54pub use rpc::{Incoming, RpcClient, read_incoming, send_exception};
55pub use tunnel::{
56    ClientInformation, ConnectionDetails, ConnectionError, ConnectionOptions, ConnectionResponse,
57    RegistrationFailure, TunnelAuth, TunnelClient,
58};