Socket
Book a DemoInstallSign in
Socket

cloudflare-dns-manager

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cloudflare-dns-manager

Easily automate and manage your CloudFlare DNS records with the Node.js CloudFlare DNS Manager library. This powerful tool allows developers to seamlessly interact with CloudFlare's DNS API, enabling automatic management of DNS records within your Node.js

1.0.1
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source
Icon

CloudFlare-DNS-Manager

Easily automate and manage your CloudFlare DNS records with the Node.js and Python3 CloudFlare DNS Manager library. This powerful tool allows developers to seamlessly interact with CloudFlare's DNS API, enabling automatic management of DNS records

Installation

NodeJS required version > 10.2.x

npm install cloudflare-dns-manager@latest

Example:

NodeJS:

const CloudflareAPI = require('cloudflare-dns-manager');

// Replace 'your-email' and 'your-api-key' with your actual CloudFlare credentials
// แทน 'your-email' และ 'your-api-key' ด้วยข้อมูลบัญชี CloudFlare ของคุณ
const cfAPI = new CloudflareAPI('your-email@example.com', 'your-api-key');

// Replace 'your-zone-id' with the actual Zone ID you want to work with
// แทน 'your-zone-id' ด้วย Zone ID ที่คุณต้องการใช้งาน
const zoneId = 'your-zone-id';



(async () => {
	// Example: Add a new DNS record
	// ตัวอย่าง: เพิ่ม record DNS ใหม่
	const targetIp = '192.168.1.1';
	const recordName = 'example.com';
	const recordType = 'A';
	try {
	    const result = await cfAPI.addDnsRecord(targetIp, recordName, recordType, zoneId);
	    console.log(result);
	} catch (error) {
	    console.error(error);
	}
	
	// Example: Get the list of DNS records
	// ตัวอย่าง: ดึงรายการระเบียน DNS
	try {
	    const result = await cfAPI.dnsScan(zoneId);
	    console.log(result);
	} catch (error) {
	    console.error(error);
	}
	
	// Example: Update a DNS record
	// ตัวอย่าง: อัปเดท record DNS
	const updatedIp = '192.168.1.2';
	const recordIdToUpdate = 'record-id-to-update'; // Replace with the actual record ID
	try {
	    const result = await cfAPI.updateDnsRecord(updatedIp, recordName, recordType, zoneId, recordIdToUpdate);
	    console.log(result);
	    // If you want Data only. หากต้องการสำหรับข้อมูลเท่านั้น.
	    console.log(result.data);
	} catch (error) {
	    console.error(error);
	}
	
	// Example: Delete a DNS record
	// ตัวอย่าง: ลบ record DNS
	const recordIdToDelete = 'record-id-to-delete'; // Replace with the actual record ID
	try {
	    const result = await cfAPI.deleteDnsRecord(zoneId, recordIdToDelete);
	    console.log(result);
	} catch (error) {
	    console.error(error);
	}
})();


FAQ

  • How to get cloudflare API ? -> Read here <-
  • Where do i get zoneId ?

Class function infromation

Usage for each function in the class.

Class FunctionArgsResponse json key
dnsScanzoneIdsuccess, exception, message, data
addDnsRecordtargetIp, name, recordType, zoneId, comment, ttlsuccess, exception, message, data
updateDnsRecordtargetIp, name, recordType, zoneId, comment, ttlsuccess, exception, message, data
deleteDnsRecordzoneId, recordIdsuccess, exception, message, data

Inside

graph LR
A[Library] -- Axios --> B(Cloudflare API)
D --Response--> A(Library)
B -- Communication --> D((Cloudfalre DNS))

Update

Python3 library is coming soon

Keywords

Cloudflare

FAQs

Package last updated on 13 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.