Выпуск WDTT Plus v17
This commit is contained in:
1 parent
4be5f36c88
commit
abf0a0f130
33 files changed
+763
-262
No files matched your search
@@ -43,7 +43,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
wdttServerVersion = "16"
|
||||
wdttServerVersion = "17"
|
||||
wgIfaceName = "wdtt0"
|
||||
wgServerAddr = "10.66.66.1"
|
||||
wgServerCIDR = wgServerAddr + "/24"
|
||||
@@ -701,6 +701,19 @@ func initDB(dir, mainPass, adminID, botToken, dnsValue string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// botRuntimeCredentials returns the values persisted in the protected database.
|
||||
// Deploy updates intentionally do not put these values back into systemd or the
|
||||
// process command line, so every restart must use the database as the runtime
|
||||
// source of truth.
|
||||
func botRuntimeCredentials() (string, string) {
|
||||
dbMutex.Lock()
|
||||
defer dbMutex.Unlock()
|
||||
if db == nil {
|
||||
return "", ""
|
||||
}
|
||||
return strings.TrimSpace(db.BotToken), strings.TrimSpace(db.AdminID)
|
||||
}
|
||||
|
||||
func saveDB() error {
|
||||
if err := persistDatabaseFile(dbFile, db); err != nil {
|
||||
log.Printf("[DB] сохранение отклонено: %v", err)
|
||||
@@ -1624,7 +1637,8 @@ func main() {
|
||||
go statsLoop(ctx, *configDir)
|
||||
go systemMetricsLoop(ctx)
|
||||
go expiredPasswordJanitor(ctx, wgDev)
|
||||
go botLoop(*botToken, *adminID, wgDev)
|
||||
storedBotToken, storedAdminID := botRuntimeCredentials()
|
||||
go botLoop(storedBotToken, storedAdminID, wgDev)
|
||||
|
||||
addr, _ := net.ResolveUDPAddr("udp", *listen)
|
||||
cert, _ := selfsign.GenerateSelfSigned()
|
||||
|
||||
Reference in new issue
Block a user