# node-ddns

> A simple ddns library for NodeJS

Latest version **1.0.1** (published 2021-01-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-ddns
pnpm add node-ddns
yarn add node-ddns
bun add node-ddns
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-01-02 |
| First published | 2021-01-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 45.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 17 |
| Author | Daniel Sörlöv |
| Maintainers | sorlov |
| Keywords | dns |

## Links

- npm: https://www.npmjs.com/package/node-ddns
- Repository: https://github.com/dsorlov/node-ddns
- Homepage: https://github.com/sorlov/node-ddns#readme
- Issues: https://github.com/dsorlov/node-ddns/issues
- npm.io page: https://npm.io/package/node-ddns

## Dependencies (1)

- [dns-packet](https://npm.io/package/dns-packet.md) ^5.2.1

## Recent versions

- 1.0.1 (latest) — 2021-01-02

## README

# node-ddns 

![NPM version](https://img.shields.io/npm/v/node-ddns.svg?style=flat)
![stability-stable](https://img.shields.io/badge/stability-stable-green.svg)
![version](https://img.shields.io/badge/version-1.0.1-red.svg)
![maintained](https://img.shields.io/maintenance/yes/2021.svg)
[![maintainer](https://img.shields.io/badge/maintainer-daniel%20sörlöv-blue.svg)](https://github.com/DSorlov)
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://img.shields.io/github/license/DSorlov/node-ddns)

> A DNS Client, Server and DDNS Implementation in Pure JavaScript, only dependant on [dns-packet](https://github.com/mafintosh/dns-packet) and [node-ip](https://github.com/indutny/node-ip). Huge thanks to [dns2](https://github.com/song940/node-dns) for inspiration and lots of smart code.

### Features

+ UDPClient, TCPClient, TLSClient, DOHClient
+ UDPServer, TCPServer, TLSServer, DOHServer
+ Support a massive amount of record types
+ Supports DNSSEC
+ Extremely lightweight and simple to use
+ Many detailed samples to get you started
+ Supports Dyndns2 update via http if running DOHServer!
+ Basic json-zone-file handing built in

### Installation

```
npm install node-ddns
```

### Example Client

Most simple lookup the A-record for the domain `google.com`.

```js
const ddns = require('node-ddns');
const dns = new ddns();

dns.ResolveA('www.google.com').then((result)=>{
    console.log(result.answers);
}).catch((error)=>{
    console.log(error);
});
```

### Example Server

```js
const ddns = require('../..');
const server = new ddns.UDPServer({port:53});

server.listen().then(()=>{
    console.log(`Listening on ${server.address}:${server.port}`);
})

server.on('request', (request, response, rinfo) => {
    request.questions.forEach(function (question) {
        var answers = [{
            "name":question.name,
            "type":"A",
            "ttl":300,
            "data":"192.168.100.55"}];
        response(ddns.ServerUtilities.createSuccessResponseFromRequest(request,answers));
    });
});
```

Then you can test your DNS server:

```bash
$ dig @127.0.0.1 test.com
```
```bat
c:\> nslookup test.com 127.0.0.1
```

Note that when implementing your own lookups, the contents of the query
will be found in `request.questions[0].name`.

### Examples
```
npm run example-client-simple
npm run example-client-udp
npm run example-client-tcp
npm run example-client-tls
npm run example-client-doh
npm run example-server-udp
npm run example-server-tcp
npm run example-server-tls
npm run example-server-doh
npm run example-server-ddns
npm run example-server-recursive
```

---
_Source: https://npm.io/package/node-ddns · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
