MCPcopy Index your code
hub / github.com/apersomany/libcfd

github.com/apersomany/libcfd @0.1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.1.1 ↗ · + Follow
35 symbols 52 edges 9 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

LibCFD

A port of cloudflared (Cloudflare Tunnel Client) to Rust.

Note

The current version is merely a proof of concept, and I am currently in the process of rewriting the whole crate with documentation, and a much more reasonable interface based on http-rs. My exams end on May 16, so I'll try to get it done by the end of may. :)

Purpose

LibCFD intends to be lightweight and programmable replacement for cloudflared and its command line wrappers. The main advantage of LibCFD is that we don't have to spawn a whole new process (that uses a garbage collected runtime) to connect to Cloudflare. Thanks to this, we can save on resources by removing the IPC and GC overheads.

Features

The currently supported features are

  • [ ] Named tunnel (Zero Trust Network Access)
  • [x] Quick tunnel (TryCloudflare)
  • [x] QUIC tunnel connection
  • [ ] HTTP tunnel connection (non-priority)
  • [ ] Proper client information reporting (priority)
  • [ ] Tunnel reconnection
  • [x] HTTP connection (kind of works, but is a footgun)
  • [ ] HTTP connection wrapper
  • [x] Websocket connection (kind of works, but is an even bigger footgun)
  • [ ] Websocket connection wrapper
  • [ ] TCP connection (gated by named tunnel)
  • [ ] Remote management (gated by named tunnel)

To Do

Aside form those already listed above, these two are some to dos I am lookning forward to

  • Fix async (some futures are !Send due to capnp, there may be a need to modify capnp)
  • Decouple Tokio
  • Clean up dependencies

Performance

Work in progress. Seems to be able to hit 1gbps at least.

Examples

Http Hello World

Creates a HTTP server that sends simple "hello world" response.

cargo run --example http_hello_world

Http Download

Creates a HTTP server that sends data as fast as possible.

cargo run --example http_download

Http Download

Creates a HTTP server that receives data as fast as possible.

cargo run --example http_upload

Websocket Echo

Creates a WebSocket server that echos all received Websocket messages.

cargo run --example websocket_echo

Core symbols most depended-on inside this repo

accept
called by 4
src/connection.rs
respond_with
called by 4
src/connection.rs
async_main
called by 1
examples/http_download.rs
handle_connect_request
called by 1
examples/http_download.rs
async_main
called by 1
examples/http_upload.rs
handle_connect_request
called by 1
examples/http_upload.rs
async_main
called by 1
examples/http_hello_world.rs
handle_connect_request
called by 1
examples/http_hello_world.rs

Shape

Function 14
Method 11
Class 7
Enum 3

Languages

Rust100%

Modules by API surface

src/connection.rs12 symbols
examples/websocket_echo.rs8 symbols
src/tunnel_config.rs4 symbols
examples/http_upload.rs3 symbols
examples/http_hello_world.rs3 symbols
examples/http_download.rs3 symbols
src/generated/mod.rs1 symbols
build.rs1 symbols

For agents

$ claude mcp add libcfd \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact