25 Commits
v0.1 ... master

Author SHA1 Message Date
11eaaf7385 Security is our #1 priority
Some checks failed
Build and Push Server Docker Image / build-server (push) Has been cancelled
2025-09-17 10:12:51 +03:30
7485151f66 oops
All checks were successful
Build and Push Server Docker Image / build-server (push) Successful in 47s
2025-09-17 10:07:40 +03:30
69d385e86f I dont remember the username and password sooooo.....
Some checks failed
Build and Push Server Docker Image / build-server (push) Failing after 50s
2025-09-17 10:06:04 +03:30
64318b0ec9 Update README formatting for improved readability
All checks were successful
Build and Push Server Docker Image / build-server (push) Successful in 5m14s
2025-09-05 22:13:21 +03:30
864748c98c Add step to install required tools in build-docker-image workflow
All checks were successful
Build and Push Server Docker Image / build-server (push) Successful in 1m33s
2025-09-05 21:19:12 +03:30
0f09e75f0d Switch build-docker-image workflow from services to container configuration
Some checks failed
Build and Push Server Docker Image / build-server (push) Failing after 20s
2025-09-05 21:14:13 +03:30
89c96b0672 Revert back the changes
All checks were successful
Build and Push Server Docker Image / build-server (push) Successful in 2m39s
2025-09-03 20:05:48 +03:30
776c463c0c GPT5 - Refactor build-docker-image workflow: streamline buildx setup, switch to inline build command, and improve cleanup process.
All checks were successful
Build and Push Server Docker Image / build-server (push) Successful in 10m11s
2025-09-03 19:46:11 +03:30
eda54928f2 Use docker builder prune instead of docker system prune in build-docker-image workflow
All checks were successful
Build and Push Server Docker Image / build-server (push) Successful in 1m45s
2025-09-03 19:41:19 +03:30
0d1f57399a Add Docker cleanup step to build-docker-image workflow
All checks were successful
Build and Push Server Docker Image / build-server (push) Successful in 45s
2025-09-03 19:37:31 +03:30
0db3fda0c6 Lets see what deepseek does
All checks were successful
Build and Push Server Docker Image / build-server (push) Successful in 8m58s
2025-09-03 19:13:23 +03:30
e7957e7138 Fix Dockerfile path
All checks were successful
Build and Push Server Docker Image / build-server (push) Successful in 7m55s
2025-09-03 18:17:37 +03:30
53cdd4da8e Fix Dockerfile
Some checks failed
Build and Push Server Docker Image / build-server (push) Failing after 3m8s
2025-09-03 18:12:38 +03:30
dc32e7c171 change dotnet build images in Dockerfile
Some checks failed
Build and Push Server Docker Image / build-server (push) Failing after 21s
2025-09-03 18:11:27 +03:30
993f4fe135 Made repo name lowercase in actions
Some checks failed
Build and Push Server Docker Image / build-server (push) Failing after 22s
2025-09-03 18:06:12 +03:30
ef94d8ec95 Added gitea actions for testing
Some checks failed
Build and Push Server Docker Image / build-server (push) Failing after 2m31s
2025-09-03 18:00:23 +03:30
f46ca8615f Improved http mapping file for the server 2025-09-03 08:34:42 +03:30
53206dfc2d Added AI generated README 2025-09-02 16:53:30 +03:30
a6d9ae87aa Refactor YAML parsing logic and settings handling across Client and Server projects, improve request building in the client. 2025-08-24 09:34:54 +03:30
3a9d48a3b6 WIP - Add VirtualDDNSRouter.Client project with Docker support, YAML settings handling, and example configuration 2025-08-23 23:31:56 +03:30
866a5c57e3 Refactor route handling to use ConcurrentDictionary for thread-safe updates and optimize /goto/{path} logic 2025-08-20 14:22:48 +03:30
462f10ffb2 Refactor and optimize route handling, clean up code structure, and apply minor improvements 2025-08-20 13:52:52 +03:30
64e025d9f7 Update route handling to modify existing routes instead of duplicating 2025-08-20 13:44:01 +03:30
09bc23a739 Enable forwarded headers middleware to support X-Forwarded-For and X-Forwarded-Proto 2025-08-20 13:27:52 +03:30
f90db6e714 Switch /setip from PUT to GET, add logging, update response formats 2025-08-20 13:19:10 +03:30
21 changed files with 548 additions and 85 deletions

View File

@@ -0,0 +1,50 @@
name: Build and Push Server Docker Image
on:
push:
branches:
- master
jobs:
build-server:
runs-on: ubuntu-24.04
container:
image: docker:dind
privileged: true
steps:
- name: Install required tools
run: apk add --no-cache git nodejs npm
# 1. Check out the repo
- uses: actions/checkout@v4
# 2. Set up Docker Buildx (recommended for advanced caching)
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# 3. Log in to your container registry
- name: Log in to registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
# 4. Lowercase the repository name
- name: Set lowercase repo name
run: echo "REPO_NAME_LOWER=$(echo '${{ github.event.repository.name }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
# 5. Build & push the server image, using remote cache
- name: Build and push server image
uses: docker/build-push-action@v4
with:
context: VirtualDDNSRouter.Server
file: VirtualDDNSRouter.Server/Dockerfile
push: true
tags: ${{ secrets.REGISTRY_URL }}/${{ github.repository_owner }}/${{ env.REPO_NAME_LOWER }}:latest-server
cache-from: type=registry,ref=${{ secrets.REGISTRY_URL }}/${{ github.repository_owner }}/${{ env.REPO_NAME_LOWER }}:buildcache
cache-to: type=registry,ref=${{ secrets.REGISTRY_URL }}/${{ github.repository_owner }}/${{ env.REPO_NAME_LOWER }}:buildcache,mode=max

4
.gitignore vendored
View File

@@ -4,4 +4,6 @@ obj/
riderModule.iml
/_ReSharper.Caches/
.idea
rules.yaml
rules.yaml
/VirtualDDNSRouter.Client/settings.yaml
settings.yaml

87
README.md Normal file
View File

@@ -0,0 +1,87 @@
# VirtualDDNSRouter (VDR)
VirtualDDNSRouter (VDR) is a lightweight dynamic DNS router solution that consists of two components:
- **Client**: Updates the server with the current IP address of a service
- **Server**: Acts as a reverse proxy that redirects requests to the correct IP address
This solution is particularly useful for accessing services running on dynamic IP addresses through consistent URLs.
## Quick Start (Recommended Method)
The easiest way to use VDR is by downloading the pre-built binaries:
1. Download the latest release for your platform from [https://git.mahdium.ir/mahdium/VDR/releases/latest](https://git.mahdium.ir/mahdium/VDR/releases/latest)
2. Extract the archives for both client and server
3. Configure each component using the provided examples
4. Run the server and client applications
## Components
- [Client Documentation](VirtualDDNSRouter.Client/README.md) - For updating IP addresses
- [Server Documentation](VirtualDDNSRouter.Server/README.md) - For routing requests
## Architecture
```
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ VDR Client │ │ VDR Server │ │ Service │
│ │ │ │ │ │
│ • Periodically │◄──────►│ • Maintains IP │◄──────►│ • Running on │
│ updates IP │ │ mappings │ │ dynamic IP │
│ with server │ │ • Redirects to │ │ • Exposes port │
│ │ │ correct IP │ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘
┌─────────────────┐
│ User │
│ │
│ • Accesses │
│ service via │
│ consistent │
│ URL │
└─────────────────┘
┌─────────────────┐
│ VDR Server │
│ │
│ • Redirects to │
│ current IP │
└─────────────────┘
```
## Alternative Deployment Methods
### Using Docker
You can also run VDR using Docker:
```bash
# Build the images
docker-compose build
# Run the services
docker-compose up
```
See the [compose.yaml](compose.yaml) file for details.
### Building from Source
If you prefer to build from source:
```bash
# For the server
cd VirtualDDNSRouter.Server
dotnet build
dotnet run
# For the client
cd VirtualDDNSRouter.Client
dotnet build
dotnet run
```
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

View File

@@ -0,0 +1,9 @@
using YamlDotNet.Serialization;
namespace VirtualDDNSRouter.Client.Context;
[YamlStaticContext]
[YamlSerializable(typeof(Settings))]
public partial class YamlStaticContextClient : StaticContext
{
}

View File

@@ -0,0 +1,21 @@
FROM mcr.microsoft.com/dotnet/runtime:10.0 AS base
USER $APP_UID
WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["VirtualDDNSRouter.Client/VirtualDDNSRouter.Client.csproj", "VirtualDDNSRouter.Client/"]
RUN dotnet restore "VirtualDDNSRouter.Client/VirtualDDNSRouter.Client.csproj"
COPY . .
WORKDIR "/src/VirtualDDNSRouter.Client"
RUN dotnet build "./VirtualDDNSRouter.Client.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./VirtualDDNSRouter.Client.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "VirtualDDNSRouter.Client.dll"]

View File

@@ -0,0 +1,34 @@
using VirtualDDNSRouter.Client.Context;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;
using Settings = VirtualDDNSRouter.Client.Models.Settings;
namespace VirtualDDNSRouter.Client.Helpers;
public class Helpers
{
private static readonly string YamlFilePath = "settings.yaml";
public static async Task<Settings> GetSettings()
{
if (!File.Exists(YamlFilePath))
throw new FileNotFoundException($"Settings file not found: {YamlFilePath}");
var yamlContent = await File.ReadAllTextAsync(YamlFilePath).ConfigureAwait(false);
// Build the deserializer with explicit naming convention
var deserializer = new StaticDeserializerBuilder(new YamlStaticContextClient())
.WithNamingConvention(UnderscoredNamingConvention.Instance)
.IgnoreUnmatchedProperties()
.Build();
// Deserialize into Settings
var settings = deserializer.Deserialize<Settings>(yamlContent);
if (settings is null || string.IsNullOrWhiteSpace(settings.host) || string.IsNullOrWhiteSpace(settings.path) ||
string.IsNullOrWhiteSpace(settings.apiKey))
throw new Exception("Invalid settings file");
return settings;
}
}

View File

@@ -0,0 +1,17 @@
using YamlDotNet.Serialization;
namespace VirtualDDNSRouter.Client.Models;
[YamlSerializable]
public record Settings
{
public string host { get; set; } = string.Empty;
public string path { get; set; } = string.Empty;
public ushort destinationPort { get; set; } = 80;
public string apiKey { get; set; } = string.Empty;
public ushort refreshIntervalMinutes { get; set; } = 5;
public Settings()
{
}
}

View File

@@ -0,0 +1,43 @@
using VirtualDDNSRouter.Client.Helpers;
var settings = await Helpers.GetSettings();
using var cts = new CancellationTokenSource();
Console.CancelKeyPress += (s, e) =>
{
Console.WriteLine("Shutdown requested…");
e.Cancel = true;
cts.Cancel();
};
var timer = new PeriodicTimer(TimeSpan.FromMinutes(settings.refreshIntervalMinutes));
var client = new HttpClient { Timeout = TimeSpan.FromSeconds(10) };
var builder = new UriBuilder
{
Scheme = "http",
Host = settings.host,
Path = $"setip/{settings.path}/{settings.destinationPort}/{settings.apiKey}"
};
var request = new HttpRequestMessage(HttpMethod.Get, builder.Uri);
Console.WriteLine("[INFO] App started. Scheduling IP address update every " + settings.refreshIntervalMinutes +
" minutes.");
try
{
while (await timer.WaitForNextTickAsync(cts.Token))
{
if (cts.IsCancellationRequested) break;
var response = await client.SendAsync(request, cts.Token);
if (response.IsSuccessStatusCode)
Console.WriteLine("[INFO] IP address updated at " + DateTime.Now.ToString("HH:mm:ss"));
else
Console.WriteLine("[ERROR] IP address update failed at " + DateTime.Now.ToString("HH:mm:ss"));
}
}
catch (OperationCanceledException)
{
Console.WriteLine("[INFO] Shutdown complete.");
}

View File

@@ -0,0 +1,56 @@
# VirtualDDNSRouter Client
The VirtualDDNSRouter Client is a lightweight application that periodically updates the IP address of a service with the VirtualDDNSRouter Server.
## Configuration
The client uses a YAML configuration file named `settings.yaml`. You can create this file by copying and modifying the provided example:
```bash
cp settings.example.yaml settings.yaml
```
The configuration file has the following structure:
```yaml
host: example.com # The hostname of the VDR server
path: odoo # The path identifier for your service
destination_port: 8081 # The port of your service
api_key: abc123XYZ # The API key for authentication
refresh_interval_minutes: 3 # How often to update the IP address (in minutes)
```
## Running the Client
### Method 1: Downloading Pre-built Binaries (Recommended)
1. Download the latest client binary from [https://git.mahdium.ir/mahdium/VDR/releases/latest](https://git.mahdium.ir/mahdium/VDR/releases/latest)
2. Extract the archive
3. Create your `settings.yaml` file based on `settings.example.yaml`
4. Run the client:
```bash
./VirtualDDNSRouter.Client
```
### Method 2: Using Docker
```bash
docker run -v ./settings.yaml:/app/settings.yaml virtualddnsrouter.client
```
### Method 3: Building from Source
```bash
dotnet build
dotnet run
```
## Usage
After starting the client, it will:
1. Read the configuration from `settings.yaml`
2. Send an update to the server every `refresh_interval_minutes`
3. Continue running until stopped with Ctrl+C
The client will output logs showing when updates are sent and whether they were successful.

View File

@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<InvariantGlobalization>true</InvariantGlobalization>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>
<Content Include="..\.dockerignore">
<Link>.dockerignore</Link>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="YamlDotNet" Version="16.3.0"/>
<PackageReference Include="Vecc.YamlDotNet.Analyzers.StaticGenerator" Version="16.3.0"/>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,5 @@
host: example.com
path: odoo
destination_port: 8081
api_key: abc123XYZ
refresh_interval_minutes: 3

View File

@@ -5,6 +5,6 @@ namespace VirtualDDNSRouter.Server.Context;
[YamlStaticContext]
[YamlSerializable(typeof(Rule))]
public partial class YamlStaticContext : YamlDotNet.Serialization.StaticContext
public partial class YamlStaticContextServer : StaticContext
{
}

View File

@@ -1,23 +1,17 @@
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081
FROM mcr.microsoft.com/dotnet/sdk:10.0.100-preview.7-alpine3.22-aot AS build
# Install NativeAOT build prerequisites
RUN apk update \
&& apk add --no-cache \
clang zlib-dev
WORKDIR /source
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["VirtualDDNSRouter.Server/VirtualDDNSRouter.Server.csproj", "VirtualDDNSRouter.Server/"]
RUN dotnet restore "VirtualDDNSRouter.Server/VirtualDDNSRouter.Server.csproj"
COPY . .
WORKDIR "/src/VirtualDDNSRouter.Server"
RUN dotnet build "./VirtualDDNSRouter.Server.csproj" -c $BUILD_CONFIGURATION -o /app/build
RUN dotnet publish -r linux-musl-x64 -o /app 'VirtualDDNSRouter.Server.csproj'
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./VirtualDDNSRouter.Server.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM mcr.microsoft.com/dotnet/runtime-deps:10.0.0-preview.7-alpine3.22
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "VirtualDDNSRouter.Server.dll"]
COPY --from=build /app .
ENTRYPOINT ["/app/VirtualDDNSRouter.Server"]

View File

@@ -1,5 +1,4 @@
using System.Net;
using YamlDotNet.Serialization;
namespace VirtualDDNSRouter.Server.Models;
@@ -9,16 +8,19 @@ public record Rule
public string apiKey { get; set; } = string.Empty;
public string path { get; set; } = string.Empty;
public Rule() { } // Needed for AOT static deserializer
public Rule()
{
} // Needed for AOT static deserializer - AI
}
public record Route
{
public string path { get; set; } = string.Empty;
public IPAddress ipAddress { get; set; } = IPAddress.None;
public UInt16 port { get; set; } = 80;
public ushort port { get; set; } = 80;
public Route() { }
public Route()
{
}
}

View File

@@ -1,3 +1,5 @@
using System.Collections.Concurrent;
using Microsoft.AspNetCore.HttpOverrides;
using VirtualDDNSRouter.Server.Interfaces;
using VirtualDDNSRouter.Server.Services;
using Route = VirtualDDNSRouter.Server.Models.Route;
@@ -12,39 +14,49 @@ builder.Services.AddOpenApi();
var app = builder.Build();
if (app.Environment.IsDevelopment())
app.UseForwardedHeaders(new ForwardedHeadersOptions
{
app.MapOpenApi();
}
List<Route> routes = new List<Route>();
app.MapPut("/setip/{path}/{port}/{apiKey}", async (IYamlParser yamlParser ,HttpContext context, string path, UInt16 port, string apiKey) =>
{
var rules = await yamlParser.GetRules();
var ruleValid = rules.Any(r => r.path == path && r.apiKey == apiKey);
if (!ruleValid)
{
return Results.StatusCode(StatusCodes.Status403Forbidden);
}
var clientIp = context.Connection.RemoteIpAddress;
if (clientIp is null) return Results.BadRequest("Could not get the client ip address");
routes.Add(new Route
{
ipAddress = clientIp,
path = path,
port = port
});
return Results.Created();
ForwardedHeaders = ForwardedHeaders.XForwardedFor |
ForwardedHeaders.XForwardedProto
});
if (app.Environment.IsDevelopment()) app.MapOpenApi();
var routes = new ConcurrentDictionary<string, Route>();
app.MapGet("/setip/{path}/{port}/{apiKey}",
async (IYamlParser yamlParser, HttpContext context, string path, ushort port, string apiKey) =>
{
var rules = await yamlParser.GetRules();
app.Logger.LogInformation($"New setip request for {path} with port {port}.");
var ruleValid = rules.Any(r => r.path == path && r.apiKey == apiKey);
if (!ruleValid)
{
app.Logger.LogInformation($"Invalid rule for {path} with port {port}.");
return Results.StatusCode(StatusCodes.Status403Forbidden);
}
var clientIp = context.Connection.RemoteIpAddress;
if (clientIp is null)
{
app.Logger.LogInformation($"Could not get the client ip address for {path} with port {port}.");
return Results.BadRequest("Could not get the client ip address");
}
routes[path] = new Route
{
ipAddress = clientIp,
path = path,
port = port
};
return Results.Ok($"goto/{path}");
});
app.MapGet("/goto/{path}", (string path) =>
{
var ruleExists = routes.Any(r => r.path == path);
if (!ruleExists) Results.NoContent();
var redirectRoute = routes.FirstOrDefault(r => r.path == path);
if (redirectRoute is null) return Task.FromResult(Results.NotFound());
return Task.FromResult(Results.Redirect($"http://{redirectRoute.ipAddress}:{redirectRoute.port}"));
if (routes.TryGetValue(path, out var route)) return Results.Redirect($"http://{route.ipAddress}:{route.port}");
return Results.NotFound();
});
app.Run();
app.Run();

View File

@@ -0,0 +1,89 @@
# VirtualDDNSRouter Server
The VirtualDDNSRouter Server is a lightweight reverse proxy that maintains dynamic mappings between paths and IP
addresses. Clients can update their IP addresses, and users can access services through consistent URLs.
## Configuration
The server uses a YAML rules file named `rules.yaml`. You can create this file by copying and modifying the provided
example:
```bash
cp rules.example.yaml rules.yaml
```
The rules file has the following structure:
```yaml
- name: Odoo Server # A descriptive name for the service
api_key: abc123XYZ # The API key for authentication
path: odoo # The path identifier for the service
- name: Backup server
api_key: def456ABC
path: bk
```
Each entry defines a service with:
- `name`: A descriptive label (for documentation purposes)
- `api_key`: A secret key used by clients to authenticate updates
- `path`: The URL path that users will use to access the service
## Running the Server
### Method 1: Downloading Pre-built Binaries (Recommended)
1. Download the latest server binary
from [https://git.mahdium.ir/mahdium/VDR/releases/latest](https://git.mahdium.ir/mahdium/VDR/releases/latest)
2. Extract the archive
3. Create your `rules.yaml` file based on `rules.example.yaml`
4. Run the server:
```bash
./VirtualDDNSRouter.Server
```
By default, the server listens on port 8080. You can change this by setting the `ASPNETCORE_HTTP_PORTS` environment
variable:
```bash
ASPNETCORE_HTTP_PORTS=8081 ./VirtualDDNSRouter.Server
```
### Method 2: Using Docker
```bash
docker run -p 8080:8080 -v ./rules.yaml:/app/rules.yaml virtualddnsrouter.server
```
### Method 3: Building from Source
```bash
dotnet build
dotnet run
```
## Usage
The server provides two main endpoints:
1. **IP Update Endpoint** (used by clients):
```
GET /setip/{path}/{port}/{api_key}
```
Clients call this endpoint to update their IP address.
2. **Service Access Endpoint** (used by users):
```
GET /goto/{path}
```
Users access this endpoint to reach the service associated with the path.
For example, if a client has configured a service with path "odoo", users can access it at:
```
http://your-server:8080/goto/odoo
```
The server will redirect users to the IP address and port that the client last reported.

View File

@@ -1,4 +1,3 @@
using System.Diagnostics.CodeAnalysis;
using VirtualDDNSRouter.Server.Context;
using VirtualDDNSRouter.Server.Interfaces;
using VirtualDDNSRouter.Server.Models;
@@ -19,7 +18,7 @@ public class YamlParser : IYamlParser
var yamlContent = await File.ReadAllTextAsync(_yamlFilePath).ConfigureAwait(false);
// Build the deserializer with explicit naming convention
var deserializer = new StaticDeserializerBuilder(new YamlStaticContext())
var deserializer = new StaticDeserializerBuilder(new YamlStaticContextServer())
.WithNamingConvention(UnderscoredNamingConvention.Instance) // maps api_key -> apiKey
.IgnoreUnmatchedProperties()
.Build();
@@ -27,6 +26,6 @@ public class YamlParser : IYamlParser
// Deserialize into a list of Rule
var rules = deserializer.Deserialize<List<Rule>>(yamlContent);
return rules ?? new List<Rule>();
return rules;
}
}

View File

@@ -1,25 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<!-- <TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
<InvariantGlobalization>true</InvariantGlobalization>
&lt;!&ndash; Publish settings &ndash;&gt;
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>full</TrimMode>
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
<PublishReadyToRun>true</PublishReadyToRun>
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
<OptimizationLevel>Release</OptimizationLevel>
<TieredPGO>true</TieredPGO>
<IlcOptimizationPreference>Size</IlcOptimizationPreference>-->
<!-- <TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
<InvariantGlobalization>true</InvariantGlobalization>
&lt;!&ndash; Publish settings &ndash;&gt;
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>full</TrimMode>
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
<PublishReadyToRun>true</PublishReadyToRun>
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
<OptimizationLevel>Release</OptimizationLevel>
<TieredPGO>true</TieredPGO>
<IlcOptimizationPreference>Size</IlcOptimizationPreference>-->
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
@@ -33,14 +33,14 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0-preview.6.25358.103"/>
<PackageReference Include="Vecc.YamlDotNet.Analyzers.StaticGenerator" Version="16.3.0" />
<PackageReference Include="YamlDotNet" Version="16.3.0" />
<PackageReference Include="Vecc.YamlDotNet.Analyzers.StaticGenerator" Version="16.3.0"/>
<PackageReference Include="YamlDotNet" Version="16.3.0"/>
</ItemGroup>
<ItemGroup>
<Content Include="..\.dockerignore">
<Link>.dockerignore</Link>
</Content>
<Content Include="..\.dockerignore">
<Link>.dockerignore</Link>
</Content>
</ItemGroup>
</Project>

View File

@@ -1,11 +1,18 @@
@VirtualDDNSRouter.Server_HostAddress = http://localhost:5277
GET {{VirtualDDNSRouter.Server_HostAddress}}/todos/
Accept: application/json
### Set IP for a path
# This endpoint is used by clients to register/update their IP address for a specific path
# Parameters:
# - path: The path identifier (must match a rule in rules.yaml)
# - port: The port number the client wants to expose
# - apiKey: The API key for authentication (must match the rule for the path)
POST {{VirtualDDNSRouter.Server_HostAddress}}/setip/{path}/{port}/{apiKey}
Content-Type: application/json
###
GET {{VirtualDDNSRouter.Server_HostAddress}}/todos/1
Accept: application/json
### Redirect to registered service
# This endpoint redirects to the IP and port registered for a specific path
GET {{VirtualDDNSRouter.Server_HostAddress}}/goto/{path}
###

View File

@@ -7,6 +7,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
compose.yaml = compose.yaml
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VirtualDDNSRouter.Client", "VirtualDDNSRouter.Client\VirtualDDNSRouter.Client.csproj", "{68BC4818-F3A1-4862-BAE6-6F43D3237E63}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -17,5 +19,9 @@ Global
{6101BFD3-C31C-41CB-9402-A8B9F3EBEE22}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6101BFD3-C31C-41CB-9402-A8B9F3EBEE22}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6101BFD3-C31C-41CB-9402-A8B9F3EBEE22}.Release|Any CPU.Build.0 = Release|Any CPU
{68BC4818-F3A1-4862-BAE6-6F43D3237E63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{68BC4818-F3A1-4862-BAE6-6F43D3237E63}.Debug|Any CPU.Build.0 = Debug|Any CPU
{68BC4818-F3A1-4862-BAE6-6F43D3237E63}.Release|Any CPU.ActiveCfg = Release|Any CPU
{68BC4818-F3A1-4862-BAE6-6F43D3237E63}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@@ -5,3 +5,9 @@
context: .
dockerfile: VirtualDDNSRouter.Server/Dockerfile
virtualddnsrouter.client:
image: virtualddnsrouter.client
build:
context: .
dockerfile: VirtualDDNSRouter.Client/Dockerfile