This is a finished Java implementation for the codecrafters "Build Your Own DNS server" Challenge. This code implements functionality for all stages (and extensions) of the challenge as of 2025-02-13.
- Respond to multiple questions with a hardcoded
Arecord of8.8.8.8. - Handle compressed label sequences in questions.
- Forward queries for
Arecords to an upstream resolver specified with--resolver <address>on the command line. That upstream resolver must:- Always respond with an answer section for the queries.
- Generate a response that does not contain other sections like (authority section and additional section)
- Only respond when there is only one question in the question section (this DNS server handles splitting questions into multiple packets then merges the answers into a single response packet).
You will need Java 23 (or later) and maven installed to run this code. The program can then be run with:
./your_program.sh --resolver <optional-upstream-ressolver>
A short video of the code being run in the codecrafters test environment: