Proxy.Abstractions 2.0.0-alpha.1

This is a prerelease version of Proxy.Abstractions.
dotnet add package Proxy.Abstractions --version 2.0.0-alpha.1
                    
NuGet\Install-Package Proxy.Abstractions -Version 2.0.0-alpha.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Proxy.Abstractions" Version="2.0.0-alpha.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Proxy.Abstractions" Version="2.0.0-alpha.1" />
                    
Directory.Packages.props
<PackageReference Include="Proxy.Abstractions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Proxy.Abstractions --version 2.0.0-alpha.1
                    
#r "nuget: Proxy.Abstractions, 2.0.0-alpha.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Proxy.Abstractions@2.0.0-alpha.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Proxy.Abstractions&version=2.0.0-alpha.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Proxy.Abstractions&version=2.0.0-alpha.1&prerelease
                    
Install as a Cake Tool

Proxy.Abstractions

Provides abstractions for building proxy pipelines — stream I/O via System.IO.Pipelines and packet I/O via IPacketConnection.

Key Features

  • Decouples inbound protocol handling from outbound connection strategies.
  • Stream I/O built on IDuplexPipe for high-performance, allocation-friendly I/O.
  • Packet I/O built on IPacketConnection for message-oriented protocols.
  • Enables composable proxy chains (e.g. HTTP proxy over SOCKS5).

Main Types

IInbound

public interface IInbound;

Base type for all inbound implementations. Concrete capabilities are exposed via IStreamInbound and IPacketInbound. These names describe the I/O shape, not a specific transport protocol: stream inbounds handle ordered bidirectional byte streams, while packet inbounds handle discrete messages with per-message addressing.

IStreamInbound

public interface IStreamInbound : IInbound
{
    ValueTask HandleAsync(InboundContext context, IDuplexPipe clientPipe, IOutbound outbound, CancellationToken cancellationToken = default);
}

Handles a stream-oriented inbound client connection. An implementation parses the proxy protocol from clientPipe (e.g. HTTP CONNECT, SOCKS5 handshake), extracts the target destination, connects via outbound, and relays traffic bidirectionally. InboundContext carries per-connection metadata (client/local endpoints) supplied by the accept loop.

IPacketInbound

public interface IPacketInbound : IInbound
{
    ValueTask HandleAsync(InboundContext context, IPacketConnection clientPackets, IOutbound outbound, CancellationToken cancellationToken = default);
}

Handles a packet-oriented inbound connection. An implementation reads packets from clientPackets, processes them (e.g. decryption, session management), and relays traffic via outbound.

InboundContext

public sealed class InboundContext
{
    public required IPAddress ClientAddress { get; init; }
    public required ushort ClientPort { get; init; }
    public required IPAddress LocalAddress { get; init; }
    public required ushort LocalPort { get; init; }
}

Per-connection metadata supplied by the accept loop: the client's remote address/port and the local address/port on which the connection was accepted.

IOutbound

public interface IOutbound;

Base type for all outbound implementations. Concrete capabilities are exposed via IStreamOutbound and IPacketOutbound. These names describe the I/O shape, not a specific transport protocol: stream outbounds provide an ordered bidirectional byte stream, while packet outbounds preserve per-message boundaries.

IStreamOutbound

public interface IStreamOutbound : IOutbound
{
    ValueTask<IConnection> ConnectAsync(ProxyDestination destination, CancellationToken cancellationToken = default);
}

Creates stream-oriented outbound connections. Typical examples include direct TCP connections, tunneled byte streams, or any other transport that behaves like an ordered bidirectional stream.

IPacketOutbound

public interface IPacketOutbound : IOutbound
{
    ValueTask<IPacketConnection> CreatePacketConnectionAsync(CancellationToken cancellationToken = default);
}

Creates packet-oriented outbound connections. Per-message destinations are specified via IPacketConnection.SendToAsync. Typical examples include UDP or any other transport that preserves message boundaries.

IConnection

public interface IConnection : IDuplexPipe, IAsyncDisposable
{
    SocketAddress? LocalEndPoint { get; }
}

A duplex pipe backed by a connection. Provides PipeReader / PipeWriter for I/O and exposes the local SocketAddress of the underlying transport when available. DisposeAsync releases the underlying transport.

ProxyDestination

public readonly record struct ProxyDestination(ReadOnlyMemory<byte> Host, ushort Port);

Represents a target address for proxy connections. Host contains the raw bytes of a domain name (e.g. "example.com") or an IP address (e.g. "1.2.3.4", "::1"). The caller must ensure the backing memory remains valid for the lifetime of this value.

IPacketConnection

public interface IPacketConnection : IAsyncDisposable
{
    ValueTask<int> SendToAsync(ReadOnlyMemory<byte> data, ProxyDestination destination, CancellationToken cancellationToken = default);
    ValueTask<PacketReceiveResult> ReceiveFromAsync(Memory<byte> buffer, CancellationToken cancellationToken = default);
}

A packet-oriented connection with per-message addressing. SendToAsync sends data to the specified destination. ReceiveFromAsync receives one packet and returns the number of bytes received along with the remote destination.

PacketReceiveResult

public readonly struct PacketReceiveResult
{
    public int BytesReceived { get; init; }
    public ProxyDestination RemoteDestination { get; init; }
}

Result of a packet receive operation, including the number of bytes received and the remote endpoint.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Proxy.Abstractions:

Package Downloads
Socks5

A simple SOCKS5 library for .NET

HttpProxy

A simple http proxy library for .NET

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0-alpha.1 0 4/13/2026