Skip to content

Commit c312de4

Browse files
committed
docs: cover DNS Server and multi-module builds
1 parent 419efc8 commit c312de4

File tree

2 files changed

+99
-0
lines changed

2 files changed

+99
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@ GoUP! is a minimal, tweakable web server written in Go. You can use it to serve
1414
- Support for SSL/TLS with custom certificates
1515
- Custom headers for HTTP responses
1616
- Support for multiple domains and virtual hosting
17+
- Native Authoritative DNS Server (A, AAAA, CNAME, TXT, MX, NS)
1718
- Logging to both console and files - JSON formatted (structured logs)
1819
- Optional TUI interface for real-time monitoring
1920
- HTTP/2 and HTTP/3 support (not configurable, HTTP/1.1 is used for unencrypted connections, HTTP/2 and HTTP/3 for encrypted connections)
2021

22+
## Documentation
23+
24+
- [DNS Server Guide](docs/dns.md) explanation of the DNS module configuration and usage.
25+
2126
## Future Plans
2227

2328
- API for dynamic configuration changes
@@ -94,10 +99,24 @@ Go is required to build the software, ensure you have it installed on your syste
9499

95100
2. **Build the software:**
96101

102+
Standard build (includes both Web and DNS modules):
97103
```bash
98104
go build -o ~/.local/bin/goup cmd/goup/main.go
99105
```
100106

107+
**Specialized Builds**:
108+
You can build optimized binaries using build tags to exclude unused modules:
109+
110+
*Web Server Only*:
111+
```bash
112+
go build -tags web_only -o goup-web cmd/goup/main.go
113+
```
114+
115+
*DNS Server Only*:
116+
```bash
117+
go build -tags dns_only -o goup-dns cmd/goup/main.go
118+
```
119+
101120

102121
## Usage
103122

docs/dns.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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

Comments
 (0)