Skip to content

Add support for XDP/AF_XDP zero-copy integration in shoes #112

@kwrum1

Description

@kwrum1

Body:

Feature Request / Proposal

Summary:
I propose adding support for XDP/AF_XDP zero-copy packet reception in shoes. The goal is to allow shoes to directly receive packets from a specified port (e.g., 443) using AF_XDP sockets, bypassing the kernel TCP/IP stack for high-performance use cases, while maintaining normal TCP/IP processing for other ports. This would enable a single-port high-performance zero-copy proxy setup for protocols like VLESS, AnyTLS, and HY2.

Motivation:

Improve CPU efficiency for high-throughput TCP/TLS traffic.

Reduce user-space/kernel-space copy overhead.

Allow users to selectively accelerate critical ports (e.g., 443) without affecting other services.

Provide a foundation for integrating kernel TLS offload (kTLS) with shoes in the future.

Proposed Implementation:

Introduce an AF_XDP socket layer in shoes.

Add a TCP/UDP user-space stack to handle packets received from AF_XDP.

Maintain compatibility with the existing transport and application layers (VLESS, AnyTLS, HY2, etc.).

Allow configuration to specify which ports should be redirected to AF_XDP.

Ensure fallback: traffic on non-specified ports continues to use the kernel TCP/IP stack.

Benefits:

CPU usage reduction for high-concurrency TCP/TLS workloads.

Zero-copy packet processing for selected ports.

Flexibility: only accelerate high-priority traffic.

Foundation for future high-performance user-space TLS handling.

Additional Context / References:

AF_XDP official documentation

XDP Programming Guide

Similar zero-copy approaches are commonly used in high-performance proxy servers (e.g., sing-box with AF_XDP experimental implementations).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions