{"id":30050023,"url":"https://github.com/andrewmd5/libwtf","last_synced_at":"2025-08-07T13:03:44.071Z","repository":{"id":306464755,"uuid":"1025716091","full_name":"andrewmd5/libwtf","owner":"andrewmd5","description":"A fast WebTransport implementation in C","archived":false,"fork":false,"pushed_at":"2025-07-31T14:54:53.000Z","size":912,"stargazers_count":32,"open_issues_count":4,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-04T04:29:17.719Z","etag":null,"topics":["http3","msquic","quic","webrtc","websocket","webtransport"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andrewmd5.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-24T17:24:11.000Z","updated_at":"2025-08-03T08:57:36.000Z","dependencies_parsed_at":"2025-07-25T23:10:52.153Z","dependency_job_id":"fba7bfaf-0916-430b-b0a2-026271f49af0","html_url":"https://github.com/andrewmd5/libwtf","commit_stats":null,"previous_names":["andrewmd5/libwtf"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andrewmd5/libwtf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewmd5%2Flibwtf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewmd5%2Flibwtf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewmd5%2Flibwtf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewmd5%2Flibwtf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrewmd5","download_url":"https://codeload.github.com/andrewmd5/libwtf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewmd5%2Flibwtf/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269261294,"owners_count":24387212,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-07T02:00:09.698Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http3","msquic","quic","webrtc","websocket","webtransport"],"created_at":"2025-08-07T13:01:16.302Z","updated_at":"2025-08-07T13:03:44.063Z","avatar_url":"https://github.com/andrewmd5.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# libwtf - WebTransport Fast\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/andrewmd5/libwtf\"\u003e\u003cimg alt=\"GitHub\" src=\"https://img.shields.io/github/stars/andrewmd5/libwtf?style=flat-square\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/andrewmd5/libwtf/releases\"\u003e\u003cimg alt=\"Release\" src=\"https://img.shields.io/github/v/release/andrewmd5/libwtf?style=flat-square\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\nA high-performance WebTransport implementation built on [MsQuic](https://github.com/microsoft/msquic).\n\n## Overview\n\nlibwtf implements [WebTransport over HTTP/3 (draft-07)](https://datatracker.ietf.org/doc/html/draft-ietf-webtrans-http3-07) with forward compatibility for [draft-13](https://datatracker.ietf.org/doc/draft-ietf-webtrans-http3/). The library handles real-world browser quirks where Chrome sends draft-02 format without proper negotiation.\n\nWebTransport provides low-latency, bidirectional communication over QUIC with support for both reliable streams and unreliable datagrams. All communication occurs over a single QUIC connection with built-in congestion control and multiplexing.\n\n## Features\n\nThe library centers around session management with isolated WebTransport sessions. Applications handle connection validation, session lifecycle events, and stream management through callback-based APIs.\n\nStream support includes both bidirectional and unidirectional channels with flow control and priority handling. Datagram support enables low-latency messaging for real-time applications.\n\nThe implementation provides comprehensive error handling with detailed diagnostics and performance statistics for monitoring connection health and throughput.\n\n**Status:** Early development - not recommended for production use.\n\n## Installation\n\n```bash\n# Build from source\ngit clone https://github.com/andrewmd5/libwtf.git\ncd libwtf\n# macOS / Linux\n cmake -DWTF_BUILD_SAMPLES=on -S . -B build -G \"Ninja Multi-Config\"\n# Windows\n cmake -S . -B build -G \"Visual Studio 17 2022\"\n\n cmake --build build --config Release\n```\n\n## Quick Start\n\n```c\n#include \"wtf.h\"\n\nvoid session_callback(const wtf_session_event_t *event) {\n    switch (event-\u003etype) {\n    case WTF_SESSION_EVENT_CONNECTED:\n        printf(\"Session established\\n\");\n        break;\n    case WTF_SESSION_EVENT_DATAGRAM_RECEIVED:\n        // Echo datagram back\n        wtf_session_send_datagram(event-\u003esession, \u0026event-\u003edatagram_received.data);\n        break;\n    }\n}\n\nint main() {\n    // Initialize context\n    wtf_context_config_t ctx_config = {.log_level = WTF_LOG_INFO};\n    wtf_context_t *context;\n    wtf_context_create(\u0026ctx_config, \u0026context);\n    \n    // Configure server\n    wtf_server_config_t config = {\n        .port = 4433,\n        .cert_file = \"server.crt\",\n        .key_file = \"server.key\", \n        .session_callback = session_callback\n    };\n    \n    // Start server\n    wtf_server_t *server;\n    wtf_server_create(context, \u0026config, \u0026server);\n    wtf_server_start(server);\n    \n    // Server runs...\n    \n    wtf_server_destroy(server);\n    wtf_context_destroy(context);\n}\n```\n\n## Stream Handling\n\n```c\nvoid stream_callback(const wtf_stream_event_t *event) {\n    switch (event-\u003etype) {\n    case WTF_STREAM_EVENT_DATA_RECEIVED:\n        // Echo data back\n        wtf_stream_send(event-\u003estream, event-\u003edata_received.buffers,\n                       event-\u003edata_received.buffer_count, false);\n        break;\n    case WTF_STREAM_EVENT_PEER_CLOSED:\n        printf(\"Stream closed by peer\\n\");\n        break;\n    }\n}\n\n// In session callback:\ncase WTF_SESSION_EVENT_STREAM_OPENED:\n    wtf_stream_set_callback(event-\u003estream_opened.stream, stream_callback);\n    break;\n```\n\n## Server-Initiated Streams\n\n```c\n// Create outbound stream\nwtf_stream_t *stream;\nwtf_result_t result = wtf_session_create_stream(session, WTF_STREAM_BIDIRECTIONAL, \u0026stream);\n\nif (result == WTF_SUCCESS) {\n    // Send initial data\n    const char *message = \"Hello from server\";\n    wtf_buffer_t buffer = {.data = (uint8_t*)message, .length = strlen(message)};\n    wtf_stream_send(stream, \u0026buffer, 1, false);\n}\n```\n\n## Connection Validation\n\n```c\nwtf_connection_decision_t connection_validator(const wtf_connection_request_t *request, void *user_data) {\n    printf(\"Connection from: %s%s\\n\", \n           request-\u003eauthority ? request-\u003eauthority : \"unknown\",\n           request-\u003epath ? request-\u003epath : \"/\");\n    \n    // Validate origin, check authentication, etc.\n    if (request-\u003eorigin \u0026\u0026 strcmp(request-\u003eorigin, \"https://example.com\") == 0) {\n        return WTF_CONNECTION_ACCEPT;\n    }\n    \n    return WTF_CONNECTION_REJECT;\n}\n```\n\n## Error Handling\n\nThe library provides comprehensive error handling with detailed diagnostics:\n\n```c\nwtf_result_t result = wtf_server_start(server);\nif (result != WTF_SUCCESS) {\n    printf(\"Server start failed: %s\\n\", wtf_result_to_string(result));\n    return -1;\n}\n\n// Get detailed error information\nwtf_error_details_t details;\nif (wtf_get_error_details(error_code, \u0026details) == WTF_SUCCESS) {\n    printf(\"Error: %s (code: %u)\\n\", details.description, details.error_code);\n}\n```\n\n## Example Server\n\nIncluded with libwtf is a complete echo server that demonstrates session management, stream handling, datagram processing, and command parsing. The server supports interactive commands for testing WebTransport features.\n\n```bash\n./example_server --port 4433 --cert server.crt --key server.key --verbose\n```\n\n## Build Requirements\n\n- C11 compatible compiler\n- [MsQuic](https://github.com/microsoft/msquic)\n- [OpenSSL](https://github.com/openssl/openssl)\n\n## Technical Considerations\n\nWebTransport runs over QUIC with HTTP/3 framing. The implementation handles QPACK header compression, flow control, and connection migration. Session multiplexing allows multiple WebTransport sessions over a single QUIC connection.\n\nBrowser compatibility varies significantly. Chrome supports WebTransport but with draft-02 semantics, while Firefox implementation is still evolving. The library includes compatibility shims for real-world deployment.\n\nFuture client implementation will provide matching functionality for WebTransport clients, enabling full-duplex communication patterns.\n\n---\n\nFeedback and contributions welcome!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewmd5%2Flibwtf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewmd5%2Flibwtf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewmd5%2Flibwtf/lists"}