Skip to content

neatFactory/netDNS

Repository files navigation

netDNS

LOGO

Apache licensed Docker

A plugin for JobAgent that implements DDNS functionality.

Currently, only the Cloudflare provider has been implemented.

How To Use

Windows or Linux

unzip the plugin and then copy it to the JobAgent's Plugins path.

Docker

Available Docker registries:

Visit https://hub.docker.com/r/aicrosoft/netdns to get the latest Docker image.

DEBUG Creation

sudo docker run -d \
  --name ddns-de \
  aicrosoft/netdns:debug

PRODUCTION Creation

## Create an empty directory on the host machine and assign permissions.
sudo mkdir -p /apps/ddns/logs /apps/ddns/plugins /apps/ddns/states
sudo chmod -R 777 /apps/ddns
sudo chown -R 65532:65532 /apps/ddns

## Ensure the parent directory exists.
mkdir -p /apps/ddns/plugins/netDNS
## Create an empty file (or copy the JSON file you have prepared).
touch /apps/ddns/plugins/netDNS/netDNS.json
## Modify your configuration file

## Create a container
sudo docker run -d --name ddns \
  -p 600:600 \
  -v /apps/ddns/logs:/app/logs:rw \
  -v /apps/ddns/states:/app/states:rw \
  -v /apps/ddns/plugins/netDNS/netDNS.json:/app/Plugins/netDNS/netDNS.json:ro \
  aicrosoft/netdns:latest

## Create a container mapping ipv4 and ipv6
sudo docker run -d --name ddns \
  -p 0.0.0.0:600:600 \
  -p [::]:600:600 \
  -v /apps/ddns/logs:/app/logs:rw \
  -v /apps/ddns/states:/app/states:rw \
  -v /apps/ddns/plugins/netDNS/netDNS.json:/app/Plugins/netDNS/netDNS.json:ro \
  aicrosoft/netdns:latest

Docker Parameter Description

  • If you do not need to view logs, do not map /app/logs. Logs will only be retained for 30 days.
  • If you do not need to view or modify the status of Jobs, do not map /app/states.
  • If you map /app/Plugins, you must place the plugin content in the corresponding path on the host machine.
  • You can map /app/appsettings.json to the corresponding configuration on the host machine.
  • You must map /app/Plugins/netDNS/netDNS.json to the corresponding configuration on the host machine.

etDNS.json Configuration Example

{
  "DDNS": {
    "enableWatchRouteIp": true,
    "enableIntervalDetectIp": true,
    "provider": "Cloudflare",
    "interval": 300, //300  Every five minutes.
    "loginToken": "{INPUT_YOUR_LOGIN_TOKNE}",
    //"resolver": "8.8.8.8",//not support now.
    "ipUrls": [
      "https://ipecho.net/plain",
      "https://api.ipify.org",
      "https://myip.biturl.top",
      "https://api-ipv4.ip.sb/ip",
      "https://ip.3322.net/", //mainland
      "https://4.ipw.cn", //mainland
      "https://ip.qaros.com/" //mainland
    ],
    "ipStyle": "IPv4",
    "routeEventSetting": {
      "updServicePort": 600,
      "hitRegPartten": "^pppd\\[+\\d+\\]:.*local\\s+IP\\s+address",
      "ipV4RegPartten": "(?<=\\blocal\\s+IP\\s+address\\s+)(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})\\b",
      "ipV6RegPartten": ""
    },

    "domains": [
      {
        "name": "cnemcc.com",
        "subNames": [ "dev", "test", "debug" ]
      }
    ]
  }
}
  • If you are in the Mainland, delete the first four ipUrls configurations.
  • You can configure the logs on your router to be sent to the corresponding port on Docker.

Contributing

Contributions are welcome! Feel free to submit a Pull Request.

About

A plugin for JobAgent that implements DDNS functionality.

Resources

License

Stars

Watchers

Forks

Packages