Code Monkey home page Code Monkey logo

dns-server's Introduction

A simple low-level DNS resolver

This project consists of a DNS server written from scratch in Rust, based on RFCs 1034 and 1035. The server listens for a stream of bytes representing the DNS message on a UDP port, decodes it, looks for a resource record (RR) matching the query, and returns the encoded information back to the origin. The resource record is currently being held in records.json.

The server can be run by passing the port as an argument. You can pick any as long as it's not being used or reserved.

cargo run 1053

Its functionality can be tested with a tool like dig on localhost and the specific port. In the following example, we are asking the server for the A records of the domain name example.com.

dig +retry=0 -p 1053 @127.0.0.1 +noedns example.com A

Records

A records for amazon.co.uk stored in records.json.

Input and output stream

Stream of bytes from the query and the response message sent back to the origin. As we can see, one response has been sent for each RR, which corresponds to the ones in records.json.

Using dig

Interpretation of the DNS message by the dig tool.

Further reading

A detailed overview of the project can be found in this paper.

dns-server's People

Contributors

viktaur avatar

Watchers

 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.