mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-05-08 16:50:12 +03:00
Pull request: upd-dnsproxy
Squashed commit of the following: commit 463811748fa5a1f52e084c782e94f268b00b3abc Merge: 3de62244e130560b10
Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Jul 10 15:06:01 2024 +0300 Merge remote-tracking branch 'origin/master' into upd-dnsproxy commit 3de62244ee10fce9fb97c73c2955479883ce34eb Merge: e2de50bf9e269260fb
Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Jul 10 09:13:40 2024 +0300 Merge remote-tracking branch 'origin/master' into upd-dnsproxy commit e2de50bf9cf4eddaa0d87c20c8c1605bf4630fce Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Wed Jul 10 09:11:25 2024 +0300 home: todos commit58fe497eec
Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Tue Jul 9 13:29:19 2024 +0300 home: imp code commit4db7cdc0c4
Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Tue Jul 9 11:31:12 2024 +0300 all: imp code commit7e8d3b50e7
Merge:559c3b79d
9a6dd0dc5
Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Jul 8 10:56:14 2024 +0300 Merge remote-tracking branch 'origin/master' into upd-dnsproxy commit559c3b79d7
Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Jul 8 10:54:03 2024 +0300 dnsforward: imp code commitba4a7e1c70
Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Mon Jul 8 10:49:46 2024 +0300 aghos: imp code commitcdf9ccd371
Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Jul 5 16:19:27 2024 +0300 all: partial revert slog logger usage commitf16cddbb8c
Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Jul 5 13:01:37 2024 +0300 all: upd dnsproxy commit5932c8d102
Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Jul 5 11:49:37 2024 +0300 dnsforward: slog logger commit3d7f734ac9
Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Fri Jul 5 11:05:14 2024 +0300 all: slog logger commit9a74d5d98b
Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Jul 4 12:16:21 2024 +0300 all: upd dnsproxy commit537bdacec8
Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Jul 4 12:10:30 2024 +0300 all: upd dnsproxy commit38e10dee48
Author: Dimitry Kolyshev <dkolyshev@adguard.com> Date: Thu Jul 4 10:37:50 2024 +0300 dnsforward: upstream mode
This commit is contained in:
parent
130560b104
commit
c0a33ce708
19 changed files with 153 additions and 50 deletions
internal/home
|
@ -2,6 +2,7 @@ package home
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"net"
|
||||
"net/netip"
|
||||
"net/url"
|
||||
|
@ -43,8 +44,8 @@ func onConfigModified() {
|
|||
|
||||
// initDNS updates all the fields of the [Context] needed to initialize the DNS
|
||||
// server and initializes it at last. It also must not be called unless
|
||||
// [config] and [Context] are initialized.
|
||||
func initDNS() (err error) {
|
||||
// [config] and [Context] are initialized. l must not be nil.
|
||||
func initDNS(l *slog.Logger) (err error) {
|
||||
anonymizer := config.anonymizer()
|
||||
|
||||
statsDir, querylogDir, err := checkStatsAndQuerylogDirs(&Context, config)
|
||||
|
@ -113,13 +114,16 @@ func initDNS() (err error) {
|
|||
anonymizer,
|
||||
httpRegister,
|
||||
tlsConf,
|
||||
l,
|
||||
)
|
||||
}
|
||||
|
||||
// initDNSServer initializes the [context.dnsServer]. To only use the internal
|
||||
// proxy, none of the arguments are required, but tlsConf still must not be nil,
|
||||
// in other cases all the arguments also must not be nil. It also must not be
|
||||
// called unless [config] and [Context] are initialized.
|
||||
// proxy, none of the arguments are required, but tlsConf and l still must not
|
||||
// be nil, in other cases all the arguments also must not be nil. It also must
|
||||
// not be called unless [config] and [Context] are initialized.
|
||||
//
|
||||
// TODO(e.burkov): Use [dnsforward.DNSCreateParams] as a parameter.
|
||||
func initDNSServer(
|
||||
filters *filtering.DNSFilter,
|
||||
sts stats.Interface,
|
||||
|
@ -128,8 +132,10 @@ func initDNSServer(
|
|||
anonymizer *aghnet.IPMut,
|
||||
httpReg aghhttp.RegisterFunc,
|
||||
tlsConf *tlsConfigSettings,
|
||||
l *slog.Logger,
|
||||
) (err error) {
|
||||
Context.dnsServer, err = dnsforward.NewServer(dnsforward.DNSCreateParams{
|
||||
Logger: l,
|
||||
DNSFilter: filters,
|
||||
Stats: sts,
|
||||
QueryLog: qlog,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue