-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
1,092 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
types: [ opened, synchronize ] | ||
branches: [ main ] | ||
schedule: | ||
- cron: '29 1 12 * *' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: windows-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v1 | ||
with: | ||
languages: javascript | ||
|
||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v1 | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules/ | ||
package-lock.json | ||
yarn.lock | ||
/src/daemon/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# test directories | ||
__tests__ | ||
test | ||
tests | ||
powered-test | ||
|
||
# asset directories | ||
docs | ||
doc | ||
website | ||
images | ||
assets | ||
|
||
# examples | ||
example | ||
examples | ||
|
||
# code coverage directories | ||
coverage | ||
.nyc_output | ||
|
||
# build scripts | ||
Makefile | ||
Gulpfile.js | ||
Gruntfile.js | ||
|
||
# configs | ||
appveyor.yml | ||
circle.yml | ||
codeship-services.yml | ||
codeship-steps.yml | ||
wercker.yml | ||
.tern-project | ||
.gitattributes | ||
.editorconfig | ||
.*ignore | ||
.eslintrc | ||
.jshintrc | ||
.flowconfig | ||
.documentup.json | ||
.yarn-metadata.json | ||
.travis.yml | ||
|
||
# misc | ||
*.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# DNS Provider Instructions | ||
|
||
## [Dynu](https://www.dynu.com/) | ||
|
||
To obtain your access key and domain ID: | ||
1. Go to https://www.dynu.com/en-US/ControlPanel/APICredentials. | ||
2. In "API Credentials" section, click "View" icon in Action column for API Key. | ||
3. The key is now displayed. Use it as accessKey in settings.json. | ||
4. In a command window, run 'curl https://api.dynu.com/v2/dns -H "API-Key:ACCESSKEY"'. If not already | ||
installed, curl can be downloaded from https://curl.se/windows/. | ||
5. The returned string is in JSON format. Under "domains", each domain entry comes with id, name, along with | ||
other properties. Find the id value for the domain name you want to update. | ||
6. Use this id as domainID in settings.json. | ||
|
||
API to update IP address: | ||
|
||
POST https://api.dynu.com/v2/dns/{DOMAINID} | ||
|
||
Header: "API-Key: {ACCESSKEY}" | ||
|
||
Body: { "name": "{DOMAINNAME}"[, "ipv4Address": "ddd.ddd.ddd.ddd"][, "ipv6Address": "xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx"] } | ||
|
||
## [FreeDNS](https://freedns.afraid.org/) | ||
|
||
To enable programmically updating DNS entry and obtain your access key: | ||
1. Go to https://freedns.afraid.org/dynamic/v2/. | ||
2. Select the domain(s) you want to enable. | ||
3. Make sure you select "Enable Dynamic DNS..." in Action dropdown list. | ||
4. Click "Apply" button. | ||
5. These domains should now appear under "Active dynamic entries" section. | ||
6. For the domain you want to update, grab the API key in the URL shown in the last column. It is the last | ||
segment in the URL displayed, i.e. http://sync.afraid.org/u/{ACCESSKEY}/. | ||
7. Use this key as accessKey in settings.json. | ||
8. domainID in settings.json is not needed. FreeDNS assigns unique API key per domain. | ||
|
||
API to update IP address: | ||
|
||
GET http://[v6.]sync.afraid.org/u/{ACCESSKEY}/?ip=[ddd.ddd.ddd.ddd][xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx] | ||
|
||
## [DuckDNS](https://www.duckdns.org/) | ||
|
||
To obtain your access key and domain ID: | ||
1. Go to https://www.duckdns.org/ | ||
2. "token" displayed on this page (near the top) is the API token. Use it as accessKey in settings.json. | ||
3. Domains are listed below. The first column is domain ID. It is essentially the subdomain name in | ||
DOMAINID.duckdns.org. | ||
4. Use this id as domainID in settings.json. | ||
|
||
API to update IP address: | ||
|
||
GET https://www.duckdns.org/update?domains={DOMAINID}&token={ACCESSKEY}[&ip=ddd.ddd.ddd.ddd][&ipv6=xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx] | ||
|
||
## [YDNS](https://ydns.io/) | ||
|
||
To obtain your access key: | ||
1. Your access key is either your account username:password, or API username:password which can be found here: | ||
https://ydns.io/user/api. | ||
|
||
For example, if your email is "[email protected]" and password is "MySuperSecretPwd" then use | ||
"[email protected]:MySuperSecretPwd" as accessKey in settings.json. | ||
2. domainID in settings.json is not needed. YDNS uses domain name to update. | ||
|
||
API to update IP address: | ||
|
||
GET https://ydns.io/api/v1/update/?host={DOMAINNAME}&ip=[ddd.ddd.ddd.ddd][xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx] | ||
|
||
Header: "Authorization: Basic {base64-encoded ACCESSKEY}" | ||
|
||
## [No-IP](https://www.noip.com/) | ||
|
||
To obtain your access key: | ||
1. Your access key is username:password. See [YDNS](#ydns-httpsydnsio) section for example. | ||
2. domainID in settings.json is not needed. NoIP uses domain name to update. | ||
|
||
API to update IP address: | ||
|
||
GET https://dynupdate.no-ip.com/nic/update?hostname={DOMAINNAME}[&myip==ddd.ddd.ddd.ddd][&myipv6=xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx] | ||
|
||
Header: "Authorization: Basic {base64-encoded ACCESSKEY}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Update-Dynamic-DNS-with-VPN | ||
![Apache 2.0 License](https://img.shields.io/badge/License-Apache%202.0-yellow) | ||
![node.js 10+](https://img.shields.io/badge/node.js-10.16.3-blue?logo=node.js) | ||
![Latest Release](https://img.shields.io/github/v/release/blu3mania/update-dynamic-dns-with-vpn) | ||
|
||
Auto update a dynamic DNS registration based on a given network interface, such as VPN. **Note**, it does | ||
not update dynamic DNS with your public IP. If that's what you are looking for, there are already many other | ||
apps doing just that. | ||
|
||
It can be run as a standalone application or as a Windows service. When running in standalone mode, it can | ||
also be used to just monitor a network interface without auto DNS update. | ||
|
||
## Run these steps first: | ||
|
||
1. One of the packages, "ffi-napi", uses native modules and relies on "node-gyp" to build the project. As a | ||
result, there are some prerequisites that need to be installed/configured. Please refer to [node-gyp's | ||
instructions](https://github.com/nodejs/node-gyp#installation). | ||
2. Run "npm run show \[addessFamily\]" or "node src/show-interfaces.js \[addessFamily\]". | ||
|
||
addessFamily is optional, which can be "ipv4" or "ipv6" if you only care about one type of IP address. | ||
Shortened forms of parameter are accepted as well, which are "4", "6", "v4", "v6". | ||
|
||
Find the network interface you want to monitor, and note down the key to that interface, e.g. "Local Area | ||
Connection", "Wi-Fi". | ||
3. Edit src/settings.json. | ||
* networkInterface is the network interface you wrote down in the previous step. | ||
* addressFamily is the IP address family to monitor and register on dynamic DNS. | ||
|
||
Valid values are "IPv4" and "IPv6". | ||
* dnsProvider is the provider of your domain. | ||
|
||
Supported values are: "Dynu", "FreeDNS", "DuckDNS", "YDNS", "NoIP". | ||
|
||
**Note**, if only using the script to monitor a network interface, leave this setting empty. | ||
* domainName is the domain name to be updated on that provider. | ||
* domainID is the ID assigned to the given domain by that provider. | ||
|
||
Not all providers support this. Some of them map access key to individual domains or simply use domain | ||
name as id. | ||
* accessKey is the access key or token assigned by the DNS provider that can be used to update your domain. | ||
|
||
How to obtain this info is provider specific. Please refer to [DNS Provider Instructions](DNS-Providers.md). | ||
* showNotification allows showing Windows notification when an action is taken, such as domain is updated | ||
in provider, or domain update is queued (due to update interval). | ||
|
||
**Note**, this only works when running in standalone mode instead of as a Windows service. | ||
* notificationTypes is an array of string values that defines what types of notification should be shown. | ||
|
||
Supported values are: "DNS Registration", "Scheduled DNS Registration", "IP Changed", "IP Assigned", "IP | ||
Removed". | ||
4. Run "npm install". Accept UAC prompts if any (there could be up to 4). "npm link" can be used as well, | ||
which will create a command "showip" that can be used as a shortcut to "src/show-interfaces.js". | ||
|
||
**Note**, this step installs the script as a Windows service. If it's not desired, run "npm run uninstall" | ||
afterwards. | ||
|
||
## To run the script manually: | ||
|
||
Run "npm start" or "node src/app.js". | ||
|
||
## To install and run the script as a Windows service: | ||
|
||
Run "npm run install" or "node src/install-service.js". Accept UAC prompts if any (there could be up to 4). | ||
|
||
**Note**, if settings.json is updated when service is running, restart it in Windows Services control panel. | ||
|
||
## To uninstall the Windows service: | ||
|
||
Run "npm run uninstall" or "node src/uninstall-service.js". Accept UAC prompts if any (there could be up to 4). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"name": "update-dynamic-dns-with-vpn", | ||
"version": "1.0.0", | ||
"description": "Automatically update a dynamic DNS registration based on a given network interface, such as VPN", | ||
"main": "src/app.js", | ||
"scripts": { | ||
"start": "node src/app.js", | ||
"install": "node src/install-service.js", | ||
"uninstall": "node src/uninstall-service.js", | ||
"show": "node src/show-interfaces.js" | ||
}, | ||
"bin": { | ||
"showip": "src/show-interfaces.js" | ||
}, | ||
"keywords": [ | ||
"dynamic", | ||
"dns", | ||
"dynamic-dns", | ||
"network-interface", | ||
"vpn" | ||
], | ||
"author": "blu3mania <[email protected]>", | ||
"license": "Apache-2.0", | ||
"homepage": "https://github.com/blu3mania/update-dynamic-dns-with-vpn#readme", | ||
"bugs": { | ||
"url": "https://github.com/blu3mania/update-dynamic-dns-with-vpn/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/blu3mania/update-dynamic-dns-with-vpn.git" | ||
}, | ||
"os": [ | ||
"win32" | ||
], | ||
"dependencies": { | ||
"chalk": "^4.1.0", | ||
"ffi-napi": "^3.1.0", | ||
"node-notifier": "^9.0.0", | ||
"node-windows": "^1.0.0-beta.5" | ||
}, | ||
"devDependencies": {}, | ||
"resolutions": { | ||
"**/minimist": "^1.2.5" | ||
} | ||
} |
Oops, something went wrong.