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-server2

v1.0.4

Published

A node dns server

Downloads

2

Readme

Introduction

A simple Node DNS Server proxy based on Pēteris Ņikiforovs tutorial

Features

  • Create a static file with static address for each hostname that you want
  • Create your docker containers with HOSTNAMES env, example: HOSTNAMES=dev.mageddo.com, blog.mageddo.com then access these hostnames in browser
  • DNS try to solve the hosts from docker containers then from records.json file then from 3rd remote DNS servers one by one
  • Cache for remote DNS increasing internet velocity, and options to enable/disable
  • List docker containers using http://dns.mageddo:5380/containers
  • List cached hosts using http://127.0.0.1:5380/cache(without docker) or http://dns.mageddo:5380/cache (with docker)
  • Change DNS server ip, or GUI editor IP

Running

Running without docker

you can not have other dns running on 53 port, in some tests I discover that the DNS not work as well on another port

Build the project

npm install

Starting the server

sudo npm start

setting this DNS as default DNS

sudo echo 'nameserver <127.0.0.1 or docker container ip>' > /etc/resolv.conf

Running on docker

From 1.4.0 setup resolv.conf is not needled, is automatically

setup it

$ npm install # install dependencies
$ ./gradlew build # build docker image and run the container starting the app

Testing if DNS is working

$ host google.com 127.0.0.1
Using domain server:
Name: 127.0.0.1
Address: 127.0.0.1#53
Aliases:

See binded hostnames with containers

$ curl -X GET dns.mageddo:5380/containers
container=/docker-dns-server, domain=dns.mageddo

Adding manual DNS entries

you can create/edit conf/records.json (based on records.samples.json) manually or use the Gui Editor

Gui editor

the password is cat

A entry example

For more details see conf/records.sample.json

records.json

{
  "remoteDns": [
    { "address": "8.8.8.8", "port": 53, "type": "udp" }
  ],
  "entries" : [
    {
      "records": [
        {
          "type": "A",
          "address": "127.0.0.1",
          "ttl": 300,
          "name": "testing.mageddo.com"
        }
      ],
      "domain": "testing.mageddo.com"
    }
  ]
}

testing on terminal

$ host testing.mageddo.com 127.0.0.1
Using domain server:
Name: 127.0.0.1
Address: 127.0.0.1#53
Aliases: 

testing3.mageddo.com has address 127.0.0.1
testing3.mageddo.com has address 127.0.0.1
testing3.mageddo.com has address 127.0.0.1

Changing default ports

After create your records.json file edit the variables uiPort and dnsServerPort then restart the DNS server

APIs

Containers - Show mapped containers

$ curl -X GET http://dns.mageddo:5380/containers
container=/docker-dns-server, ip=172.17.0.2, domain=dns.mageddo
container=/mageddo-jenkins, ip=172.17.0.3, domain=jenkins.mageddo.dev

Cache - List data

$ curl -X GET http://dns.mageddo:5380/v1/cache
{
"www.google.com-1": {
	"header": {
		"id": 12286,
		"qr": 1,
		"opcode": 0,
		"aa": 0,
		"tc": 0,
		"rd": 1,
		"ra": 1,
		"res1": 0,
		"res2": 0,
		"res3": 0,
		"rcode": 0
	},
	"question": [
		{
			"name": "www.google.com",
			"type": 1,
			"class": 1
		}
	],
	"answer": [
		{
			"name": "www.google.com",
			"type": 1,
			"class": 1,
			"ttl": 231,
			"address": "216.58.222.100"
		}
	],
	"authority": [
		{
			"name": "google.com",
			"type": 2,
			"class": 1,
			"ttl": 101725,
			"data": "ns2.google.com"
		}
	],
	"additional": [
		{
			"name": "ns4.google.com",
			"type": 1,
			"class": 1,
			"ttl": 101725,
			"address": "216.239.38.10"
		}
	],
	"edns_options": [],
	"_socket": {
		"address": "201.6.2.124",
		"family": "IPv4",
		"port": 53,
		"size": 184
	},
	"creationDate": "2016-10-01T16:27:41.734Z"
}

$ curl -X GET http://dns.mageddo:5380/v2/cache
{
	size: 10, // how many keys has been cached
	keys: "keys": ["www.google.com-1"], // the key array
	data: {} // the data of version 1
}

License

This project is released under version 2.0 of the [Apache License][]. [Apache License]: http://www.apache.org/licenses/LICENSE-2.0

Credits