Project 2: Private Relay
Every packet you send carries your IP address, and nearly every connection starts with a DNS lookup that names where you’re going. Your ISP, the Wi-Fi you’re on and your DNS resolver can put those two facts together: this person visited that site. Services like Apple’s iCloud Private Relay, Oblivious DNS and Tor fix this by sending your traffic through two relays run by different operators: the first knows who you are but not where you’re going, and the second knows where you’re going but not who you are.
In Project 2 you build a simplified version of that system in Python.
| Project 2A: Private DNS | Project 2B: Private HTTP | |
|---|---|---|
| What it does | Looks up a name through two relays, so the first doesn’t learn the name and the second doesn’t learn who asked | Carries a browser’s or curl’s web traffic through two relays, so the first doesn’t learn the website and the second doesn’t learn who you are |
| You write | A client, a DNS ingress and a DNS egress | A relay client, an ingress and an egress |
| Transport | UDP: one datagram per message | TCP: byte streams, framing, both directions at once |
| Modeled on | Oblivious DNS over HTTPS (RFC 9230) | iCloud Private Relay, and Tor with two hops instead of three |
| Released | Week 11 · 11/4 | Later in the semester |
| Due | Sun 11/22 · tag dns/N |
Wed 12/9 · tag final/N |
| Guide | 2A: Message flows | 2B: Message flows |
Each part has its own starter repository with a README, the protocol specification, a FAQ and a self-test. The guides above step through every message in each half, byte by byte, showing which parts are encrypted and who can read them.
What to expect
- You work alone on both halves. You can discuss ideas with others, but not share code.
- You don’t design the protocol. Unlike Project 1, everyone implements one fixed specification (
SPEC.mdin each repository). - Much of the code is provided. In each half, the command-line handling and server loops are done, and you write the body of three functions. The encryption is provided too, as four black-box functions:
sealandunsealfor public-key encryption,encryptanddecryptfor shared keys. You never implement cryptography. - The work is in the networking. 2A builds on the UDP sockets you used in Project 1, plus timeouts and a relay that forwards replies it can’t read. 2B moves to TCP, where
recv()can return part of a message, so messages need framing, and each relay has to carry data in both directions at once. - A self-test checks your work as you go. It runs every component on your machine and records what an eavesdropper on each link would see, so it checks the privacy as well as the function.
- There’s one report, at the end. It’s due with 2B and covers both halves, mostly 2B: who knows what, backed by evidence from your components’ logs and a Wireshark capture, and what an attacker could still learn.
- Add-ons give extra credit. 2B lists extensions, such as padding against traffic analysis, three-hop circuits and a traffic-correlation attack, for anyone who wants to go further. They aren’t required but can give extra credit.
You need Python 3.10 or newer and one library, PyNaCl. The README explains how to get this.
Getting started on 2A
Accept the assignment on the accept page, clone the repository it gives you, and read its README. For 2B, use the 2B accept page.
Grading
Project 2 is worth 100 points across both halves:
| Part | Points |
|---|---|
| Project 2A: Private DNS | 30 |
| Project 2B: Private HTTP | 45 |
| Report | 20 |
| Project management: tags pushed on time, files where the grading scripts expect them, a real commit history | 5 |
Most of the code points come from automated tests run against the tag you push. Each repository’s RUBRIC.md has the details.
Late submissions:
- Project 2A receives a flat 5 point deduction if not submitted on time. You can update your submission after its deadline and request a regrade (with the 5 point penalty applied). No regrade requests for 2A will be accepted after the 2B deadline.
- Project 2B will receive a 25 point penalty for each 24 hour period it is late after the deadline.
Using AI tools
The course AI policy applies: AI tools are a supplement to your own thinking, not a replacement for it. Both repositories set AI coding assistants up as tutors: they answer setup and Python questions directly, and help with your own code by asking questions rather than writing it. If you are using AI tools, you must have them follow these guidelines.
The supported environment is using VS Code with either:
- GitHub Copilot – should work with a free GitHub student account
- GitHub Copilot with GW provided model – follow these instructions to set it up
- Claude Code extension or command line tool – requires a paid subscription
- Not tested but should work: Codex and Gemini CLI (try it and report back to me)
If you find the AI agent writing code on your behalf, stop and inform the instructor.