mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-05-01 21:50:29 +03:00
Pull request: all: imp uniq validation err msgs
Updates #3975. Squashed commit of the following: commit f8578c2afb1bb5786e7b855a1715e0757bc08510 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Tue Dec 28 16:39:13 2021 +0300 aghalgo: imp docs commit d9fc625f7c4ede2cf4b0683ad5efd0ddf9b966b1 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Tue Dec 28 16:21:24 2021 +0300 all: imp uniq validation err msgs
This commit is contained in:
parent
2ed1f939b5
commit
d2ce06e1ca
10 changed files with 166 additions and 128 deletions
internal/home
|
@ -19,6 +19,7 @@ import (
|
|||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/AdguardTeam/AdGuardHome/internal/aghalgo"
|
||||
"github.com/AdguardTeam/AdGuardHome/internal/aghnet"
|
||||
"github.com/AdguardTeam/AdGuardHome/internal/aghos"
|
||||
"github.com/AdguardTeam/AdGuardHome/internal/dhcpd"
|
||||
|
@ -295,22 +296,24 @@ func setupConfig(args options) (err error) {
|
|||
Context.clients.Init(config.Clients, Context.dhcpServer, Context.etcHosts)
|
||||
|
||||
if args.bindPort != 0 {
|
||||
pm := portsMap{}
|
||||
pm.add(
|
||||
uv := aghalgo.UniquenessValidator{}
|
||||
addPorts(
|
||||
uv,
|
||||
args.bindPort,
|
||||
config.BetaBindPort,
|
||||
config.DNS.Port,
|
||||
)
|
||||
if config.TLS.Enabled {
|
||||
pm.add(
|
||||
addPorts(
|
||||
uv,
|
||||
config.TLS.PortHTTPS,
|
||||
config.TLS.PortDNSOverTLS,
|
||||
config.TLS.PortDNSOverQUIC,
|
||||
config.TLS.PortDNSCrypt,
|
||||
)
|
||||
}
|
||||
if err = pm.validate(); err != nil {
|
||||
return err
|
||||
if err = uv.Validate(aghalgo.IntIsBefore); err != nil {
|
||||
return fmt.Errorf("validating ports: %w", err)
|
||||
}
|
||||
|
||||
config.BindPort = args.bindPort
|
||||
|
@ -374,7 +377,7 @@ func fatalOnError(err error) {
|
|||
}
|
||||
}
|
||||
|
||||
// run performs configurating and starts AdGuard Home.
|
||||
// run configures and starts AdGuard Home.
|
||||
func run(args options, clientBuildFS fs.FS) {
|
||||
var err error
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue