• Stars
    star
    3,283
  • Rank 13,116 (Top 0.3 %)
  • Language
  • License
    MIT License
  • Created almost 8 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A guide to writing a DNS Server from scratch in Rust

Building a DNS server in Rust

The internet has a rich conceptual foundation, with many exciting ideas that enable it to function as we know it. One of the really cool ones is DNS. Before it was invented, everyone on the internet - which admittedly wasn't that many at that stage - relied on a shared file called HOSTS.TXT, maintained by the Stanford Research Institute. This file was synchronized manually through FTP, and as the number of hosts grew, so did the rate of change and the unfeasibility of the system. In 1983, Paul Mockapetris set out to find a long term solution to the problem and went on to design and implement DNS. It's a testament to his genius that his creation has been able to scale from a few thousand computers to the Internet as we know it today.

With the combined goal of gaining a deep understanding of DNS, of doing something interesting with Rust, and of scratching some of my own itches, I originally set out to implement my own DNS server. This document is not a truthful chronicle of that journey, but rather an idealized version of it, without all the detours I ended up taking. We'll gradually implement a full DNS server, starting from first principles.

Samples

Each chapter has a corresponding sample which contains the full code up to that point in the guide, named sample1.rs through sample5.rs. These can be run using, for first chapter, cargo run --example sample1.

Revision History

  • June 2020 - Fixed a security vulnerability in read_qname which allowed for a malicious packet to trigger an infinite loop. Modernized the code to conform to current rust practices, and fixed various ugly inefficiencies.
  • July 2016 - Initial version

More Repositories

1

hermes

compact dns server in rust
Rust
79
star
2

tregmine

The tregmine plugins
Java
8
star
3

SassyBarista

Early stage java-clone of SASS
Java
8
star
4

candify

A spotify client (libspotify-based) that implements some primitive visualizations
C++
5
star
5

QuadTree

An implementation of a Rectangle QuadTree that can be used for quickly finding in which rectangle a point falls. Intended for MineCraft use.
Java
4
star
6

UglyLang

Toy programming language
Java
3
star
7

mosaic

A small c-program that builds image mosaics
C
2
star
8

imageretarget

Java-implementation of the seam carving algorithm
Java
2
star
9

fatcat

An irc server written in java
Java
2
star
10

projecteuler

My project euler solutions
Python
2
star
11

dockerdemo

JavaScript
1
star
12

cropper

Program for cropping images
C++
1
star
13

expiler

jvm bytecode generation showcase
Java
1
star
14

nsfu

Toy tls 1.3 implementation based on ring
Rust
1
star
15

calculator

A simple attempt at parsing arbitrary expressions in java
Java
1
star
16

emilhernvall.github.com

Homepage repository
HTML
1
star
17

flagrant

Rust
1
star
18

3DEngine

Ridiculously unoptimized software rasterizer in java, done as a learning project.
Java
1
star
19

catahya

What was supposed to one day be catahya 2
PHP
1
star
20

playlistcopy

Small program for copying or moving the files in a playlist to a new directory
C++
1
star
21

collapsible

Lousy DirectDraw-based Tetris clone
C++
1
star
22

chatclient

A badly working irc client for win32
C++
1
star
23

rust-course-2022

Rust
1
star
24

hostimg

Work in progress image hosting solution
Rust
1
star
25

pacman

pacman clone in javascript
JavaScript
1
star
26

flourbot6

An old irc bot I write in C. Integrates spidermonkey for javascript scripting.
C
1
star
27

subsurface

Sinkship inpsired submarine warfare game for demonstrating react, websockets and svg
TypeScript
1
star
28

cesium

Version control for MySQL schemas
ANTLR
1
star
29

triportreat

Rust
1
star