Make client DNS configurable via -dns flag end to end

Previously the deploy UI had DNS fields but server.go hardcoded
DNS=1.1.1.1 and defined no -dns flag, so passing -dns crash-looped the
service. Add a real -dns flag to the server (overrides the default,
comma-separated list supported) and feed the value into the client
WireGuard config; re-enable -dns in the app deploy, sending the trimmed
non-empty DNS fields (falling back to the server default when blank).

Requires a server-asset rebuild so the deployed binary accepts -dns.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
andbul0103andClaude Opus 4.8 committed 2026-06-14 21:49:58 +04:00
1 parent 130a5841f5
commit 6bf043d4d1
2 files changed
+14 -5

No files matched your search

+9 -1
View File
@@ -49,11 +49,14 @@ const (
wgServerAddr = "10.66.66.1"
wgServerCIDR = wgServerAddr + "/24"
defaultInternalWGPort = 56001
dns = "1.1.1.1"
wgMTU = 1280
keepalive = 25
)
// dns — DNS-серверы, прописываемые в WireGuard-конфиг клиента.
// Значение по умолчанию переопределяется флагом -dns (несколько через запятую).
var dns = "1.1.1.1"
// ==================== База данных и Бот ====================
type ClientDevice struct {
@@ -1311,8 +1314,13 @@ func main() {
mainPass := flag.String("password", "", "пароль владельца")
adminID := flag.String("admin", "", "Telegram Admin ID")
botToken := flag.String("bot-token", "", "Telegram Bot Token")
dnsFlag := flag.String("dns", dns, "DNS для клиента (можно несколько через запятую)")
flag.Parse()
if v := strings.TrimSpace(*dnsFlag); v != "" {
dns = v
}
log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds)
log.Println("══════════════════════════════════════════")
log.Println(" WDTT Server v2 (Multi-User)")