2023-02-18 03:01:51 +08:00
|
|
|
/*
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2023-03-14 15:01:55 +08:00
|
|
|
* Copyright (c) 2022-2023, daeuniverse Organization <dae@v2raya.org>
|
2023-02-18 03:01:51 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
package config
|
|
|
|
|
2023-02-20 18:06:54 +08:00
|
|
|
import (
|
2023-03-14 15:01:55 +08:00
|
|
|
"github.com/daeuniverse/dae/common/consts"
|
2023-02-20 18:06:54 +08:00
|
|
|
)
|
2023-02-18 03:01:51 +08:00
|
|
|
|
2023-02-25 22:53:18 +08:00
|
|
|
type patch func(params *Config) error
|
2023-02-18 03:01:51 +08:00
|
|
|
|
|
|
|
var patches = []patch{
|
2023-02-25 02:38:21 +08:00
|
|
|
patchEmptyDns,
|
2023-02-18 03:01:51 +08:00
|
|
|
}
|
|
|
|
|
2023-02-25 22:53:18 +08:00
|
|
|
func patchEmptyDns(params *Config) error {
|
2023-02-25 02:38:21 +08:00
|
|
|
if params.Dns.Routing.Request.Fallback == nil {
|
|
|
|
params.Dns.Routing.Request.Fallback = consts.DnsRequestOutboundIndex_AsIs.String()
|
|
|
|
}
|
|
|
|
if params.Dns.Routing.Response.Fallback == nil {
|
|
|
|
params.Dns.Routing.Response.Fallback = consts.DnsResponseOutboundIndex_Accept.String()
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|