CloudPub.Client 1.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package CloudPub.Client --version 1.2.0
                    
NuGet\Install-Package CloudPub.Client -Version 1.2.0
                    
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="CloudPub.Client" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CloudPub.Client" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="CloudPub.Client" />
                    
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 CloudPub.Client --version 1.2.0
                    
#r "nuget: CloudPub.Client, 1.2.0"
                    
#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 CloudPub.Client@1.2.0
                    
#: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=CloudPub.Client&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=CloudPub.Client&version=1.2.0
                    
Install as a Cake Tool

CloudPub .NET SDK

Expose local HTTP, HTTPS, TCP, and other services to the internet through CloudPub — similar in spirit to ngrok-style tunnels, with a control WebSocket, protobuf protocol, and optional ASP.NET Core integration that publishes your app during startup and tears it down on shutdown.

This repository ships two NuGet packages:

Package When to use
CloudPub.Client Console apps, workers, or any .NET Standard 2.1+ library.
CloudPub.AspNet ASP.NET Core apps on .NET 10+ that should auto-publish when the web host starts.

Both packages share the root namespace CloudPub (types such as CloudPubClient, CloudPub.Options.CloudPubClientOptions).


Installation

dotnet add package CloudPub.Client

For ASP.NET Core integration:

dotnet add package CloudPub.AspNet

(CloudPub.AspNet references CloudPub.Client; you do not need to add the client package separately unless you want an explicit reference.)


Authentication

The agent handshake accepts either:

  • Token — set CloudPubClientOptions.Token (e.g. from environment or user secrets), or
  • Email + password — set Email and Password.

You can also point ServerUri at another control plane (default is https://cloudpub.ru).


Using the client library

Minimal example (publish HTTP on localhost)

using CloudPub;
using CloudPub.Options;
using CloudPub.Protocol;

CloudPubClientOptions options = new CloudPubClientOptions
{
    Email = "you@example.com",
    Password = "your-password",
    // Or: Token = "your-token",
};

await using CloudPubClient client = new CloudPubClient(options);
await client.ConnectAsync();

Endpoint endpoint = await client.PublishAsync(new CloudPubPublishOptions
{
    Protocol = ProtocolType.Http,
    Address = "8080",              // localhost:8080 (or host:port, URL, etc.)
    Name = "my-app",
    Auth = AuthType.None,
});

Console.WriteLine($"Public URL: {endpoint.Url}");
// … keep running …
await client.UnpublishAsync(endpoint);

Extension helpers (CloudPubClientExtensions)

After ConnectAsync, use the static extension methods on ICloudPubClient:

Method Purpose
PublishAsync Register a new publication from CloudPubPublishOptions.
UnpublishAsync Remove a publication and mark the endpoint offline.
StopAsync Stop traffic without removing registration.
CleanAsync Clear all publications on the account.
ListAsync List current endpoints.

CloudPubClientOptions (common properties)

Property Description
ServerUri Control server (default https://cloudpub.ru). WebSocket URL is derived from this.
Timeout Handshake / wait timeouts (default 30 seconds).
ResumeEndpointsOnConnect When true, the transport may send EndpointStartAll after connect.
Token Session token after login, or pre-provisioned token.
Email / Password Account credentials for hello handshake.
AgentId Stable agent id; a new GUID is used if empty.
Hwid Optional hardware id string.
ClientVersion Reported client version string.

CloudPubPublishOptions (publishing)

Property Description
Protocol e.g. Http, Https, Tcp, Udp, Ssh, …
Address Port only, host:port, path, or full URL — see XML docs on CreateCleintEndpoint.
Name Friendly description stored on the endpoint.
Auth Optional; defaults (e.g. Basic for WebDAV) apply when null.
Acl, Headers, Rules Optional access lists, headers, and filter rules.

ASP.NET Core addon (CloudPub.AspNet)

The addon wires ICloudPubClient into DI and provides HostedCloudPubLifecycleService, which:

  1. Runs during host startup (IHostedLifecycleService.StartingAsync): connects the client and calls PublishAsync for each registered CloudPubPublishOptions.
  2. Adds each public URL to IServerAddressesFeature.Addresses (so logs show “Now listening on …” for the tunnel URL as well as local URLs).
  3. Runs during shutdown (StoppingAsync): unpublishes each endpoint.

1. Register client + options

Pick one style.

Option A — bind from configuration (recommended)

appsettings.json:

{
  "CloudPub": {
    "ServerUri": "https://cloudpub.ru",
    "Email": "you@example.com",
    "Password": "your-password"
  }
}

Program:

using CloudPub;

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);

builder.Services.AddCloudPub(builder.Configuration.GetSection("CloudPub"));

Option B — inline options

builder.Services.AddCloudPub(new CloudPub.Options.CloudPubClientOptions
{
    Token = builder.Configuration["CloudPub:Token"]!,
});

Option C — custom factory

builder.Services.AddCloudPub(sp =>
{
    CloudPub.Options.CloudPubClientOptions o = sp.GetRequiredService<IOptions<CloudPub.Options.CloudPubClientOptions>>().Value;
    return new CloudPubClient(o);
});

2. Declare what to publish

Register one or more publish profiles. The port overload publishes localhost at that port (same idea as Address = "5000" in the client API):

builder.Services.AddPublishEndpoint(port: 5000, name: "My API");

// Or full control:
builder.Services.AddPublishEndpoint(new CloudPub.Options.CloudPubPublishOptions
{
    Protocol = CloudPub.Protocol.ProtocolType.Https,
    Address = "5001",
    Name = "Secure API",
});

Full minimal Program.cs sketch

using CloudPub;

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);

builder.Services.AddCloudPub(builder.Configuration.GetSection("CloudPub"));
builder.Services.AddPublishEndpoint(port: 5000, name: "Sample site");

WebApplication app = builder.Build();
app.MapGet("/", () => "Hello from CloudPub!");
app.Run();

CloudPubEndpointsBuilder

builder.Services.AddCloudPub(builder.Configuration.GetSection("CloudPub"));
builder.Services.AddPublishEndpoint(builder => builder
    .AddPublishEndpoint(port: 5010, name: "Sample site")
    .AddPublishEndpoint(port: 5020, name: "Sample site 2"));

Requirements: a server that exposes IServerAddressesFeature (Kestrel does). The hosted service throws at startup if the feature is missing.


Sample console project

The solution includes CloudPub.Example: a small CLI that reads CLOUDPUB_* environment variables and can publish-http <port> to expose a local HTTP port. Run it with:

set CLOUDPUB_EMAIL=you@example.com
set CLOUDPUB_PASSWORD=secret
dotnet run --project src/CloudPub.Example/CloudPub.Example.csproj -- publish-http 8080

(Use CLOUDPUB_TOKEN instead of email/password if you prefer.)


Building from source

git clone <repository-url>
cd CloudPub.Client
dotnet build CloudPub.Sdk.slnx -c Release

Packages are emitted under bin/Release/ when GeneratePackageOnBuild is enabled.


Repository and license

  • Repository: see the package metadata (e.g. RepositoryUrl in the .csproj files).
  • License: see the LICENSE file bundled with the package.

For API details, open the XML documentation shipped with each package or browse the /// comments in the source.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on CloudPub.Client:

Package Downloads
CloudPub.AspNet

The CloudPub C# SDK provides a simple interface for interacting with the CloudPub platform. CloudPub provides secure tunneling and service publishing, allowing you to securely expose local services to the internet.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.5.7 110 4/24/2026
1.5.6 101 4/24/2026
1.5.5 104 4/23/2026
1.5.4 98 4/23/2026
1.5.3 103 4/16/2026
1.5.0 117 4/13/2026
1.4.0 109 4/4/2026
1.3.0 106 4/4/2026
1.2.0 102 4/3/2026
1.1.0 119 4/3/2026
1.0.0 107 4/3/2026