Giter Site home page Giter Site logo

rcdns's Introduction

rcdns

This is a work in progress DNS server I wrote to learn more about DNS. It's written in C++17 and targets Ubuntu 22.04.

Demo with opt build mode:

~/dev/rcdns main
❯ ./bazel-bin/src/rcdns&
[1] 492513
I20230924 01:39:02.572237 492513 main.cpp:89] Starting server with port: 54532 dns_address: 8.8.8.8 ns_address: 198.41.0.4
❯ dig @127.0.0.1 -p 54532 +noedns www.google.com

; <<>> DiG 9.18.12-0ubuntu0.22.04.3-Ubuntu <<>> @127.0.0.1 -p 54532 +noedns www.google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 30446
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: Message has 450 extra bytes at end

;; QUESTION SECTION:
;www.google.com.			IN	A

;; ANSWER SECTION:
www.google.com.		8	IN	A	142.251.32.68

;; Query time: 7 msec
;; SERVER: 127.0.0.1#54532(127.0.0.1) (UDP)
;; WHEN: Sun Sep 24 01:39:22 EDT 2023
;; MSG SIZE  rcvd: 512

Build

Build Dependencies

g++-9.3.0 or clang++-10
ninja or GNU Make
clang-tidy
ccache
bazel
lld

Libraries

ASIO (non-Boost)
googletest
glog
abseil

Building the project

Bazel

Build optimized binary:

bazel build  --compilation_mode=opt --features=asan --features=ubsan //src:rcdns

Build debug binary:

bazel build  --compilation_mode=dbg --features=asan --features=ubsan //src:rcdns

Build tests:

bazel build  --compilation_mode=dbg --features=asan --features=ubsan //src:all_tests

Running the project

The following are examples of running artifacts produced by debug builds of the project

Running the project

./bazel-bin/src/rcdns
OR
bazel run  --compilation_mode=dbg --features=asan --features=ubsan //src:rcdns

Running tests

Tests can be run by executing the all_tests binary in the build directory.

./bazel-bin/src/all_tests
OR
bazel run  --compilation_mode=dbg --features=asan --features=ubsan //src:all_tests

Compile commands

bazel run @hedron_compile_commands//:refresh_all

References

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.