Added AI generated README

This commit is contained in:
2025-09-02 16:53:30 +03:30
parent a6d9ae87aa
commit 53206dfc2d
3 changed files with 226 additions and 0 deletions

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

@@ -0,0 +1,83 @@
# 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.