Skip to content

Latest commit

 

History

History
76 lines (55 loc) · 2.15 KB

README.md

File metadata and controls

76 lines (55 loc) · 2.15 KB

mDNS

CI   Release to Docker Hub   License  

mDNS is a lightweight application capable of processing dns queries and managing dns zones through a rest api. With the rest api, you can add, modify, and delete dns zones, records, and server settings. All operations are performed through http requests, making dns server management convenient and flexible.

Usage

Open 53 ports in your firewall:

sudo ufw enable
sudo ufw allow 53/tcp
sudo ufw allow 53/udp

Get the script:

curl -O https://raw.githubusercontent.com/MarlikAlmighty/mdns/master/ubuntu-server-install.sh

Make it executable:

sudo chmod +x ubuntu-server-install.sh

Then run it:

sudo ./ubuntu-server-install.sh

Docker

docker run -it --rm -p 53:53/udp -p 53:53/tcp -p 8081:8081 -d marlikalmighty/mdns

Request examples

# Add domain
curl -X POST http://127.0.0.1:8081/dns -H 'Content-Type: application/json' \
-d '{"domain":"example.com.", "ipv4s":["127.0.0.1"]}'

# List all domains
curl http://127.0.0.1:8081/dns

# List one domain
curl http://127.0.0.1:8081/dns/example.com.

# Update domain
curl -X PUT http://127.0.0.1:8081/dns -H 'Content-Type: application/json' \
-d '{"domain":"example.com.", "ipv4s":["127.0.0.2", "127.0.0.3"]}'

# Delete domain
curl -X DELETE http://127.0.0.1:8081/dns -H 'Content-Type: application/json' \
-d '{"domain":"example.com."}'

API Documentation

$ swagger serve ./swagger-api/swagger.yml

How to generate server

Be careful, core methods will be overwritten.

$ swagger generate server --spec ./swagger-api/swagger.yml \ 
--target ./internal/gen -C ./swagger-templates/default-server.yml \
--template-dir ./swagger-templates --name mdns