https://github.com/nasriyasoftware/nasriyadns
DNS manager for your domains
https://github.com/nasriyasoftware/nasriyadns
a-record dns ip ip-address ipaddress proxy
Last synced: 2 months ago
JSON representation
DNS manager for your domains
- Host: GitHub
- URL: https://github.com/nasriyasoftware/nasriyadns
- Owner: nasriyasoftware
- License: other
- Created: 2024-03-01T06:36:38.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-17T18:45:24.000Z (10 months ago)
- Last Synced: 2025-04-14T12:07:50.513Z (2 months ago)
- Topics: a-record, dns, ip, ip-address, ipaddress, proxy
- Language: TypeScript
- Homepage: https://nasriya.net
- Size: 245 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
[](https://nasriya.net)
# NasriyaDNS.
[-blue)](https://github.com/nasriyasoftware/NasriyaDNS?tab=License-1-ov-file)   [](link-to-your-status-page)
##### Visit us at [www.nasriya.net](https://nasriya.net).NasriyaDNS is a DNS manager for your domains.
Made with ❤️ in **Palestine** 🇵🇸
> [!IMPORTANT]
> 🌟 **Support Our Open-Source Development!** 🌟
> We need your support to keep our projects going! If you find our > work valuable, please consider contributing. Your support helps us > continue to develop and maintain these tools.
>
> **[Click here to support us!](https://fund.nasriya.net/)**
>
> Every contribution, big or small, makes a difference. Thank you for > your generosity and support!
___
If your server is running behind a dynamic IP address you can make use of **Nasriya DNS manager** to update the [DNS records](https://www.cloudflare.com/learning/dns/dns-records/) of your domain.**Notes:**
- **NasriyaDNS** is part of [HyperCloud](https://www.npmjs.com/package/@nasriya/HyperCloud)'s HTTP2 server framework.
___
## Quick Start Guide### Installation
```shell
npm i @nasriya/dns
```### Importing
Import in **ES6** modules
```ts
import hyperCloudDNS from '@nasriya/dns';
```Import in **CommonJS (CJS)**
```js
const hyperCloudDNS = require('@nasriya/dns').default;
```
### Usage
Start by getting the new IP address:
```ts
// Get the machine's public IP
const public_ip: string = await hyperCloudDNS.helpers.getPublicIP();
```##### DuckDNS
```ts
// Initialize a provider:
const duckdns: DuckDNSManager = hyperCloudDNS.duckdns(process.env.DUCKDNS_API_TOKEN);// Update the IP address
await duckdns.records.update('', public_ip);
```##### Cloudflare
```ts
import hyperCloudDNS from "nasriya-dns";
const cloudflare = hyperCloudDNS.cloudflare(process.env.CLOUDFLARE_API_TOKEN);// If you know the Zone ID of your domain, uncomment the below line
// const zone_id = process.env.CLOUDFLARE_ZONE_ID;// If you don't know the Zone ID. Comment the following 4 lines if you do
const zone_id: string = await cloudflare.zone.list({
accountName: '',
just_ids: true
}).then(list => list[0]) as string;// Get all A records:
const records = await cloudflare.records.list(zone_id, {
type: 'A',
simplified: true
})// Prepare the promises
const promises = records.map(record => {
return new Promise((resolve, reject) => {
cloudflare.records.update({
zone_id,
record,
record_id: record.id,
}).then(res => resolve(res)).catch(err => reject(err));
})
})// Invoke promises
await Promise.allSettled(promises).then(res => {
const fulfilled = (res.filter(i => i.status === 'fulfilled') as unknown as PromiseFulfilledResult[]).map(i => i.value);
const rejected = (res.filter(i => i.status === 'rejected') as unknown as PromiseRejectedResult[]).map(i => i.reason);if (fulfilled.length === res.length) {
return Promise.resolve({ status: 'success', result: fulfilled });
} else {
return Promise.resolve({ status: 'failed', result: rejected });
}
})
```
___
## License
Please read the license from [here](https://github.com/nasriyasoftware/NasriyaDNS?tab=License-1-ov-file).