npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

quarry-dns

v0.6.2

Published

A rock solid, dynamic DNS server with swappable backends and CRUD API

Downloads

45

Readme

quarry

About

Description

A rock solid, dynamic DNS server with swappable backends and CRUD API. Start Quarry with one of the available persistence layers and manage records and forwarders through the API. Quarry can also be accessed programmatically by requiring it in your code!

Author

Getting Started

Installing

Run npm install -g quarry-dns to install Quarry as an executable

Run npm install quarry-dns --save to install Quarry as a required module for your application

Features

Statsd Integration

Setting --statsd-host will enable Quarry statsd integration. Ship metrics such as:

  • errors

  • forwarder timeouts

  • records

  • forwarders

  • HTTP Response Codes

Various Persistence Layers

  • Disk
  • Memory
  • MongoDB
  • S3
  • Redis

CRUD API

When running Quarry as a standalone executable, records and forwarders are managed through a simple CRUD API.

Module

When requiring Quarry as a module, records and forwarders are managed through exposed functions.

Usage & Examples

Executable

quarry --help can be used for a comprehensive list of available commands and options. To run Quarry on a priviliged port such as 53, it must be start as root. Below are some usage examples:

Disk

sudo quarry disk --file-location /path/to/quarry/config.json

Memory

sudo quarry memory

MongoDB

sudo quarry mongo --mongo-host ds028017.mongolab.com

Redis

sudo quarry redis --redis-host quarry.abcdef.0001.use1.cache.amazonaws.com

S3

sudo quarry s3 --access-key-id $AWS_ACCESS_KEY_ID --secret-access-key $AWS_SECRET_ACCESS_KEY --bucket quarry

Get Records

curl http://quary.server:5353/v1/records -X GET -H "Content-Type: application/json"

Get Record

curl http://quary.server:5353/v1/records/www.domain.com -X GET -H "Content-Type: application/json"

Create Record

curl http://quary.server:5353/v1/records/www.domain.com -X POST -d '{"address": "1.2.3.4", "type": "A", "ttl": 60}' -H "Content-Type: application/json"

Update Record

curl http://quary.server:5353/v1/records/www.domain.com -X PUT -d '{"address": ["1.2.3.4", "5.6.7.8"], "type": "A", "ttl": 60}' -H "Content-Type: application/json"

Delete Record

curl http://quary.server:5353/v1/records/www.domain.com -X DELETE

Get Forwarders

curl http://quary.server:5353/v1/forwarders -X GET -H "Content-Type: application/json"

Get Forwarder

curl http://quary.server:5353/v1/forwarders/8.8.8.8 -X GET -H "Content-Type: application/json"

Create Forwarder

curl http://quary.server:5353/v1/forwarders/8.8.8.8 -X POST -d '{"timeout": 500, "port": 53}' -H "Content-Type: application/json"

Update Forwarder

curl http://quary.server:5353/v1/forwarders/8.8.8.8 -X PUT -d '{"timeout": 1000, "port": 53}' -H "Content-Type: application/json"

Delete Forwarder

curl http://quary.server:5353/v1/forwarders/8.8.8.8 -X DELETE

Module

var Quarry = require("quarry-dns");
var quarry = new Quarry({
    persistence: "memory"
});

if(quarry){
    quarry.listen(function(){
        console.log("quarry is now listening");
    });
}

Disk

var quarry = new Quarry({
    persistence: "disk",
    "file-location": "/tmp/quarry.json"
});

Memory

var quarry = new Quarry({
    persistence: "memory"
});

MongoDB

var quarry = new Quarry({
    persistence: "mongo",
    "mongo-host": "ds028017.mongolab.com"
});

Redis

var quarry = new Quarry({
    persistence: "redis",
    "redis-host": "quarry.abcdef.0001.use1.cache.amazonaws.com"
});

S3

var quarry = new Quarry({
    persistence: "s3",
    "access-key-id": process.env["AWS_ACCESS_KEY_ID"],
    "secret-access-key": process.env["AWS_SECRET_ACCESS_KEY"],
    bucket: "quarry"
});

Get Records

quarry.persistence.get_configuration(function(err, configuration){
    if(err)
        throw err;

    var records = configuration.records;
});

Get Record

quarry.persistence.get_configuration(function(err, configuration){
    if(err)
        throw err;

    var record = configuration.records["www.domain.com"];
});

Create Record

quarry.persistence.create_record("www.domain.com", { address: "1.2.3.4", type: "A", ttl: 60 }, function(err){
    if(err)
        throw err;
});

Update Record

quarry.persistence.update_record("www.domain.com", { address: ["1.2.3.4", "5.6.7.8"], type: "A", ttl: 60 }, function(err){
    if(err)
        throw err;
});

Delete Record

quarry.persistence.delete_record("www.domain.com", function(err){
    if(err)
        throw err;
});

Get Forwarders

quarry.persistence.get_configuration(function(err, configuration){
    if(err)
        throw err;

    var forwarders = configuration.forwarders;
});

Get Forwarder

quarry.persistence.get_configuration(function(err, configuration){
    if(err)
        throw err;

    var forwarder = configuration.forwarders["8.8.8.8"];
});

Create Forwarder

quarry.persistence.create_forwarder("8.8.8.8", { timeout: 500, port: 53 }, function(err){
    if(err)
        throw err;
});

Update Forwarder

quarry.persistence.update_forwarder("8.8.8.8", { timeout: 1000, port: 53 }, function(err){
    if(err)
        throw err;
});

Delete Forwarder

quarry.persistence.delete_forwarder("8.8.8.8", function(err){
    if(err)
        throw err;
});

Contributing

Please feel free to contribute by opening issues and creating pull requests!