Coder Social home page Coder Social logo

redirect2me / which-dns Goto Github PK

View Code? Open in Web Editor NEW
408.0 11.0 7.0 131 KB

Detects which DNS server is being used - https://which.nameserve.rs/

Home Page: https://which.nameserve.rs/

License: GNU Affero General Public License v3.0

Go 99.25% Shell 0.75%
dns resolver dns-resolver nameserver

which-dns's Introduction

Which DNS: DNS Resolver Detection Which DNS Logo

This is a combined DNS+HTTP server that shows which DNS server a computer is using.

How does it work?

  1. You make a request to a hostname with a unique prefix.
  2. All hostnames resolve to the same IP, but the DNS server records which IP address the query came from.
  3. The webserver looks for this record and returns it.

Using

My server is running at which.nameserve.rs.

Be forewarned: it is running on the cheapest box I could find with a static IP. You can hit it for light, non-commercial use. I specifically made the API be JSONP only (i.e. you need to provide a callback parameter), so if you abuse it, bad things will happen to your clients!

Make an HTTPS request to GUID.which.nameserve.rs/api.json?callback=myfunction. The GUID should be a unique string (not necessarily an actual GUID), different for every call. It will call myfunction with an object that has the following fields:

  • success - boolean if it succeeded or not
  • output - the result (if it succeeded)
  • message - the error message (if it failed)
  • source - the source IP address (useful for detecting self-hosted DNS)

You can see it in action on the home page of resolve.rs.

Running your own copy

You need a static IP address to run this server.

Then you need to decide on two host names:

  • hostname is the name of the subdomain that this server will own (for example: which.example.com)
  • nshostname is the name of the authoritative name server for the subdomain (for example: which-dns.example.com)

They will both be served by the same server and at the same IP address.

The following DNS records need to be added to the main domain (for the above examples this would be example.com):

  • A for the nshostname pointing to the static IP
  • NS for the hostname pointing to the nshostname

The program needs access to the following ports:

  • 53: for DNS
  • 80: for HTTP
  • 443: for HTTPS

The following parameters are required:

  • email: the email address for your account with Let's Encrypt (and the SOA record)
  • hostname: the hostname that you picked
  • ipaddress: the public IP address of the server
  • nshostname: the nshostname that you picked

Optional parameters:

  • disclaimer: text to include in every response (for example: "no commercial use")
  • proxy: true if behind a trusted proxy (uses X-Forwarded-For header)

License

GNU Affero General Public License v3.0

Credits

certmagic Digital Ocean Git Github golang GoatCounter Let's Encrypt svgrepo Ubuntu water.css

Alternatives

I wasn't the first person to come up with this idea. Here are some other public sites that do the same thing:

which-dns's People

Contributors

amarcuse avatar birdie0 avatar fileformat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.