mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-28 09:58:52 +03:00
1511fabeec
Squashed commit of the following: commit afb5a0d8a499bccf7761baea40910f39c92b8a20 Merge: 09ac43c85abf20c6de
Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Dec 25 12:55:45 2023 +0200 Merge remote-tracking branch 'origin/master' into conf-ups-mode commit 09ac43c859ef8cbd3bb0488d1a945589cd59ca19 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Dec 22 14:36:07 2023 +0200 openapi: imp docs commit d0fbd4349e4bddde73c6e92f75854acfc481ac0d Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Dec 22 11:47:10 2023 +0200 all: changelog commit 105f9c50738733b0736a768fb9ee09d2e7fbf42e Merge: 62a2cf12d4bc5c346a
Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Dec 22 11:27:21 2023 +0200 Merge remote-tracking branch 'origin/master' into conf-ups-mode # Conflicts: # openapi/CHANGELOG.md commit 62a2cf12df694611888e840a5041a9c517cdfddb Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Dec 22 10:52:59 2023 +0200 openapi: imp docs commit 87956c49240da44b216489920feff69996e3502b Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Dec 21 12:08:07 2023 +0200 dnsforward: imp code commit bf74d67ad112735d557be3d8fac75964cd99e375 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Dec 20 15:46:38 2023 +0200 dnsforward: imp code commit 3a98dee88809a25118a14a1f07eeecbfccb14cd9 Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Dec 20 15:41:06 2023 +0200 dnsforward: imp code commit 1499da1fa0319ac3ad914171e807446f2c4d2fdb Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Dec 20 13:36:28 2023 +0200 dnsforward: imp code commit 228c61a5a0f73cc13655cef8bdaa1995b3f7fced Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Dec 20 13:06:11 2023 +0200 dnsforward: imp code commit 069ee22c6d904db4e983135ce87a9fe8d12b7e9a Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Tue Dec 19 12:39:25 2023 +0200 dnsforward: imp code commit 90919f99a975862dcb07ac82fb740e4404e48bae Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Tue Dec 19 12:10:43 2023 +0200 confmigrate: fix commit a8c329950423b59098d1f2b16d1da7100dd54f8d Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Tue Dec 19 12:08:05 2023 +0200 dnsforward: imp code commit 58b53ccd97d353fab0df29f13425b5e341c8fdeb Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Dec 18 15:10:01 2023 +0200 all: conf upstream mode
47 lines
967 B
Go
47 lines
967 B
Go
package configmigrate
|
|
|
|
import (
|
|
"github.com/AdguardTeam/AdGuardHome/internal/dnsforward"
|
|
)
|
|
|
|
// migrateTo28 performs the following changes:
|
|
//
|
|
// # BEFORE:
|
|
// 'dns':
|
|
// 'all_servers': true
|
|
// 'fastest_addr': true
|
|
// # …
|
|
// # …
|
|
//
|
|
// # AFTER:
|
|
// 'dns':
|
|
// 'upstream_mode': 'parallel'
|
|
// # …
|
|
// # …
|
|
func migrateTo28(diskConf yobj) (err error) {
|
|
diskConf["schema_version"] = 28
|
|
|
|
dns, ok, err := fieldVal[yobj](diskConf, "dns")
|
|
if !ok {
|
|
return err
|
|
}
|
|
|
|
allServers, _, _ := fieldVal[bool](dns, "all_servers")
|
|
fastestAddr, _, _ := fieldVal[bool](dns, "fastest_addr")
|
|
|
|
var upstreamModeType dnsforward.UpstreamMode
|
|
if allServers {
|
|
upstreamModeType = dnsforward.UpstreamModeParallel
|
|
} else if fastestAddr {
|
|
upstreamModeType = dnsforward.UpstreamModeFastestAddr
|
|
} else {
|
|
upstreamModeType = dnsforward.UpstreamModeLoadBalance
|
|
}
|
|
|
|
dns["upstream_mode"] = upstreamModeType
|
|
|
|
delete(dns, "all_servers")
|
|
delete(dns, "fastest_addr")
|
|
|
|
return nil
|
|
}
|