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

ldns

v1.0.0

Published

Local `dns` server for development.

Downloads

5

Readme

ldns

Local dns server for development.

This basically allows you to have wildcard subdomains on your local machine, which /etc/hosts doesn't allow.

Installation

➜ npm install -g ldns

Usage

➜ ldns -h

Usage:

ldns [ <options> ... ]

Options:

--port           Port to bind on.
--zones          Path to JSON file with zones info.
--debug          Switch logging level to debug.
-h, --help       Show this help.
-v, --version    Show ldns version.

Zones

By default the following zones are used.

{
  "dev": {
    "*": "127.0.0.1"
  },
  "docker": {
    "*": "192.168.59.103"
  }
}

These are based on my own use case, where I have a a proxy running on my machine and a docker virtual machine. With the default zones the dev domain (and all its subdomains, ie: app1.dev, app2.dev, ...) will resolve to 127.0.0.1 and the docker domain and all its subdomains resolve to 192.168.59.103.

You can also configure records for subdomains. In the example below vm-1.vms and vm-2.vms resolve to two different IP addresses.

{
  "local": {
    "*": "127.0.0.1"
  },
  "vms": {
    "vm-1": "192.168.59.103",
    "vm-2": "192.168.59.104"
  }
}

Common pitfalls

By default ldns will try to bind to port 53, which means that you need to run ldns as root, otherwise you will get an error like this:

➜ ldns | bunyan
[2015-03-13T22:58:47.214Z] ERROR: ldns/1115 on Lupos-MacBook-Pro-Retina.local: bind EACCES (err.code=EACCES)
    Error: bind EACCES
        at errnoException (dgram.js:458:11)
        at dgram.js:211:28
        at dns.js:72:18
        at process._tickCallback (node.js:442:13)
        at Function.Module.runMain (module.js:499:11)
        at startup (node.js:119:16)
        at node.js:929:3

To run as root on default port (53) and in the background try this:

➜ sudo ldns &>/dev/null &

Or using nohup to dettach the process from the current shell.

➜ sudo nohup ldns &> /dev/null

Otherwise you can specify a higher port number via command line arguments.

➜ ldns --port 15353 | bunyan
➜ ldns --port 15353 --debug | bunyan