|
| 1 | +# GoUp Native Authoritative DNS Server |
| 2 | + |
| 3 | +GoUp includes a built-in, lightweight authoritative DNS server written in Go. It runs alongside the web server (or standalone) and shares the same high-performance architecture. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **Authoritative Only**: Designed to serve your zones, not to act as a recursive resolver. |
| 8 | +- **Record Types**: Supports `A`, `AAAA`, `CNAME`, `TXT`, `MX`, `NS`. |
| 9 | +- **Integrated Logging**: detailed query logging to `logs/system/`. |
| 10 | +- **Performance**: Runs on its own goroutine with low overhead. |
| 11 | +- **Failover**: Optional upstream resolvers for non-authoritative zones (limited forwarding). |
| 12 | + |
| 13 | +## Configuration |
| 14 | + |
| 15 | +The DNS server is configured in the global configuration file (`~/.config/goup/conf.global.json`). |
| 16 | + |
| 17 | +### Enabling DNS |
| 18 | + |
| 19 | +```json |
| 20 | +{ |
| 21 | + "dns": { |
| 22 | + "enable": true, |
| 23 | + "port": 53, |
| 24 | + "upstream_resolvers": ["1.1.1.1", "8.8.8.8"], |
| 25 | + "zones": { |
| 26 | + "example.com": [ |
| 27 | + { "type": "A", "name": "@", "value": "192.168.1.10", "ttl": 300 }, |
| 28 | + { "type": "CNAME", "name": "www", "value": "@", "ttl": 300 }, |
| 29 | + { "type": "TXT", "name": "_test", "value": "hello world", "ttl": 3600 } |
| 30 | + ] |
| 31 | + } |
| 32 | + } |
| 33 | +} |
| 34 | +``` |
| 35 | + |
| 36 | +### Fields |
| 37 | + |
| 38 | +- **enable**: Set to `true` to start the DNS server. |
| 39 | +- **port**: UDP/TCP port to listen on (default: 53). *Note: Ports < 1024 require root/sudo.* |
| 40 | +- **upstream_resolvers**: List of DNS servers to forward queries to if no local zone matches (optional). |
| 41 | +- **zones**: Map of zone names to their records. |
| 42 | + |
| 43 | +### Record Structure |
| 44 | + |
| 45 | +- **type**: Record type (`A`, `AAAA`, `CNAME`, `TXT`, `MX`, `NS`). |
| 46 | +- **name**: Subdomain name. Use `@` for the zone apex (e.g. `example.com`), or just the name (e.g. `www`). |
| 47 | +- **value**: The IP address, target domain, or text content. |
| 48 | +- **ttl**: Time-To-Live in seconds. |
| 49 | +- **prio**: Priority (only for `MX` records). |
| 50 | + |
| 51 | +## Running the Server |
| 52 | + |
| 53 | +You can run the DNS server in different modes using the CLI: |
| 54 | + |
| 55 | +1. **Full Stack (Web + DNS)** (Default) |
| 56 | + ```bash |
| 57 | + goup start |
| 58 | + ``` |
| 59 | +2. **DNS Only** |
| 60 | + ```bash |
| 61 | + goup start-dns |
| 62 | + ``` |
| 63 | +3. **Web Only** |
| 64 | + ```bash |
| 65 | + goup start-web |
| 66 | + ``` |
| 67 | + |
| 68 | +## Specialized Builds |
| 69 | + |
| 70 | +For deployment in constrained environments, you can compile GoUp with only the components you need to save binary size. |
| 71 | + |
| 72 | +- **Build DNS-Only Binary**: |
| 73 | + ```bash |
| 74 | + go build -tags dns_only -o goup-dns cmd/goup/main.go |
| 75 | + ``` |
| 76 | + |
| 77 | +- **Build Web-Only Binary**: |
| 78 | + ```bash |
| 79 | + go build -tags web_only -o goup-web cmd/goup/main.go |
| 80 | + ``` |
0 commit comments