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

dns-proxy

v1.1.0

Published

Simple DNS Proxy written in Node.JS. Override hosts, domains, or tlds.

Downloads

27

Readme

CircleCI npm npm David David

DNS Proxy

Simple DNS Proxy written in Node.JS

Designed to allow you to override hosts or domains with specific answers or override tlds, or domains to use different nameservers. Useful when using VPN connections with split DNS setups.

This app makes use of the rc module for configuration, the default configuration is below, use any file location to override the defaults. Appname is dnsproxy when creating a configuration file.

I can guarentee this app isn't perfect but fulfills my current needs for routing certain domains to private IP name servers when on VPN.

Install

Grab a binary from the release section.

OLD METHOD

npm install -g dns-proxy

Features

  • Override nameservers for TLD
  • Override nameservers for Domain
  • Set IP for entire domain or TLD. (example: if you want to answer 192.168.11.1 for local.dev)
  • Set IP for host
  • Wildcard Support

Examples

For nameserver overrides if an answer isn't received by a threshold (350ms by default) DNS proxy will fallback to one of the default nameservers provided in the configuration (by default 8.8.8.8 or 8.8.4.4)

TLD Specific Nameserver

This will send all .com queries to 8.8.8.8 and .dk queries to 127.0.0.1 and custom port 54.

"servers": {
  "com": "8.8.8.8",
  "dk": "127.0.0.1:54"
}
  • This is a snippet that will go into your rc config file.

Domain Specific Nameserver

This will match all google.com and its subdomains.

"servers": {
  "google.com": "8.8.8.8"
}
  • This is a snippet that will go into your rc config file.

Domain Specific Answers

This will match all of google.com and its subdomains and return 127.0.0.1 as the answer. This technically doens't even have to be a real domain or a full domain, if you configure ogle.com and do a lookup on google.com, the ogle.com will match.

"domains": {
  "google.com": "127.0.0.1"
}

Wildcard Domain Specific Answers

this will resolve review-someotherstring.google.com to 127.0.0.1

"domains": {
  "review-*.google.com": "127.0.0.1"
}

Aliases

Domains and Hosts support aliases now, whereby you can define a host like normal such as "hi": "127.0.0.1" and in another entry reference it like "hello": "hi".

Default Configuration

This is the default configuration in the application, you should override this by creating the proper rc file in one of the searchable paths.

{
  port: 53,
  host: '127.0.0.1',
  logging: 'dns-proxy:query',
  nameservers: [
    '8.8.8.8',
    '8.8.4.4'
  ],
  servers: {},
  domains: {
    'dev': '127.0.0.1'
  },
  hosts: {
    'devlocal': '127.0.0.1'
  }
}
  • Note this snippet is JavaScript and rc config file format is JSON.

Logging

Logging is handled by the simple lightweight debug package. By default all queries are logged. To change the logging output update the logging variable to any of the following: dns-proxy:error, dns-proxy:query, dns-proxy:debug. You can specify all or none, separate using a comma, a wildcard can be used as well.

Running as a Service

OSX

You can copy the resources/launchd.plist file into /Library/LaunchDaemons as com.github.ekristen.dns-proxy.plist. To start just run sudo launchctl load /Library/LaunchDaemons/com.github.ekristen.dns-proxy.plist. This will also make the dns-proxy service to start on boot.