Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/amirhnajafiz/mockapetris
Implementing a DNS server with Golang programming language
https://github.com/amirhnajafiz/mockapetris
dns dns-server golang mockapetris redis
Last synced: about 2 months ago
JSON representation
Implementing a DNS server with Golang programming language
- Host: GitHub
- URL: https://github.com/amirhnajafiz/mockapetris
- Owner: amirhnajafiz
- Created: 2022-04-30T06:20:15.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-08-31T07:06:21.000Z (over 2 years ago)
- Last Synced: 2024-06-21T06:18:36.056Z (7 months ago)
- Topics: dns, dns-server, golang, mockapetris, redis
- Language: Go
- Homepage:
- Size: 87.9 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
MockapetrisImplementing a DNS server with Golang programming language. Mockapetris uses a local cache and saves the records of host,ip pairs
in that cache. After that it listens on port **8090** for our requests
to get the domain name and return the ip address of that domain.The connection protocol is UDP and our main server is a DNS type A.
Our service also provides a root server where you can control the DNS. You
can add or remove records in the DNS cache.## Run DNS server
You can run the DNS server by the following command:
```shell
go run main.go
```After that you will have the following services:
- DNS server: 127.0.0.1:8090
- Root server: 127.0.0.1:1230## Requests
You can edit the records by the following requests:#### Add new record
```shell
curl -X POST -H "Content-Type: application/json" \
-d '{"url": "[host]", "ip": "[IP]"}' \
http://localhost:1230/put
```#### Remove record
```shell
curl -X POST -H "Content-Type: application/json" \
-d '{"url": "[host]"}' \
http://localhost:1230/del
```## Test DNS server
You can test the dns server with the following command:
```shell
nslookup www.google.com localhost -port=8090
```