18 Commits
v1.0 ... 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
6 changed files with 305 additions and 22 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

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,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

@@ -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

@@ -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,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}
###