Implementing DNS functionality using chord framework
🚀 Report
Our DNS system builds on top of the Chord protocol, where multiple nodes store DNS records in their storage or local cache. When a user initiates a DNS query, the queried node retrieves the record from its local storage or cache if available. If the record is not present, the system locates the node holding the requested DNS record in the network. If found, that node returns the requested DNS record. Otherwise, a traditional DNS query is performed to obtain the record, which is then inserted into our network for future lookups.
-
Install Go. If you haven't already, you may install it from here.
-
Clone the repository
git clone https://github.com/fauzxan/dns-chord.git cd dns-chord go mod download
-
Navigate to the cloned repository
cd dns-chord
-
Open a terminal for each node you want in the network.
-
Build the project and run the dns-chord executable to start a node.
go build && ./dns-chord
-
Upon running the command, you will be prompted to input the following information:
-
Your current port number: Enter the port number that you want the Chord node to use. This should be a valid port number (e.g., 3000).
-
Full IP address of the node you're using to join the network:
-
-
We also designed a user-friendly interface to interact with the Chord node and gather information about its state, routing, storage, and cache.
-
Press 1 to display the fingertable of the current node.
-
Press 2 to view the successor and predecessor of the current node in the Chord network.
-
Press 5 to query a website using the DNS functionality implemented in the Chord protocol.
-
Press 3 to see the contents stored at the current node. This includes information about the DNS records or any data stored by the node.
-
Press 4 to see the cache - Includes cached results from previous DNS queries.
-
Press m to see the menu
-
To run docker container, just build docker image using
docker build --tag dns-chord-node .
Build a docker volume called mydata (This is not needed anymore)
docker volume create mydata
If successfully built, then run, as well as to bind the volume with the container, run
docker run -v mydata:/app/data -it dns-chord-node
Do note that the -it tag is important to enable interactivity and also see colored output. This mounts the "mydata" volume to the "/app/data" path inside the container.
If you kill the container, then to restart it simply run:
docker start -ai <container_name>
You may close the terminal, and the container will still keep running in the background. You can confirm this behaviour via the log output of the container on docker desktop.