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

rainbow-dns

v4.0.0

Published

DNS server with http API

Downloads

18

Readme

DNS Server with http API

:rainbow:-dns is a DNS server with an http API for populating it's records. Inspired by skydns.

Install

npm install -g rainbow-dns

Use

rainbow-dns

CLI Options

--apihost       // API host          (default 127.0.0.1)
--apiport       // API port          (default 8080)
--dnshost       // DNS host          (default 127.0.0.1)
--dnsport       // DNS port          (default 53)
--ttl           // Time To Live      (default 300 -> seconds)
--store         // Records datastore (default mem -> memory)
--domain        // Domain            (default random)
--fwdhost       // Forward host
--fwdport       // Forward port
--static        // Path to static records file
--ipv4-for-ipv6 // Broken linux NODATA response handling crutch

fwdhost

By passing a --fwdhost flag you can forward requests to another dns server if rainbow-dns don't have any matching records.

rainbow-dns --fwdhost 8.8.8.8

static

By passing a --static flag you can inject some static records from a json file.

rainbow-dns --static ./static.json --domain dance.kiwi

// Example static.json
{
    "records" : [
        { "name" : "break",   "A"     : [{"address" : "192.168.1.100"}] }
        { "name" : "popping", "CNAME" : [{"data"    : "break.dance.kiwi"}] }
    ]
}

ipv4-for-ipv6

Due to an issue with some recent linux distributions not properly handling (valid) NODATA responses, you can set the --ipv4-for-ipv6 flag to include A records in response to AAAA requests and thereby working around this issue.

Symptom:

curl app.domain.com
// unable to resolve hostname
curl app.domain.com -4
// 200 OK

API

GET /
    List all records
PUT /{name}
    Add record name.domain
DELETE /{name}
    Delete record name.domain

// Valid json payload
{
    "A"     : [{"address" : "192.168.1.1"},{"address" : "192.168.10.1"}],
    "AAAA"  : [{"address" : "2605:f8b0:4006:802:0:0:0:1010"}]
}

Rainbow-dns supports all record types listed here provided that you include the required properties, with appropriate key and value, for the respective record type. Rainbow-dns will not validate your input and will only eject an error message upon requests if your record data is invalid.

The payload for a CNAME record would look something like this:

{
    "CNAME" : [{"data" : "elsewhere.domain.com"}]
}

Defaults (domain, ttl) can be included in the payload and thereby overwritten by PUTs.

Example cURL

curl -X PUT localhost:8080/database -d '{"A": [{"address" : "192.168.1.10"}], "ttl" : 999}' -H 'Content-Type: application/json'

Example dig

dig @localhost database.polychromatic.mo +short
// 192.168.1.10
dig @localhost polychromatic.mo
// polychromatic.mo.             5   IN  A   192.168.1.10
dig @localhost "*.polychromatic.mo"
// database.polychromatic.mo.    5   IN  A   192.168.1.10

Changelog

4.0.0

  • Fixed issue with case sensitive matching. rainbow-dns's matching is now case insensitive :point_right: rfc 4343. Thanks to @valentin2105 for catching this one! :rainbow: :tada:

3.0.1

  • Advertising recursion (setting ra header), fixes resolving on some platforms

3.0.0

  • Flexible record support (support any record supported by native-dns as long as you set the correct data)
  • Support for CNAME records :tada:
  • Renamed --ipv4-only -> --ipv4-for-ipv6

2.0.0

  • Removed default forward host - if no fwdhost is specified, empty results are returned
  • Added --ipv4-only crazy mode for Docker

1.2.1

  • New and improved query matcher
  • Groups now respond with the same name for all matches (!)

1.2.0

  • Added support for group responses

1.1.3

  • Fixed query match but no ipv4/ipv6 data bug

1.1.2

  • TTL sensitive interval for staticloop (with a minimum for 1s -> same as ttloop)

1.1.1

  • Support relative paths for --static

1.1.0

  • Added support for static records

1.0.0

  • Intial release :tada: